- (case-lambda (LAMBDA-LIST1 EXP1 ...) ...)syntax
Expands into a lambda that invokes the body following the first matching lambda-list.
(define plus (case-lambda (() 0) ((x) x) ((x y) (+ x y)) ((x y z) (+ (+ x y) z)) (args (apply + args)))) (plus) ==> 0 (plus 1) ==> 1 (plus 1 2 3) ==> 6
For more information see the documentation for SRFI-16
This special form is also compatible with the definition from the R7RS (scheme case-lambda) library.