merits of Lisp vs Python
Piotr
piotr.zielinski at gmail.com
Mon Dec 11 21:02:26 EST 2006
Paul Rubin wrote:
> > > a[i] = b[n]
> > > (setf (aref a i) (aref b n))
>
> Well, there's some similar way to look up elements in a Lisp
> hashtable, but I've forgotten the keyword for it (oops, cognitive
> inefficiency, having to remember separately.) Python uses the same
> syntax for both.
That's true, Lisp would benefit from _standard_ homogenuous polymorphic
accessor functions to list-like objects and/or low-level (macro-like)
syntactic sugar. Yes, you can easily make (a i) act like (aref a i)
but it is not done by default. Legacy reasons? Graham has interesting
things to say about this issue:
http://www.paulgraham.com/ilc03.html
Most of my programs are also written in Python, however, I would say
that in many cases "a[i] = b[n]" is an artefact of programming habits
from C, which has no language support for list comprehension,
iterators, etc. I tend to avoid such constructs; usually there is a
more natural way to do the same and it's just too easy to get the
indices wrong.
Piotr
More information about the Python-list
mailing list