I am just starting Erlang (though with some lisp background) and have a question about pattern matching on lists.
If I say
[Head | Tail] = [1, 2, 3].
then I get
Head = 1
Tail = [2, 3]
If I want to do the same from the other end without reversing the list twice, is there some succint patter for that? I would like to be able to say something like:
[All_but | last] = [1, 2, 3].
and get:
All_but = [1, 2]
last = 3
Thanks.
PS: I know my example is incorrect behavior.