Matt Bowcock // mbowcock.com

Project Euler Problem 2 in Scheme

without comments

This one was relatively straight forward.

(define (fib-iter last-one last-two total max)   (if (or (> (+ last-one last-two) max) (= (+ last-one last-two) max))       total       (fib-iter (+ last-one last-two)                 last-one                 (if (= (modulo (+ last-one last-two) 2) 0)                     (+ total last-one last-two)                     total)                 max))) (fib-iter 1 0 0 4000000)

Written by matt

October 6th, 2009 at 10:16 pm

Posted in notebook

Tagged with

Leave a Reply