what is the offical way to handle multiple list in map() ?

bearophile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Feb 16 02:50:54 PST 2015


Baz:

> is this the official way ?

It seems a way to perform nested mapping in D.


> ---
> auto fruits = ["apple", "banana", "orange"][];
> auto vegies = ["grass", "salad"][];

Those trailing [] are unneded.


> auto youreallygonna = map!( `map!(a => "eat " ~ a)(a)` 
> )([fruits, vegies]);

Better to use another lambda inside, instead of that string.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list