
Composing Programs – Python 3 in the tradition of SICP - tillulen
http://composingprograms.com/
======
sumukh1
This is the textbook used for the introductory CS course (CS61A) at Berkeley.
The course material is available at [http://cs61a.org](http://cs61a.org) (The
course uses Python 3, Scheme, and SQL). There are some neat projects (students
are working on building a Scheme interpreter now)

Previous Hacker News Discussions:

[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)

Full disclosure: I'm a TA for the course right now.

~~~
cutler
Given Python's limited lambda implementation and Guido's distaste for FP I
find it odd that Python should be chosen to teach SICP let alone replace
Scheme as a teaching language.

~~~
pmoriarty
There's a lot of pressure to teach languages that are widely used in industry,
which is why so many students come out of university knowing mostly Java.
There's also a lot of bias against "old" languages, and for newer, trendy
languages.

Teaching SICP in Python is just a further development of that trend.

Software engineering is a very trend-following, path of least resistance,
bandwagon-jumping profession. If "everyone" is using language X, that's where
most engineers (and managers) want to be. Universities are just satisfying
that need.

It's a wonder that Scheme lasted in universities as long as it did. It'll be
interesting to see how long Python lasts.

~~~
cutler
There's always Clojure. Best of both worlds, i.e. Scheme-ish with Java host.
We had a SICP Clojure group here in London last year and I think someone has
written an adaptation of SICP in Clojure. If it was any other text I'd have
nothing to say but SICP without the Scheme/Lisp doesn't make sense. If
universities choosing Python or Java as their teaching language they should
also switch to texts based on OOP.

~~~
conceit
Why doesn't it make sense without any LISP? I read only the first chapters and
found the concept of composition immediately applicable in C and as a C
programmer I would write the same way in python, probably.

------
nickysielicki
> Over Quota

