]> gitweb.factorcode.org Git - factor.git/blob - basis/byte-vectors/byte-vectors-docs.factor
Updating sequence and hashtable documentation to point more clearly at the relevant...
[factor.git] / basis / byte-vectors / byte-vectors-docs.factor
1 USING: arrays byte-arrays help.markup help.syntax kernel combinators ;\r
2 IN: byte-vectors\r
3 \r
4 ARTICLE: "byte-vectors" "Byte vectors"\r
5 "The " { $vocab-link "byte-vectors" } " vocabulary implements resizable mutable sequence of unsigned bytes. Byte vectors implement the " { $link "sequence-protocol" } " and thus all " { $link "sequences" } " can be used with them."\r
6 $nl\r
7 "Byte vectors form a class:"\r
8 { $subsection byte-vector }\r
9 { $subsection byte-vector? }\r
10 "Creating byte vectors:"\r
11 { $subsection >byte-vector }\r
12 { $subsection <byte-vector> }\r
13 "Literal syntax:"\r
14 { $subsection POSTPONE: BV{ }\r
15 "If you don't care about initial capacity, a more elegant way to create a new byte vector is to write:"\r
16 { $code "BV{ } clone" } ;\r
17 \r
18 ABOUT: "byte-vectors"\r
19 \r
20 HELP: byte-vector\r
21 { $description "The class of resizable byte vectors. See " { $link "byte-vectors" } " for information." } ;\r
22 \r
23 HELP: <byte-vector>\r
24 { $values { "n" "a positive integer specifying initial capacity" } { "byte-vector" byte-vector } }\r
25 { $description "Creates a new byte vector that can hold " { $snippet "n" } " bytes before resizing." } ;\r
26 \r
27 HELP: >byte-vector\r
28 { $values { "seq" "a sequence" } { "byte-vector" byte-vector } }\r
29 { $description "Outputs a freshly-allocated byte vector with the same elements as a given sequence." }\r
30 { $errors "Throws an error if the sequence contains elements other than integers." } ;\r
31 \r
32 HELP: BV{\r
33 { $syntax "BV{ elements... }" }\r
34 { $values { "elements" "a list of bytes" } }\r
35 { $description "Marks the beginning of a literal byte vector. Literal byte vectors are terminated by " { $link POSTPONE: } } "." } \r
36 { $examples { $code "BV{ 1 2 3 12 }" } } ;\r