Skip to content

Using shell function in lists:map results in exception undefined function #9771

Open
@sgillis

Description

@sgillis

Describe the bug
When defining a function in the erlang shell, I can call it normally in the shell. Using it in a lists:map call results in an undefined function exception.

To Reproduce

add_one(X) ->
  X + 1.

lists:map(fun(X) -> add_one(X) end, [1, 2]).
% [2, 3]

lists:map(fun add_one/1, [1, 2]).
% ** exception error: undefined function erl_eval:add_one/1

Expected behavior
I am expecting to be able to use either version of the lists:map

Affected versions
OTP 26

Additional context

Metadata

Metadata

Assignees

Labels

bugIssue is reported as a bugteam:VMAssigned to OTP team VM

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions