Re: Re: New version, new bugs
- To: mathgroup at smc.vnet.net
- Subject: [mg43192] Re: [mg43175] Re: New version, new bugs
- From: Andrzej Kozlowski <andrzej at platon.c.u-tokyo.ac.jp>
- Date: Mon, 18 Aug 2003 02:50:51 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
On Saturday, August 16, 2003, at 06:22 PM, Andrzej Kozlowski wrote: >> > On Saturday, August 16, 2003, at 08:53 AM, Maxim wrote: > >> Using Unique is a very useful suggestion, especially when there are >> twenty >> pattern variables and some of them already have values assigned. > Using Unique may not be a perfect solution, but it took me about two > seconds to think of it, which shows something about what I called the > flexibility of Mathematica. I can actually think of some other ways, > but as you say it would be pointless to list them here. On second thoughts I have decided to post one way of using Unique that avoids Maxim's objections (when there is a large number of pattern variables), not as a "workaround", because there is obviously no need for one, but as a possibly interesting example of using pattern matching to manipulate patterns: f=(f = #1 /. { x_, y_} :> Refine[Sign[{x, y}], #2] &)/.Thread[Cases[f,x__Pattern:> First[x],Infinity]- >Map[Unique,Cases[f,x__Pattern:>First[x],Infinity]]]; f[{y, x}, y > 0 && x < 0] {1,-1} There are of course also lots of pretty obvious ways of dealing with the problem of the pattern variables having assigned value.