math.bits: Clean up the docs some more.

db4
Doug Coleman 2014-06-06 14:45:30 -07:00
parent c765f85851
commit 018d12b29b
1 changed files with 10 additions and 7 deletions

View File

@ -5,29 +5,32 @@ IN: math.bits
ABOUT: "math.bits"
ARTICLE: "math.bits" "Number bits virtual sequence"
"The " { $vocab-link "math.bits" } " vocabulary implements a virtual sequence which presents an integer as a sequence of bits, with the first element of the sequence being the least significant bit of the integer."
ARTICLE: "math.bits" "Integer virtual sequences"
"The " { $vocab-link "math.bits" } " vocabulary implements words that represent a positive integer as a virtual sequence of bits in order of ascending significance, e.g. " { $snippet "{ f f f t }" } " is " { $snippet "8" } "."
{ $subsections
bits
<bits>
make-bits
bits>number
} ;
HELP: bits
{ $class-description "Virtual sequence class of bits of a number. The first bit is the least significant bit. This can be constructed with " { $link <bits> } " or " { $link make-bits } "." } ;
{ $class-description "Tuple representing a number as a virtual sequence of booleans. The first bit is the least significant bit. Constructors are " { $link <bits> } " or " { $link make-bits } "." } ;
HELP: <bits>
{ $values { "number" integer } { "length" integer } { "bits" bits } }
{ $description "Creates a virtual sequence of bits of a number in little endian order, with the given length." } ;
{ $description "Constructor for a " { $link bits } " tuple." } ;
HELP: make-bits
{ $values { "number" integer } { "bits" bits } }
{ $description "Creates a sequence of bits " { $link bits } " in ascending significance. Throws an error on negative numbers." }
{ $description "Creates a sequence of " { $link bits } " in ascending significance. Throws an error on negative numbers." }
{ $examples
{ $example "USING: math.bits prettyprint arrays ;" "0b1101 make-bits >array ." "{ t f t t }" }
{ $example "USING: math.bits prettyprint arrays ;" "64 make-bits >array ." "{ f f f f t }" }
{ $example "USING: math.bits prettyprint arrays ;" "64 make-bits >array ." "{ f f f f f f t }" }
} ;
{ <bits> make-bits } related-words
HELP: bits>number
{ $values { "seq" sequence } { "number" integer } }
{ $description "Converts a sequence of booleans into a number." } ;
{ $description "Converts a sequence of booleans in ascending significance into a number." } ;
{ make-bits bits>number } related-words