Thread overview |
---|
January 06, 2017 Sorting with unaryFun predicate | ||||
---|---|---|---|---|
| ||||
Why isn't there an overload for `std.algorithm.sorting.sort` that takes a `unaryFun` lambda? Something like x[].sort!"a.m"; sorting elements in `x` according to the value of element member `m` compared to the longer x[].sort!"a.m < b.m"; |
January 06, 2017 Re: Sorting with unaryFun predicate | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nordlöw | On Friday, 6 January 2017 at 15:36:42 UTC, Nordlöw wrote:
> Something like
>
> x[].sort!"a.m";
Perhaps under a different name `sortBy`
x[].sortBy!"a.m";
|
January 06, 2017 Re: Sorting with unaryFun predicate | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nordlöw | On Friday, 6 January 2017 at 15:36:42 UTC, Nordlöw wrote: > Why isn't there an overload for `std.algorithm.sorting.sort` that takes a `unaryFun` lambda? > > x[].sort!"a.m < b.m"; Oops, http://forum.dlang.org/post/nxdsmdimnfssqmeybuxp@forum.dlang.org https://github.com/nordlow/phobos-next/blob/master/src/sort_ex.d Deja vu |
Copyright © 1999-2021 by the D Language Foundation