[erlang-questions] DRY principle and the syntax inconsistency in fun vs. vanilla functions

Jack Moffitt <>
Wed May 18 19:03:16 CEST 2011


> I'm still waiting for the answer to the real showstopper question: would any
> existing code break, under my proposal?

Assuming the answer is no, then I think it's fine to fix the
inconsistency an add this alternate notation. It would be nice to fix
it the other way to so that you could use the normal syntax in funs,
but I'm guessing that is a lot harder than just a parser change.

I could see using it for short functions.

I'll also point out that this is name-less clause syntax is the same
as in Clojure:

(defn
  mymax
  ([x] x)
  ([x y] (if (> x y) x y))
  ([x y & more]
   (reduce mymax (mymax x y) more)))

jack.



More information about the erlang-questions mailing list