factor/library/collections/arrays.facts

33 lines
1.4 KiB
Plaintext

IN: arrays
USING: help kernel kernel-internals prettyprint strings
vectors ;
HELP: <byte-array> "( n -- byte-array )"
{ $values { "n" "a non-negative integer" } { "byte-array" "a new byte array" } }
{ $description "Creates a new byte array holding " { $snippet "n" } " cells." } ;
HELP: <array> "( n elt -- array )"
{ $values { "n" "a non-negative integer" } { "elt" "an initial element" } { "array" "a new array" } }
{ $description "Creates a new array with the given length and all elements initially set to " { $snippet "elt" } "." }
{ $see-also <quotation> <string> <sbuf> <vector> } ;
HELP: >array "( seq -- array )"
{ $values { "seq" "a sequence" } { "array" "an array" } }
{ $description "Outputs a freshly-allocated array with the same elements as a given sequence." }
{ $see-also >string >sbuf >vector >quotation } ;
HELP: 1array "( x -- array )"
{ $values { "x" "an object" } { "array" "an array" } }
{ $description "Create a new array with one element." }
{ $see-also 2array 3array ch>string } ;
HELP: 2array "( x y -- array )"
{ $values { "x" "an object" } { "y" "an object" } { "array" "an array" } }
{ $description "Create a new array with two elements." }
{ $see-also 1array 3array ch>string } ;
HELP: 3array "( x y z -- array )"
{ $values { "x" "an object" } { "y" "an object" } { "z" "an object" } { "array" "an array" } }
{ $description "Create a new array with three elements." }
{ $see-also 1array 2array ch>string } ;