I have a little issue to which I can find no easy answer.
I set:
Who = apple.
Message = [{apple, {0,0,0}}, {orange, {1,1,1}}].
Old = [X || {Who, X} <- Message].
Old returns as [{0,0,0},{1,1,1}]
Of course my expected response was {0,0,0}
Instead I get both apple and orange.
What could I do??
Interesting question, I really liked that one! Looks like the scoping rules of Erlang are a bit odd (or at least I am not used to it, because I don’t use Erlang regularly)… But the following seems to work: