how implement takeWhile

Simen Kjaeraas simen.kjaras at gmail.com
Mon Aug 6 03:15:16 PDT 2012


On Mon, 06 Aug 2012 11:59:29 +0200, Simen Kjaeraas  
<simen.kjaras at gmail.com> wrote:

> This is what you want, isn't it?
>
> recurrence!((a,n)=>a[n-1]+a[n-2])(1,1).until!(a=>a>=40000)()

That is, the meat of it. The full line:

writeln(recurrence!((a,n)=>a[n-1]+a[n-2])(1,1).until!(a=>a>=40000)().filter!(a=>a%2==0)().reduce!((a,b)=>a+b)())

-- 
Simen


More information about the Digitalmars-d-learn mailing list