On Monday, 30 December 2013 at 21:58:29 UTC, Timon Gehr wrote:
On 12/30/2013 10:15 PM, Ilya Yaroshenko wrote:
On Monday, 30 December 2013 at 12:24:28 UTC, lomereiter wrote:
Use Y combinator?
http://forum.dlang.org/thread/[email protected]#post-l6rgfq:24g5o:241:40digitalmars.com


This is not lambda =(

I want something like

enum factrorial5 = (a => a == 0 ? 1 : a * __lambda(a-1))(5);
//Recursive pure lambda function


enum factorial5=(function int(a)=>a==0?1:a*__traits(parent,{})(a-1))(5);

(In D, you need to specify the return type for a recursive function
declaration. If one doesn't here, DMD crashes, which is a bug.
https://d.puremagic.com/issues/show_bug.cgi?id=11848)

And of course I'm wrong about that as soon as I post. No idea why one works when the other doesn't...

Reply via email to