41 lines
2.1 KiB
Plaintext
41 lines
2.1 KiB
Plaintext
IN: arrays
|
|
USING: byte-arrays bit-arrays help kernel kernel-internals
|
|
prettyprint strings sbufs vectors ;
|
|
|
|
HELP: array
|
|
{ $description "The class of fixed-length arrays. See " { $link "syntax-arrays" } " for syntax and " { $link "arrays" } " for general information." } ;
|
|
|
|
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> <bit-array> } ;
|
|
|
|
HELP: >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 >byte-array >bit-array } ;
|
|
|
|
HELP: 1array
|
|
{ $values { "x" "an object" } { "array" "an array" } }
|
|
{ $description "Create a new array with one element." }
|
|
{ $see-also 2array 3array 1string } ;
|
|
|
|
HELP: 2array
|
|
{ $values { "x" "an object" } { "y" "an object" } { "array" "an array" } }
|
|
{ $description "Create a new array with two elements, with " { $snippet "x" } " appearing first." }
|
|
{ $see-also 1array 3array 1string } ;
|
|
|
|
HELP: 3array
|
|
{ $values { "x" "an object" } { "y" "an object" } { "z" "an object" } { "array" "an array" } }
|
|
{ $description "Create a new array with three elements, with " { $snippet "x" } " appearing first." }
|
|
{ $see-also 1array 2array 1string } ;
|
|
|
|
HELP: 4array
|
|
{ $values { "w" "an object" } { "x" "an object" } { "y" "an object" } { "z" "an object" } { "array" "an array" } }
|
|
{ $description "Create a new array with four elements, with " { $snippet "w" } " appearing first." }
|
|
{ $see-also 1array 2array 1string } ;
|
|
|
|
HELP: resize-array ( n array -- newarray )
|
|
{ $values { "n" "a non-negative integer" } { "array" "an array" } { "newarray" "a new array" } }
|
|
{ $description "Creates a new array of " { $snippet "n" } " elements. The contents of the existing array are copied into the new array; if the new array is shorter, only an initial segment is copied, and if the new array is longer the remaining space is filled in with "{ $link f } "." } ;
|