[erlang-questions] Sorting of lists

Fredrik Hoback <>
Thu Apr 19 19:31:52 CEST 2007


Hi, I've this problem:

If you have a list containing elements like this:
Names = [adam, billy, ceasar, david]

and then I have another list:

MyList = [ {3, ceasar}, {1, adam}, {4, david}, {2, billy}]

then I would like to order MyList according to Names, so MyList would
look like this:

[{1, adam}, {2, billy}, {3, ceasar},  {4, david}].

How would a function look like to get MyList sorted according to Names ?
---------------------------------



More information about the erlang-questions mailing list