[challenge] Lazy flatten/avoiding type forward reference with map

Timon Gehr timon.gehr at gmx.ch
Sun Nov 3 04:50:45 PST 2013


On 10/31/2013 10:19 PM, Ali Çehreli wrote:
> ...
>
> Y Combinator? (No, I have not solved it yet. :) )
>
>    http://rosettacode.org/wiki/Y_combinator#D
>
> Ali
>

Oh my god, my eyes!

auto y(S,T...)(S delegate(T) delegate(S delegate(T)) f){
     struct F{ S delegate(T) delegate(F) f; alias f this; }
     return (x=>x(x))(F(x=>f((T v)=>x(x)(v))));
}


More information about the Digitalmars-d-learn mailing list