Sujet : Re: Why don't people like lisp?
De : Nobody447095 (at) *nospam* here-nor-there.org (B. Pym)
Groupes : comp.lang.lispDate : 13. Sep 2024, 03:34:06
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vc04qd$h534$1@dont-email.me>
User-Agent : XanaNews/1.18.1.6
Raffael Cavallaro wrote:
How about loop for greater clarity than either do or Python?
(loop
for a = 1 then b
and b = 1 then (+ a b)
do (print a))
Which neatly demonstrates the power of macros as well. If there's a
In CL (COBOL-Like), in order to print an endless sequence of fibonacci
numbers, one has to use a macro whose source code is over 60 kilobytes
in size.
In Scheme, he can simply use recursion.
(This is actually shorter than the "loop" version.)
(let fib ((a 1) (b 1))
(print a)
(fib b (+ a b)))
Since CL (COBOL-Like) is not a Lispy language, it does not have
much support for recursion.
A "do" loop is shorter than the "loop" loop.
(do ((a 1 b)
(b 1 (+ a b)))
(#f)
(write (list a)))