digitalmars.D.learn - Lazy sort
- ixid (4/4) Sep 11 2015 Does sort have to be eager or would it be possible to have a lazy
- deed (2/6) Sep 11 2015 Wouldn't that mean removing min or max lazily?
- Chris (3/7) Sep 11 2015 Are you the lazy sort? ;)
- "Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= (2/6) Sep 11 2015 https://en.wikipedia.org/wiki/Priority_queue
- ixid (7/13) Sep 11 2015 Yes, I was reading about heapsort. I was only thinking about the
- "Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= (6/11) Sep 11 2015 I think there is something called "partial sort" in Phobos, but
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.
Sep 11 2015
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 lazy.Wouldn't that mean removing min or max lazily?
Sep 11 2015
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 lazy.Are you the lazy sort? ;) Sorry, I couldn't resist the pun.
Sep 11 2015
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 lazy.https://en.wikipedia.org/wiki/Priority_queue
Sep 11 2015
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: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 if you only use a part of the sorted array.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.https://en.wikipedia.org/wiki/Priority_queue
Sep 11 2015
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 if you only use a part of the sorted array.I think there is something called "partial sort" in Phobos, but "lazy" sorting is the same as a priority queue. You need to look at all elements before finding the largest one, that's why you cannot turn sort into a plain generator (or lazy range as some may call it).
Sep 11 2015