(define (f l)
  (cond ((null? l) 0)
        (else (+ (* (car l) (car l)) (f (cdr l))))))

(f '(1 2 3))