For example, how can I use System.Console.WriteLine
from clojure-clr? In general, what's the rule for exporting/importing functions/classes from other languages such as C#/F# from/to Clojure-clr?
Asked
Active
Viewed 662 times
2

prosseek
- 182,215
- 215
- 566
- 871
2 Answers
3
System.Console is loaded by default. You can simply use:
(System.Console/WriteLine "Hello World!")
Another example, using a static class:
(import (System.IO Path))
(println (Path/GetFullPath "."))

Maurits Rijk
- 9,789
- 2
- 36
- 53
-
is it different from the Java type? or am I missing something? – Quazi Irfan May 25 '11 at 23:56
-
I don't think there is a difference, although I haven't looked into detail. – Maurits Rijk May 26 '11 at 09:11
0
in Java, instantiating the Date object, then calls its toString() method, you have to write like the following,
user=> (. (new java.util.Date) (toString))

Quazi Irfan
- 2,555
- 5
- 34
- 69
-
1While this example works, note that it can also be written as `(. (new java.util.Date) toString)` or `(.toString (new java.util.Date))`. – Torbjørn May 25 '11 at 17:40