Glen, learning by example is good, but you should consider backing it
with also taking a look at the main documentation pages from
clojure.org !

Concerning the topic at hand, you need to "get" :

 * the syntax for defn :
http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/defn
 * which references the syntax for def : http://clojure.org/special_forms#toc1
 * the syntax for the anonymous function form (fn []) :
http://clojure.org/special_forms#toc10 may also help

Granted, with a book offering less "normalized" documentation, it may
be easier to start with :-)

2010/1/25 Glen Rubin <[email protected]>:
> I am trying to learn clojure by learning the programing by example
> open wiki book.  For an excercise demonstrating iteration they give
> the following example:
>
> (defn factorial
>    ([n]
>        (factorial n 1))
>    ([n acc]
>        (if  (= n 0)   acc
>             (recur (dec n) (* acc n)))))
>
>
> first I don't understand how acc ever gets an initial value?
>
> also  the arguments to the function are a list and not a vector?
>
> why is the vector [n acc] on a line by itself?
>
> This function is very confusing to me!!  thanks 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 [email protected]
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> [email protected]
> 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 post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to