Archive.org Mirror:
[http://web.archive.org/web/20160402152716/http://www.composi...](http://web.archive.org/web/20160402152716/http://www.composingprograms.com/)

------
raymondh
Overall, SICP in Python 3 is first rate. I highly recommend it to anyone
wanted to improve their sophistication with Python and programming in general.

The exercises and demonstrations in each section quickly build from an
elementary introduction up to powerful examples accompanied by clear
explanations. I especially like the explanatory diagrams.

Thank you to the authors for your craftsmanship and for making it available
on-line.

~~~
gagagababa
I was thinking of taking "Principles of Reactive Programming" by Martin
Ordesky after taking his other class "Functional Programming Principles in
Scala" on Coursera. After looking at CS 61A, I am thinking of taking it
instead. How long did it take you to complete the course? Also, as far as I
understood you can use the grader with "\--local" flag to check the
correctness of your program, is that the case?

~~~
sumukh1
> as far as I understood you can use the grader with "\--local" flag to check
> the correctness of your program, is that the case?

Yes. The autograder is provided with each assignment.

------
uptownfunk
Guys I just have to give the obligatory shout out to Prof Hilfinger. The guy
is legendary. My life has been made worthwhile to have been initiated into the
deep mystic art of CS by him.

~~~
pgbovine
i dunno, i'm on the side of Prof. DeNero (who runs this course website) in
this rap battle:

[https://www.youtube.com/watch?v=VTcWL2AfT7k](https://www.youtube.com/watch?v=VTcWL2AfT7k)

~~~
uptownfunk
No way man it's all about Hilfinger, probably the only Prof who still highly
encourages the use of emacs at Cal.

------
jxy
Berkeley CS bends to common usage, instead of holding to its own pride? Scheme
is such a simple but deep language, and is really good at introducing all the
concepts. It is aged, like a good single malt whisky. Now they try to serve
fruit punch?

~~~
thramp
I love Scheme as much as anybody else, but I’m not convinced that it should be
the first introduction to computer science that people have. I think that the
goals for an intro class is to get people to enjoy programming, not expose
them to the raw beauty of Scheme/FP. I sure as shit didn’t appreciate what
Scheme offered the first time I learned it.

~~~
jxy
The way I see it: the language rules are simple, anyone can understand all in
one sitting; yet the language gives you all the materials you need to build
different concepts in SC from scratch. The latter point is important to both
teaching and learning.

~~~
bunderbunder
> the language rules are simple

Completely agreed

> anyone can understand all in one sitting

Goodness gracious, no. At least it sure wasn't as of the last time I TA'd a
class that was taught using it (admittedly during the previous millennium). In
a typical group, approaching half the students - smart students, this was a
fairly selective school - dropped or failed. A huge chunk foundered on
figuring out how to do useful things with lists (cons/car/cdr and friends are
elegant, but they are also _weird_ ). Another huge chunk struggled with
let/let*/letrec. And closures weren't very fun for many students, either.

The one neat thing I've noticed about Scheme is that, if you get Scheme, then
you will have a very solid grasp of how to compose abstractions. I wouldn't be
too quick to infer a causal link there, though. It might be that Scheme makes
people better at CS. It could just as easily (given those failure rates,
possibly more easily) be that Scheme is a filter for identifying people who
have a pre-existing knack for the academic side of CS.

------
itsmemattchung
I'm currently self studying SICP
([https://mitpress.mit.edu/sicp/](https://mitpress.mit.edu/sicp/)) and glad
this is illustrated in Python.

~~~
topkekz
This may help
[http://paste.lisp.org/display/313070/raw](http://paste.lisp.org/display/313070/raw)

------
chris11
I was kind of hoping to see python used in the functional programming section.
I was playing around with a small project in python and decided I wanted to
re-implement a really simple context free grammar I had done in a functional
programming class. It was slightly annoying, Lisp seemed like a better choice
than python. But it looks like they use scheme.

~~~
jarcane
Python is deliberately bad at functional programming by design. Guido has
decreed it.

~~~
tomsthumb
It seems to be pretty good at map, filter, any, all, reversed, reduce, zip,
list comprehensions, dict comprehensions, lambdas, and closures.

Granted, it would be unusual to see all, or even most, of those in one place,
but they see use enough that calling python bad a functional programming is a
little odd. I'd say it's pretty good at functional work in the small while
somewhat ill suited in the large.

~~~
Walkman
It's really not good. Python is an imperative language and if you dig a
little, you can find why [0]. The reduce function has been moved to functools
module [1]. If you try to write in purely functional style in Python, you will
have a bad time.

[0]: [http://python-history.blogspot.hu/2009/04/origins-of-
pythons...](http://python-history.blogspot.hu/2009/04/origins-of-pythons-
functional-features.html)

[1]:
[https://docs.python.org/3.2/library/functools.html#functools...](https://docs.python.org/3.2/library/functools.html#functools.reduce)

~~~
GFK_of_xmaspast
Why does it matter if reduce is no longer a keyword?

~~~
cosarara97
reduce was not a keyword, it was a builtin function. So:

    
    
        reduce = 0
    

is valid. But really it doesn't matter.

------
alexkon
Has anyone read this book? What’s your experience? Would it make an
approachable introduction to programming for a complete newbie?

------
dschiptsov
Those who have mastered principles doesn't have to memorize particulars.

Nevertheless I still maintain that the classic CS61a by Prof. Brian Harvey is
a gold standard. It teaches the most important big ideas, such that _code is
data_ and hence the whole OO paradigm is mere a DSL over structured data with
named slots, with a protocol to follow (inheritance).

It teaches the superiority of declarative over imperative approach - one
defines _what_ shall be done, not how it can be done.

It also teaches lazy evaluation, so one doesn't parrot nonsense about monads
and Haskell.

It teaches what genetics are, and that everything could be defined as an ADT
with corresponding predicates (which represents mental categories we learn
from environment).

~~~
topkekz
The "classic" course is still available as cs61as

[http://www.cs61as.org/](http://www.cs61as.org/)

~~~
dschiptsov
No. The different instructor ruined it.

Mr. Harvey is a gentle intellectual with charm and that characteristic lack of
arrogance and tendencies to show off modern narcissistic personages exhibit
nowadays.

I can't stand guys like Hickey or Tellman or whoever it is.

Watch him, at least first 3 or 4 lectures.

[https://m.youtube.com/playlist?list=PL1AE464371B3398CC](https://m.youtube.com/playlist?list=PL1AE464371B3398CC)

~~~
zodiac
61as is not the same as 61a

~~~
e12e
Is this the correct link for 61a as referred to by grand parent?:
[http://wla.berkeley.edu/~cs61a/sp11/](http://wla.berkeley.edu/~cs61a/sp11/)

------
x5n1
Should have hosted it on a shared provider, it would still be online.

