(define funcname
(lambda (arg1 ... argn)
exp1 ... expn))
(define (funcname arg1 ... argn)
exp1 ... expn)
举例:
#lang racket (define (addx x) (lambda (y) (+ y x))) (define addx8 (addx 8)) (define addx9 (addx 9)) (addx8 100) (addx9 100) (define addy (lambda (x) (lambda (y) (+ y x)))) (define addy8 (addy 8)) (define addy9 (addy 9)) (addy8 100) (addy9 100) (define (fun x y) (+ x y)) (fun 3 9) (define funa (lambda (x y) (+ x y) )) (funa 3 9)
结果:
108 109 108 109 12 12 >