Up next: Sicp JAVASCRIPT
SICP in Python
61–70 of 136 posts
Re: SICP in Python
#62People say SICP is bigger then Scheme and then get outraged when someone implements it in another language.
Re: SICP in Python
#63If anyone wants to work through SICP in the original way, you can get MIT Scheme, and run it on some computers.
sudo apt install mit-scheme
Some of us added support to DrRacket, for working through SICP that way (though if you already know how to use an editor, etc., you might prefer to just run MIT Scheme): https://docs.racket-lang.org/sicp-manual/
Re: SICP in Python
#64If you wanted to delve into the original 1984 LISP/Scheme version by Abelson and Sussman, I recommend you take a look at https://opendocs.github.io/sicp/sicp.pdf which is based on the MITPress HTML version, released under a permissive CC-by-SA license. https://mitpress.mit.edu/sites/default/files/sicp/index.html (nb. The pdf starts out with a curious little 'texinfo foreword'. Being able to type `info sicp` in one's…
Re: SICP in Python
#65Earlier quoted context omitted.
The vast ecosystem of python libraries is an incredibly powerful argument for using it. One major library could dramatically cut the development time of your project. You’ve not spelt out actual reasons why Python is so bad, could you give your top three?
One thing I have felt is that python doesn't embrace the functional way of thinking, even to the extent that JavaScript does. I personally find that once I have been exposed to a modern functional approach like in Clojure, etc, I find python lacking. Not just syntactically, but conceptually. For example, IIRC, many list methods in python modify the list they are working on, instead of returning a new list.
Re: SICP in Python
#66Earlier quoted context omitted.
I concur, this book is a terrible way to introduce anybody to Python. I imagine they want to teach general programming skills, and hence want to give you a "way to think" that is low level enough to let you work with any language, using Python as a pseudo-code to demonstrate it. This approach is doomed to fail. It's much better to teach the language properly, then introduce other languages as a comparison point, if t…
SICP shouldn't really be taught in any language other than Scheme, or a language designed specifically for teaching SICP. It doesn't make sense otherwise.
Re: SICP in Python
#67Earlier quoted context omitted.
SICP is about deeply understanding computation. Scheme is a good language for SICP because it's simple. You can build a Scheme interpreter as a class project. You can analyze it formally. Etc. Python is a good language because it's readable and writeable. But it doesn't work for SICP since it's too complex for that. Python also intentionally omits things critical to SICP (like tail recursion). Calling this book "SICP…
Except that 90% of Python programmers fail to answer simple questions like: Given: def extendList(val, list=[]): list.append(val) return list What do the following print: print(extendList(1)) print(extendList(1)) print(extendList(2)) print(extendList(3,[])) I do not blame them. This sort of behavior is error-prone. You can make sure that you do not use such a code in production with code reviews but it would be also…
The answer is:
[1]
[1, 1]
[1, 1, 2]
[3]
It relies on knowing something about how python applies default arguments.
I’ve only written about a hundred lines of python in my life, so possibly I just got lucky - still, I would have thought an actual Python programmer should get this?
Re: SICP in Python
#68It made me so sad when I found out CS61A was being taught in Python. I love Python, but I also know that I would have missed out on so much wonderful information if I hadn't learned Scheme. It was truly mind blowing when they had us implement a Scheme interpreter in Scheme, and then add infix operators. I think the original SICP was perfect for an intro course. It was also the great leveler, because even if you enter…
Thank you for explaining why you think Scheme is a better langauge for SICP than Python. As a fan of Python, my reaction to seeing this course was: "oh cool, a course on interesting things in a language I'm comfortable with". I was then somewhat discombobulated to see the Python bashing in the comments.
Re: SICP in Python
#69Re: SICP in Python
#70Earlier quoted context omitted.
SICP is about deeply understanding computation. Scheme is a good language for SICP because it's simple. You can build a Scheme interpreter as a class project. You can analyze it formally. Etc. Python is a good language because it's readable and writeable. But it doesn't work for SICP since it's too complex for that. Python also intentionally omits things critical to SICP (like tail recursion). Calling this book "SICP…
Except that 90% of Python programmers fail to answer simple questions like: Given: def extendList(val, list=[]): list.append(val) return list What do the following print: print(extendList(1)) print(extendList(1)) print(extendList(2)) print(extendList(3,[])) I do not blame them. This sort of behavior is error-prone. You can make sure that you do not use such a code in production with code reviews but it would be also…