1 USING: arrays bit-arrays help.markup help.syntax kernel
\r
2 bit-vectors.private combinators ;
\r
5 ARTICLE: "bit-vectors" "Bit vectors"
\r
6 "A bit vector is a resizable mutable sequence of bits. The literal syntax is covered in " { $link "syntax-bit-vectors" } ". Bit vector words are found in the " { $vocab-link "bit-vectors" } " vocabulary."
\r
8 "Bit vectors form a class:"
\r
9 { $subsection bit-vector }
\r
10 { $subsection bit-vector? }
\r
11 "Creating bit vectors:"
\r
12 { $subsection >bit-vector }
\r
13 { $subsection <bit-vector> }
\r
14 "If you don't care about initial capacity, a more elegant way to create a new bit vector is to write:"
\r
15 { $code "?V{ } clone" } ;
\r
17 ABOUT: "bit-vectors"
\r
20 { $description "The class of resizable bit vectors. See " { $link "syntax-bit-vectors" } " for syntax and " { $link "bit-vectors" } " for general information." } ;
\r
23 { $values { "n" "a positive integer specifying initial capacity" } { "bit-vector" bit-vector } }
\r
24 { $description "Creates a new bit vector that can hold " { $snippet "n" } " bits before resizing." } ;
\r
27 { $values { "seq" "a sequence" } { "bit-vector" bit-vector } }
\r
28 { $description "Outputs a freshly-allocated bit vector with the same elements as a given sequence." } ;
\r
30 HELP: bit-array>vector
\r
31 { $values { "bit-array" "an array" } { "length" "a non-negative integer" } { "bit-vector" bit-vector } }
\r
32 { $description "Creates a new bit vector using the array for underlying storage with the specified initial length." }
\r
33 { $warning "This word is in the " { $vocab-link "bit-vectors.private" } " vocabulary because it does not perform type or bounds checks. User code should call " { $link >bit-vector } " instead." } ;
\r