Live data from Hacker News

Ask PG: Lisp vs Python (2010)

news.ycombinator.com

191–200 of 200 posts

Re: Ask PG: Lisp vs Python (2010)

#191

When I last tried Lisp (SBCL) i was surprised how hard it is to find standard, common sense 'batteries' as you would in python, and how hard it is to get things going if you're not experienced. I think the point where I jumped out of the boat was trying out 'Hunchentoot' or something like that (webserver). I haven't seen that with Python, Ruby, C++, Java, even Haskell feels 'modern' in that way. Why must it be so har…

> standard, common sense 'batteries' ... even Haskell feels 'modern' in that way

Glad you noticed! We've been working hard on this: http://haskell.org/platform

Re: Ask PG: Lisp vs Python (2010)

#192
post #4

Earlier quoted context omitted.

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?

He is probably not interested in talking about stuff when he could be doing stuff.

Re: Ask PG: Lisp vs Python (2010)

#193

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.

that's bad assembly-style pseudo-code and thinking. Lisp favors higher-level, functional pseudo-code that readily runs as is!

like in scheme: (write (let for ((i 0) (s 0)) (if (> i 100) s (for (+ 1 i) (+ i s)))))

why would you care for those a, b, or s variables in the first place when all you want is the sum? The above expression writes the sum as computed by a recursive approach using lexical bindings.

you may of course abstract it away into a function: (define (for from to doit result) (if (> from to) result (for (+ 1 from) to doit (doit from result))))

and use it: (write (let ((a 0) (b 100)) (for a b + 0)))

I didn't even need macros yet!

Re: Ask PG: Lisp vs Python (2010)

#194
post #105

Earlier quoted context omitted.

For non-hygienic macros, it's essentially the variable capture problem. For hygienic macros, I don't know of a good argument that they are inherently more difficult to understand separately from their invocation than a function. (I'm not personally arguing against macros - or global variables for that matter - just trying to state the argument).

I think it should be obvious that you use programming constructs only when difficulty of understanding it is less than the difficulty of understanding code without it (over the whole program). This applies to functions, classes, macros, frameworks etc. Full macros (like in CL where they are just functions that don't evaluate their arguments) give the programmer same power as compiler writer or programming language de…

What is code walker?

Re: Ask PG: Lisp vs Python (2010)

#195
post #108

Earlier quoted context omitted.

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.

Lisp macros manipulate Lisp code once it has been read (parsed and tokenized into lists) and sometime before it is executed. That has nothing to do with grammars. Common Lisp also offers a facility to augment or replace the parsing and tokenizing mechanism in an unrestricted fashion.

Re: Ask PG: Lisp vs Python (2010)

#196
post #61

I'm a Clojure guy that just wrote my first Pylons app. Here's my impression: 1. Python doesn't suck. I was able to mix FP & OOP approaches to get to my goal fairly quickly. 2. iPython was fun to use, helped out a lot, but it's not SLIME. 3. Guido has an excellent goal with making code readable, and significant white space is not a bad choice. However, I find being able to analyze active data structures in a Clojure n…

It's funny, but the thing I miss most from Common Lisp when I write in other languages is the LOOP macro. It's ugly, and non-lispy, but most loops I have to write can be expressed clearly and concisely using LOOP, and writing the equivalent code in another language is annoying. I'm tempted to create a LOOP clone for Clojure, then laugh villainously as I unleash it upon the world.

If you have to create a LOOP clone, why not creating an ITERATE one? ITERATE is cleaner, and it would follow the Clojure trend of bringing out the most modern features of Lisp.

http://common-lisp.net/project/iterate/doc/Don_0027t-Loop-It...

Re: Ask PG: Lisp vs Python (2010)

#197
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…

[deleted]

Re: Ask PG: Lisp vs Python (2010)

#198
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…

[deleted]

Re: Ask PG: Lisp vs Python (2010)

#199
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…

[deleted]

Re: Ask PG: Lisp vs Python (2010)

#200
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…

[deleted]
Post reply on HN