News for hackers. Stuff that matters.
Re:Functional programming explained in Clojure with a termin... by ajuc on Friday May 16, 2014 @06:53AM (#7754830)
Pattern matching would be nice, but destructuring helps.

    (defn sum-acc
      ([xs] (sum-acc xs 0))
      ([[x & xs] acc]
        (if (nil? x)
          acc
          (recur xs (+ x acc)))))
Could you show Haskell equivalent?

BTW there should be a macro that adds argument with default value.

Re:Functional programming explained in Clojure with a termin... by malisper on Friday May 16, 2014 @09:45AM (#7755435)
I believe it should be something along the lines of:

  sumacc xs = summer xs 0
    where summer [] n = n
          summer (x:xs) n = summer xs (x+n)
I'm sure there are macros in some library somewhere that implement pattern matching in lisp (regardless of dialect).