[erlang-questions] Simple Erlang Recommendation (last returned value)
Fri Jul 25 22:00:16 CEST 2008
Thomas Lindgren wrote:
> --- On Fri, 7/25/08, Berlin Brown <> wrote:
>> I wish there were something like this to get the result of
>> the last call
>> queue:add(joe, erlang:last_value()),
>> queue:add(mike, erlang:last_value())), ...
> It's probably better to get more familiar with functional programming, which instead of updating state passes around values.
> How about this?
> fun(X, Last_value) -> queue:add(X, Last_value) end,
> [joe, mike]).
8> lists:foldl(fun queue:in/2, queue:new(), [joe, mike]).
More information about the erlang-questions