Python syntax in Lisp and Scheme

Alex Martelli aleax at aleax.it
Fri Oct 10 19:12:27 CEST 2003


Edi Weitz wrote:
   ...
>> > > I think it's about a single namespace (Scheme, Python, Haskell,
>> > > ...)  vs CLisp's dual namespaces.  People get used pretty fast
>> > > to having every object (whether callable or not) "first-class"
>> > > -- e.g. sendable as an argument without any need for stropping
   ...
>> He's talking about NAMESPACES.  "namespace" occurs twice in his
>> paragraph, while "function" occurs only once, that should have given
>> you a hint.
> 
> Thanks, I think my reading comprehension is quite good. What you said
> doesn't change the fact that Mr. Martelli's wording insinuates that in
> Scheme and Python functions are first-class objects and in Common Lisp

I put "first class" in quotes and immediately explained what I meant.

> they're not. For the sake of c.l.p readers who might not know CL I
> think this should be corrected.
> 
> * (let ((fn (lambda (x) (* x x))))
>     (mapcar fn (list 1 2 3 4 5)))
> 
> (1 4 9 16 25)
> 
> There you have it. I can create a function, assign it to a variable
> and pass it to another function like any other object, that's what I'd
> call a "first-class object."

Yes, but:

>> Namely, he's saying that people used to write: (mapcar cadr '((a 1)
>> (b 2))) don't like having to write: (mapcar #'cadr '((a 1) (b 2)))
>> in Common-Lisp.
> 
> This old namespace debate only makes me yawn, sorry.

If so then why jump on assertions related exactly just to that --
namespaces?  Re-read my quote above, o you of self-proclaimed "quite
good" reading comprehension: I was trying to explain to Doug Tolton 
why many think that Haskell, Scheme or Python "do HOFs better",
while he was claiming that the use of #' if "far clearner" (sic)
because "in lisp with #' it's immediately obvious that you are
receiving or sending a HOF that will potentially alter how the
call operates".  I.e., it IS strictly a namespace debate from the
word go.  Whether it SHOULD be emphasized with horns and bells
that "warning, HOF coming!!!" -- as Doug claimed -- or not.

If you're bored by debating namespaces, don't jump into a debate
on namespaces -- seems simple common sense (as opposed to
common lisp?)...


Alex





More information about the Python-list mailing list