[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sub conditionals_true_when (@@) [PATCH]
From: |
Raja R Harinath |
Subject: |
Re: sub conditionals_true_when (@@) [PATCH] |
Date: |
14 Jun 2001 17:49:35 -0500 |
User-agent: |
Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.0.103 |
Richard Boulton <address@hidden> writes:
[snip]
> (ii) is fixed by redefining the behaviour of conditionals_true_when() such
> that it returns TRUE if all the @CONDS are true for a condition in @WHENS.
> The behaviour when WHENS is empty is also altered to be more logical (this
> is where the FIXME is fixed).
>
> This should not affect any other code since conditionals_true_when() is
> only called with an array of size != 1 in @WHENS by
> variable_conditions_reduce().
I would suggest that you keep the semantics of conditions_true_when()
as is, and introduce
sub redundant_condition ($@)
{
my ($cond, @when) = @_;
foreach my $when (@when)
{
return 1 if condition_true_when ($cond, $when);
}
return 0;
}
and use this in variable_conditions_reduce.
So, I think it's cleaner to do:
1. conditions_true_when(\@@) -- takes a list of conditions and one
or more "whens", and returns true when all conditions are true
for all whens.
2. redundant_condition($@) -- check if the given condition
subsumed by any of the whens.
3. change 'variable_conditions_reduce' to use 'redundant_condition',
along with your modification to look at the tail of @conds too.
- Hari
--
Raja R Harinath ------------------------------ address@hidden
"When all else fails, read the instructions." -- Cahn's Axiom
"Our policy is, when in doubt, do the right thing." -- Roy L Ash