(define (find-best f p) (if (null? (cdr p)) (car p) (pick-best f (car p) (find-best f (cdr p))))) (define (pick-best f a b) (if (f a b) a b))How can we define find-best-hand using find-bestiest?
Define a procedure list-map that takes two inputs, a procedure and a list and produces as output a list whose elements are the results of applying the input procedure to each element in the input list.
What do each of these expressions mean:
(define (mystery-one p) (list-map (lambda (x) (if (< x 0) (- x) x))) p)) (define (mystery-two p) (list-map list-sum p)) (define (mystery-three p) (list-map (lambda (q) (list-map (lambda (n) (odd? n)) q)) p))Could you use list-map to count the number of odd numbers in a list?
Could you use list-map to produce a list that is the input list with all the odd numbers removed? (e.g., input: (1 2 3 4), output: (2 4)).