infix-subseq-range ( from to step len -- from to )


Vocabulary
infix.private

Inputs
froman object
toan object
stepan object
lenan object


Outputs
froman object
toan object


Definition


:: infix-subseq-range ( from to step len -- from to )
step [ 0 < ] [ f ] if* [
to [ dup 0 < [ len + ] when 1 + ] [ 0 ] if* from
[ dup 0 < [ len + ] when 1 + ] [ len ] if*
] [
from 0 or dup 0 < [ len + ] when to
[ dup 0 < [ len + ] when ] [ len ] if*
] if [ 0 len clamp ] bi@ dupd max ;