Fun with Fibonacci

Aug 19, 2004 23:21


Everyone having studied science has met Fibonacci numbers somewhere or another in his curriculum ( Read more... )

mathematics, lisp, code, en

Leave a comment

Comments 6

broken link to the actual code anonymous April 6 2006, 16:55:41 UTC
Your link and/or script meant to show the Lisp code seems to be broken..

Reply

fixed link to the actual code fare April 6 2006, 23:47:05 UTC
Oops. I don't use CVS anymore. I uploaded the (now stable) file to a new location and updated the link. Sorry for the trouble and thanks for your interest.

Reply


fusiongyro November 11 2007, 02:53:39 UTC
May I offer you another?

(defun fibs-series (n)
(let ((fibs (scan-fn '(values :integer :integer)
(lambda () (values 1 1))
(lambda (x y) (values y (+ x y))))))
(collect-last (subseries fibs (1- n) n))))

Reply


stassats January 25 2010, 15:24:39 UTC
Using multiple-value-call instead of (apply function (multiple-value-list ...)) should be better.

Reply

multiple-value-call fare January 25 2010, 15:36:11 UTC
Thanks! I updated the file with this style improvement.

Reply

Re: multiple-value-call stassats January 25 2010, 16:02:55 UTC
It's not only style actually, it may eliminate consing too.

Reply


Leave a comment

Up