Python syntax in Lisp and Scheme
Edi Weitz
edi at agharta.de
Thu Oct 9 19:01:42 EDT 2003
On 10 Oct 2003 00:00:24 +0200, Pascal Bourguignon <spam at thalassa.informatimago.com> wrote:
> Edi Weitz <edi at agharta.de> writes:
>
> > [Followup-To ignored because I don't read comp.lang.python]
> >
> > On Thu, 09 Oct 2003 16:13:54 GMT, Alex Martelli <aleax at aleax.it> 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
> > > or the like. To you, HOFs may feel like special cases needing
> > > special syntax that toots horns and rings bells; to people used
> > > to passing functions as arguments as a way of living, that's as
> > > syntactically obtrusive as, say, O'CAML's mandate that you use
> > > +. and not plain + when summing floats rather than ints
> >
> > In Common Lisp (not "CLisp", that's an implementation) functions
> > /are/ first-class and sendable as an argument "without any need
> > for stropping or the like." What exactly are you talking about?
>
> Read him.
>
> 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
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."
> 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.
> [ Personnaly, I rather write it as: (mapcar (function cadr) '((a 1)
> (b 2))) The less read macro the better I feel.]
Sincere condolences... :)
Edi.
More information about the Python-list
mailing list