News for hackers. Stuff that matters.
Re:For Lispers: How accurate is this portrait of Lisp? by pg on Friday April 06, 2007 @03:48PM (#9691)
Oddly enough, I can't tell. It seems to be a portrait expressed in terms of the broken reinventions of the Lisp wheel that currently occupy the median programmer's head. Sort of like describing a car as a "horseless carriage." But since I don't know those reinventions well, I can't say if this is an accurate portrait.

For example, someone recently told me that in Python you can't have conditionals within math expressions. E.g. you can say the equiv of

(if foo (+ x 1) (+ x 2))

but not

(+ x (if foo 1 2))

To me this just seems gratuitously restrictive. But I suppose it would at least be an accurate, if rather long, description of Lisp to teach people Python, and then say e.g. "Ok, now imagine if you could also just put any expression anywhere." Plus a few other things, of course...

Re:For Lispers: How accurate is this portrait of Lisp? by nostrademons on Friday April 06, 2007 @04:30PM (#9705)
"For example, someone recently told me that in Python you can't have conditionals within math expressions."

You can, but until Python 2.5 you needed to use a somewhat opaque idiom:

x + (foo and 1 or 2)

This works because the short-circuiting boolean operators return their second operand. So if foo is true, it'll evaluate 1, find that it's true, and return 1. If foo is false, it short-circuits over the 1, evaluates the 2, finds that that is a true value, and so returns 2. It's not intuitive at all, but most serious Pythonistas are familiar with it.

I agree that this is gratuitously restrictive, and evidently the Python developers did too. As of Python 2.5, you can do this:

x + (1 if foo else 2)

It's a shame that it took so long for them to add it, though.

Re:For Lispers: How accurate is this portrait of Lisp? by jkush on Friday April 06, 2007 @04:12PM (#9703)
Thanks very much for your response. I don't think it's odd because this article (even with it's length) would probably benefit people coming from entirely different environments. They might know something about programming but need some help grasping the fundamental differences between writing programs in say C# vs. Lisp or Python.

Oddly enough, after reading his article and letting is sink in a little bit more, I was able to understand your writing better. That's no fault of yours, I just think it's a little bit of a shortcut to getting over that initial confusion.

Thanks.