如何咖喱方案中的功能列表?

How to curry list of function in scheme?

所以 compose 函数将多个函数组合在一起 假设 ((组成 sin cos tan asin) 0) 所以期望输出为 (sin (cos (tan (asin x))))

 (define (compose f . g)
    (lambda(x)
    (if(eq? (cdr g) '())
        (f ((car g) x))
    (f ((compose (car g)  (cdr g)) x))
    )
)
)
(define (compose f . rest)
    (if (null? rest)
        f
        (lambda (x) (f ((apply compose rest) x)))))

(define (foo x) (- x 30))
(define (bar x) (* x 20))
(define (baz x) (+ x 10))

((compose baz) 100)           ; 110
((compose bar baz) 100)       ; 2200
((compose foo bar baz) 100)   ; 2170