prosseek
prosseek

Reputation: 190679

How can I use .net functions/classes to/from clojure-clr?

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?

Upvotes: 2

Views: 721

Answers (2)

Quazi Irfan
Quazi Irfan

Reputation: 2589

in Java, instantiating the Date object, then calls its toString() method, you have to write like the following,

user=> (. (new java.util.Date) (toString))

Upvotes: 0

Maurits Rijk
Maurits Rijk

Reputation: 9985

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 "."))

Upvotes: 3

Related Questions