remove dipd, it's 2dip

db4
Doug Coleman 2008-05-23 22:48:58 -05:00
parent f1fe2641b5
commit f706b50ac7
8 changed files with 10 additions and 15 deletions

View File

@ -23,7 +23,7 @@ HELP: ndip
{ $example "USING: combinators.lib kernel prettyprint ;" "1 2 [ dup ] 1 ndip .s" "1\n1\n2" } { $example "USING: combinators.lib kernel prettyprint ;" "1 2 [ dup ] 1 ndip .s" "1\n1\n2" }
{ $example "USING: combinators.lib kernel prettyprint ;" "1 2 3 [ drop ] 2 ndip .s" "2\n3" } { $example "USING: combinators.lib kernel prettyprint ;" "1 2 3 [ drop ] 2 ndip .s" "2\n3" }
} }
{ $see-also dip dipd } ; { $see-also dip 2dip } ;
HELP: nslip HELP: nslip
{ $values { "n" number } } { $values { "n" number } }

View File

@ -5,9 +5,6 @@ IN: combinators.lib.tests
[ 5 ] [ [ 10 random ] [ 5 = ] generate ] unit-test [ 5 ] [ [ 10 random ] [ 5 = ] generate ] unit-test
[ t ] [ [ 10 random ] [ even? ] generate even? ] unit-test [ t ] [ [ 10 random ] [ even? ] generate even? ] unit-test
{ 6 2 } [ 1 2 [ 5 + ] dip ] unit-test
{ 6 2 1 } [ 1 2 1 [ 5 + ] dipd ] unit-test
[ [ 99 ] 1 2 3 4 5 5 nslip ] must-infer [ [ 99 ] 1 2 3 4 5 5 nslip ] must-infer
{ 99 1 2 3 4 5 } [ [ 99 ] 1 2 3 4 5 5 nslip ] unit-test { 99 1 2 3 4 5 } [ [ 99 ] 1 2 3 4 5 5 nslip ] unit-test
[ 1 2 3 4 5 [ drop drop drop drop drop 2 ] 5 nkeep ] must-infer [ 1 2 3 4 5 [ drop drop drop drop drop 2 ] 5 nkeep ] must-infer

View File

@ -38,8 +38,6 @@ MACRO: napply ( n -- )
: 3apply ( obj obj obj quot -- ) 3 napply ; inline : 3apply ( obj obj obj quot -- ) 3 napply ; inline
: dipd ( x y quot -- y ) 2 ndip ; inline
: 2with ( param1 param2 obj quot -- obj curry ) : 2with ( param1 param2 obj quot -- obj curry )
with with ; inline with with ; inline

View File

@ -19,7 +19,7 @@ dquote = '"'
squote = "'" squote = "'"
digit = [0-9] digit = [0-9]
integer = ("-")? (digit)+ => [[ first2 append string>number ]] integer = ("-")? (digit)+ => [[ first2 append string>number ]]
float = integer "." (digit)* => [[ first3 >string [ number>string ] dipd 3append string>number ]] float = integer "." (digit)* => [[ first3 >string [ number>string ] 2dip 3append string>number ]]
rational = integer "/" (digit)+ => [[ first3 nip string>number / ]] rational = integer "/" (digit)+ => [[ first3 nip string>number / ]]
number = float number = float
| rational | rational

View File

@ -50,7 +50,7 @@ C: <ebnf> ebnf
: syntax-pack ( begin parser end -- parser ) : syntax-pack ( begin parser end -- parser )
#! Parse 'parser' surrounded by syntax elements #! Parse 'parser' surrounded by syntax elements
#! begin and end. #! begin and end.
[ syntax ] dipd syntax pack ; [ syntax ] 2dip syntax pack ;
: 'identifier' ( -- parser ) : 'identifier' ( -- parser )
#! Return a parser that parses an identifer delimited by #! Return a parser that parses an identifer delimited by

View File

@ -35,8 +35,8 @@ IN: project-euler.047
pick pick = [ pick pick = [
swap - nip swap - nip
] [ ] [
dup prime? [ [ drop 0 ] dipd ] [ dup prime? [ [ drop 0 ] 2dip ] [
2dup unique-factors length = [ [ 1+ ] dipd ] [ [ drop 0 ] dipd ] if 2dup unique-factors length = [ [ 1+ ] 2dip ] [ [ drop 0 ] 2dip ] if
] if 1+ (consecutive) ] if 1+ (consecutive)
] if ; ] if ;

View File

@ -35,7 +35,7 @@ IN: reports.noise
{ compose 1/2 } { compose 1/2 }
{ curry 1/3 } { curry 1/3 }
{ dip 1 } { dip 1 }
{ dipd 2 } { 2dip 2 }
{ drop 1/3 } { drop 1/3 }
{ dup 1/3 } { dup 1/3 }
{ if 1/3 } { if 1/3 }

View File

@ -22,9 +22,9 @@ TUPLE: space-invaders port1 port2i port2o port3o port4lo port4hi port5o bitmap s
: set-bitmap-pixel ( color point array -- ) : set-bitmap-pixel ( color point array -- )
#! 'color' is a {r g b}. Point is {x y}. #! 'color' is a {r g b}. Point is {x y}.
[ bitmap-index ] dip ! color index array [ bitmap-index ] dip ! color index array
[ [ first ] dipd set-uchar-nth ] 3keep [ [ first ] 2dip set-uchar-nth ] 3keep
[ [ second ] dipd [ 1 + ] dip set-uchar-nth ] 3keep [ [ second ] 2dip [ 1 + ] dip set-uchar-nth ] 3keep
[ third ] dipd [ 2 + ] dip set-uchar-nth ; [ third ] 2dip [ 2 + ] dip set-uchar-nth ;
: get-bitmap-pixel ( point array -- color ) : get-bitmap-pixel ( point array -- color )
#! Point is a {x y}. color is a {r g b} #! Point is a {x y}. color is a {r g b}
@ -311,7 +311,7 @@ M: invaders-gadget draw-gadget* ( gadget -- )
: plot-bitmap-bits ( bitmap point byte bit -- ) : plot-bitmap-bits ( bitmap point byte bit -- )
#! point is a {x y}. #! point is a {x y}.
[ first2 ] dipd [ first2 ] 2dip
dup swapd -1 * shift 1 bitand 0 = dup swapd -1 * shift 1 bitand 0 =
[ - 2array ] dip [ - 2array ] dip
[ black ] [ dup get-point-color ] if [ black ] [ dup get-point-color ] if