std.algorithm sort() and reverse() confusion

Paul via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jan 30 12:20:20 PST 2015


On Friday, 30 January 2015 at 18:46:55 UTC, Ali Çehreli wrote:
> > there is no such benefit with reverse, so there's no need to
> > return anything.
>
> Still, returning the original range would help with chaining 
> calls:
>
>   arr.reverse.map!sqrt
>
> Side note: There is the confusion between the .reverse property 
> of arrays and std.algorithm.reverse. :-/
>
> Ali

Thanks all, I now understand why this happens, although as a 
newcomer, it seems a little odd that these 'utility functions' 
have to be handled differently.

Paul






More information about the Digitalmars-d-learn mailing list