On Monday, 19 December 2016 at 09:24:38 UTC, Ali wrote:
Ok so laziness stops as soon as sort is required on a range
then? Ahh, because in place algorithms? Are there any plans in
D to make is to that you can output copies to collections so
that you could do something like filter.transpose.sort and just
have it output a modified copy?
This is a shortcoming of Phobos - here is a package of sorting
algorithms including some that do not require their inputs to be
mutable, random access, and/or finite:
https://github.com/pineapplemachine/mach.d/tree/master/mach/range/sort
The library is permissively licensed; feel free to take out
whatever you need.
It's worth noting that giving up eagerness, random access, etc.
often comes with a speed penalty. It may be more efficient just
to copy the lazy things into memory first and then sort in-place,
as you have been doing.