remove dipd, it's 2dip
parent
f1fe2641b5
commit
f706b50ac7
|
@ -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 3 [ drop ] 2 ndip .s" "2\n3" }
|
||||
}
|
||||
{ $see-also dip dipd } ;
|
||||
{ $see-also dip 2dip } ;
|
||||
|
||||
HELP: nslip
|
||||
{ $values { "n" number } }
|
||||
|
|
|
@ -5,9 +5,6 @@ IN: combinators.lib.tests
|
|||
[ 5 ] [ [ 10 random ] [ 5 = ] generate ] 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 } [ [ 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
|
||||
|
|
|
@ -38,8 +38,6 @@ MACRO: napply ( n -- )
|
|||
|
||||
: 3apply ( obj obj obj quot -- ) 3 napply ; inline
|
||||
|
||||
: dipd ( x y quot -- y ) 2 ndip ; inline
|
||||
|
||||
: 2with ( param1 param2 obj quot -- obj curry )
|
||||
with with ; inline
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ dquote = '"'
|
|||
squote = "'"
|
||||
digit = [0-9]
|
||||
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 / ]]
|
||||
number = float
|
||||
| rational
|
||||
|
|
|
@ -50,7 +50,7 @@ C: <ebnf> ebnf
|
|||
: syntax-pack ( begin parser end -- parser )
|
||||
#! Parse 'parser' surrounded by syntax elements
|
||||
#! begin and end.
|
||||
[ syntax ] dipd syntax pack ;
|
||||
[ syntax ] 2dip syntax pack ;
|
||||
|
||||
: 'identifier' ( -- parser )
|
||||
#! Return a parser that parses an identifer delimited by
|
||||
|
|
|
@ -35,8 +35,8 @@ IN: project-euler.047
|
|||
pick pick = [
|
||||
swap - nip
|
||||
] [
|
||||
dup prime? [ [ drop 0 ] dipd ] [
|
||||
2dup unique-factors length = [ [ 1+ ] dipd ] [ [ drop 0 ] dipd ] if
|
||||
dup prime? [ [ drop 0 ] 2dip ] [
|
||||
2dup unique-factors length = [ [ 1+ ] 2dip ] [ [ drop 0 ] 2dip ] if
|
||||
] if 1+ (consecutive)
|
||||
] if ;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ IN: reports.noise
|
|||
{ compose 1/2 }
|
||||
{ curry 1/3 }
|
||||
{ dip 1 }
|
||||
{ dipd 2 }
|
||||
{ 2dip 2 }
|
||||
{ drop 1/3 }
|
||||
{ dup 1/3 }
|
||||
{ if 1/3 }
|
||||
|
|
|
@ -22,9 +22,9 @@ TUPLE: space-invaders port1 port2i port2o port3o port4lo port4hi port5o bitmap s
|
|||
: set-bitmap-pixel ( color point array -- )
|
||||
#! 'color' is a {r g b}. Point is {x y}.
|
||||
[ bitmap-index ] dip ! color index array
|
||||
[ [ first ] dipd set-uchar-nth ] 3keep
|
||||
[ [ second ] dipd [ 1 + ] dip set-uchar-nth ] 3keep
|
||||
[ third ] dipd [ 2 + ] dip set-uchar-nth ;
|
||||
[ [ first ] 2dip set-uchar-nth ] 3keep
|
||||
[ [ second ] 2dip [ 1 + ] dip set-uchar-nth ] 3keep
|
||||
[ third ] 2dip [ 2 + ] dip set-uchar-nth ;
|
||||
|
||||
: get-bitmap-pixel ( point array -- color )
|
||||
#! 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 -- )
|
||||
#! point is a {x y}.
|
||||
[ first2 ] dipd
|
||||
[ first2 ] 2dip
|
||||
dup swapd -1 * shift 1 bitand 0 =
|
||||
[ - 2array ] dip
|
||||
[ black ] [ dup get-point-color ] if
|
||||
|
|
Loading…
Reference in New Issue