On Wednesday, 5 November 2014 at 14:07:10 UTC, Nordlöw wrote:
On Wednesday, 5 November 2014 at 11:18:56 UTC, Marc Schütz wrote:
This could also be an arbitrary expression, of course:

   r.sortBy!"x*x + y*y + z*z"

The above could be implemented using `with` and `std.functional.unaryFun`. Alternatively, a lambda could be used:

   r.sortBy!(a => a.norm);

Ok. Great. What do you think about the name sortBy?

It's intuitive and concise. Plus, Ruby uses `sort` and `sort_by` for the same functionality, exactly in parallel, so it will be familiar to many users.

Reply via email to