From 01f7f6b76c48e300731806f3ed51f42722e540f7 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Wed, 14 Feb 2018 11:23:03 -0800 Subject: [PATCH] sequences: moving none? to core. --- core/sequences/sequences-docs.factor | 4 ++++ core/sequences/sequences.factor | 3 +++ extra/sequences/extras/extras.factor | 3 --- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/core/sequences/sequences-docs.factor b/core/sequences/sequences-docs.factor index af69bbebd9..1c8dcf80c0 100644 --- a/core/sequences/sequences-docs.factor +++ b/core/sequences/sequences-docs.factor @@ -546,6 +546,10 @@ HELP: any? { $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 } "." } ; +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? { $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 } "." } ; diff --git a/core/sequences/sequences.factor b/core/sequences/sequences.factor index e40e90cc48..67b20a5886 100644 --- a/core/sequences/sequences.factor +++ b/core/sequences/sequences.factor @@ -654,6 +654,9 @@ PRIVATE> : any? ( ... seq quot: ( ... elt -- ... ? ) -- ... ? ) find drop >boolean ; inline +: none? ( ... seq quot: ( ... elt -- ... ? ) -- ... ? ) + any? not ; inline + : member? ( elt seq -- ? ) [ = ] with any? ; diff --git a/extra/sequences/extras/extras.factor b/extra/sequences/extras/extras.factor index bf49f8c4d5..83febd65f7 100644 --- a/extra/sequences/extras/extras.factor +++ b/extra/sequences/extras/extras.factor @@ -355,9 +355,6 @@ PRIVATE> : unsurround ( newseq seq2 seq3 -- seq1 ) [ ?head drop ] [ ?tail drop ] bi* ; -: none? ( ... seq quot: ( ... elt -- ... ? ) -- ... ? ) - any? not ; inline - : one? ( ... seq quot: ( ... elt -- ... ? ) -- ... ? ) [ find ] 2keep rot [ [ 1 + ] 2dip find-from drop not -- 2.34.1