loops - common lisp iterate generalized drivers -


i'm going throught iterate manual , in section 2.1.3, appears genearlized drivers , in section 2.1.5 previous values of driver variables.

with thing want first fiboonacci number bigger 1000

so step this:

cl-user> (iter (initially (setf an-1 1))                (for an-2 previous an-1 1)                 (for an-1 next (if (> an-1 1000) (terminate) (+ an-1 an-2)))                (collect an-1)                (format t "~a -- ~a~%" an-2 an-1)) 

with following result:

1 -- 2 2 -- 4 4 -- 8 8 -- 16 16 -- 32 32 -- 64 64 -- 128 128 -- 256 256 -- 512 512 -- 1024 (2 4 8 16 32 64 128 256 512 1024) 

i not how variables inside loop growing


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -