[erlang-questions] Simple Erlang Recommendation (last returned value)

Berlin Brown berlin.brown@REDACTED
Fri Jul 25 18:14:06 CEST 2008


Maybe this is already implemented, but I wish there were some kind of
"last_value" built in function where you can get the last value
without having to define it yourself.

Has this been talked about a lot already.

E.g. this is from the erlang docs as a "best" practice.

NewQ = queue:new(),
Queue1 = queue:add(joe, NewQ),
Queue2 = queue:add(mike, Queue1), ...

When I am coding, I end up forgetting to define Q1, Q2

NewQ = queue:new(),
queue:add(joe, NewQ),
queue:add(mike, NewQ), ...

Logic error!!!

I wish there were something like this to get the result of the last
call

queue:new(),
queue:add(joe,  erlang:last_value()),
queue:add(mike, erlang:last_value())), ...




More information about the erlang-questions mailing list