]> gitweb.factorcode.org Git - factor.git/blob - extra/combinators/tuple/tuple-docs.factor
Update some copyright headers to follow the current convention
[factor.git] / extra / combinators / tuple / tuple-docs.factor
1 ! Copyright (C) 2009 Joe Groff.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: assocs classes help.markup help.syntax kernel math
4 quotations strings ;
5 IN: combinators.tuple
6
7 HELP: 2make-tuple
8 { $values
9     { "x" object } { "y" object } { "class" class } { "assoc" assoc }
10     { "tuple" tuple }
11 }
12 { $description "Constructs a " { $link tuple } " of " { $snippet "class" } " by calling the quotations making up the values of " { $snippet "assoc" } " on " { $snippet "x" } " and " { $snippet "y" } ", assigning the result of each call to the slot named by the corresponding key. The quotations must have the effect " { $snippet "( x y -- slot-value )" } ". The order in which the quotations are called is undefined." } ;
13
14 HELP: 3make-tuple
15 { $values
16     { "x" object } { "y" object } { "z" object } { "class" class } { "assoc" "a list of " { $link string } "/" { $link quotation } " pairs" }
17     { "tuple" tuple }
18 }
19 { $description "Constructs a " { $link tuple } " of " { $snippet "class" } " by calling the quotations making up the values of " { $snippet "assoc" } " on " { $snippet "x" } ", " { $snippet "y" } ", and " { $snippet "z" } ", assigning the result of each call to the slot named by the corresponding key. The quotations must have the effect " { $snippet "( x y z -- slot-value )" } ". The order in which the quotations are called is undefined." } ;
20
21 HELP: make-tuple
22 { $values
23     { "x" object } { "class" class } { "assoc" "a list of " { $link string } "/" { $link quotation } " pairs" }
24     { "tuple" tuple }
25 }
26 { $description "Constructs a " { $link tuple } " of " { $snippet "class" } " by calling the quotations making up the values of " { $snippet "assoc" } " on " { $snippet "x" } ", assigning the result of each call to the slot named by the corresponding key. The quotations must have the effect " { $snippet "( x -- slot-value )" } ". The order in which the quotations are called is undefined." }
27 { $examples
28     { $example
29         "USING: combinators.tuple math prettyprint ;"
30         "IN: scratchpad"
31         "TUPLE: demo x y z ;"
32         "5 demo {"
33         "   { \"x\" [ 10 + ] }"
34         "   { \"y\" [ 100 / ] }"
35         "} make-tuple ."
36         "T{ demo { x 15 } { y 1/20 } }"
37     }
38 } ;
39
40 HELP: nmake-tuple
41 { $values
42     { "class" class } { "assoc" "a list of " { $link string } "/" { $link quotation } " pairs" } { "n" integer }
43 }
44 { $description "Constructs a " { $link tuple } " of " { $snippet "class" } " by calling the quotations making up the values of " { $snippet "assoc" } " on the top " { $snippet "n" } " values on the datastack below " { $snippet "class" } ", assigning the result of each call to the slot named by the corresponding key. The order in which the quotations are called is undefined." } ;
45
46 { make-tuple 2make-tuple 3make-tuple nmake-tuple } related-words
47
48 ARTICLE: "combinators.tuple" "Tuple-constructing combinators"
49 "The " { $vocab-link "combinators.tuple" } " vocabulary provides combinators that construct " { $link tuple } " objects. These provide additional functionality above and beyond built-in " { $link "tuple-constructors" } "."
50 { $subsections
51     make-tuple
52     2make-tuple
53     3make-tuple
54     nmake-tuple
55 } ;
56
57 ABOUT: "combinators.tuple"