 { v? vif } related-words
 
 HELP: vany?
-{ $values { "v" "a sequence of booleans" } { "?" boolean } }
+{ $values { "v" { $sequence boolean } } { "?" boolean } }
 { $description "Returns true if any element of " { $snippet "v" } " is true." }
 { $notes "See " { $link "math-vectors-simd-logic" } " for notes on dealing with vector boolean inputs when using SIMD types." } ;
 
 HELP: vall?
-{ $values { "v" "a sequence of booleans" } { "?" boolean } }
+{ $values { "v" { $sequence boolean } } { "?" boolean } }
 { $description "Returns true if every element of " { $snippet "v" } " is true." }
 { $notes "See " { $link "math-vectors-simd-logic" } " for notes on dealing with vector boolean inputs when using SIMD types." } ;
 
 HELP: vnone?
-{ $values { "v" "a sequence of booleans" } { "?" boolean } }
+{ $values { "v" { $sequence boolean } } { "?" boolean } }
 { $description "Returns true if every element of " { $snippet "v" } " is false." }
 { $notes "See " { $link "math-vectors-simd-logic" } " for notes on dealing with vector boolean inputs when using SIMD types." } ;
 

ABOUT: "math-vectors"

HELP: vneg
{ $values { "v" "a sequence of numbers" } { "w" "a sequence of numbers" } }
{ $description "Negates each element of " { $snippet "v" } "." } ;

HELP: vabs
{ $values { "v" "a sequence of numbers" } { "w" "a sequence of non-negative real numbers" } }
{ $description "Takes the absolute value of each element of " { $snippet "v" } "." } ;

HELP: vsqrt

} ;

HELP: norm-sq
{ $values { "v" { $sequence number } } { "x" "a non-negative real number" } }
{ $description "Computes the squared length of a mathematical vector." } ;

HELP: norm
{ $values { "v" { $sequence number } } { "x" "a non-negative real number" } }
{ $description "Computes the length of a mathematical vector." } ;

HELP: p-norm
{ $values { "v" { $sequence number } } { "p" "a positive real number" } { "x" "a non-negative real number" } }
{ $description "Computes the length of a mathematical vector in " { $snippet "L^p" } " space." } ;

HELP: normalize
{ $values { "v" "a sequence of numbers, not all zero" } { "w" { $sequence number } } }
{ $description "Outputs a vector with the same direction as " { $snippet "v" } " but length 1." } ;

HELP: distance
{ $values { "u" { $sequence number } } { "v" { $sequence number } } { "x" "a non-negative real number" } }
{ $description "Outputs the Euclidean distance between two vectors." } ;

HELP: set-axis
{ $values { "u" { $sequence number } } { "v" { $sequence number } } { "axis" "a sequence of 0/1" } { "w" { $sequence number } } }
{ $description "Using " { $snippet "w" } " as a template, creates a new sequence containing corresponding elements from " { $snippet "u" } " in place of 0, and corresponding elements from " { $snippet "v" } " in place of 1." }
{ $examples { $example "USING: math.vectors prettyprint ;" "{ 1 2 3 } { 4 5 6 } { 0 1 0 } set-axis ." "{ 1 5 3 }" } } ;

HELP: v<
{ $values { "u" { $sequence number } } { "v" { $sequence number } } { "w" { $sequence boolean } } }
{ $description "Compares each corresponding element of " { $snippet "u" } " and " { $snippet "v" } ", returning " { $link t } " in the result vector when the former is less than the latter or " { $link f } " otherwise." }
{ $notes "See " { $link "math-vectors-simd-logic" } " for notes on dealing with vector boolean results when using SIMD types." } ;

HELP: v<=
{ $values { "u" { $sequence number } } { "v" { $sequence number } } { "w" { $sequence boolean } } }
{ $description "Compares each corresponding element of " { $snippet "u" } " and " { $snippet "v" } ", returning " { $link t } " in the result vector when the former is less than or equal to the latter or " { $link f } " otherwise." }
{ $notes "See " { $link "math-vectors-simd-logic" } " for notes on dealing with vector boolean results when using SIMD types." } ;

HELP: v=
{ $values { "u" { $sequence number } } { "v" { $sequence number } } { "w" { $sequence boolean } } }
{ $description "Compares each corresponding element of " { $snippet "u" } " and " { $snippet "v" } ", returning " { $link t } " in the result vector when they are equal or " { $link f } " otherwise." }
{ $notes "See " { $link "math-vectors-simd-logic" } " for notes on dealing with vector boolean results when using SIMD types." } ;

