On Monday, 10 November 2014 at 19:58:32 UTC, Nordlöw wrote:
On Monday, 10 November 2014 at 03:38:49 UTC, Andrei
Alexandrescu wrote:
That's a better approach, thanks. A few compelling examples
would help.
Andrei
One more thing. How should reverse sorting be handled in
elegant way? Like this
https://github.com/nordlow/justd/blob/master/sort_ex.d#L57
or via some other clever solution I haven't thought about?
By chaining it with std.range.retro? But this will of course be
lazy, and will lose the information that the range is sorted.
Maybe there doesn't need to be a special facility for that, if
it's allowed to specify arbitrary expressions?
container.sortBy!(a => a.intMember) // ascending
container.sortBy!(a => -a.intMember) // descending
Or shorter (the expression will be mixed in):
container.sortBy!" intMember"; // ascending
container.sortBy!"-intMember"; // descending