Proposed change to libraries

Kostis Sagonas <>
Fri Feb 4 14:18:15 CET 2005


We had an interesting discussion in the HiPE group today, so let
me take a quick poll on the following issue.

The Erlang/OTP documentation specifies that e.g. lists:map/2 is
-------------------------------------------------------------------
map(Func, List1) -> List2
   Types:
      Func = fun(A) -> B
      List1 = [A]
      List2 = [B]
-------------------------------------------------------------------

However, currently this does NOT agree with its implementation.
For example, one can issue the call:

  lists:map(gazonk, [])

which will return [].

Will it cause havoc if in a future Erlang version such calls
result in a 'function_clause' error?

I.e., change the implementation of map/2 (and similar functions)
as if defined by:

map(F, [H|T]) ->
  [F(H)|map(F, T)];
map(F, []) when is_function(F) ->	%% andalso is_fun_arity(F) == 1
  [].


Kostis




More information about the erlang-questions mailing list