Scheme - sum the squares of even-valued elements in a list
问题 I want to be able to sum the squares of the even elements in the list, however my current code only sums the elements, not the squares. Does anyone know of any modifications that can be made to make this to sum the squares of the even-valued elements in the list? (define (sum elemList) (if (null? elemList) 0 (+ (car elemList) (sum (cdr elemList))) ) ) My input would be: (sum-evens (list 1 2 3 4)) Output would be: 20 Which is (2*2) + (4*4) . If possible, it would be good to see both a