因此,如果一种语言提供更高阶的程序,那么我可以有返回程序的程序.就像是:
(define (Proc a b c)
(lambda (x) ( #| method body here in terms of a b c and x |# )))
Run Code Online (Sandbox Code Playgroud)
要创建新程序,我会做类似的事情:
(define ProcA (Proc a1 b1 c1)) ; Would create ProcA that has 1 argument
Run Code Online (Sandbox Code Playgroud)
类似的任务可以用不支持高阶过程的语言来完成,方法是定义Proc4个而不是3个参数并调用这个过程来定义ProcA,如:
(define (Proc a b c x) ( #| method body -- does not return any procedure |# )
(define (ProcA x) (Proc a1 b1 c1 x))
Run Code Online (Sandbox Code Playgroud)
那么为什么有关高阶程序的模糊呢?我错过了什么吗?
scheme closures abstraction programming-languages functional-programming