Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2003

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

Search the Archive

Re: New version, old bugs

  • To: mathgroup at
  • Subject: [mg44127] Re: [mg44093] New version, old bugs
  • From: Andrzej Kozlowski <akoz at>
  • Date: Thu, 23 Oct 2003 07:16:01 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

On Wednesday, October 22, 2003, at 04:24 PM, Maxim wrote:

>  For example:
> In[1]:=
> 2*x*y /. x*y -> z
> 2*x*y /. s:x*y -> z
> Out[1]=
> 2*z
> Out[2]=
> 2*x*y

As I am sure you realize, this problem (like all other pattern matching 
problem I remember your pointing out), is connected with the Flat 
attribute (of Times)

f[w, f[u, v]] /. s:f[u, v] -> z

f[w, z]

SetAttributes[f, Flat]

f[w, f[u, v]] /. s:f[u, v] -> z

f[w, u, v]

I have a feeling that there are very few people at WRI who would want 
to mess with the Flat attribute. I can't say I blame them: the more I 
think about it the more surprised I am it works as well as it does.

Andrzej Kozlowski
Yokohama, Japan

  • Prev by Date: NSolve and SplineFit
  • Next by Date: Re pdf-export
  • Previous by thread: New version, old bugs
  • Next by thread: Re: New version, old bugs