Open
Description
I wonder if sorting should be built into the language? This is such a fundamental thing that currently take a staggering amount of code to make it work with all intrinsic types and user-defined types (see for example here). I think C++ has sorting built in to its standard library.
Features:
- sort ascending or descending
- it works for all intrinsic numeric types (
integer(kind=*)
andreal(kind=*)
) - how about also a "sort x, while carrying y along"? That's always nice to have. See, for example, isort from SLATEC. Or even a variadic "sort x while carrying any number of other arrays along". And any of them can be any combination of types.
- maybe also indexing?
- how about lexical sorting? Including "[natural sorting]?(https://en.wikipedia.org/wiki/Natural_sort_order)".
I think it goes without saying that any well-designed future generic/templating feature should also allow one to apply a sorting algorithm (either one from a third-party library or maybe even the hypothetical intrinsic one) to a user-defined type with a minimum of code.
Activity