combinators.conditional: 1if and 1cond
parent
6bf04eb1ee
commit
46fc50af37
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
USING: kernel combinators sequences macros fry newfx combinators.cleave ;
|
||||||
|
|
||||||
|
IN: combinators.conditional
|
||||||
|
|
||||||
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
MACRO: 1if ( test then else -- ) '[ dup @ , , if ] ;
|
||||||
|
|
||||||
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
MACRO: 1cond ( tbl -- )
|
||||||
|
[ [ 1st [ dup ] prepend ] [ 2nd ] bi {2} ] map
|
||||||
|
[ cond ] prefix-on ;
|
||||||
|
|
||||||
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
Loading…
Reference in New Issue