(index ("define-generic" 0) ("define-type" 574))
(def (sig (syntax "(define-generic (NAME ARGUMENT ...) BODY ...)" (id define-generic))) (p "Defines a generic function with the given name, specialized to argument-types as described by " (tt "ARGUMENT ...") ". " (tt "ARGUMENT") " should be either a symbol or a list of the form " (tt "(TYPE SYMBOL)") " where a symbol is equivalent to " (tt "(any SYMBOL)") ".") (p "Calls to " (tt "NAME") " textually following this generic definition will be dispatched to the first registered generic with this name that matches the types of the arguments given in the procedure call."))
(def (sig (syntax "(define-type TYPENAME PREDICATE [BASETYPE])" (id define-type))) (p "Defines a named type for objects that satisfy " (tt "PREDICATE") " (a procedure of one argument that returns either true or false). If " (tt "BASETYPE") " is given, it designates the parent type of " (tt "TYPENAME") ". Thus types may form a hierarchy. If " (tt "BASETYPE") " is not given, " (tt "any") " is assumed.") (p "The predicate should be referentially transparent and not cause any side- effects."))
