MathGroup Archive 1994

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

Search the Archive

Re: Unexpected RepeatNull behaviour. BUG?

  • To: mathgroup at yoda.physics.unc.edu
  • Subject: Re: Unexpected RepeatNull behaviour. BUG?
  • From: withoff (David Withoff)
  • Date: Thu, 3 Mar 1994 19:24:52 -0600

> In...	Mathematica 2.2 for SGI
> 	Copyright 1988-93 Wolfram Research, Inc.
> 	 -- Motif graphics initialized -- 
> 
> If I define...
> 
> 	In[253]:= Clear[foo]; foo[l:_Integer...] := {l};
> 
> then it works as expected...
> 
> 	In[254]:= foo[1,2,3]
> 	Out[254]= {1, 2, 3}
> 
> 	In[255]:= foo[1]
> 	Out[255]= {1}
> 
> except for...
> 
> 	In[256]:= foo[]
> 	Out[256]= foo[]
> 
> Maybe I'm missing something obvious, but why does
> 
> 	In[257]:= Clear[foo]; foo[l:(_Integer|AnyThing)...] := {l};
> 
> 	In[258]:= foo[1]
> 	Out[258]= {1}
> 
> 	In[259]:= foo[]
> 	Out[259]= {}
> 
> work!!?  Please enlighten.

You are not missing anything.  The RepeatedNull pattern has
only been implemented for a limited number of cases. It is
hoped that this deficiency can be correct this for a future
release.

In the meantime, the effect of the RepeatedNull pattern can always
be simulated using other methods, such as by using a separate rule
for the pattern with no elements.  This approach is klunkier than
RepeatedNull, but it works.

Dave Withoff
Research and Development
Wolfram Research





  • Prev by Date: Improper Integral
  • Next by Date: Re: Help.... Unable to open FeynArts.m
  • Previous by thread: Improper Integral
  • Next by thread: digital logic circuits