How does one sort a list in Erlang depending on a tag for each element?
If I have a process which loops and receives a single value from multiple processes and then I want to arrange the list according to the tag(which is an index) as an element is received.
How does one do this without using BIFs?
I currently do the following but would like to arrange the list when an element is added, like an insertion sort using the tags.
fibLoop(calcData) ->
receive
{Number, Tag} ->
fibLoop([{Number, Tag}|calcData]);