GENERIC#
Factor documentation > Factor handbook > The language > Objects > Generic words and methods
Prev:GENERIC:
Next:HOOK:


Vocabulary
syntax

Syntax
GENERIC# word n ( stack -- effect )


Inputs and outputs
worda new word to define
nthe stack position to dispatch on


Word description
Defines a new generic word which dispatches on the nth most element from the top of the stack in the current vocabulary. Initially, it contains no methods, and thus will throw a no-method error when called.

Notes
The following two definitions are equivalent:
GENERIC: foo ( obj -- )

GENERIC# foo 0 ( obj -- )


See also
generic, define-generic, define-simple-generic, GENERIC:, MATH:, HOOK:

Definition
USING: generic.parser generic.standard parser ;

IN: syntax

SYNTAX: GENERIC#
[ scan-number <standard-combination> ] (GENERIC:) ;