MathGroup Archive 1995

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

Search the Archive

Correction: Function with attributes Flat and OneIdentity

  • To: mathgroup at christensen.cybernetics.net
  • Subject: [mg1112] Correction: Function with attributes Flat and OneIdentity
  • From: villegas (Robert Villegas)
  • Date: Mon, 15 May 1995 00:41:42 -0400
  • Organization: Wolfram Research, Inc.

I wrote:

> I do remember seeing one or two strange things when I was in tech support,
> though (regarding Flat and OneIdentity I think), so there might be points
> that I'll miss.

I did miss a point all right, but it was because I forgot about the usage
in the page after the one I cited in Maeder!


This statement was wrong:

> It [OneIdentity] affects only matching of other rewrite rules, and it
> doesn't play alone, it is really there to specify which way Flat should
> go in one case.

The part about it not playing alone is wrong.  As Maeder says on p. 151,
you can use OneIdentity with Default to use patterns with optional
arguments, like x_ + y_. for Plus.

Here's the example from Maeder:

In[1]:= Attributes[q] = OneIdentity

Out[1]= OneIdentity

In[2]:= Default[q] = 18

Out[2]= 18

In[3]:= g[ q[x_, y_.] ] := {x, y}

In[4]:= g[a]

Out[4]= {a, 18}


Robby Villegas


  • Prev by Date: Bivariate Normal Probs.
  • Next by Date: Re: Optica?
  • Previous by thread: Bivariate Normal Probs.
  • Next by thread: DSolveConstants problem