Python syntax in Lisp and Scheme
Hartmann Schaffer
hs at heaven.nirvananet
Tue Oct 14 12:38:35 EDT 2003
In article <raffaelcavallaro-583E78.11332714102003 at netnews.attbi.com>,
Raffael Cavallaro <raffaelcavallaro at junk.mail.me.not.mac.com> writes:
> In article <8yno1dvi.fsf at comcast.net>, prunesquallor at comcast.net wrote:
>
>> (flet ((add-offset (x) (+ x offset)))
>> (map 'list #'add-offset some-list))
>
> But flet is just lambda in drag. I mean real, named functions, with
> defun. Then the code becomes:
>
> (add-offset the-list)
>
> instead of either of theversions you gave.
the version he gave has the advantage that it doesn't clutter up the
namespace of the environment. with
(map (lambda (x) (+ x offset)) the-list)
you have everything that is relevant in the immediate neighborhood of
the statement. with a separate defun you have to search the program
to see what the function does. i agree that for lengthy functions
defining it separately and just writing the name is preferrable.
> ...
> I guess I'm arguing that the low level implementation details should not
> be inlined by the programmer, but by the compiler. To my eye, anonymous
> functions look like programmer inlining.
i would call this a misconception
hs
--
ceterum censeo SCO esse delendam
More information about the Python-list
mailing list