Proposed change to libraries
Bjorn Gustavsson
bjorn@REDACTED
Wed Feb 9 14:55:12 CET 2005
Kostis Sagonas <kostis@REDACTED> writes:
[...]
>
> map({M,F}, L) -> map(fun(X) -> M:F(X) end, L);
> map(F, [H|T]) -> [F(H) | map(F, T)];
> map(F, []) when is_function(F,1) -> [].
>
> and then is_function/2 only handles proper fun objects. Besides being
> much cleaner, I think, it also has the extra advantage that calls to
> map/2 with a tuple-as-fun also work when compiled in native code (which
> currently they do not). Then taking out support for tuples-as-funs is
> just a matter of removing the extra clause -- the semantics of all guards,
> current or new, remains unchanged.
OK. Sounds good. I can add the guard BIF is_function/2 to R10B-4.
/Björn
--
Björn Gustavsson, Erlang/OTP, Ericsson AB
More information about the erlang-questions
mailing list