Lazy sort

2015-09-11 Thread ixid via Digitalmars-d-learn
Does sort have to be eager or would it be possible to have a lazy version? It's messy to always have to use array and leap in and out of lazy operations within a UFCS chain. Surely as many functions as possible should be optionally lazy.

Re: Lazy sort

2015-09-11 Thread Chris via Digitalmars-d-learn
. Are you the lazy sort? ;) Sorry, I couldn't resist the pun.

Re: Lazy sort

2015-09-11 Thread via Digitalmars-d-learn
On Friday, 11 September 2015 at 10:41:16 UTC, ixid wrote: Does sort have to be eager or would it be possible to have a lazy version? It's messy to always have to use array and leap in and out of lazy operations within a UFCS chain. Surely as many functions as possible should be optionally

Re: Lazy sort

2015-09-11 Thread deed via Digitalmars-d-learn
On Friday, 11 September 2015 at 10:41:16 UTC, ixid wrote: Does sort have to be eager or would it be possible to have a lazy version? It's messy to always have to use array and leap in and out of lazy operations within a UFCS chain. Surely as many functions as possible should be optionally

Re: Lazy sort

2015-09-11 Thread ixid via Digitalmars-d-learn
On Friday, 11 September 2015 at 11:08:29 UTC, Ola Fosheim Grøstad wrote: On Friday, 11 September 2015 at 10:41:16 UTC, ixid wrote: Does sort have to be eager or would it be possible to have a lazy version? It's messy to always have to use array and leap in and out of lazy operations within a

Re: Lazy sort

2015-09-11 Thread via Digitalmars-d-learn
On Friday, 11 September 2015 at 12:23:52 UTC, ixid wrote: Yes, I was reading about heapsort. I was only thinking about the usability POV (I mean isn't reduced pretty much an eager operation that accepts a lazy input? Why can't sort do that?) but it could also offer some performance improvement

Lazy sort?

2011-10-02 Thread bearophile
Sometimes in my code I have to find the first few smaller (or bigger) items of an array, I don't know how many I will need, but I know in general I will need only few of them, much less than the whole array. Turnign the array into an heap is slow if I need only few items, and I can't use

Re: Lazy sort?

2011-10-02 Thread Timon Gehr
On 10/02/2011 09:47 PM, bearophile wrote: Sometimes in my code I have to find the first few smaller (or bigger) items of an array, I don't know how many I will need, but I know in general I will need only few of them, much less than the whole array. Turnign the array into an heap is slow if I