University of California, Berkeley
EECS Department - Computer Science Division

CS3 Lecture 12 : Higher-Order Functions


Overview of today's lecture


Review


Higher-Order Functions (chapter 8)

Introduction

every : Do something to every word in a sentence

keep : Keep only the words you want

accumulate : Combine the words in some way

(accumulate - '(4 3 2 1))
;; ==> (- 4 (- 3 (- 2 1)))
;; ==> (- 4 (- 3 1))
;; ==> (- 4 2)
;; ==> 2

Combine higher-order functions

Choosing the right tool (mini-summary)

These are NOT the holy grail of higher-order functions!
These are just three of the ones we have in the book. We showed how to write new ones:

First-class functions and first-class sentences

repeated : A function that returns a function!


Summary

Next Time

Puzzle : I've been had!

Whereas John had had had Bill had had had had had had was corrrect

Game : Northcott's Game [Guy89]

References


WWW Maven: Dan Garcia (ddgarcia@cs.berkeley.edu) Send me feedback

Dan Garcia Berkeley Computer Science