swap-when ( x y quot: ( x -- n ) quot: ( n n -- ? ) -- x' y' )


Vocabulary
combinators.extras

Inputs
xan object
yan object
quota quotation with stack effect ( x -- n )
quota quotation with stack effect ( n n -- ? )


Outputs
x'an object
y'an object


Definition


: swap-when
( x y quot: ( x -- n ) quot: ( n n -- ? ) -- x' y' )
'[ _ _ 2dup _ bi@ @ [ swap ] when ] call ; inline