]> gitweb.factorcode.org Git - factor.git/commitdiff
Removing slip 2slip 3slip nslip
authorSlava Pestov <slava@shill.internal.stack-effects.com>
Sun, 10 May 2009 21:39:17 +0000 (16:39 -0500)
committerSlava Pestov <slava@shill.internal.stack-effects.com>
Sun, 10 May 2009 21:39:17 +0000 (16:39 -0500)
basis/fry/fry-docs.factor
basis/generalizations/generalizations-docs.factor
basis/generalizations/generalizations-tests.factor
basis/generalizations/generalizations.factor
core/combinators/combinators-docs.factor
core/kernel/kernel-docs.factor
core/kernel/kernel.factor
core/quotations/quotations.factor
extra/reports/noise/noise.factor

index 5d750775e571d0885fc70b2dc49c7a1f37e3d435..32ad856d004e9c82f350a91f048fae609039b790 100644 (file)
@@ -57,7 +57,6 @@ $nl
 "Here are some built-in combinators rewritten in terms of fried quotations:"\r
 { $table\r
     { { $link literalize } { $snippet ": literalize '[ _ ] ;" } }\r
-    { { $link slip } { $snippet ": slip '[ @ _ ] call ;" } }\r
     { { $link curry } { $snippet ": curry '[ _ @ ] ;" } }\r
     { { $link compose } { $snippet ": compose '[ @ @ ] ;" } }\r
     { { $link bi@ } { $snippet ": bi@ tuck '[ _ @ _ @ ] call ;" } }\r
index 36715111940242937ab1e43d6976993a4151f139..d6a3aa948a8489f0bfdc4cf2f722a412cc411f0e 100644 (file)
@@ -161,22 +161,6 @@ HELP: ndip
     }\r
 } ;\r
 \r
