Live data from Hacker News

Ask PG: Lisp vs Python (2010)

news.ycombinator.com

131–140 of 200 posts

Re: Ask PG: Lisp vs Python (2010)

#131

Earlier quoted context omitted.

Peter, you imply that Python is better for, or more like, pseudo-code, but why is it better? In my opinion, it is better for most people because they were taught syntaxes more like that of Python than that of Lisp. An important factor in easy-of-understanding is to be similar to something you are already familiar with. To the extent that this is the reason, it's not implicit in Lisp vs. Python, but rather more a ques…

> Peter, you imply that Python is better for, or more like, pseudo-code, but why is it better? Well from what he writes, he seems to say Python looks much closer to their actual pseudo-code, and it's therefore easier for students to translate pseudocode to Python than to Lisp. > In my opinion, it is better for most people because they were taught syntaxes Such as english. One of the original goals of Python (inherite…

When I took an AI class at my university with AI: A Modern Approach (the book was good, if a little difficult to understand at times), we had a couple projects that we had to write in lisp.

First project: Problem Solving Agent for Traveling Salesman Problem. 1. Depth First Search (function argument- DFS) 2. Iterative Depth First Search (function argument- IDFS) 3. A* - Heuristic: Path Cost Incurred (function argument- PATH) 4. A* - Heuristic: Minimum Spanning Tree heuristic (function argument- MST) 5. (Extra Credit 25 points ) Create and implement a heuristic equal to or better than MST

Second project: In this project we implement a decision tree induction algorithm in Lisp.

I had played around with lisp before this point and found it fascinating. I approached these projects with excitement. But even with 8 years of serious programming experience, I could not for the life of me solve these problems in lisp. My problems included:

1. Knowing exactly what methods I wanted to call and use and either a. Not being able to find them in any reference I found online, or b. Finding out that they don't exist, and you have to write them yourself, or c. Finding them and shaking my head at how ridiculously they were named. 2. Not being able to read the code I had just written. 3. Not being able to debug. 4. Finding that manipulating common data structures like hash tables is a total chore.

Eventually I gave up. I had spent about two hours trying to implement the project I had already solved in my head into common lisp and was making little or no progress. So I fired up another vim terminal, solved the project in Python in about 30 minutes, including debugging, and then manually translated the code into lisp.

When project 2 rolled around, I decided to give it another go, but I quickly became frustrated again. Maybe my mind just isn't able to grok lisp? Maybe I'm just not smart enough?

All I'm claiming is that I am an example of a student who was already very knowledgeable about programming and completely unable to adapt to lisp.

Re: Ask PG: Lisp vs Python (2010)

#132
post #108

Earlier quoted context omitted.

How are you going to logically think about manipulating the structure of a program that looks like C# or Perl? In Perl 6, you extend the active grammar within a delimited scope.

My point still holds, just replace manipulating the structure of a program with manipulating the structure of a grammar. In no way is that comparable to manipulating raw parse trees.

But you are manipulating parse trees: surely you have to add new grammar rules to the parser, but then the macro itself does just that.

Furthermore, when adding syntax you are not limited to a Lisp-style grammar.

Re: Ask PG: Lisp vs Python (2010)

#133
post #4
post #2

An approximation of some of Norvig's recent thoughts (Feb 2010): "(1) It just turned out that when Google was started, the core programmers were C++ programmers and they were very effective. Part of it is a little bit of culture. (2) Early Lisp programmers (Erann Gat) at Google actually noticed that other programmers were equally or more productive. It has more to do with the programmer; we're getting to the point wh…

That reminds me of a cool story, in Norvig's talk about Python... When he finished Peter [Norvig] took questions and to my surprise called first on the rumpled old guy who had wandered in just before the talk began and eased himself into a chair just across the aisle from me and a few rows up. This guy had wild white hair and a scraggly white beard and looked hopelessly lost as if he had gotten separated from the tou…

"... My first thought was that he would be terribly disappointed by our bizarre topic and my second thought was that he would be about the right age, Stanford is just down the road, I think he is still at Stanford -- could it be? ..."

I've often wondered why McCarthy has never been asked to Startup school to talk about developing and using Lisp and the advantages?

Re: Ask PG: Lisp vs Python (2010)

#134

Earlier quoted context omitted.

I've had a similar experience, lately while writing and editing pieces for Code Quarterly--I've written the same basic algorithms in Javascript, Python, and Common Lisp to play around with them. I find the Python the best vehicle for conveying the algorithms despite being more fluent in Common Lisp. But I've also been astounded at how slow CPython is compared to SBCL (the Common Lisp implementation I use) when I have…

I'm not a Lisp expert, so I have another question. Is it possible to embed DSL into Lisp which will looks like pseudo-code? For example: (pseudo a = 0 b = 100 s = 0 for (i from a to b) s = s + i write(s) ) If such pseudo code can be embedded into SBCL it would generate fast machine code, also it would be possible to easily modify pseudo code syntax.

sure, that's possible - just see the LOOP macro...

Re: Ask PG: Lisp vs Python (2010)

#135
post #88

Earlier quoted context omitted.

