MathGroup Archive 1997

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

Search the Archive

Re: Any uses for SequenceHold ?


Ersek_Ted%PAX1A at mr.nawcad.navy.mil wrote:
> 
> Mma 3.0 has a new Attribute called SequenceHold.
> As far as I can tell this Attribute has no useful application.
> 
> However there are exactly nine built in functions
> that have this Attribute.    They are:
>     Rule
>     RuleDelayed
>     Set
>     SetDelayed
>     TagSet
>     TagSetDelayed
>     Timing
>     UpSet
>     UpSetDelayed
> 
> I used a method in Dave Wagner's book to get the above information.
> In what way would things fail to work if these function didn't have this
> Attribute?

Whether or not you find the following "useful"
is up to you.  Once upon a time I had a real application for this in 
2.2, I can't remember what it was though.

In[1]:=
{a,b,c}/.b->Sequence[b1,b2]

Out[1]=
{a,b1,b2,c}

> 
> How did ealier versions get by without SequenceHold?

You had to use an inefficient pattern like the following:

In[2]:=
{a,b,c}/.{prefix___,b,suffix___}->{prefix,b1,b2,suffix}

Out[2]=
{a,b1,b2,c}

Of course, since you've read my book, you know why the above is
inefficient. :-)

> 
>                Ted Ersek
>                ersek_ted%pax1a at mr.nawcad.navy.mil
-- 
		Dave Wagner
		Principia Consulting
		http://www.princon.com/princon/
		Voice: (500) PRN-CPIA or (303) 258-9178
		Fax:   (303) 258-3859


  • Prev by Date: AutoLoading Packages-License 2079-6702, Sean Ross
  • Next by Date: Re: Re: Just another bug in MMA 3.0
  • Previous by thread: Re: Any uses for SequenceHold ?
  • Next by thread: Re: Any uses for SequenceHold ?