-HELP: nslip\r
-{ $values { "n" integer } }\r
-{ $description "A generalization of " { $link slip } " that can work " \r
-"for any stack depth. The first " { $snippet "n" } " items after the quotation will be "\r
-"removed from the stack, the quotation called, and the items restored."\r
-} \r
-{ $examples\r
-  { $example "USING: generalizations kernel prettyprint ;" "[ 99 ] 1 2 3 4 5 5 nslip 6 narray ." "{ 99 1 2 3 4 5 }" }\r
-  "Some core words expressed in terms of " { $link nslip } ":"\r
-    { $table\r
-        { { $link slip } { $snippet "1 nslip" } }\r
-        { { $link 2slip } { $snippet "2 nslip" } }\r
-        { { $link 3slip } { $snippet "3 nslip" } }\r
-    }\r
-} ;\r
-\r
 HELP: nkeep\r
 { $values { "quot" quotation } { "n" integer } }\r
 { $description "A generalization of " { $link keep } " that can work " \r
@@ -339,7 +323,6 @@ ARTICLE: "shuffle-generalizations" "Generalized shuffle words"
 \r
 ARTICLE: "combinator-generalizations" "Generalized combinators"\r
 { $subsection ndip }\r
-{ $subsection nslip }\r
 { $subsection nkeep }\r
 { $subsection napply }\r
 { $subsection ncleave }\r
index 7ede271d017d0fec830904498e06e664b7bdb913..d0f614f9cdbaeb6cba920e90280f333435fbe68e 100644 (file)
@@ -26,8 +26,6 @@ IN: generalizations.tests
 [ [ 1 ] 5 ndip ] must-infer\r
 [ 1 2 3 4 ] [ 2 3 4 [ 1 ] 3 ndip ] unit-test\r
 \r
-[ [ 99 ] 1 2 3 4 5 5 nslip ] must-infer\r
-{ 99 1 2 3 4 5 } [ [ 99 ] 1 2 3 4 5 5 nslip ] unit-test\r
 [ 1 2 3 4 5 [ drop drop drop drop drop 2 ] 5 nkeep ] must-infer\r
 { 2 1 2 3 4 5 } [ 1 2 3 4 5 [ drop drop drop drop drop 2 ] 5 nkeep ] unit-test\r
 [ [ 1 2 3 + ] ] [ 1 2 3 [ + ] 3 ncurry ] unit-test\r
index 139b7a528add97756ddd2848585b57fc7368e7fc..397166a4182af0bb28febe6fd5f38577a6fcb4d4 100644 (file)
@@ -60,9 +60,6 @@ MACRO: ntuck ( n -- )
 MACRO: ndip ( quot n -- )
     [ '[ _ dip ] ] times ;
 
-MACRO: nslip ( n -- )
-    '[ [ call ] _ ndip ] ;
-
 MACRO: nkeep ( quot n -- )
     tuck '[ _ ndup _ _ ndip ] ;
 
index 8b301affbd995e1cd02edb06e0f3723b1efca838..1a17e8c1fbf34e99549600db5c7a7feac1573150 100755 (executable)
@@ -62,9 +62,6 @@ $nl
     ": dip   [ ] bi* ;"
     ": 2dip  [ ] [ ] tri* ;"
     ""
-    ": slip  [ call ] [ ] bi* ;"
-    ": 2slip [ call ] [ ] [ ] tri* ;"
-    ""
     ": nip   [ drop ] [ ] bi* ;"
     ": 2nip  [ drop ] [ drop ] [ ] tri* ;"
     ""
@@ -121,7 +118,7 @@ $nl
 { $subsection both? }
 { $subsection either? } ;
 
-ARTICLE: "slip-keep-combinators" "Retain stack combinators"
+ARTICLE: "retainstack-combinators" "Retain stack combinators"
 "Sometimes an additional storage area is needed to hold objects. The " { $emphasis "retain stack" } " is an auxilliary stack for this purpose. Objects can be moved between the data and retain stacks using a set of combinators."
 $nl
 "The dip combinators invoke the quotation at the top of the stack, hiding the values underneath:"
@@ -129,10 +126,6 @@ $nl
 { $subsection 2dip }
 { $subsection 3dip }
 { $subsection 4dip }
-"The slip combinators invoke a quotation further down on the stack. They are most useful for implementing other combinators:"
-{ $subsection slip }
-{ $subsection 2slip }
-{ $subsection 3slip }
 "The keep combinators invoke a quotation which takes a number of values off the stack, and then they restore those values:"
 { $subsection keep }
 { $subsection 2keep }
@@ -259,7 +252,7 @@ ARTICLE: "conditionals" "Conditional combinators"
 
 ARTICLE: "dataflow-combinators" "Data flow combinators"
 "Data flow combinators pass values between quotations:"
-{ $subsection "slip-keep-combinators" }
+{ $subsection "retainstack-combinators" }
 { $subsection "cleave-combinators" }
 { $subsection "spread-combinators" }
 { $subsection "apply-combinators" }
index e67e2bc0ddb5de076284329b03ffd1e09549d758..22e0e76451f87222df5e0d88e836fee8b3b0ff46 100644 (file)
@@ -212,18 +212,6 @@ HELP: call-clear ( quot -- )
 { $description "Calls a quotation with an empty call stack. If the quotation returns, Factor will exit.." }
 { $notes "Used to implement " { $link "threads" } "." } ;
 
-HELP: slip
-{ $values { "quot" quotation } { "x" object } }
-{ $description "Calls a quotation while hiding the top of the stack." } ;
-
-HELP: 2slip
-{ $values { "quot" quotation } { "x" object } { "y" object } }
-{ $description "Calls a quotation while hiding the top two stack elements." } ;
-
-HELP: 3slip
-{ $values { "quot" quotation } { "x" object } { "y" object } { "z" object } }
-{ $description "Calls a quotation while hiding the top three stack elements." } ;
-
 HELP: keep
 { $values { "quot" { $quotation "( x -- ... )" } } { "x" object } }
 { $description "Call a quotation with a value on the stack, restoring the value when the quotation returns." }
index 624508022595f40d9944617fdc50b12ea3e1b4db..d6350e0420241ffbd5d2001f3c75f9d1805db265 100644 (file)
@@ -58,37 +58,19 @@ DEFER: if
 : ?if ( default cond true false -- )
     pick [ drop [ drop ] 2dip call ] [ 2nip call ] if ; inline
 
-! Slippers and dippers.
+! Dippers.
 ! Not declared inline because the compiler special-cases them
 
-: slip ( quot x -- x )
-    #! 'slip' and 'dip' can be defined in terms of each other
-    #! because the JIT special-cases a 'dip' preceeded by
-    #! a literal quotation.
-    [ call ] dip ;
+: dip ( x quot -- x ) swap [ call ] dip ;
 
-: 2slip ( quot x y -- x y )
-    #! '2slip' and '2dip' can be defined in terms of each other
-    #! because the JIT special-cases a '2dip' preceeded by
-    #! a literal quotation.
-    [ call ] 2dip ;
+: 2dip ( x y quot -- x y ) -rot [ call ] 2dip ;
 
-: 3slip ( quot x y z -- x y z )
-    #! '3slip' and '3dip' can be defined in terms of each other
-    #! because the JIT special-cases a '3dip' preceeded by
-    #! a literal quotation.
-    [ call ] 3dip ;
-
-: dip ( x quot -- x ) swap slip ;
-
-: 2dip ( x y quot -- x y ) -rot 2slip ;
-
-: 3dip ( x y z quot -- x y z ) -roll 3slip ;
+: 3dip ( x y z quot -- x y z ) -roll [ call ] 3dip ;
 
 : 4dip ( w x y z quot -- w x y z ) swap [ 3dip ] dip ; inline
 
 ! Keepers
-: keep ( x quot -- x ) over slip ; inline
+: keep ( x quot -- x ) over [ call ] dip ; inline
 
 : 2keep ( x y quot -- x y ) [ 2dup ] dip 2dip ; inline
 
index 3245ac1e206bda428464352efd80422fe5489741..af3c110d61db516a333fa34cc20daf2a75d4caf6 100644 (file)
@@ -19,7 +19,7 @@ M: quotation call (call) ;
 
 M: curry call uncurry call ;
 
-M: compose call uncompose slip call ;
+M: compose call uncompose [ call ] dip call ;
 
 M: wrapper equal?
     over wrapper? [ [ wrapped>> ] bi@ = ] [ 2drop f ] if ;
index 89e00f88c56670bb4dc05eeaf5b0f279cb9b96e4..51196279ff0b728e2245d03c0a627218154b08bc 100755 (executable)
@@ -52,7 +52,6 @@ IN: reports.noise
         { nkeep 5 }\r
         { npick 6 }\r
         { nrot 5 }\r
-        { nslip 5 }\r
         { ntuck 6 }\r
         { nwith 4 }\r
         { over 2 }\r