assocs, math.bitwise: remove first blank line and useless whitespace in a few usage examples
parent
5cad80fdc9
commit
8d2ceda8f3
|
@ -32,7 +32,7 @@ HELP: bitfield
|
||||||
}
|
}
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
HELP: bits
|
HELP: bits
|
||||||
{ $values { "m" integer } { "n" integer } { "m'" integer } }
|
{ $values { "m" integer } { "n" integer } { "m'" integer } }
|
||||||
{ $description "Keep only n bits from the integer m." }
|
{ $description "Keep only n bits from the integer m." }
|
||||||
{ $example "USING: math.bitwise prettyprint ;" "HEX: 123abcdef 16 bits .h" "cdef" } ;
|
{ $example "USING: math.bitwise prettyprint ;" "HEX: 123abcdef 16 bits .h" "cdef" } ;
|
||||||
|
@ -52,12 +52,12 @@ HELP: bit-clear?
|
||||||
{ "?" "a boolean" }
|
{ "?" "a boolean" }
|
||||||
}
|
}
|
||||||
{ $description "Returns " { $link t } " if the nth bit is set to zero." }
|
{ $description "Returns " { $link t } " if the nth bit is set to zero." }
|
||||||
{ $examples
|
{ $examples
|
||||||
{ $example "USING: math.bitwise prettyprint ;"
|
{ $example "USING: math.bitwise prettyprint ;"
|
||||||
"HEX: ff 8 bit-clear? ."
|
"HEX: ff 8 bit-clear? ."
|
||||||
"t"
|
"t"
|
||||||
}
|
}
|
||||||
{ $example "" "USING: math.bitwise prettyprint ;"
|
{ $example "USING: math.bitwise prettyprint ;"
|
||||||
"HEX: ff 7 bit-clear? ."
|
"HEX: ff 7 bit-clear? ."
|
||||||
"f"
|
"f"
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ HELP: bit-count
|
||||||
{ "n" integer }
|
{ "n" integer }
|
||||||
}
|
}
|
||||||
{ $description "Returns the number of set bits as an object. This word only works on non-negative integers or objects that can be represented as a byte-array." }
|
{ $description "Returns the number of set bits as an object. This word only works on non-negative integers or objects that can be represented as a byte-array." }
|
||||||
{ $examples
|
{ $examples
|
||||||
{ $example "USING: math.bitwise prettyprint ;"
|
{ $example "USING: math.bitwise prettyprint ;"
|
||||||
"HEX: f0 bit-count ."
|
"HEX: f0 bit-count ."
|
||||||
"4"
|
"4"
|
||||||
|
@ -90,9 +90,9 @@ HELP: bitroll-32
|
||||||
{ $values
|
{ $values
|
||||||
{ "m" integer } { "s" integer }
|
{ "m" integer } { "s" integer }
|
||||||
{ "n" integer }
|
{ "n" integer }
|
||||||
}
|
}
|
||||||
{ $description "Rolls the number " { $snippet "m" } " by " { $snippet "s" } " bits to the left, wrapping around after 32 bits." }
|
{ $description "Rolls the number " { $snippet "m" } " by " { $snippet "s" } " bits to the left, wrapping around after 32 bits." }
|
||||||
{ $examples
|
{ $examples
|
||||||
{ $example "USING: math.bitwise prettyprint ;"
|
{ $example "USING: math.bitwise prettyprint ;"
|
||||||
"HEX: 1 10 bitroll-32 .h"
|
"HEX: 1 10 bitroll-32 .h"
|
||||||
"400"
|
"400"
|
||||||
|
@ -109,7 +109,7 @@ HELP: bitroll-64
|
||||||
{ "n" integer }
|
{ "n" integer }
|
||||||
}
|
}
|
||||||
{ $description "Rolls the number " { $snippet "m" } " by " { $snippet "s" } " bits to the left, wrapping around after 64 bits." }
|
{ $description "Rolls the number " { $snippet "m" } " by " { $snippet "s" } " bits to the left, wrapping around after 64 bits." }
|
||||||
{ $examples
|
{ $examples
|
||||||
{ $example "USING: math.bitwise prettyprint ;"
|
{ $example "USING: math.bitwise prettyprint ;"
|
||||||
"HEX: 1 10 bitroll-64 .h"
|
"HEX: 1 10 bitroll-64 .h"
|
||||||
"400"
|
"400"
|
||||||
|
@ -275,7 +275,7 @@ HELP: unmask
|
||||||
{ $description "Clears the bits in " { $snippet "x" } " if they are set in the mask " { $snippet "n" } "." }
|
{ $description "Clears the bits in " { $snippet "x" } " if they are set in the mask " { $snippet "n" } "." }
|
||||||
{ $examples
|
{ $examples
|
||||||
{ $example "USING: math.bitwise kernel prettyprint ;"
|
{ $example "USING: math.bitwise kernel prettyprint ;"
|
||||||
"HEX: ff HEX: 0f unmask .h"
|
"HEX: ff HEX: 0f unmask .h"
|
||||||
"f0"
|
"f0"
|
||||||
}
|
}
|
||||||
} ;
|
} ;
|
||||||
|
@ -288,7 +288,7 @@ HELP: unmask?
|
||||||
{ $description "Tests whether unmasking the bits in " { $snippet "x" } " would return an integer greater than zero." }
|
{ $description "Tests whether unmasking the bits in " { $snippet "x" } " would return an integer greater than zero." }
|
||||||
{ $examples
|
{ $examples
|
||||||
{ $example "USING: math.bitwise kernel prettyprint ;"
|
{ $example "USING: math.bitwise kernel prettyprint ;"
|
||||||
"HEX: ff HEX: 0f unmask? ."
|
"HEX: ff HEX: 0f unmask? ."
|
||||||
"t"
|
"t"
|
||||||
}
|
}
|
||||||
} ;
|
} ;
|
||||||
|
@ -339,7 +339,7 @@ HELP: wrap
|
||||||
}
|
}
|
||||||
{ $description "Wraps an integer " { $snippet "m" } " by modding it by " { $snippet "n" } ". This word is uses bitwise arithmetic and does not actually call the modulus word, and as such can only mod by powers of two." }
|
{ $description "Wraps an integer " { $snippet "m" } " by modding it by " { $snippet "n" } ". This word is uses bitwise arithmetic and does not actually call the modulus word, and as such can only mod by powers of two." }
|
||||||
{ $examples "Equivalent to modding by 8:"
|
{ $examples "Equivalent to modding by 8:"
|
||||||
{ $example
|
{ $example
|
||||||
"USING: math.bitwise prettyprint ;"
|
"USING: math.bitwise prettyprint ;"
|
||||||
"HEX: ffff 8 wrap .h"
|
"HEX: ffff 8 wrap .h"
|
||||||
"7"
|
"7"
|
||||||
|
|
|
@ -369,7 +369,7 @@ HELP: assoc-union
|
||||||
|
|
||||||
HELP: assoc-diff
|
HELP: assoc-diff
|
||||||
{ $values { "assoc1" assoc } { "assoc2" assoc } { "diff" "a new assoc" } }
|
{ $values { "assoc1" assoc } { "assoc2" assoc } { "diff" "a new assoc" } }
|
||||||
{ $description "Outputs an assoc consisting of all entries from " { $snippet "assoc1" } " whose key is not contained in " { $snippet "assoc2" } "." }
|
{ $description "Outputs an assoc consisting of all entries from " { $snippet "assoc1" } " whose key is not contained in " { $snippet "assoc2" } "." }
|
||||||
;
|
;
|
||||||
|
|
||||||
HELP: assoc-diff!
|
HELP: assoc-diff!
|
||||||
|
@ -482,10 +482,10 @@ HELP: unzip
|
||||||
{ "assoc" assoc }
|
{ "assoc" assoc }
|
||||||
{ "keys" sequence } { "values" sequence } }
|
{ "keys" sequence } { "values" sequence } }
|
||||||
{ $description "Outputs an array of keys and an array of values of the input " { $snippet "assoc" } "." }
|
{ $description "Outputs an array of keys and an array of values of the input " { $snippet "assoc" } "." }
|
||||||
{ $examples
|
{ $examples
|
||||||
{ $example "USING: prettyprint assocs kernel ;"
|
{ $example "USING: prettyprint assocs kernel ;"
|
||||||
"{ { 1 4 } { 2 5 } { 3 6 } } unzip [ . ] bi@"
|
"{ { 1 4 } { 2 5 } { 3 6 } } unzip [ . ] bi@"
|
||||||
"{ 1 2 3 }\n{ 4 5 6 }"
|
"{ 1 2 3 }\n{ 4 5 6 }"
|
||||||
}
|
}
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
@ -494,8 +494,8 @@ HELP: zip
|
||||||
{ "keys" sequence } { "values" sequence }
|
{ "keys" sequence } { "values" sequence }
|
||||||
{ "alist" "an array of key/value pairs" } }
|
{ "alist" "an array of key/value pairs" } }
|
||||||
{ $description "Combines two sequences pairwise into a single sequence of key/value pairs." }
|
{ $description "Combines two sequences pairwise into a single sequence of key/value pairs." }
|
||||||
{ $examples
|
{ $examples
|
||||||
{ $example "" "USING: prettyprint assocs ;"
|
{ $example "USING: prettyprint assocs ;"
|
||||||
"{ 1 2 3 } { 4 5 6 } zip ."
|
"{ 1 2 3 } { 4 5 6 } zip ."
|
||||||
"{ { 1 4 } { 2 5 } { 3 6 } }"
|
"{ { 1 4 } { 2 5 } { 3 6 } }"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue