axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Axiom-developer] Literated VMLISP.LISP.PAMPHLET


From: Kai Kaminski
Subject: Re: [Axiom-developer] Literated VMLISP.LISP.PAMPHLET
Date: Tue, 26 Sep 2006 19:35:00 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin)

root <address@hidden> writes:

>> use lots of small functions. What is the difference between
>
> This defines 2 functions.
True.
>> 
>> (defun bar (...)
>>   (blah blub))
>> 
>> (defun foo (...)
>>   (let ((...))
>>     (bar ...)))
>> 
>
> This defines a function and a "top level form".
> The first expression is evaluated and returns a function.
> The second expression is immediately evaluated for effect.
No. The DO-BAR chunk is included in the FOO chunk. Hence (BLAH BLUB)
ends up in the body of FOO and is not a toplevel form. Of course, the
two snippets differ in that one defines a function and the other does
not. But in a Lisp program I'd very much prefer the former, since it's
easier to understand and to work with. If performance is an issue, an
INLINE-declaration might help.

>> and
>> 
>> <<foo>>=
>> (defun foo (...)
>>   (let ((...))
>>     <<do-bar>>))
>> @
>> 
>> <<do-bar>>=
>> (blah blub)
>> @
>
> Depending on the situation the value of the top level form
> could have other side effects.
It is not a toplevel form.

Kai




reply via email to

[Prev in Thread] Current Thread [Next in Thread]