Handbook
Glossary
swap-when ( x y quot: ( x -- n ) quot: ( n n -- ? ) -- x' y' )
Vocabulary
combinators
.
extras
Inputs
x
an
object
y
an
object
quot
a
quotation
with stack effect
( x -- n )
quot
a
quotation
with stack effect
( n n -- ? )
Outputs
x'
an
object
y'
an
object
Definition
USING:
kernel
;
IN:
combinators.extras
:
swap-when
( x y quot: ( x -- n ) quot: ( n n -- ? ) -- x' y' )
[
[
[
2dup
]
2curry
]
dip
[
bi@
]
curry
compose
]
dip
[
[
swap
]
when
]
compose
compose
call
;
inline