Why is std.algorithm so complicated to use?

Dmitry Olshansky dmitry.olsh at gmail.com
Tue Jul 10 08:04:52 PDT 2012


On 10-Jul-12 19:00, Timon Gehr wrote:
> On 07/10/2012 02:53 PM, Dmitry Olshansky wrote:
>> On 10-Jul-12 15:37, Jacob Carlborg wrote:
>>> On 2012-07-10 12:05, Dmitry Olshansky wrote:
>>>
>>>> and what type has the return of map ? Let me guess - array.
>>>
>>> Yes, and that is what I _want_.
>>
>> Too bad, as there is no need to make an array when you map something.
>>
>> I have no need for streaming data from
>>> the network into a linked list, filter it and then convert it to an
>>> array (or something similar). I want to start with an array and end with
>>> an array.
>>>
>>
>> Then you need something like transform. Anyway the result of map should
>> be sortable it's a bug.
>>
>
> What would sort do? Special case the result of map and then call
> schwartzSort on the underlying range?
>
It may be a good idea actually. I once found myself in a need to sort 
mapped range. I think I just sorted original with "mapped" predicate it 
could get slow but in my case it was ok. Then assumeSorted(map!(...)).

-- 
Dmitry Olshansky




More information about the Digitalmars-d mailing list