CSE341, Winter 1997
David Notkin
Lecture #7 Notes
Announcements
- Today's Perlis epigram: "Most people find the concept
of programming obvious, but the doing impossible."
Today's Instructional Objectives
- What is functional programming style, and why do we
care about it?
Points to Make
- Close your eyes: raise your hand if you've finished the program;
raise your hand if your hopelessly confused.
- What do you find hardest about programming? (Get a bunch
of ideas, hoping that some will motivate the day's discussion.)
- Referential transparency
- Again, x:=x + 1 is
a strange animal
- So is a while loop: if the loop condition were a mathematical
expression, you'd either never execute the loop or else infinitely
loop
- Word at a time programming is limited; just because machines
are built that way, doesn't mean we have to program that way.
-Backus
- Coolness
- Terseness with clarity (not APL)
- Captures common idioms into higher-order functions
- And allows you to capture your own common idioms into higher-order
functions
- "Simplicity does not precede complexity, but follows
it." -Perlis
- Closer relationship to mathematical definitions (e.g., Example
11.1 in Ullman), reducing the potential for (some kinds of) errors
- But what is the style?