|
[Date Index]
[Thread Index]
[Author Index]
RE: Reevaluation of conditional arguments when the condition has changed
- To: mathgroup at smc.vnet.net
- Subject: [mg61077] RE: Reevaluation of conditional arguments when the condition has changed
- From: "David Park" <djmp at earthlink.net>
- Date: Sun, 9 Oct 2005 01:36:01 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
As would happen, that works for the example I gave, but not for my actual
case. Here is an example that more closely follows what I have.
fooQ[x_] := MatchQ[x, fooForms]
foo[a_ b_?fooQ] := a foo[b]
expr1 = foo[a b]
giving: foo[a,b]
Now define b as one of the fooForms.
fooForms = b;
foo[a b]
giving: a foo[b]
expr1
giving: foo[a b] that is, not evaluating.
But...
fooForms = None;
expr1 = foo[g[a]b]
giving: foo[b g[a]]
Now define b as one of the fooForms AND give a definition for g.
fooForms = b;
g[x_] := x^2
foo[g[a]b]
giving: a^2*foo[b]
expr1
giving: a^2*foo[b]
Putting in a definition for g did force evaluation, but the changed
condition alone does not.
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: wouter meeussen [mailto:wouter.meeussen at pandora.be]
To: mathgroup at smc.vnet.net
replace "fooQ[b] := True" by "fooQ[b] ^= True"
This attaches the rule to b, not to fooQ.
W.
Prev by Date:
RE: Plot with 10E10 instead of 1*10E10
Next by Date:
RE: Reevaluation of conditional arguments when the condition has changed
Previous by thread:
Re: Re: Reevaluation of conditional arguments when the condition has changed
Next by thread:
RE: Reevaluation of conditional arguments when the condition has changed
|