combinators.extras: adding keepd.

db4
John Benediktsson 2013-05-14 09:40:40 -07:00
parent f29aac24bb
commit 8805da92e0
2 changed files with 5 additions and 0 deletions

View File

@ -27,3 +27,5 @@ IN: combinators.extras.tests
{ 2 15 } [ 1 2 3 4 5 6 [ - - ] [ + + ] 3bi* ] unit-test
{ 2 5 } [ 1 2 3 4 5 6 [ - - ] 3bi@ ] unit-test
{ 3 1 } [ 1 2 [ + ] keepd ] unit-test

View File

@ -24,3 +24,6 @@ MACRO: cleave-array ( quots -- )
: 3bi@ ( u v w x y z quot -- )
dup 3bi* ; inline
: keepd ( ..a x y quot: ( ..a x y -- ..b ) -- ..b x )
2keep drop ; inline