set-axis ( u v axis -- w ) (original) (raw)
Inputs
u | a sequence of numbers |
---|---|
v | a sequence of numbers |
axis | a sequence of 0/1 |
Outputs
w | a sequence of numbers |
---|
Word description
Using w as a template, creates a new sequence containing corresponding elements from u in place of 0, and corresponding elements from v in place of 1.
Examples
USING: math.vectors prettyprint ; { 1 2 3 } { 4 5 6 } { 0 1 0 } set-axis .
{ 1 5 3 }
Definition
USING: kernel math sequences ;
: set-axis ( u v axis -- w )
[ [ zero? 2over ? ] dip swap nth ] map-index 2nip ;