如何实现一个以一个参数作为参数输入任意数量的过程并返回另一个函数的函数,是Scheme中这些过程的组成。
例如:
(define (f x) (* x 2))
(define (g x) (* x 3))
(define (h x) (- x))
((comp-func f g h) 1) => -6
((comp-func f g) 1) => 6
((comp-func h) 1) => -1
((comp-func) 1) => 1
Run Code Online (Sandbox Code Playgroud)