LOOP is not from Interlisp. It comes straight from Maclisp. 'LOOPS' from Interlisp is something entirely different: an object-oriented extension to Interlisp.

I'm going by the Hyperspec and what I remember from reading Kaisler's Interlisp. From the former: "One of the Interlisp ideas that influenced Common Lisp was an iteration construct implemented by Warren Teitelman that inspired the loop macro used both on the Lisp Machines and in MacLisp, and now in Common Lisp." http://www.lispworks.com/documentation/HyperSpec/Body/01_ab....

It influenced it the Maclisp LOOP. The idea. That's all. The CL LOOP macro OTOH is a straight version of the Maclisp version. The MIT version of LOOP came from the same sources, even.

The Interlisp iteration facility looks slightly different. There are Interlisp manuals as PDF at bitsavers...

Re: Ask PG: Lisp vs Python (2010)

#136
post #58

Earlier quoted context omitted.

CCL has very good ObjC/Cocoa integration, and a well integrated IDE. But it also runs on Linux and Windows, it has native threads (that feature alone puts it head-and-shoulders over Python), and it has a wicked fast compiler. So it makes a kick-ass webapp development platform. I don't know about Cocoa touch, but the CCL compiler was recently ported to run on ARM processors.

> that feature alone puts it head-and-shoulders over Python Uh no it doesn't. Python uses OS threads. It cripples them with the GIL (hence multiprocessing), but it never used green threads. And of course, using green threads can be an advantage if you're not dumb about it (see Erlang). > it has a wicked fast compiler. So it makes a kick-ass webapp development platform. What?

CCL has no GIL.

Re: Ask PG: Lisp vs Python (2010)

#137
post #23

Peter Norvig here. I came to Python not because I thought it was a better/acceptable/pragmatic Lisp, but because it was better pseudocode. Several students claimed that they had a hard time mapping from the pseudocode in my AI textbook to the Lisp code that Russell and I had online. So I looked for the language that was most like our pseudocode, and found that Python was the best match. Then I had to teach myself eno…

Robert M. Lefkowitz's 2007 PyCon Keynote discusses the "main goal is communication, not programming" in great detail. Wish there was a text I could cite.

Re: Ask PG: Lisp vs Python (2010)

#138
post #12

Earlier quoted context omitted.

At least P. Norvig things python is an acceptable language, if not LISP. I think the point about being optimized for small teams is a significant one. Also, because LISP appeals mostly to programmers, but it often "repeals" people with expert knowledge (e.g. scientists without a strong programming background). P. Norvig mentioned that when he converted his AI book from Lisp to python code examples, it seemed much mor…

I think you meant "repels", unless you meant "refudiates", though perhaps your finger stumbled in the middle of "repls".

"refudiate" isn't a word (though it appears to be a Palin-ism -- http://www.urbandictionary.com/define.php?term=Refudiate). Perhaps you meant "repudiate?"

Re: Ask PG: Lisp vs Python (2010)

#139
post #134

Earlier quoted context omitted.

I'm not a Lisp expert, so I have another question. Is it possible to embed DSL into Lisp which will looks like pseudo-code? For example: (pseudo a = 0 b = 100 s = 0 for (i from a to b) s = s + i write(s) ) If such pseudo code can be embedded into SBCL it would generate fast machine code, also it would be possible to easily modify pseudo code syntax.

sure, that's possible - just see the LOOP macro...

Then, why no one still not made such eDSL? As I understand, the only reason to choose Python for Peter Norvig was the similarity of Python to pseudo-code. I think that such great hacker as Peter Norvig could easily develop pseudo-code eDSL on top of Lisp macro-system.

As school teacher on programming I'm limited in choice of programming languages. The only language which I can study is Pascal (a lot of other reasons on it). The problem is that Pascal have not any libraries (GUI, 2D/3D, Game Development Engines, programming micro-controllers, ...). Students can write only simple console applications. So, it was be ideal to have subset of Pascal as eDSL on top of Common Lisp or Clojure. In that way I can easily extend original Pascal to access some real world libraries.

I think also on top of Common Lisp we can develop some simpler eDSL as pseudo-code for beginner students.

PS: gone to learn Common Lisp...

Re: Ask PG: Lisp vs Python (2010)

#140
post #58

Earlier quoted context omitted.

CCL has very good ObjC/Cocoa integration, and a well integrated IDE. But it also runs on Linux and Windows, it has native threads (that feature alone puts it head-and-shoulders over Python), and it has a wicked fast compiler. So it makes a kick-ass webapp development platform. I don't know about Cocoa touch, but the CCL compiler was recently ported to run on ARM processors.

> that feature alone puts it head-and-shoulders over Python Uh no it doesn't. Python uses OS threads. It cripples them with the GIL (hence multiprocessing), but it never used green threads. And of course, using green threads can be an advantage if you're not dumb about it (see Erlang). > it has a wicked fast compiler. So it makes a kick-ass webapp development platform. What?

> Uh no it doesn't.

Uh, yes it does.

> Python uses OS threads. It cripples them with the GIL

And CCL doesn't. QED.

> using green threads can be an advantage

Not if you have multiple cores.

> What?

http://www.youtube.com/watch?v=snW3cM1KipQ

;-)

Post reply on HN