guile> (define (foo x)
(cond ((= x 1) (lambda (y) (+ y 10)))
((= x 2) (lambda (y) (+ y 20)))
(else (lambda (y) (+ y 0)))))
guile> (foo 1)
#<procedure #f (y)>
guile> ((foo 1) 23)
33
guile> ((foo 2) 23)
43
guile> ((foo 3) 23)
23
guile> ((foo 2) 33)
53
guile>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment