]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/combinators/extras/extras.factor
combinators.extras: adding plox-if
[factor.git] / extra / combinators / extras / extras.factor
index ec0da1bfc1cac725230b802f5a7312f6c10d9657..600716db5a861815a06dd6cd28d0799b23b27300 100644 (file)
@@ -58,6 +58,9 @@ MACRO: cleave-array ( quots -- quot )
 : plox ( ... x/f quot: ( ... x -- ... y ) -- ... y/f )
     dupd when ; inline
 
+: plox-if ( ... x quot: ( ... x -- ... ? ) quot: ( ... x -- ... y ) -- ... y/f )
+    [ keep swap ] dip when ; inline
+
 MACRO: smart-plox ( true -- quot )
     [ inputs [ 1 - [ and ] n*quot ] keep ] keep swap
     '[ _ _ [ _ ndrop f ] smart-if ] ;