Re: The uses of Condition (/;)
- To: mathgroup at smc.vnet.net
- Subject: [mg82954] Re: The uses of Condition (/;)
- From: Thomas E Burton <tburton at brahea.com>
- Date: Sun, 4 Nov 2007 06:15:17 -0500 (EST)
Assuming that you mean (as in your examples for testing)
A. pattern /; condition := definition
I think A & B do yield the same results.
Despite the fact that Condition has a higher Precedence than
SetDelayed and RuleDelayed, Condition seems to apply itself the
entire assignment or rule, not just the definition. Perhaps the
documentation emphasizes both A and B to bring out this somewhat
unexpected behavior.
> According to the documentation, /; can be used in three different
> ways, illustrated below:
>
> A. pattern /; condition = definition
>
> B. pattern := definition /; condition
>
> C. pattern := Module[{}, definition /; condition]