Wither Self

Vlad Dumitrescu vlad_dumitrescu@REDACTED
Tue Sep 9 10:01:47 CEST 2003


> >     {Even, Odd} =
> >         {fun(0) -> true;  (N) -> Odd( N-1) end,
> >          fun(0) -> false; (N) -> Even(N-1) end},

Hi,

is this so much simpler to write and understand than

even(0)->true; even(N)->odd(N-1).
odd(0)->false; odd(N)->even(N-1).

Even = fun even/1,
Odd=fun odd/1,

? Having the funs local may be simpler to write in some cases, but once the fun
is larger than those above, the code gets rather difficult to read.

regards,
/Vlad




More information about the erlang-questions mailing list