Ted Leung on the air
Ted Leung on the air: Open Source, Java, Python, and ...
Ted Leung on the air: Open Source, Java, Python, and ...
Sun, 01 Feb 2004
Python vs Lisp
Thursday's posting on Lunacy provoked a decent number of comments. There was also a discussion (unrelated) of Python vs Lisp/Scheme in #joiito that day...
Now that lots of people are piling onto the Python bandwagon, it's amusing that many of them don't realize that they are using a language which has many similarities to Lisp. So as a service to both language communities, I'm posting references to a pair of pages written by Peter Norvig. The first is called Python for Lisp Programmers, and tries to help Lisp hackers map concepts they know on to Python. It also works in the reverse direction. There are also a few microbenchmarks, as well as a bunch of things that will trip up Lispers coming to Python.
The second page is called Retrospective on Paradigms of AI Programming and includes reflection on whether or not Lisp is still unique.
Those who commented on the Lunacy post left behind some other interesting tidbits. I've taken some of the links and reproduced them here. One of the things that interested me about Lunacy was the possibility of turning the decades of Lisp compiler research towards improving the performance of Python. Unfortunately, this pair of messages from Matthias Felleisen makes me a little less optimistic that this will be possible. The standard response to performance criticisms of Python is that you can always rewrite your code in C. Now, this is true, but I'd prefer not to rewrite working code if I can avoid it.
Bagley's Computer Language Shootout has some interesting micro benchmark results. Unfortunately, it hasn't been updated, so some of the numbers are out of date. If someone is looking for a worthy project to take on, reviving this would be great. It would be wonderful to keep it up as the various language communities improve their programs and implementations.
Here's Eric Raymond's account of how he discovered Python.
Lastly, there's Denys Duchier's on article continuations, which shows how to to continuations in Python by rewriting programs in continuation passing style. This is a good example for Python folks who are wondering what the big deal about continuations is.
[23:09] |
[computers/programming/python] |
# |
TB |
F |
G |
7 Comments |
This is a good example for Python folks who are wondering what the big deal about continuations is.
As someone who routinely makes a <a href="http://beta4.com/seaside2>big deal</a> out of continuations, I'm not so sure. For lots of applications, continuations only get interesting when they are first class, that is, when you can access the implicit continuations of your program rather than using closures or objects as explicit continuations.
Continuation passing style is a good way to try to wrap your head around a difficult concept, but I don't think it properly demonstrates the "wow" of call/cc.
Posted by Avi Bryant at Mon Feb 2 00:23:27 2004
As someone who routinely makes a <a href="http://beta4.com/seaside2>big deal</a> out of continuations, I'm not so sure. For lots of applications, continuations only get interesting when they are first class, that is, when you can access the implicit continuations of your program rather than using closures or objects as explicit continuations.
Continuation passing style is a good way to try to wrap your head around a difficult concept, but I don't think it properly demonstrates the "wow" of call/cc.
Posted by Avi Bryant at Mon Feb 2 00:23:27 2004
Whilst the whole conversation is a bit above me, whenever I hear Python and continuations together I think of stackless Python. More details are at http://www.stackless.com/
Posted by Andy Todd at Mon Feb 2 01:44:04 2004
Posted by Andy Todd at Mon Feb 2 01:44:04 2004
I just discovered that stackless python should have continuations. Parrot should have them, and ruby had them since the first day (ruby is an infix dialect of lisp).
But I never really get if continuations are really so useful.
I mean, having CPS in a vm may be useful, cause it lets you add easily lexicals, coroutines, iteartors and so on, but what about callcc ? do we really feel the need for it ?
Posted by rffrff at Mon Feb 2 03:20:27 2004
But I never really get if continuations are really so useful.
I mean, having CPS in a vm may be useful, cause it lets you add easily lexicals, coroutines, iteartors and so on, but what about callcc ? do we really feel the need for it ?
Posted by rffrff at Mon Feb 2 03:20:27 2004
Avi is right about it not being a good examples of the wow of call/cc, but I do think it sets some fundamental groundwork for understanding call/cc.
Posted by Ted Leung at Tue Feb 3 10:12:23 2004
Posted by Ted Leung at Tue Feb 3 10:12:23 2004
Ted points out this essay intended to help Lisp dudes understand Python. "Python supports all of Lisp's essential features except macros, and..." ... so what's the point? Why are people so deeply suspicious of programing languages that provide solid tools to construct the program prior to compiling it? The language designers seem to feel that programmers shouldn't be allowed such tools. "Oh no son, you might hurt your self." The programmers fallen for this - "Right you are boss! Oh, could you shapen this stick for me, please?" For example here is an optional package in Common Lisp written so that it adds an amazingly powerful bit of functionality. It allows you to write programs where functions appear to generate a series of values. A suite of functions are provided to do things with these series such as generate, filter, compose them. This is very analagous to to the pipes of unix or similar constructs found in servers. But the important point is that this package conspires to rewrite the programs written in this functional notation into more traditional programs using loops. This rewriting is made possible because Lisp provides the tools to pick up your program at compile time chew on in and put it back down again before diving into the compiler; i.e. macros. This allows you to both to create micro-languages (or not so micro like the one above) that are problem specific. For example if you want a parser you don't need to invent a separate program like yacc to generate parsers you can do it in the native language. Syntax is not as important as ablity to revise the parse tree. It's incredibly sad watching the industry slowly but surely re-discover all the features in Lisp. One at a time usually about one a year....
Posted by Trackback from Ascription is an anathema to any enthusiasm at Wed May 12 14:25:15 2004
Posted by Trackback from Ascription is an anathema to any enthusiasm at Wed May 12 14:25:15 2004
Bagley's Computer Language Shootout has some interesting micro benchmark results. Unfortunately, it hasn't been updated...
Yes it has: The Great Computer Language Shootout
Posted by Isaac Gouy at Wed May 11 10:24:53 2005
Yes it has: The Great Computer Language Shootout
Posted by Isaac Gouy at Wed May 11 10:24:53 2005
Help me on my search "A compaie between Functional programing and O.O model"
please addvice me on the backbone of my search.
Posted by mohammad fami at Fri Dec 9 00:20:03 2005
please addvice me on the backbone of my search.
Posted by mohammad fami at Fri Dec 9 00:20:03 2005
You can subscribe to an RSS feed of the comments for this blog:
Add a comment here:
You can use some HTML tags in the comment text:
To insert a URI, just type it -- no need to write an anchor tag.
Allowable html tags are:
You can also use some Wiki style:
URI => [uri title]
<em> => _emphasized text_
<b> => *bold text*
Ordered list => consecutive lines starting spaces and an asterisk
To insert a URI, just type it -- no need to write an anchor tag.
Allowable html tags are:
<a href>
, <em>
, <i>
, <b>
, <blockquote>
, <br/>
, <p>
, <code>
, <pre>
, <cite>
, <sub>
and <sup>
.You can also use some Wiki style:
URI => [uri title]
<em> => _emphasized text_
<b> => *bold text*
Ordered list => consecutive lines starting spaces and an asterisk