HomeAboutCodePastes

Paste on 2021-04-11T12:50:05

;; Scheme translation
(defun scheme ()
  (labels ((lp (i j res)
               (format t "~d~%" j)
               (if (>  j 4000000)
                   res
                 (lp j (+ i j) (if (evenp j) (+ res j) res)))))
          (lp 1 2 0)))

;; Using loop
(defun cl ()
  (loop for i = 1 then j
        for j = 2 then (+ i j)
        until (>= j 4000000)
        if (evenp j)
        do (format t "~d~%" j)
        sum j))

plain