There's an extra (and erroneous) pair of parentheses in both?
, surrounding the if
expression. This should fix it:
(define (both? proc)
(lambda (item1 item2)
(if (and (proc item1) (proc item2))
#t
#f)))
Now your procedure works as expected:
(map2-rec + '(1 2 3) '(1 2 3 4))
=> '(2 4 6)
(map2-rec (both? even?) '(1 2 3) '(1 2 3 4))
=> '(#f #t #f)