[erlang-questions] Simple Erlang Recommendation (last returned value)
Berlin Brown
berlin.brown@REDACTED
Fri Jul 25 21:36:24 CEST 2008
On Jul 25, 1:33 pm, "James Hague" <james.ha...@REDACTED> wrote:
> > And an equivalent to Perl's $_
>
> Or there could be a prefix, like an asterisk, that means "fresh
> symbol." For example:
>
> *A = something()
> *A = something_else()
>
> Need to decide what this means:
>
> [A, *A | T] = something()
> _______________________________________________
> erlang-questions mailing list
> erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions
"Or there could be a prefix, like an asterisk, that means "fresh
symbol." For example:
*A = something()
*A = something_else()"
Yea, but that tends to work against the immutability feature of
erlang?
I was merely suggesting just return or duplicate the last value
returned from the call stack. You aren't changing any process/state
variables, but essentially getting whatever is returned from the last
operation which saves some keystrokes and might avoid some common
Erlang bugs.
I don't know Perl, but $_ sounds like the operation.
If you have worked with stack languages, I was considering a variation
of the 'dup' operation, duplicate the last value on the stack.
NewQ = queue:new(),
queue:add(joe, erlang:pop_call_stack),
Queue2 = queue:add(mike, erlang:pop_call_stack), ...
More information about the erlang-questions
mailing list