On 03/20/2012 10:50 AM, bearophile wrote:
> simendsjo:
>
>> std.array includes a method, array(), for doing exactly this:
>> int[] test2 = array(map!"a+a"(test1)); //eager
>
> With 2.059 you can write that also in a more readable way, because there is less nesting:
>
> int[] test2 = test1.map!q{a + a}().array();

Going off-topic but there is also the new => lambda syntax:

    int[] test2 = test1.map!(a => a + a)(test1).array();

Although, it makes it longer in cases like the one above. :)

By the way, is there a name for "the => syntax"?

>
> Bye,
> bearophile

Ali

Reply via email to