Why is std.algorithm so complicated to use?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Jul 10 07:21:23 PDT 2012


On 7/10/12 5:35 AM, Jacob Carlborg wrote:
> On 2012-07-10 08:59, Dmitry Olshansky wrote:
>
>> Can you do it in other languages?
>
> Sure, in Ruby, but that only works on arrays:
>
> p [5, 3, 5, 6, 8].uniq.map{ |e| e.to_s }.sort

This is very inefficient.

I agree that if efficiency wasn't a concern for std.algorithm, its API 
would have been different. As things are, I think std.algorithm strikes 
a very good balance between efficiency and usability.


Andrei



More information about the Digitalmars-d mailing list