how implement takeWhile
bioinfornatics
bioinfornatics at gmail.com
Mon Aug 6 02:53:18 PDT 2012
Dear,
1/
i would like have a code near as this haskell code:
fibs = 1 : 1 : zipWith (+) fibs (tail fibs)
main = do
print $ sum (filter even (takeWhile (<4000000) fibs))
Ii know in D:
- auto fib = recurrence!("a[n-1] + a[n-2]")(1, 1);
- std.algorithm.until
- std.algorithm.filler
- std.algorithm.reduce
- std.range.InputRange.popFront
- std.range.take
- std.array.appender
but i do not see how to these feature together to have a
code
close to the haskell code.
Someone?
2/
Someone know to generate a fibonacci list directly with a lambda
syyntax and not from string ("a[n-1] + a[n-2]") ?
thanks
More information about the Digitalmars-d-learn
mailing list