]> gitweb.factorcode.org Git - factor.git/blob - core/generic/standard/standard-docs.factor
33da0037b375db9dc9915ec05a62d58f2cc8f2de
[factor.git] / core / generic / standard / standard-docs.factor
1 USING: generic generic.single help.markup help.syntax sequences math
2 math.parser effects ;
3 IN: generic.standard
4
5 HELP: standard-combination
6 { $class-description
7     "Performs standard method combination."
8     $nl
9     "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."
10 }
11 { $examples
12     "A generic word for append strings and characters to a sequence, dispatching on the object underneath the top of the stack:"
13     { $code
14         "GENERIC# build-string 1 ( elt str -- )"
15         "M: string build-string swap push-all ;"
16         "M: integer build-string push ;"
17     }
18 } ;
19
20 HELP: define-simple-generic
21 { $values { "word" "a word" } { "effect" effect } }
22 { $description "Defines a generic word with the " { $link standard-combination } " method combination and a dispatch position of 0." } ;