Skip to content
Evan Savage edited this page Mar 18, 2014 · 3 revisions

This week: Henderson's picture language!

Prelude

If you use racket you can try using this line at the top of your file to get the pictures:

(require (planet "sicp.ss" ("soegaard" "sicp.plt" 1 1)))

Or take a look at SO on SICP.

Conversational notes

  • Pros and cons of representing painters as procedures?
  • Closure property over operations: is that vis-a-vis HoF?
  • Fn 23 "bituminous coal"
  • Pg 179 (Ex 2.44): combinators
  • Pg 190 (Ex 2.51): stratified design [also, data abstraction vs serialized data format...]
  • Fn 29 how would you rotate an arbitrary frame by 90?

Additional Resources

Nice slides: http://cs.wellesley.edu/~cs111/notes/lectures/07_picture_world_intro.pdf -dann

Discussion

I ended up writing my own implementation of draw-line to get SVG output, which reveals bugs in my exercise code. Anyone got an eye to spare for a quick check? (If you do, note that parts marked "given" are pulled out of the book, so you theoretically don't need to look at them).

Note re: dynamic scoping for draw-line - a reasonable approach to the "dynamic scoping" problem you identified would be to rewrite the painter, segments->painter, etc. hierarchy to accept the draw-line function as a parameter. If you wanted more generality, you could take an OOP approach and pass a drawer object that accepts the message 'draw-line, which dispatches to its own draw-line implementation. (Hooray for duck typing!)

weekly recap message

Oh hi there!

Henderson's Picture Language lived up to its hype last night, yielding a delightful conversation full of functions first, second and even third order. We saw graphic images of combinatory prowess, and combined operators to produce imaginative graphics. We contemplated data abstractions, dissected the disparate layers of stratified design and railed against unfair treatment for so-called "improper" linked lists. 

For next week we'll do sections 2.3.1 and 2.3.2 -- this is about 12 pages of reading and 6 exercises, so quite a light load despite being two sections. Remember to bring your party hats, as we'll head upstairs around 7:30 to ring in the winter festival. 

Happy coding!

Nov 30

Clone this wiki locally