Condition and RuleDelayed
This was somewhat too long for a comment. Not sure it answers the question but it might give a way of thinking about the elusive handling of Condition
that proves helpful.
The behavior in question is fairly well documented (I think people know this, I just wanted to state it for the record). The general idea to RuleDelayed
is that it fires on a match and delivers its rhs. The devil in the details can be broken into two questions. (1) What comprises a match? (2) What is the evaluation of the rhs?
When Condition
is present on the rhs we do get into some murky semantics issues. The gist is that it is part of what determines whether there is a match, which is to say that the lhs alone does not suffice (I believe this is the only exception to the general rule that the lhs determines a match). As for what is the evaluated rhs, if the Condition
is True
then the rhs is what preceded that condition. If it is not True
then the issue is moot because the delayed rule is not going to fire. Which is the point of having this construct to begin with.