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