Use fun erlang:hd/1
as the syntax. You need the module name here for that fun
syntax to work.
Exception error while using fun hd/1 in erlang
-
21-07-2023 - |
문제
I did the following in order to get each list's head:
lists:map(fun hd/1, [[1, 2, 3], [4, 5, 6], [7, 8, 9]]).
The result is:
** exception error: undefined function erl_eval:hd/1
But when used otherwise:
lists:map(fun(A) -> hd(A) end, [[1, 2, 3], [4, 5, 6], [7, 8, 9]]).
I got appropriate result! Sorry for trivial question but can you tell me why it is not working with fun hd/1
?
해결책
제휴하지 않습니다 StackOverflow