Complex networks in D

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Tue Jul 16 11:45:13 PDT 2013


On Tuesday, 16 July 2013 at 15:57:06 UTC, bearophile wrote:
>>> For such kind of code I suggest to use UFCS chains.
>>
>> Can you explain in a little more detail?  It's not an aspect 
>> of programming I'm familiar with.
>
> auto r1 = iota(_sumHead[v], _sumHead[v + 1]).map!(a => 
> _tail[_indexHead[a]]);
> auto r2 = iota(_sumTail[v], _sumTail[v + 1]).map!(a => 
> _head[_indexTail[a]]);
> return chain(r1, r2);

Ahh, OK.  To be sure I understand what you're getting at, is it 
just that it's more elegant to write it this way (I agree:-), or 
is there a performance benefit in the iota().map!() form (or to 
separately generating the ranges and then chaining them)?


More information about the Digitalmars-d-announce mailing list