
Composing Programs in Python, SICP Style - philonoist
https://composingprograms.com/
======
sumukh1
This is the textbook used for the introductory CS course (CS61A) at UC
Berkeley. The course material is available at
[http://cs61a.org/fa18](http://cs61a.org/fa18) (The course uses Python 3,
Scheme, and SQL).

There are some neat projects (students build a Scheme interpreter and
implement game logic as part of the projects)

Previous Hacker News Discussions (from which I’ve copied my comment)

[https://news.ycombinator.com/item?id=11465234](https://news.ycombinator.com/item?id=11465234)
[https://news.ycombinator.com/item?id=3491142](https://news.ycombinator.com/item?id=3491142)
[https://news.ycombinator.com/item?id=3141996](https://news.ycombinator.com/item?id=3141996)

~~~
faizshah
Thanks for linking this, I'm currently working on designing an introductory
python course. What background are students expected to have for CS61A? Is it
expected to be students first introduction to python?

~~~
aerioux
no background needed

------
zelphirkalt
Huh, I already thought this was suspicious reading the title, as Python does
not have in-built TCO and indeed,
[https://composingprograms.com/pages/17-recursive-
functions.h...](https://composingprograms.com/pages/17-recursive-
functions.html) does not even mention Stackoverflow errors and neither does it
introduce a decorator to avoid them. Under these conditions however, it is
impossible to compose programs "SICP Style".

~~~
abecedarius
When I worked through SICP in the 80s it was with XLisp on MS-DOS. XLisp
didn't optimize tail recursion, and I had well under a megabyte, but this
turned out to be a problem only once or twice, and ad-hoc hacks were enough
then. (OTOH the system didn't have an only 1000-deep call-stack limit by
default, either.)

It's true that this'd be more of a problem for real-world work.

~~~
e12e
They introduce both a traditional factorial function and a naive Fibonacci
function - it seems likely most enterprising students will overflow the stack.

Odd that they don't (from a quick skim) seem to mention it at all? When they
do hand wave a bit around stack frames (call trees)?

~~~
abecedarius
A naive fib(n) only needs stack depth of about n -- it takes a long time but
doesn't need to go very deep.

~~~
e12e
You're right about Fibonacci - a naive fib(1000) takes a long time to
eventually overflow the stack in python. But fact(1000) quickly crashes. Which
is a shame as python has a full(?) number tower and has no problem calculating
1000!

------
divs1210
People who find this interesting might find this answer of mine on
stackoverflow interesting as well:
[https://stackoverflow.com/a/44729275/1163490](https://stackoverflow.com/a/44729275/1163490)

------
simplegeek
Great effort. I cannot find exercises? Do authors plan on adding those?

------
LukeB42
Very nice formatting for the content but it feels like it's missing three
chapters on category theory and two chapters each on the AST module and the
`compile` builtin after that last chapter on recursion.

~~~
simonh
Which parts of the course would you drop or abreviate, in order to make time
for these?

~~~
LukeB42
Very tough question.

Personally I'd lengthen the course with a Section "1.5" on the raw math topics
being dealt with (Set Theory and Category Theory) plus ones the student will
certainly bump into if they ever find themselves having to deploy MapReduce in
production...

