From c24e06d026e6d75a5f3d8c0522c64d07301caae8 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Fri, 31 Jan 2014 18:26:16 -0500 Subject: Solve Problem 2. --- problem-2.scm | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 problem-2.scm diff --git a/problem-2.scm b/problem-2.scm new file mode 100644 index 0000000..2b4af05 --- /dev/null +++ b/problem-2.scm @@ -0,0 +1,9 @@ +(use-modules (srfi srfi-41)) + +(define fib + (stream-cons 0 (stream-cons 1 (stream-map + fib (stream-cdr fib))))) + +(define even-fib + (stream-filter even? fib)) + +(stream-fold + 0 (stream-take-while (lambda (x) (< x 4000000)) even-fib)) -- cgit v1.2.3