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