List Comprehension equivalent

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Mar 17 12:32:35 PDT 2017


On 03/17/2017 12:21 PM, John Colvin wrote:
 > On Friday, 17 March 2017 at 19:08:36 UTC, Russel Winder wrote:

 >> Rust ownership problems
 >> seem to be a doddle compared to this problem.

It sometimes feels like that but we don't want to lose you. :)

 > reduce is a free function in std.algorithm. Just import it and you're
 > away.

'fold' (a relatively recent addition) is recommended is almost all cases 
because  it actually works with chained range syntax.

   https://dlang.org/phobos/std_algorithm_iteration.html#fold

Ali



More information about the Digitalmars-d-learn mailing list