(define (f g x)
   (cond ((null? x) x)
         (else (cons (g (car x))
                     (f g (cdr x))))))

(f (lambda (x) (* x x x)) '(3 1 2))