2

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?

prosseek
  • 182,215
  • 215
  • 566
  • 871

2 Answers2

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
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
  • 1
    While 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