Permalink
Browse files

sequences.generalizations: adding "nall?".

  • Loading branch information...
mrjbq7 committed Sep 27, 2012
1 parent 061a4c6 commit 70fcdb856baadb34df34d7da5b90aa3be0997747
@@ -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
@@ -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
@@ -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

0 comments on commit 70fcdb8

Please sign in to comment.