diff options
Diffstat (limited to '0002/main.lisp')
| -rw-r--r-- | 0002/main.lisp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/0002/main.lisp b/0002/main.lisp new file mode 100644 index 0000000..df3e1cd --- /dev/null +++ b/0002/main.lisp @@ -0,0 +1,19 @@ +(defun new-next-fibo-generator () + (let ((x0 0) + (x1 1)) + (lambda () + (let ((next (+ x0 x1))) + (setf x0 x1) + (setf x1 next) + next)))) + +(defvar *uplimit* 4000000) + +(let ((next-fibo (new-next-fibo-generator)) + (sum 0)) + (do ((x (funcall next-fibo) (funcall next-fibo))) + ((> x *uplimit*) sum) + (setf sum (if (evenp x) + (+ sum x) + sum))) + (format t "~&~S" sum)) |
