Two mistakes:

First, if you want sum to take a vector, you should remove the & from
the arglist.
Second, (rest(other)) should be (rest other).

This buys you:

user> (defn sum [more ]
        ((fn [total other]
           (if other
               (recur (+ total (first other)) (rest other))
             total))
         0 more))
#'user/sum
user> (sum [1 2 3 4])
10

(of course, sum could also be defined as just (apply + more) or
(reduce + more)).

-Jason

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