Cool! I was in the process of reading the JavaScript version. Converting the book to various languages will help spread the concepts in this book to a larger audience.
CS61A: The Structure and Interpretation of Computer Programs
21–30 of 39 posts
Re: CS61A: The Structure and Interpretation of Computer Programs
#22Cool! I was in the process of reading the JavaScript version. Converting the book to various languages will help spread the concepts in this book to a larger audience.
Oh wow! I didn't know js version existed! I'll go check it out.
That's the JS version's page. Click "Open Access" to get to the online version.
Re: CS61A: The Structure and Interpretation of Computer Programs
#23Earlier quoted context omitted.
"...if you need more than 3 levels of indentation, you're screwed anyway, and should fix your program."
I think he's probably right for C. Unfortunately for TS/JS it's not just idiomatic it's downright unavoidable to have at least twice that number of { } levels.
Re: CS61A: The Structure and Interpretation of Computer Programs
#24Earlier quoted context omitted.
In general, I would suggest that conversions to non-LISP languages (and that includes things like Ruby because people say "Ruby is my favorite LISP") makes pedagogical goals of teaching the theory difficult. When I took my intro class in college, it was taught in Pascal. I had already been programming pascal (as taught by a chemist) in high school for a year or so. The first assignment which was Hello World I didn't…
Yeah that's exactly why (I imagine) the first course in programming I was taught at University was Haskell. All of us who had been programming since age 8 had to reset our brains. A fantastic strategy for a curriculum if you ask me. Lisp/Scheme/Clojure I'm sure are elegant and great for the same reasons as Haskell. They have unique traits that work well for teaching CS concepts. I have one single issue: the syntax. I…
(defn pi
([] (float (* 4 (pi 1 0.01 0 true))))
([term tol accum pn]
(let
[t (/ 1 term)
a ((if pn + -) accum t)]
(if (
While I won't claim that that is beautiful Clojure, the `((if pn + -) accum t)` part was a lightbulb moment for me about how LISP and functional programming really worked.With Java 8 (and beyond) I've become comfortable with passing around functions themselves or creating a Map or having an enum with a function field.
if (type == enum.FOO) {
UnaryOperator trim = s -> s.replaceFirst("^0+", "");
idFun = trim.compose(DTO::getFooNum);
} else {
idFun = DTO::getBarNum;
}
// ...
Set ids = results.stream().map(idFun).collect(Collectors.toSet());
As to LISP-ish concepts with {} syntax... https://en.wikipedia.org/wiki/Schwartzian_transform @sorted = map { $_->[0] }
sort { $a->[1] $b->[1]}
map { [$_, -s $_] } # get the size of the file on disk
@files;Re: CS61A: The Structure and Interpretation of Computer Programs
#25Anyone have experience reading both LISP and Python version of SICP? Does the Python version as good as LISP version?
I suppose using python might make it easier for some people to translate what they learned in class into their work, at least if that is in python.
Python has gobs of libraries so it’s easier to write complex programs that can benefit from that than it is to try the same in lisp.
Re: CS61A: The Structure and Interpretation of Computer Programs
#26I couldn't make head or tails of that link but the textbook his here: https://inst.eecs.berkeley.edu/~cs61a/sp12/book/index.html Looks awesome but I still wish there was a completed clojure version.
http://composingprograms.com/ <- This is the current textbook they use for the course (per the Summer 2023 course site).
Re: CS61A: The Structure and Interpretation of Computer Programs
#27Earlier quoted context omitted.
http://composingprograms.com/ <- This is the current textbook they use for the course (per the Summer 2023 course site).
yes. but that's the python book.
(The title of the submission seems to have changed, earlier it mentioned both Scheme and Python.)
Re: CS61A: The Structure and Interpretation of Computer Programs
#28Anyone have experience reading both LISP and Python version of SICP? Does the Python version as good as LISP version?
And then you mix that with Larry Wall's famous quote: "Computer languages differ not so much in what they make possible, but in what they make easy."
So you mix these two references together and you get the idea that maybe Lisp and Scheme and ML make functional programming easy. Python, on the other hand, makes it easy to avoid the key feature of Lisp: separating concerns and managing complexity.
This doesn't mean Python is a bad language, and it doesn't mean you can't use python to craft programs in a functional style. But it's A LOT easier in Python for an inexperienced programmer to do things that Lisp and Scheme are trying to force you to avoid (by exposing unnecessary state to a function, conflating concerns and avoiding abstractions for manipulating complexity.)
I think this is why Scheme was originally chosen for SICP over contemporary languages like C or Modula-{2|3} or Bliss. It's simultaneously good for CS pedagogy and a small team can build decent, extendible, testable and debuggable programs with it.
Re: CS61A: The Structure and Interpretation of Computer Programs
#29Are there "conversions" for other languages as well? I know it's almost required reading for any software developer worth their salt, but I have several failed starts with the original version and have sworn to never have to read Lisp code. I get the gist. I get that Lisp elegantly represents the close tie between data and programs in a way that procedural programs never will, which is probably why it is chosen for t…
Re: CS61A: The Structure and Interpretation of Computer Programs
#30Earlier quoted context omitted.
yes. but that's the python book.
There are three books involved, two of them are Python. The original SICP, the CS61A Python version of SICP (top poster in this thread linked to it, no longer in use), and the current version of the text (also Python) that I linked. (The title of the submission seems to have changed, earlier it mentioned both Scheme and Python.)
I think most people would look at that corpus and say "that's a Python text."