I'm going through the Do Things: A Clojure Crash Course, and the following 
example (in REPL) is presented:

(defn recursive-printer
  ([]
     (recursive-printer 0))
  ([iteration]
     (println iteration)
     (if (> iteration 3)
       (println "Goodbye!")
       (recursive-printer (inc iteration)))))(recursive-printer); => Iteration 
0; => Iteration 1; => Iteration 2; => Iteration 3; => Iteration 4; => Goodbye!


This works as expected, but I don't understand the syntax of the function 
definition. Specifically: (defn recursive-printer ([] (recursive-printer 
0)). Isn't the parameter list supposed to be a vector [] not ([]...)? Also, 
I don't see how [iteration] is resolved on the next line.

Thanx for any help!

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to