procmail
[Top] [All Lists]

Re: what does 1^0 mean ?

2001-12-22 16:15:33
Don Hammond wrote,

| I made an assumption that the simple
| example that parv_ gave might be just that -- a simple example -- and
| was thinking of something that could be extended to more complex and
| related sets of recipes.

That's why I said that there is (to my knowledge) no general answer.

Well, I can think of one, but it's limited to ten conditions, and tricks
with the supremum or the infemum are more efficient (if less legible).  What
I'm thinking is that each condition could score a power of ten, and then the
total score will be, if not zero, a string of ones and zeroes starting with
a one.  To use parv_'s example again, which was to do the action if A and B
are both true, or if C, D, or E is true,

 :0 flags
 * 1^0 A
 * 10^0 B
 * 100^0 C
 * 1000^0 D
 * 10000^0 E
 { }

 score = $=

 :0
 * score ?? (1....|1...|1..|11)^^
 action

Again, while the approach is very adaptable, it is far less efficient than
what I posted before.  Note that testing for a 0 in a given position to make
sure that a specific condition didn't match is awkward, because if there is
no 1 anywhere to the left of that place there will be no digit there at all,
so [possibly with exceptions, but I can't think of any] it's better to
negate the condition and test for a 1.

(The last recipe's condition can be reduced to this:

 * score ?? 1..|11

but then we're getting far from the general case.)



_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>