user-defined operators

Vlad Dumitrescu vlad_dumitrescu@REDACTED
Thu Mar 25 20:09:30 CET 2004


> Would be nice to just say this in Erlang:
> 0 + over [1, 2, 3, 4].

Maybe, but how about comparing
    lists:foldl (fun (X, A) -> M:foo(Env, X, A) end, 0, [1, 2, 3, 4]).
    0 fun(X, Y)->M:foo(Env, X, Y)end over [1, 2, 3, 4].
? If we name the fun, then we're back to Martin's '$@*_' operators.

In this case, there isn't much to gain, really. And I argue it's easier to
read the original.

That said, I too would like to see such heavily used functionality being
less verbose, but I can't come up with anything that is easy to read in the
general case.

Regarding the beforementioned idea of an "Erlang playground" for testing
such new ideas, I think it'd be interesting. Basically, this would mean that
we'd have another language(s) with Erlang semantics that get compiled to
beam code.


More information about the erlang-questions mailing list