Play audio slide show -- Keyboard shortcut: 'x'  Lecture overview -- Keyboard shortcut: 'u'  Previous page: Higher-order functions -- Keyboard shortcut: 'p'  Next page: Linear search in lists -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Alphabetic index  Help page about these notes  Course home      Higher-order Functions - slide 3 : 34

Some simple and general higher-order functions
(define (flip f)
  (lambda (x y)
    (f y x)))
flip-alternative.scm
An alternative formulation of flip without use of the sugared define syntax.
(define (negate p)
  (lambda (x) 
    (if (p x) #f #t)))
(define (compose f g)
  (lambda (x)
    (f (g x))))
 

Go to exercise
Using flip, negate, and compose