HELP: v>
{ $values { "u" { $sequence number } } { "v" { $sequence number } } { "w" { $sequence boolean } } }
{ $description "Compares each corresponding element of " { $snippet "u" } " and " { $snippet "v" } ", returning " { $link t } " in the result vector when the former is greater than the latter or " { $link f } " otherwise." }
{ $notes "See " { $link "math-vectors-simd-logic" } " for notes on dealing with vector boolean results when using SIMD types." } ;

HELP: v>=
{ $values { "u" { $sequence number } } { "v" { $sequence number } } { "w" { $sequence boolean } } }
{ $description "Compares each corresponding element of " { $snippet "u" } " and " { $snippet "v" } ", returning " { $link t } " in the result vector when the former is greater than or equal to the latter or " { $link f } " otherwise." }
{ $notes "See " { $link "math-vectors-simd-logic" } " for notes on dealing with vector boolean results when using SIMD types." } ;

HELP: vunordered?
{ $values { "u" { $sequence number } } { "v" { $sequence number } } { "w" { $sequence boolean } } }
{ $description "Compares each corresponding element of " { $snippet "u" } " and " { $snippet "v" } ", returning " { $link t } " in the result vector when either value is Not-a-Number or " { $link f } " otherwise." }
{ $notes "See " { $link "math-vectors-simd-logic" } " for notes on dealing with vector boolean results when using SIMD types." } ;

HELP: vand
{ $values { "u" { $sequence boolean } } { "v" { $sequence boolean } } { "w" { $sequence boolean } } }
{ $description "Takes the logical AND of each corresponding element of " { $snippet "u" } " and " { $snippet "v" } "." }
{ $notes "See " { $link "math-vectors-simd-logic" } " for notes on dealing with vector boolean inputs and results when using SIMD types." } ;

HELP: vandn
{ $values { "u" { $sequence boolean } } { "v" { $sequence boolean } } { "w" { $sequence boolean } } }
{ $description "Takes the logical AND-NOT of each corresponding element of " { $snippet "u" } " and " { $snippet "v" } ", where " { $snippet "x AND-NOT y" } " is defined as " { $snippet "NOT(x) AND y" } "." }
{ $notes "See " { $link "math-vectors-simd-logic" } " for notes on dealing with vector boolean inputs and results when using SIMD types." } ;

HELP: vor
{ $values { "u" { $sequence boolean } } { "v" { $sequence boolean } } { "w" { $sequence boolean } } }
{ $description "Takes the logical OR of each corresponding element of " { $snippet "u" } " and " { $snippet "v" } "." }
{ $notes "See " { $link "math-vectors-simd-logic" } " for notes on dealing with vector boolean inputs and results when using SIMD types." } ;

HELP: vxor
{ $values { "u" { $sequence boolean } } { "v" { $sequence boolean } } { "w" { $sequence boolean } } }
{ $description "Takes the logical XOR of each corresponding element of " { $snippet "u" } " and " { $snippet "v" } "." }
{ $notes "See " { $link "math-vectors-simd-logic" } " for notes on dealing with vector boolean inputs and results when using SIMD types." } ;

HELP: vnot
{ $values { "v" { $sequence boolean } } { "w" { $sequence boolean } } }
{ $description "Takes the logical NOT of each element of " { $snippet "v" } "." }
{ $notes "See " { $link "math-vectors-simd-logic" } " for notes on dealing with vector boolean inputs and results when using SIMD types." } ;

HELP: v?
{ $values { "mask" { $sequence boolean } } { "true" { $sequence number } } { "false" { $sequence number } } { "result" { $sequence number } } }
{ $description "Creates a new sequence by selecting elements from the " { $snippet "true" } " and " { $snippet "false" } " sequences based on whether the corresponding bits of the " { $snippet "mask" } " sequence are set or not." }
{ $notes "See " { $link "math-vectors-simd-logic" } " for notes on dealing with vector boolean inputs and results when using SIMD types." } ;

HELP: vif
{ $values { "mask" { $sequence boolean } } { "true-quot" { $quotation ( -- vector ) } } { "false-quot" { $quotation ( -- vector ) } } { "result" sequence } }
{ $description "If all of the elements of " { $snippet "mask" } " are true, " { $snippet "true-quot" } " is called and its output value returned. If all of the elements of " { $snippet "mask" } " are false, " { $snippet "false-quot" } " is called and its output value returned. Otherwise, both quotations are called and " { $snippet "mask" } " is used to select elements from each output as with " { $link v? } "." }
{ $notes "See " { $link "math-vectors-simd-logic" } " for notes on dealing with vector boolean inputs and results when using SIMD types."
$nl
