factor/core/generic/standard/standard-docs.factor

22 lines
1.0 KiB
Factor
Raw Normal View History

2009-04-24 21:43:01 -04:00
USING: generic generic.single help.markup help.syntax sequences math
math.parser effects ;
2008-03-11 20:51:58 -04:00
IN: generic.standard
2007-09-20 18:09:08 -04:00
HELP: standard-combination
{ $class-description
"Performs standard method combination."
$nl
2008-04-04 01:33:06 -04:00
"Generic words using the standard method combination dispatch on the class of the object at the given stack position, where 0 is the top of the stack, 1 is the object underneath, and 2 is the next one under that. A " { $link no-method } " error is thrown if no suitable method is defined on the class."
2007-09-20 18:09:08 -04:00
}
{ $examples
"A generic word for append strings and characters to a sequence, dispatching on the object underneath the top of the stack:"
{ $code
2008-11-10 03:43:16 -05:00
"GENERIC# build-string 1 ( elt str -- )"
2007-09-20 18:09:08 -04:00
"M: string build-string swap push-all ;"
"M: integer build-string push ;"
}
} ;
HELP: define-simple-generic
{ $values { "word" "a word" } { "effect" effect } }
2009-04-24 21:43:01 -04:00
{ $description "Defines a generic word with the " { $link standard-combination } " method combination and a dispatch position of 0." } ;