Problems | |
Easy |
Write a procedure called has-duplicates? which takes a sentence and returns true if and only if the sentence contains a repeated word > (has-duplicates? '(here there and everywhere)) |
Hard |
Create a function called at-least? whcihs takes a number, a function, and a list and returns #t if at least that number of elements in the list make the function true and #f otherwise. Write one answer using HOFs and the other using recursion. > (at-least? 4 even? '(1 2 2 2 3 5 7 9 11 12 13 14)) |
Write deeper-count which take a predicate and a sentence and counts only the letters in each word that make the predicate return true. NO RECURSION use HOFs! (there's a nice solution using accumulate) > (deeper-count number? '(a g00d 5p3ll3r)) |
|
Harder |
Write a procedure make-non-functional that takes a function of two arguments f and returns a procedure that acts like f half the time and returns a false value the other half of the time *HINT* (rand 2) returns a value 0 or 1. > (define (minus x y) (- x y)) |