Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: a problem applying Rule




N Monomachoff wrote:

> Hi there,
> I'm using 3.0.
>
> g[f[f[],a]] /. (n:(f | g))[f[],x__] -> n[f[]] evaluates properly as
> g[f[f[]]].
> But after
> SetAttributes[f,Orderless]
> it no longer works. This doesn't make much sense to me. Is this a bug or
> a feature? And is there a way around this? Thanks for any help,
> nmonomachoff@msn.com

After

SetAttributes[f,Orderless]

The evaluation of

g[f[f[],a]] /. (n:(f | g))[f[],x__] -> n[f[]]

goes through

g[f[a,f[]]] /. (n:(f | g))[f[],x__] -> n[f[]]

hence the result.


Is

g[f[f[],a]] /. (n:(f | g))[u___,f[],x___] -> n[f[]]

g[f[f[]]]

of any use?

--
Allan Hayes
Training and Consulting
Leicester, UK
hay@haystack.demon.co.uk
http://www.haystack.demon.co.uk
voice: +44 (0)116 271 4198
fax: +44 (0)116 271 8642





  • Prev by Date: How to draw several curves in different boxes ?
  • Next by Date: Re: writing to a file
  • Prev by thread: Re: a problem applying Rule
  • Next by thread: Mathematica 2.2.2 in Windows 95