Skip to content

Instantly share code, notes, and snippets.

@jeremyBanks
Created August 22, 2008 21:49
Show Gist options
  • Save jeremyBanks/6860 to your computer and use it in GitHub Desktop.
Save jeremyBanks/6860 to your computer and use it in GitHub Desktop.
[2010-01] experimenting with sbcl, i guess
#!/usr/bin/env sbclx
(let
((sum 0)) ; the sum of the even valued terms of fib
; this is the only variable we need outside of the scope of the loop
(do
(
(ubound 4000000) ; that do not excede this value
(previous 1) ; the value of the previous term
(current 1) ; the value of the current term
)
((> current ubound)) ; don't excede the limti!
(if
(=
0
(mod current 2)
)
(setq sum (+ sum current))
)
(let
(
(tempCurrent current)
)
(setq current (+ previous current))
(setq previous tempCurrent)
)
)
(print sum)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment