blob: df3e1cdd2822cd5910534c7aa3fad07227296c34 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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))
|