Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Re: Unwanted Recursion

  • To: mathgroup at smc.vnet.net
  • Subject: [mg120099] Re: Unwanted Recursion
  • From: David Bailey <dave at removedbailey.co.uk>
  • Date: Fri, 8 Jul 2011 04:53:33 -0400 (EDT)
  • References: <iv1a95$sjl$1@smc.vnet.net> <iv45tf$f6i$1@smc.vnet.net>

On 07/07/2011 12:39, David Bailey wrote:
> In[649]:= p[a_]:=a;
>
> In[650]:= p[a]
>
> Out[650]= a
>
Sorry, I didn't notice that you had used the Flat attribute. I suggest 
you use:

In[1]:= SetAttributes[p, {Flat, OneIdentity}]

In[4]:= p[a_] := a

In[5]:= p[b]

Out[5]= b

This works without any errors.

David Bailey
http://www.dbaileyconsultancy.co.uk



  • Prev by Date: Re: Bug 1+4/10
  • Next by Date: Re: Stacked fractions
  • Previous by thread: Re: Unwanted Recursion
  • Next by thread: Re: Unwanted Recursion