tags:

views:

271

answers:

1

I have a couple of questions about Hello World in Clojure:

(println "Hello, world!")
  1. Since 'println' is used, does this mean some Java libraries are included in the default namespace by default, just as in Grails?
  2. Why are the braces needed around the statement? Judging by other examples (below), braces are commonplace:

    (let [i (atom 0)] (defn generate-unique-id "Returns a distinct numeric ID for each call." [] (swap! i inc)))

  3. Any evidence so far that Clojure is likely to catch on?
+5  A: 
  1. println is a built-in function in Clojure, and just happens to have the same name as in Java (check out the source). Some Java libraries are imported by default (java.io and java.lang I think).

  2. The parentheses are syntax for calling a function and come from Lisp. For example, this function call in Java:

    addTwoNumbers(4, 5);
    

    would be written as follows in Clojure (and Lisp):

    (addTwoNumbers 4 5)
    
  3. Clojure's community is vibrant and growing. Check out the Google Group

Mike Mazur
While I do like Clojure, please don't use the term "vibrant" like that. It screams of marketing speak (which is, shall we say, not exactly known for truth).
Pavel Minaev
"Vibrant" simply means "sounding as a result of vibration", so I think as long as at least one person is speaking about Clojure with their vocal cords it is factually correct. :-)
Ken
Pavel: I can see how the word "vibrant" can be understood as marketing speak, but I couldn't come up with a good alternative quickly. Do you have any suggestions? How about "quite active" or maybe "bustling"?
Mike Mazur
`java.io` is not imported by default. Only `java.lang`.
Brian Carper
Thanks for clarifying Brian!
Mike Mazur