Re: Problem with evaluation of delayed rules
- To: mathgroup at smc.vnet.net
- Subject: [mg21891] Re: Problem with evaluation of delayed rules
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Wed, 2 Feb 2000 22:54:47 -0500 (EST)
- References: <85mkef$1og@smc.vnet.net> <86bkpr$b3o@smc.vnet.net> <86rdbh$fje$2@dragonfly.wolfram.com> <870ufj$8js@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Eckhard, >Can I rely on the (undocumented) function RuleCondition to be available in > future versions of Mathematica? Of course and only Wolfram could say for sure, and some caution is advisable. The use of Condition with Block and With is mentioned in the Help Browser but no indication of the working is given, so we might also ask whether the features that are used in the posting are permanent. RuleCondition seems useful enough to be upgraded to a regular built in function even if the implemetations of Block and With etc. are changed. Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565 "Eckhard Hennig" <hennig at itwm.uni-kl.de> wrote in message news:870ufj$8js at smc.vnet.net... > > Allan Hayes schrieb in Nachricht <86rdbh$fje$2 at dragonfly.wolfram.com>... > > >Investigating the Trott-Strzebonski method for In-Place Evaluation (see > >Robby Villegas: > >http://library.wolfram.com/conferences/devconf99/villegas/UnevaluatedExpres > s > >ions.nb) > >Lead me to > > > >If[x > 0, Difference[1, 2], Difference[3, 4]] /. Difference[x_, y_] :> > > Block[{}, symbols[[x]] - symbols[[y]] /; True] > > > >If[x > 0, a - b, c - d] > > > >And tracing the evaluation of this shows that the main work is done by the > >internal function RuleCondition. > > > >If[x > 0, Difference[1, 2], Difference[3, 4]] /. Difference[x_, y_] :> > > RuleCondition[symbols[[x]] - symbols[[y]], True] > > > >If[x > 0, a - b, c - d] > > > >So it seems that, as with Hartmut Wolf's solution, we need to wrap the > right > >side of the rules appropriately. > > > Allan, > > thank you very much for your help and for the pointer to the article by > Villegas. The above solution works perfectly. Just one further question: Can > I rely on the (undocumented) function RuleCondition to be available in > future versions of Mathematica? (I suppose that this will be the case, but I > just want to make this sure.) > > Best regards, > > Eckhard > > ----------------------------------------------------------- > Dipl.-Ing. Eckhard Hennig mailto:hennig at itwm.uni-kl.de > Institut fuer Techno- und Wirtschaftsmathematik e.V. (ITWM) > Erwin-Schroedinger-Strasse, 67663 Kaiserslautern, Germany > Voice: +49-(0)631-205-3126 Fax: +49-(0)631-205-4139 > http://www.itwm.uni-kl.de/as/employees/hennig.html > > ITWM - Makers of Analog Insydes for Mathematica > http://www.itwm.uni-kl.de/as/products/ai > ----------------------------------------------------------- > > > >