<html><body><div><br></div><div><br>On 09 Feb, 2012,at 10:57 PM, Andrej Mitrovic <andrej.mitrovich@gmail.com> wrote:<br><br><div><blockquote type="cite"><div class="msg-quote"><div class="_stretch">On 2/9/12, Jacob Carlborg <<a href="mailto:doob@me.com" _mce_href="mailto:doob@me.com">doob@me.com</a>> wrote:<br>
> Yes it is. Together with delegates.<br>
<br>
I didn't find them next to delegates but after hash literals in the<br>
Expressions section.<br>
<a href="http://www.d-programming-language.org/expression.html#Lambda" _mce_href="http://www.d-programming-language.org/expression.html#Lambda">http://www.d-programming-language.org/expression.html#Lambda</a><br>
</div></div></blockquote><span> </span><br></div><div>Oh, delegates are documented here as well: http://www.dlang.org/function.html<br></div><div><br></div><div>Seems <a href="http://www.d-programming-language.org/expression.html#Lambda" _mce_href="http://www.d-programming-language.org/expression.html#Lambda">expression.html</a> is for the actual delegate literal.<br><br><blockquote type="cite"><div class="msg-quote"><div class="_stretch"><br>
It should have usage examples though. It took me a while to figure out<br>
what was wrong with this:<br>
<br>
void test(int function(int, int) func) {<br>
func(1, 2);<br>
}<br>
<br>
void main() {<br>
test(x, y => x);<br>
}<br>
<br>
Error: undefined identifier x<br>
<br>
The fix: test((x, y) => x);</div></div></blockquote><span></span><br></div><div>Yeah, parentheses are required if the lambda takes more than one argument.<br></div><div><br></div><div>--<br></div><div>/Jacob Carlborg<br></div></div></body></html>