sequences.generalizations: adding "nall?".

db4
John Benediktsson 2012-09-27 11:42:09 -07:00
parent 608bedd208
commit 3abc7a9500
3 changed files with 11 additions and 0 deletions

View File

@ -114,6 +114,10 @@ HELP: nmap-reduce
{ $values { "map-quot" { $quotation "( element... -- intermediate )" } } { "reduce-quot" { $quotation "( prev intermediate -- next )" } } { "n" integer } }
{ $description "A generalization of " { $link map-reduce } " that can be applied to any number of sequences." } ;
HELP: nall?
{ $values { "seqs... " { $snippet "n" } " sequences on the datastack" } { "quot" { $quotation "( element... - ? )" } } { "n" integer } }
{ $description "A generalization of " { $link all? } " that can be applied to any number of sequences." } ;
ARTICLE: "sequences.generalizations" "Generalized sequence words"
"The " { $vocab-link "sequences.generalizations" } " vocabulary defines generalized versions of various sequence operations."
{ $subsections

View File

@ -136,3 +136,7 @@ D4d$
{ 45 } [
{ 1 2 3 } { 4 5 6 } { 7 8 9 } [ + + ] [ + ] 3 nmap-reduce
] unit-test
{ t } [
{ 1 3 5 } { 2 4 6 } { 4 8 12 } [ + + odd? ] 3 nall?
] unit-test

View File

@ -121,3 +121,6 @@ MACRO: nmap-reduce ( map-quot reduce-quot n -- quot )
[ [ first ] _ napply @ 1 ] _ nkeep
_ _ (neach) (each-integer)
] ;
: nall? ( seqs... quot n -- )
(neach) all-integers? ; inline