remove unused ntuck generalization, and rewrite napply not to use tuck

db4
Joe Groff 2009-11-05 16:12:13 -06:00
parent 6e9d369331
commit 9ec0c3e923
2 changed files with 2 additions and 12 deletions

View File

@ -332,12 +332,6 @@ HELP: nappend-as
{ nappend nappend-as } related-words { nappend nappend-as } related-words
HELP: ntuck
{ $values
{ "n" integer }
}
{ $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." } ;
ARTICLE: "sequence-generalizations" "Generalized sequence operations" ARTICLE: "sequence-generalizations" "Generalized sequence operations"
{ $subsections { $subsections
narray narray
@ -357,7 +351,6 @@ ARTICLE: "shuffle-generalizations" "Generalized shuffle words"
-nrot -nrot
nnip nnip
ndrop ndrop
ntuck
mnswap mnswap
nweave nweave
} ; } ;

View File

@ -71,9 +71,6 @@ MACRO: ndrop ( n -- )
MACRO: nnip ( n -- ) MACRO: nnip ( n -- )
'[ [ _ ndrop ] dip ] ; '[ [ _ ndrop ] dip ] ;
MACRO: ntuck ( n -- )
2 + '[ dup _ -nrot ] ;
MACRO: ndip ( n -- ) MACRO: ndip ( n -- )
[ [ dip ] curry ] n*quot [ call ] compose ; [ [ dip ] curry ] n*quot [ call ] compose ;
@ -112,8 +109,8 @@ MACRO: cleave* ( n -- )
[ 1 - [ [ [ keep ] curry ] dip compose ] n*quot [ call ] compose ] [ 1 - [ [ [ keep ] curry ] dip compose ] n*quot [ call ] compose ]
if-zero ; if-zero ;
MACRO: napply ( n -- ) : napply ( quot n -- )
[ [ drop ] ] dip [ '[ tuck _ 2dip call ] ] times ; [ dupn ] [ spread* ] bi ; inline
: apply-curry ( ...a quot n -- ) : apply-curry ( ...a quot n -- )
[ [curry] ] dip napply ; inline [ [curry] ] dip napply ; inline