[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
simple and useful demonstrative case
- To: (BUG LISP) at MIT-MC
- Subject: simple and useful demonstrative case
- From: DCP at MIT-MC (David C. Plummer)
- Date: Fri, 30 Jan 81 20:56:00 GMT
- Original-date: 30 JAN 1981 1556-EST
(defun fib (n)
(do ((old 0 new)
(new 1 (+ old new))
(i 0 (1+ i)))
((= i n) old)))
This is our friend the fibonacci numbers. I want to demonstrate
it to people and compile it for my own use. I know it uses
fixnums, but that's ok.
Run it interpretted:
(setq base (setq ibase 10.))
(fib 20)
6765. ; the AI phone number
demonstrate the compiler: (compiled function loaded of course)
(fib 20)
524288. ; phone number??
A naive user would be totally lost at such a response from such a
simple (and useful) function.