BORING QUIZ.
Do each of these problems using a higher-order function.
1. Write a function 2+ that takes a sentence of numbers as its inputs and returns a sentence of all those numbers added by 2.
You may find the following helper function definition useful: (define (add-2 x) (+ 2 x))
> (2+ '(1 2 3 4 5)) (3 4 5 6 7)
2. Write a function vowels-only that takes a word as its input and returns only the vowels from that word.
You may find the following helper function definition useful:
(define (vowel? x) (member? x 'aeiou))
Here is how vowels-only should work:
> (vowels-only 'abcdefghijk) aei
3. Write a function smallest-number that takes a sentence as its input and returns the smallest number in the sentence. (Hint: There is an example that works in a similar way on page 108.)
> (smallest-number '(6 3 19 1 4 8)) 1
4. Write a function shift-right that takes a number and a word and does bf to the word number times.
> (shift-right 4 'cow-mania) mania