On 01/30/2015 09:55 AM, Jonathan M Davis via Digitalmars-d-learn wrote:

> sort returns a different type rather than the original type, and that type > indicates that its sorted, and some algoritms are able to take advantage of
> that.

I covered that a little bit during DConf 2014, at around 4:30 minute mark here:


http://www.youtube.com/watch?x-yt-cl=85114404&v=oF8K4-bieaw&feature=player_detailpage&x-yt-ts=1422579428#t=267

> 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

Reply via email to