(chibi generic)

Simple generic function interface.

(define-generic name)

Define a new generic function named name.

(define-method (name params ...) body ...)

Each parameter should be either a single identifier or a list of the form (param type) where param is the parameter name and type is a predicate which returns true if it's argument is of the correct type. Parameters without a predicate will always match. If multiple methods satisfy the arguments, the most recent method will be used. The special form (call-next-method) can be invoked to call the next most recent method with the same arguments.

(make-generic name)

Create a new first-class generic function named name.

(generic-add! g preds f)

Extend the generic g with a new method f that applies when all parameters match the given list of predicates preds.