[erlang-questions] algorithm of lists:sort?
Wed Nov 21 22:42:19 CET 2012
It is a merge sort. My recollection last I looked is that all the extra functions and patterns are manually unrolled optimizations.
On Nov 21, 2012, at 1:48 PM, "Motiejus Jakštys" <> wrote:
> I am looking at implementation of lists:sort. I need to describe it to
> my colleague, so he can implement an analogous version in C++ (he does
> not know Erlang). Looking at the code it is very non-obvious how it
> works. There is a lot of pattern matching, but it is very hard to get
> the picture. Trapexit says it's a merge sort. But why is the
> implementation so big?
> Functions involved in lists:sort:
> ... and so on ...
> If anyone knows its internals, I would very much appreciate a high
> level description of the algorithm. Maybe with brief description what
> the merge_x_x and split_x_x functions are doing?
> : http://www.trapexit.org/String_Sort_List
> erlang-questions mailing list
More information about the erlang-questions