[vconvert] ( from-element to-element from-size to-size from-type to-type -- quot )


Vocabulary
math.vectors.conversion.private

Inputs and outputs
from-elementan object
to-elementan object
from-sizean object
to-sizean object
from-typean object
to-typean object
quotan object


Definition


:: [vconvert]
( from-element to-element from-size to-size from-type to-type -- quot )
{
{ [ from-element to-element eq? ] [ [ ] ] }
{
[
from-element to-element
[ float-type? not ] both?
]
[ [ underlying>> to-type boa ] ]
}
{
[ from-element float-type? ]
[
from-type new simd-rep [ [ underlying>> ] ] dip
[ (simd-v>integer) to-type boa ] curry compose
]
}
{
[ to-element float-type? ]
[
from-type new simd-rep [ [ underlying>> ] ] dip
[ (simd-v>float) to-type boa ] curry compose
]
}
} cond [ from-type check-vconvert-type ] prepose ;