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?

2 Answers 2

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 "."))
Sign up to request clarification or add additional context in comments.

2 Comments

is it different from the Java type? or am I missing something?
I don't think there is a difference, although I haven't looked into detail.
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))

1 Comment

While this example works, note that it can also be written as (. (new java.util.Date) toString) or (.toString (new java.util.Date)).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.