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 iteratio
Functions in Clojure can behave differently depending on the number of
arguments they receive (their "arity"). A function can be written:
(defn foo [x]
(str "foo" x))
But you can also write:
(defn foo
([] "empty foo")
([x] (str "foo" x))
This will do different things d
This form allows the fn to have multiple arities. So if I call (recursive-
printer) it will 'invoke' ([] (recursive-printer 0)). If I call (recursive-
printer 1) then it will 'invoke' ([iteration] ...).
HTH
--
Colin Yates
colin.ya...@gmail.com
On Sun, 4 Sep 2016, at 09:54 PM, Charlie wrote
*1) Slow startup speed.*
Everyone dislikes the slow startup speed. Though it's been argued that it
should be known as the Clojure slow startup speed. Since even though the
JVM is slower to start then say python, most of the slowness comes from the
Clojure overhead.
*I know this problem is bein
Thanx Colin & James - got it now - Charlie
On Sunday, September 4, 2016 at 5:31:40 PM UTC-4, Colin Yates wrote:
>
> This form allows the fn to have multiple arities. So if I call
> (recursive-printer) it will 'invoke' ([] (recursive-printer 0)). If I call
> (recursive-printer 1) then it will 'in