I stumbled upon this question and i realized i forgot a lot of stuff from my nonprocedural programming class.
As I was trying to understand the code it seemed to me that it's terribly long-winded, so i attempted to shorten it. Does this do the same thing that the original code does?
merge([X|Xs], Ys) -> [X | merge(Ys, Xs)];
merge([], []) -> [].
... I've never worked with erlang before, so i maybe made some syntax errors :-)