front evaluated multiple time with joiner depending on where extra arg given
bearophile
bearophileHUGS at lycos.com
Tue Oct 22 17:21:55 PDT 2013
Timothee Cour:
> auto b=[1,2,3].map!(a=>{counter++; return
> [a];}()).joiner([0]).array;
Currently there are some problems inside some of the higher order
functions of Phobos. So as general rule don't put impure code
inside the functions (usually lambdas) you pass to the higher
order functions like map, filter, etc.
By the way, a more readable way to put more commands inside a
lambda should be:
(a){ counter++; return [a]; }
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list