; Chapter 8 higher order functions summary ; ; EVERY ; Inputs: a function that takes one argument and a sentence or a word ; Output: a sentence ; ; > (every square '(1 2 3 4 5)) ; (1 4 9 16 25) ; > (every square 12345) ; (1 4 9 16 25) ; ; KEEP ; Inputs: a predicate that takes one argument and a sentence or a word ; Output: a sentence or a word (depends on second input) ; ; > (keep odd? '(1 2 3 4 5)) ; (1 3 5) ; > (keep odd? 12345) ; 135 ; ; ACCUMULATE ; Inputs: a combiner function that takes TWO arguments and a sentence or a word ; Output: depends on the combiner function ; ; > (accumulate word '(f i sh head)) ; fishhead ; > (accumulate + 1234) ; 10 ; > (accumulate se 'abcd) ; (a b c d) ; ; REPEATED ; Inputs: a function that takes one argument and a number, representing the number of times to apply it ; Output: a function, which if called, will apply the input function the number of times specified ; ; > ((repeated square 3) 2) ; (square (square (square 2))) = 256 ; 256 ; > ((repeated bl 4) 'bigfoot) ; big