]> gitweb.factorcode.org Git - factor.git/commitdiff
remove unused ntuck generalization, and rewrite napply not to use tuck
authorJoe Groff <arcata@gmail.com>
Thu, 5 Nov 2009 22:12:13 +0000 (16:12 -0600)
committerJoe Groff <arcata@gmail.com>
Thu, 5 Nov 2009 22:12:13 +0000 (16:12 -0600)
basis/generalizations/generalizations-docs.factor
basis/generalizations/generalizations.factor

index b04d0c53fbd3b2fbcffccf6d5df1021470a56e77..ef6c3767035f7dc24a83b05bac3864b0cf24a7fe 100644 (file)
@@ -332,12 +332,6 @@ HELP: nappend-as
 \r
 { nappend nappend-as } related-words\r
 \r
-HELP: ntuck\r
-{ $values\r
-     { "n" integer }\r
-}\r
-{ $description "A generalization of " { $link tuck } " that can work for any stack depth. The top item will be copied and placed " { $snippet "n" } " items down on the stack." } ;\r
-\r
 ARTICLE: "sequence-generalizations" "Generalized sequence operations"\r
 { $subsections\r
     narray\r
@@ -357,7 +351,6 @@ ARTICLE: "shuffle-generalizations" "Generalized shuffle words"
     -nrot\r
     nnip\r
     ndrop\r
-    ntuck\r
     mnswap\r
     nweave\r
 } ;\r
index dbbfc7354e1091e92352c9d76e2c33284cd129e0..6c8a0b5fdecf9558538ead28593a5d2904c3bba0 100644 (file)
@@ -71,9 +71,6 @@ MACRO: ndrop ( n -- )
 MACRO: nnip ( n -- )
     '[ [ _ ndrop ] dip ] ;
 
-MACRO: ntuck ( n -- )
-    2 + '[ dup _ -nrot ] ;
-
 MACRO: ndip ( n -- )
     [ [ dip ] curry ] n*quot [ call ] compose ;
 
@@ -112,8 +109,8 @@ MACRO: cleave* ( n -- )
     [ 1 - [ [ [ keep ] curry ] dip compose ] n*quot [ call ] compose ] 
     if-zero ;
 
-MACRO: napply ( n -- )
-    [ [ drop ] ] dip [ '[ tuck _ 2dip call ] ] times ;
+: napply ( quot n -- )
+    [ dupn ] [ spread* ] bi ; inline
 
 : apply-curry ( ...a quot n -- )
     [ [curry] ] dip napply ; inline