(rontolisp) docs
← (scheme case-lambda)

case-lambda

(case-lambda (formals body...)...)

Answers a procedure. A call takes the first clause whose formals accept the number of arguments -- (x y) exactly two, (x . rest) one or more, args any number -- binds them as a lambda with those formals would, and evaluates its body. Each body may begin with definitions. A procedure defined by case-lambda that calls itself in tail position runs in constant space, as one defined by lambda does.

Deviations:

  • A call no clause accepts raises an error object whose message is wrong number of arguments to case-lambda: followed by the arguments; Gauche spells it case lambda.
  • eval refuses case-lambda by name.