27 ms·
SICP in Python
- rahimnathwani 6y agoPrevious discussion of the book: https://news.ycombinator.com/item?id=3718364 https://news.ycombinator.com/item?id=3718364 And the course: https://news.ycombinator.com/item?id=3491142 https://news.ycombinator.com/item?id=3491142
- qpax 6y ago"Processing Recursive Lists" is a good example of how Python is abused for all sorts of things. If this is actually taught, I'm no longer surprised by the code that I encounter in the wild.
- BiteCode_dev 6y agoI 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 this is what you want. I don't get the stellar reputation of this text, maybe it was great when it was written for Scheme, but as-is, I can't see most of my students even finding the motivation to reading it.
- ylyn 6y agoSICP 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.
- hhmc 6y agoIt could probably work in an ML variant like SML.
- noah_buddy 6y agoTo disagree with you, I took the Python version of UCB's CS61A and I learned quite a lot (especially coming from a non-programming background). Perhaps other forms of SICP are better, but CS61A was a really enjoyable course overall and was part of the reason I decided to switch majors to Computer Science.
- asicsp 6y agoI'm so used to syntax highlighting that it feels odd to try to read code without highlighthing A bit off-topic, now that legacy.gitbook.com will be read-only from next month, anyone else just giving up on the platform? I used it mainly to allow readers to easily get pdf/epub versions and as far as I know, that won't be possible with new gitbook site.
- gumby 6y agoBy the way that is one of reasons for using scheme -- there's hardly any syntax, and definitely none of the confusing distinction between statements and expressions. There's not much value to syntax highlighting in such an environment. Remember: when the course was introduced (ca 1981) few of the freshman had ever used a computer before they arrived at MIT. The first lecture included an second on "how to program in scheme" and after that it was assumed you could do all the assignments. This book has to include a much more complex (and I would imagine to the new programmer, daunting) introduction to dealing with Python. I feel like the scheme version was a more nuts and bolts class full of practical information while this Python version feels less practical. But that could be a bias on my part. There are good reasons to switch the instruction to Python (the libraries, mainly) but in exchange something is lost. Engineering is all about dealing with such tradeoffs :-).
- Y_Y 6y agoManual of Ice-Fishing rewritten for desert nomads.
- nikofeyn 6y agoin the software world, one can avoid the monster that is c++ rather successfully, but it's gotten to the point that no matter what, python is thrust upon you to deal with. "hey here's this thing that is barely working" (in large part because it's written in python) "and we'd like you to maintain it but not switch from python" (because anything besides python makes us uncomfortable). meanwhile, python makes me uncomfortable and is such an unprincipled language, it feels like it fights you every step of the way to write error-free code.
- Y_Y 6y agoI have my misgivings about Python and C++ too, but when writing them for my job I think how much worse things could be. I could have a job that didn't involve coding, or no job, or even something involving Java.
- nikofeyn 6y agoi personally can't get past it. i've hated every second of developing in python in my jobs, and i just sit there wondering how nice it would be if i could move off of it, especially when debugging and finding yet another inane design decision in python or something that doesn't work. there's never been a reason to use it other than that's what someone unfamiliar with better choices chose for the project, and there's typically a very objective multiplier in risk and time in the development by sticking with python. moving to clojure, racket, f#, elixir, etc. would almost always be a better choice aside from certain uses of python-specific libraries (like for machine learning).
- randomsearch 6y agoThe 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?
- cutler 6y agoNext it will be SICP for Java. Is nothing sacred?
- wolfgke 6y agoConcerning "sacred": https://kingjamesprogramming.tumblr.com/ https://kingjamesprogramming.tumblr.com/
- haolez 6y ago"Investigate the shell’s here documents and Python’s triple-quote construct to find out the Almighty unto perfection" Now I won't sleep tonight.
- Sorrop 6y agoThis almost made me fell off my chair. 5:5 And, behold, I will deliver you up to the programmer tendency to build overelaborate castles of abstractions
- JoeAltmaier 6y agoOne person's overelaborate is another's perfection. Behold! The abstraction in ethereal splendor makes mundane human existence bearable!
- parenthesis 6y agoI thought kingjames was going to refer to James Gosling.
- nikofeyn 6y agoi think this is rather dishonest to call this "SICP in Python" and the same goes for the title of this post. this is not SICP and is not simply a port of the code found in SICP to python with the text unchanged. it's simply a book that seems inspired by SICP but the introduction doesn't go into any detail other than saying it's "derived from" SICP. this is misleading to people who aren't familiar with SICP and think this book is it but just for python.
- jholman 6y agoAgreed. Just a casual browse of the TOC will point out that even at the coarsest-grained level, only 40-60% of the book follows the SICP lesson plan.
- yarinr 6y agoThe current version is here https://composingprograms.com/ https://composingprograms.com/ Under the name Composing Programs. It is the textbook for CS61A.
- pdamoc 6y ago"Do not seek to follow in the footsteps of the wise; seek what they sought." - Basho One of the reasons that the wizards stopped teaching SICP was the fact that the world changed. Back in the 80s, most programming was done from first principles, since the middle of the 90s it switched to programming against an API. While learning to program from first principles is still amazingly useful, it is not what beginners need because most of them will never end up programming like that.
- jakear 6y agoActually Sussman teaches it to this day (or at least to a couple years ago). I found it one of the most enlightening classes I took.
- randomsearch 6y agoI’m not so sure. SICP gives a deep understanding of programming principles like abstraction. I agree that gluing APIs is essentially what modern programming has become, but it is helpful to have that extra understanding, especially in the long term. We don’t know how programming will look in 2050, but abstraction will remain abstraction, and I wouldn’t bet against Lisp being more popular then than it is now.
- jarcane 6y agoIndeed. APIs do not just appear from the void, someone has to write them for anyone to have an API to glue together. Somewhere at the bottom, fundamental code is always present.
- cc9one 6y agoWhat is an alternative resource that would be applicable to programming against an API?
- pcr0 6y agoThis would fall on the opposite end of the first principles vs practical knowledge continuum of learning. https://automatetheboringstuff.com/ https://automatetheboringstuff.com/
- anon767 6y agoThats great! However does someone know if there is still someone working on http://www.sicpdistilled.com/ http://www.sicpdistilled.com/ ?
- sesm 6y agohttps://github.com/SICPDistilled/website https://github.com/SICPDistilled/website - last commit 2 years ago. But I'm sure contributions are still welcome.
- dang 6y agoRelated from 2012: https://news.ycombinator.com/item?id=3141996 https://news.ycombinator.com/item?id=3141996 2011: https://news.ycombinator.com/item?id=3141996 https://news.ycombinator.com/item?id=3141996 Plus ça change.
- jedberg 6y agoIt 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 entered college with programming experience, almost no one knew Scheme. So you were all on equal footing when it came to the language.
- montebicyclelo 6y agoThank 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.
- jedberg 6y agoIf you're looking to learn cool stuff, I highly recommending finding a copy of the original SICP in Scheme and working through it. It will expand your mind to new ideas.
- cellularmitosis 6y agoI was going to drop a link to my favorite pdf version (with improved typesetting and graphics), but sadly the download link appears broken :( https://github.com/sarabander/sicp-pdf https://github.com/sarabander/sicp-pdf The web version appears to work though: http://sarabander.github.io/sicp/html/index.xhtml http://sarabander.github.io/sicp/html/index.xhtml
- nbap 6y agoYeah it is broken on the master branch but if you change to this one the pdf file is fine: https://github.com/sarabander/sicp-pdf/tree/print https://github.com/sarabander/sicp-pdf/tree/print
- fireattack 6y agoLinks in each chapter's TOC don't work.
- crysis2917 6y agoUp next: Sicp JAVASCRIPT
- wolfgke 6y agoThis already exists: https://sicp.comp.nus.edu.sg/ https://sicp.comp.nus.edu.sg/ Announcement on Reddit: https://www.reddit.com/r/scheme/comments/ea1f8w/sicp_js_going_public/ https://www.reddit.com/r/scheme/comments/ea1f8w/sicp_js_goin...
- ngcc_hk 6y agoGuess JS a better language for this purpose.
- deleted 6y ago[deleted]
- neilv 6y agoNeat. The more, the merrier. If 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/ https://docs.racket-lang.org/sicp-manual/
- Err_Eek 6y agoI have been using #lang sicp in Racket to go through (most of) SICP -- and it's been mostly a smooth ride. DrRacket can get very slow on Linux, so eventually I switched back to vim+terminal once exercises started to require larger amounts of code.
- hf 6y agoIf 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 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 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 shell? I wonder ...)
- neilv 6y ago> The pdf starts out with a curious little 'texinfo foreword'. Being able to type `info sicp` in one's shell? Yes, mostly in Emacs, but you could also do it in your shell. :) https://www.neilvandyke.org/sicp-texi/ https://www.neilvandyke.org/sicp-texi/ The Texinfo format happened a couple years ago, in the early days of the Web, and let people on modest computers who couldn't run a Web browser work through SICP on their screens (no need for expense of printing to paper) while they also ran a Scheme interpreter on the same modest computer. The work was done by Lytha Ayth from the original freely-available HTML version of the book. Later on, and now that everyone has more powerful computers, I've heard someone took the Texinfo source code, and replaced the ASCII-art illustrations with real ones, and ran it through TeX, such as for printing or PDF of "camera ready" format that looked similar to the original print book from MIT Press. I wasn't involved in that much more recent TeX work, and though it was kind of them to preserve the version number with my name in it, I'll ask them to please remove it. (The name was part of some kind of distributed version-tracking scheme that Lytha Ayth proposed, when this seemed to be in the spirit of the original HTML release of the book. I tried to follow versioning instructions when I made changes to the Texinfo source, not knowing my name would show up 20 years later in a very different thing. :)
- hf 6y ago[Late reply -- forgot to hit the button. ;] Thank you for the pointer and, more so, your contributions. That screenshot of SICP in Emacs -- running side-by-side with the built-in Guile interpreter -- induces peculiar sensations. An echo of how things could've been and possibly still are in some obscure(d) corners of the Net. An interactive learning environment that at least points in the right direction. It certainly looks elegant and somewhat inspirational to me (though my inner Alan Kay is voicing some profound objections ;). In any case: you carried that torch for a while, don't be hesitant accepting apparently undue credit -- there's too little, in any case, to warrant worry. ;)
- nromiun 6y agoPeople say SICP is bigger then Scheme and then get outraged when someone implements it in another language.
- rfrey 6y agoBeethoven is bigger than "piano". Also, there is very little outrage in this thread - some sadness, some resignation, some head shaking sure, but not outrage.
- greenshackle2 6y agoIt doesn't have to be Scheme but I'm skeptical you can do full justice to the metaprogramming parts of SICP if you're not using a homoiconic language. Unsurprisingly, "SICP in Python" reverts to a Lisp dialect for those parts of the book.
- analog31 6y agoI don't want to sound snarky, but... is this really it? I haven't looked through SICP itself, and have no formal CS background, but it always seemed like SICP was treated like a forbidding rite of passage. The Python version, if it's faithful to the original, seems pretty lightweight.
- wegs 6y agoSICP is an designed as a freshman course, and it was designed at a time when many students had never programmed before. It's worth looking at and trying. It's an intense course, but it's beautiful, elegant, and you get a lot out of it. I wouldn't call it a forbidding rite of passage by any stretch, though. Given a bit of time and perseverance, anyone can do it, and come out smarter on the other end.
- analog31 6y agoThanks. I can certainly appreciate that aspect, and reading it is on my bucket list. I think I'll still read the old version.
- wegs 6y agoNah. You'll definitely want the new version. I'm not exactly sure what changes were made between the 1st edition and the new 2nd edition, but the 2nd edition is canonical. The text is online: https://mitpress.mit.edu/sites/default/files/sicp/index.html https://mitpress.mit.edu/sites/default/files/sicp/index.html Virtually all Scheme interpreters support it: https://docs.racket-lang.org/sicp-manual/index.html https://docs.racket-lang.org/sicp-manual/index.html https://www.gnu.org/software/mit-scheme/ https://www.gnu.org/software/mit-scheme/ Assignments and video lectures are on-line: https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-001-structure-and-interpretation-of-computer-programs-spring-2005/ https://ocw.mit.edu/courses/electrical-engineering-and-compu... And so on. There's an ecosystem around it. I think the only reason to go with the old version is for historical interest.
- 6y ago
- gl3nnleblanc 6y agoAs someone who has taken this iteration of the course and read most of the original SICP, I actually think this new CS61A does a really good job of covering the same material as the original SICP while introducing beginners to a useful rather than esoteric language. The capstone project is still writing a scheme interpreter, just in Python. We still do actually write some code in Scheme, just in the later portion of the class.
- reminddit 6y agoOther languages are not as flexible as lisp according to pg. When you get to macros, you might run into limitations with python.
- jxy 6y agoI prefer the scheme version, though the addition of 'distributed and parallel computing' chapter is really important and I welcome such new additions. Unfortunately 'distributed and parallel computing' is no where to be seen in R*RS. I hope we can change that soon.
- basucoder 6y agoI read interview of Hal Abelson, in that interview he explains the reason behind moving away from scheme to python to teach concepts of SICP. 1. The purpose of course it self has changed, the current course 6.01 in MIT attempts to introduce grads to breadth of the software engineering rather than depths of software engineering. 6.001 course was for the later purpose. 2. He says entire debate is superficial as both the course have different purpose. It's a lengthy interview. http://www.gigamonkeys.com/code-quarterly/2011/hal-abelson/ http://www.gigamonkeys.com/code-quarterly/2011/hal-abelson/
- basucoder 6y agohttps://www.wisdomandwonder.com/link/2110/why-mit-switched-from-scheme-to-python https://www.wisdomandwonder.com/link/2110/why-mit-switched-f...