Hacker News new | past | comments | ask | show | jobs | submit login

How are tail calls and closures in any way Scheme-specific?

The "main value" cited also assumes "pure functional programming" is worthwhile. That is not an uncontroversial opinion, and does little to make the case for SICP to people not already convinced.




Scheme works great in SICP because it doesn't get in the way. After the first few pages, it doesn't feel like you're reading a programming language so much as reading the direct expression of concepts discussed in the text. The programming language learning hurdle is almost nonexistent.

That fact reduces cognitive load on the reader, freeing up mental resources that can be applied to the concepts presented.


Well, the question was about Python, which definitely doesn't have those things. If you want to me to justify Scheme, how about code-as-data, which is the entirety of chapter 4?

> That is not an uncontroversial opinion, and does little to make the case for SICP to people not already convinced.

That was not an unconsidered viewpoint, if you read what I wrote. I said "for its fans". I am not attempting to make the case for SICP; that book doesn't need my help.


CPython doesn't have built-in tail call optimization, but that's not a fundamental property of the language, just a limit of that particular implementation. One that can even be hacked around in Python with a decorator. A decorator, by the way, is a Python feature that depends on closures, which are themselves quite commonly used in Python.

You have some very strange ideas about Python that appear to have little relation to reality.


Python has things they call closures but they aren't what Scheme (or Lisp, or Perl, or Ruby, or Smalltalk, or JavaScript, or C#...) would call a closure. I think it's fair to say that Python is the odd language out here. The scoping rules are different unless you use the relatively recent "nonlocal" keyword.

http://stackoverflow.com/questions/141642/what-limitations-h...

And Guido has said that he intentionally crippled the lambda keyword.

http://www.artima.com/weblogs/viewpost.jsp?thread=147358

Anyway, why are you getting offended? Python is a great language.

Some people just think Scheme teaches certain aspects of programming better for various reasons. For instance, in Scheme, the program listing is a representation of the parse tree. Python will construct a similar tree, but this is not revealed to the programmer as much. So if you learn Scheme you can imagine how what Python is really doing (and writing parsers is much simpler because you have an intuitive sense of how they work).

And the ability to manipulate code as data is exclusive to s-expression based languages. This enables (for instance) truly hygienic macros. You don't get that in Python.

On the other hand, object-oriented programming in Scheme is pretty terrible. The part in SICP where they try to simulate it in Scheme is a travesty. Although it is somewhat illustrative of what's "really" going on, without the syntactic support it just looks ridiculous. So that's a win for Python.

Similarly, whipping up a complex data structure takes far fewer keystrokes, and is more transparent, in Pythonic syntax. Just as Scheme benefits from having built-in lists, Python wins even bigger for having lists and dictionaries everywhere. And overall Python is objectively more practical, with its vast array of libraries and ease of use.

I honestly don't know if you're trolling or are just being partisan. Not all languages are the same and there isn't any one "winner" language.


Unusual scoping rules that are easily worked around do not make Python's closures not closures. And I'm not sure why you're bringing up lambda -- I don't know anyone who uses it much, and I consider it an obfuscation mechanism rather than a useful tool.

As for your personal attacks on me... I dispute statements you made that I consider to be utterly wrong, and you say I'm "getting offended" and "trolling"? Now I'm offended.

I look up and down the comments on here and I see all sorts of people making blanket statements about how great Scheme is, yet when I argue a couple specific points you brought up about Python, I'm being the partisan troll? WTF?




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: