 { $description "Applies the quotation to each element in turn, and removes elements for which the quotation outputs a false value." }
 { $side-effects "seq" } ;
 
-{ filter filter-as filter! } related-words
-
 HELP: reject
 { $values { "seq" sequence } { "quot" { $quotation ( ... elt -- ... ? ) } } { "subseq" "a new sequence" } }
 { $description "Applies the quotation to each element in turn, and outputs a new sequence removing with the elements of the original sequence for which the quotation output a true value." } ;

    each-index
    reduce
    interleave
    replicate
    replicate-as
}
"Mapping:"
{ $subsections

$nl
"The first element of the output sequence is " { $snippet "identity" } ". Then, on the first iteration, the two inputs to the quotation are " { $snippet "identity" } " and the first element of the input sequence. On successive iterations, the first input is the result of the previous iteration, and the second input is the next element of the input sequence."
$nl
"When given the empty sequence, outputs a new empty sequence together with the " { $snippet "identity" } "." }
{ $notes "May be named " { $snippet "scan" } " or " { $snippet "prefix sum" } " in other languages." } ;

HELP: accumulate
{ $values { "seq" sequence } { "identity" object } { "quot" { $quotation ( ... prev elt -- ... next ) } } { "final" "the final result" } { "newseq" "a new sequence" } }
