I'm very new to Clojure. And I was pretty much interested to learn
about vectors, list . maps in clojure.

I have a code like this :

(defn factorial-1 [number]
  "computes the factorial of a positive integer
   in a way that doesn't consume stack space"
  (loop [n number factorial 1]
    (if (zero? n)
      factorial (recur (dec n) (* factorial n)))))

(println (time (factorial-1 5)))


which argues that it does tail recursion optimization. I found this
code on net. Can anyone explain me what does the last three lines
does:

 (loop [n number factorial 1]
    (if (zero? n)
      factorial (recur (dec n) (* factorial n))))

Thanks in advance.

-- 
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

Reply via email to