<commit_before>! Copyright (C) 2009 <NAME>.
! See http://factorcode.org/license.txt for BSD license.
USING: assocs classes help.markup help.syntax kernel math
quotations strings ;
IN: combinators.tuple

HELP: 2make-tuple
{ $values
    { "x" object } { "y" object } { "class" class } { "assoc" assoc }
    { "tuple" tuple }
}
{ $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." } ;

HELP: 3make-tuple
{ $values
    { "x" object } { "y" object } { "z" object } { "class" class } { "assoc" "a list of " { $link string } "/" { $link quotation } " pairs" }
    { "tuple" tuple }
}
{ $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." } ;

HELP: make-tuple
{ $values
    { "x" object } { "class" class } { "assoc" "a list of " { $link string } "/" { $link quotation } " pairs" }
    { "tuple" tuple }
}
{ $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." }
{ $examples
    { $example
        "USING: combinators.tuple math prettyprint ;"
        "IN: scratchpad"
        "TUPLE: demo x y z ;"
        "5 demo {"
        "   { \"x\" [ 10 + ] }"
        "   { \"y\" [ 100 / ] }"
        "} make-tuple ."
        "T{ demo { x 15 } { y 1/20 } }"
    }
} ;

HELP: nmake-tuple
{ $values
    { "class" class } { "assoc" "a list of " { $link string } "/" { $link quotation } " pairs" } { "n" integer }
}
{ $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." } ;

{ make-tuple 2make-tuple 3make-tuple nmake-tuple } related-words

ARTICLE: "combinators.tuple" "Tuple-constructing combinators"
"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" } "."
{ $subsections
    make-tuple
    2make-tuple
    3make-tuple
    nmake-tuple
} ;

ABOUT: "combinators.tuple"
<commit_msg>combinators.tuples: fix docs for 1make-tuple.<commit_after>! Copyright (C) 2009 <NAME>.
! See http://factorcode.org/license.txt for BSD license.
USING: assocs classes help.markup help.syntax kernel math
quotations strings ;
IN: combinators.tuple

HELP: 1make-tuple
{ $values
    { "x" object } { "class" class } { "assoc" "a list of " { $link string } "/" { $link quotation } " pairs" }
    { "tuple" tuple }
}
{ $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." }
{ $examples
    { $example
        "USING: combinators.tuple math prettyprint ;"
        "IN: scratchpad"
        "TUPLE: demo x y z ;"
        "5 demo {"
        "   { \"x\" [ 10 + ] }"
        "   { \"y\" [ 100 / ] }"
        "} 1make-tuple ."
        "T{ demo { x 15 } { y 1/20 } }"
    }
} ;

HELP: 2make-tuple
{ $values
    { "x" object } { "y" object } { "class" class } { "assoc" assoc }
    { "tuple" tuple }
}
{ $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." } ;

HELP: 3make-tuple
{ $values
    { "x" object } { "y" object } { "z" object } { "class" class } { "assoc" "a list of " { $link string } "/" { $link quotation } " pairs" }
    { "tuple" tuple }
}
{ $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." } ;

HELP: nmake-tuple
{ $values
    { "class" class } { "assoc" "a list of " { $link string } "/" { $link quotation } " pairs" } { "n" integer }
}
{ $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." } ;

{ 1make-tuple 2make-tuple 3make-tuple nmake-tuple } related-words

ARTICLE: "combinators.tuple" "Tuple-constructing combinators"
"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" } "."
{ $subsections
    1make-tuple
    2make-tuple
    3make-tuple
    nmake-tuple
} ;

ABOUT: "combinators.tuple"

{'fraction_non_alphanumeric': 0.14575023013194233, 'fraction_numerical': 0.007210800859159251, 'mean_word_length': 3.064214463840399, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4216784', 'n_tokens_mistral': 2143, 'n_tokens_neox': 2042, 'n_words': 772}