reduce!"a+b"(R) syntax question
Andrew Spott
andrew.spott at gmail.com
Tue Aug 21 10:11:02 PDT 2012
On Tuesday, 21 August 2012 at 17:05:46 UTC, Andrew Spott wrote:
> When I'm doing an anonymous function for something like reduce,
> how are the arguments determined? Is it alphabetical? Can I
> use
> any names (reduce!"d-c"(R)?), or are the names defined in the
> function "reduce"?
>
> This syntax isn't really documented at all in the language
> reference, which makes it a little bit of guess work.
>
> -Andrew
Oh, one more question:
does it act like a delegate?
if I do:
int a = 1;
reduce!"d - c - a"(R);
will that use the "a"? or is that out of scope? If I want to use
external variables, do I have to do something like:
int a = 1;
reduce!((int c, int d) => d - c - a)(R);
instead?
More information about the Digitalmars-d-learn
mailing list