(define (curry f n) (if (zero? n) (f) (lambda args (curry (lambda rest (apply f (append args rest))) (- n (length args))))))