Add these to Phobos?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Oct 17 07:39:37 PDT 2012


On 10/15/12 9:29 PM, Mehrdad wrote:
> Hmm, I didn't know 'sort' returns a value. That's very confusing
> since now I have no idea if it's mutating or not. Python has both
> sort and sorted, with clear meanings. (The goal was to make a
> non-mutating version that I could call functional.) Maybe we
> should clarify what sort exactly does and doesn't do...

std.algorithm operates in place wherever possible, and sort's result is 
a view on the same range as the original, but with new capabilities 
created by the sorting process. I think it's a very elegant design.

Andrei


More information about the Digitalmars-d mailing list