•过程表达式
语法: (lambda <formals> <body>)
语法中<formals>需要满足以下描述的正规参数列表, <body>是一个或多个表达式序列。
guile> (lambda (x) (+ x x))
#<procedure #f (x)>
guile> ((lambda (x) (+ x x)) 4)
8
guile> (define reverse-subtract
(lambda (x y) (- y x)))
guile> (reverse-subtract 7 10)
3
guile> (define add4
(let ((x 4))
(lambda (y) (+ x y))))
guile> (add4 6)
10
<formals>需要满足以下形式:
(<variable1> ...)
<variable>
(<variable1> ... <variablen> . <variablen+1>)
guile> ((lambda (x y . z) z)
3 4 5 6)
(5 6)
guile> ((lambda x x) 3 4 5 6)
(3 4 5 6)
> (define (fx1 x) (display x))
> (fx1 "this is input")
this is input$14 = "this is input"
> (define fx2 (lambda (x) (display x)))
> (fx2 "this is input")
this is input$16 = "this is input"
> (define-method (fx3 x) (display x))
> (fx3 "this is input")
this is input$18 = "this is input"