5 ms·
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
by montebicyclelo 6y ago
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.
- 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
- woofie11 6y agoSICP 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 in Python" would be like taking your favorite poem, releasing it into a different language, and finding that the translators wrote a completely different book, with a different theme, to make it rhyme and the rhythm hold. Just something different with the same name.
- wolfgke 6y ago> Python is a good language because it's readable and writeable. https://github.com/satwikkansal/wtfpython https://github.com/satwikkansal/wtfpython
- deleted 6y ago[deleted]
- theamk 6y agoYep, python is probably one of the most human-readable and writable languages out there. There are some dark corners, like the site above illustrates, but it is pretty easy to avoid them. (It is still not the good fit for SICP, but that’s a different conversation)
- kazinator 6y agoYou can only avoid dark corners as a writer. As a reader, you may have to peer into dark corners. Most of the issues given on the linked-to page are not simple issues of readability; they are real pitfalls. A lot of the examples are actually readable. You will not easily avoid every single one of those pitfalls if you're coding in Python, even if you lint the code.
- kazinator 6y agoPython contains semantic cluster-fumbles. For instance: def fun(listarg = []) listlocal = [] listarg.append(3) listlocal.append(3) It turns out listarg is bound to a list which is not freshly instantiated each time the function is called (with no corresponding argument), unlike listlocal. The expression is evaluated at the time the function is defined, not at call time. The value is stashed somewhere and that value is used for initializing listarg by default. I learned about this from ... running pylint3 on some code which found a buggy use of such a list. This is probably that way for performance because Python doesn't have true literals. [1] is more like (list 1) in Lisp; it's a constructor that has to be executed, producing a newly allocated object; it is not like '(1) which is just a literal object that can be embedded into the compiled program image. Python literature incorrectly refers to [] as a literal, which is bad education: a disservice to newbies who deserve to understand what is a literal. The fact that you can do "x = []" and then safely append to to it proves that it's not a literal, because literal is an abbreviation of "literal constant", which is also something newbies should be taught. Students of CS must absolutely learn the crucial difference between variable initialization and assignment. Python conflates the two. x = 42 def fun(): x = 43 # defines and binds local x. This was not even fixed in Python for a long time; now you can assign to the global one with a global statement. The concept is bad here and damaging to newbie brains.
- technion 6y agoThis relates heavily to the "what language should be taught in schools" argument. I usually answer "Java". And it's not even that I particularly like Java, it's just that the discussion often neglects that the course involved is all about classes, getters and setters, inheritance and so on. It's nonsense to shoehorn this into many other languages.
- ken 6y agoBut why is the course “all about classes, getters and setters, inheritance and so on”? It sounds like a Java class before the language is even chosen. No wonder the best choice ends up being Java. When I took CS in school, these were not the central themes. On the last day of class the teacher showed us a short program in this funky new language called “Java” and we all had a good laugh at how it tried to make everything about objects, even where it made no sense. Even if you’re only trying to teach object-oriented programming, I can think of better languages.
- dagw 6y agoI think it really depends on if you're teaching CS or programming. If I was designing a CS curriculum I would almost certainly start with something like Haskell, Lisp or Scheme. If I was designing a programming curriculum I would almost certainly start with Java, C# or Python. At the end of the day your average programming job at your average company is “all about classes, getters and setters, inheritance and so on”, and if you want to prepare students for that, you should probably focus on that.
- wegs 6y agoDijkstra once said: "It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration." I find much the same to often be true for many Java programmers. Programmers who start out with a course all about classes, getters and setters, inheritance and so on often end up with their minds wedged such that they never learn to program properly. Java has one way to do everything. That's reasonable if you're running a large IT department and want programmers to be interchangeable between projects. That's a horrible way to have people understand the richness of computation. You want new students to learn at least two ways to do abstraction and to structure code, and ideally, to learn many. Then, if they do Java for a random bank or something, they'll see where Java is on the spectrum. If you start with Java, you end with a closed mind.
- froh 6y agoTIL: discombobulate verb [ T ] UK /ˌdɪs.kəmˈbɒb.jə.leɪt/ US /ˌdɪs.kəmˈbɑː.bjə.leɪt/ informal mainly humorous to confuse someone or make someone feel uncomfortable
- dig1 6y agoTBH, magic sauce of SICP is Scheme. Even if is using languages other than python (common lisp, go, rust), it will simply miss the point. Idea is that you start with minimal (abstract) language constructs, progress through various problems expanding language on top of those minimal constructs and finalize everything building minimal language on top of that language. You basically metacirulate. Python (go, rust...) aren't minimal, nor abstract enough to achieve above. For example, most of the SICP problems can be nicely solved in python, but if you are going to add evaluator, you'll need to pull parser/ast modules, which are story on it's own.
- deleted 6y ago[deleted]