I am really new to clojure, and I want to simulate + from clojure, I wrote something like this:
(defn sum
([] 0)
([x & xs] (+ x (sum xs))))
(sum 1 2 3 4) ; ERROR
which is not right, as in Haskell, I can write
sum' :: [Int] -> Int
sum' [] = 0
sum' (x:xs) = x + sum' xs
What is the problem with the clojure code ? Thanks!