In Clojure...
((fn [xs ret]
(if (empty? xs)
ret
(recur (rest xs)
(+ ret (first xs)))))
(range 5) 0)
=> 10
nb. Clojure doesn't have automatic tail call optimisation. We need to explicitly emulate it with`recur`. replies(2):