map! filter! and range algorithm

Andrea Fontana nospam at example.com
Mon Mar 4 12:49:21 PST 2013


On Monday, 4 March 2013 at 20:21:31 UTC, Timon Gehr wrote:
> On 03/04/2013 09:06 PM, Andrea Fontana wrote:
>> If I understand it correctly something like:
>>
>> range.filter!(...).map!(...)
>>
>> browse range 2 times, one for filter and one for mapping 
>> doesn't it?
>>
>
> It does not.
>
>> Is there a way to "parallelize" this kind of operations?
>>
>
> Interleaving is the default. To perform two traversals you'd 
> have to force evaluation using eg. 
> range.filter!(...).array.map!(...).


Very interesting. IMHO that should be pointed out better in 
docs/example.
You say interleaving is "default", how can I guess if a function 
doesn't use the "default" behaviour?


More information about the Digitalmars-d-learn mailing list