sequences: moving none? to core.
parent
df9ddd1ddd
commit
01f7f6b76c
|
@ -546,6 +546,10 @@ HELP: any?
|
||||||
{ $values { "seq" sequence } { "quot" { $quotation ( ... elt -- ... ? ) } } { "?" boolean } }
|
{ $values { "seq" sequence } { "quot" { $quotation ( ... elt -- ... ? ) } } { "?" boolean } }
|
||||||
{ $description "Tests if the sequence contains an element satisfying the predicate, by applying the predicate to each element in turn until a true value is found. If the sequence is empty or if the end of the sequence is reached, outputs " { $link f } "." } ;
|
{ $description "Tests if the sequence contains an element satisfying the predicate, by applying the predicate to each element in turn until a true value is found. If the sequence is empty or if the end of the sequence is reached, outputs " { $link f } "." } ;
|
||||||
|
|
||||||
|
HELP: none?
|
||||||
|
{ $values { "seq" sequence } { "quot" { $quotation ( ... elt -- ... ? ) } } { "?" boolean } }
|
||||||
|
{ $description "Tests if the sequence does not contain any element satisfying the predicate, by applying the predicate to each element in turn until a true value is found. If the sequence is empty or if the end of the sequence is reached, outputs " { $link t } "." } ;
|
||||||
|
|
||||||
HELP: all?
|
HELP: all?
|
||||||
{ $values { "seq" sequence } { "quot" { $quotation ( ... elt -- ... ? ) } } { "?" boolean } }
|
{ $values { "seq" sequence } { "quot" { $quotation ( ... elt -- ... ? ) } } { "?" boolean } }
|
||||||
{ $description "Tests if all elements in the sequence satisfy the predicate by checking each element in turn. Given an empty sequence, vacuously outputs " { $link t } "." } ;
|
{ $description "Tests if all elements in the sequence satisfy the predicate by checking each element in turn. Given an empty sequence, vacuously outputs " { $link t } "." } ;
|
||||||
|
|
|
@ -654,6 +654,9 @@ PRIVATE>
|
||||||
: any? ( ... seq quot: ( ... elt -- ... ? ) -- ... ? )
|
: any? ( ... seq quot: ( ... elt -- ... ? ) -- ... ? )
|
||||||
find drop >boolean ; inline
|
find drop >boolean ; inline
|
||||||
|
|
||||||
|
: none? ( ... seq quot: ( ... elt -- ... ? ) -- ... ? )
|
||||||
|
any? not ; inline
|
||||||
|
|
||||||
: member? ( elt seq -- ? )
|
: member? ( elt seq -- ? )
|
||||||
[ = ] with any? ;
|
[ = ] with any? ;
|
||||||
|
|
||||||
|
|
|
@ -355,9 +355,6 @@ PRIVATE>
|
||||||
: unsurround ( newseq seq2 seq3 -- seq1 )
|
: unsurround ( newseq seq2 seq3 -- seq1 )
|
||||||
[ ?head drop ] [ ?tail drop ] bi* ;
|
[ ?head drop ] [ ?tail drop ] bi* ;
|
||||||
|
|
||||||
: none? ( ... seq quot: ( ... elt -- ... ? ) -- ... ? )
|
|
||||||
any? not ; inline
|
|
||||||
|
|
||||||
: one? ( ... seq quot: ( ... elt -- ... ? ) -- ... ? )
|
: one? ( ... seq quot: ( ... elt -- ... ? ) -- ... ? )
|
||||||
[ find ] 2keep rot [
|
[ find ] 2keep rot [
|
||||||
[ 1 + ] 2dip find-from drop not
|
[ 1 + ] 2dip find-from drop not
|
||||||
|
|
Loading…
Reference in New Issue