in reply to Filter objects?

You'll find more about filtering in functional programming languages like LISP than in object-oriented languages. If I understand you correctly, what you call a 'cassette' is what is generally called a predicate--a function that returns true or false.

In Perl you can apply a predicate to a list using the "grep" function and you get back all the things in the list that the predicate classifies as "true". E.g.

perl -le 'print join " ", grep { $_ > 4 } (1,7,2,6,3,5,4)'
prints "7 6 5".

In other languages, this function (or its inverse) may be called "find_all", "filter", "select", "remove-if", or "reject". I don't know of any general framework for an XML syntax for the predicates or the filters, though

Replies are listed 'Best First'.
Re: Re: Filter objects?
by Anonymous Monk on Jan 29, 2003 at 09:01 UTC
    Thanks for the grep code. I have tried a variation on you code as follows:
    perl -le 'print join " ", grep { $_ =~ /start4/ | $_ =~ /end7/ } (st +art4,end7)'
    How would you advance on this to produce a condition of print if the end position minus the start position is greater than 3?
      I have answered the question myself.
      perl -le '$a = join " ", grep { $_ == 4 } (4); $b = join " ", grep { + $_ == 7 } (7); $c = $b-$a; print $c;'