Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1997
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1997

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

Search the Archive

Re: Any uses for SequenceHold ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg7586] Re: Any uses for SequenceHold ?
  • From: Roman Maeder <maeder at mathconsult.ch>
  • Date: Thu, 19 Jun 1997 03:13:49 -0400 (EDT)
  • Organization: MathConsult Dr. R. Mäder
  • Sender: owner-wri-mathgroup at wolfram.com

David B. Wagner wrote:
> ...
> > 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. :-)

If you had read *my* book, you'd know that there exists an efficient
way to do it in 2.2 :-)

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

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

Roman Maeder

-----------------------------------------------------------------------
MathConsult Dr. R. Mäder                   Aryanastrasse 21
Mathematik- und Informatik-Beratung        CH-8704 Herrliberg

T: +41-1-991 6343                          mailto:maeder at mathconsult.ch
F: +41-1-991 6345                          http://www.mathconsult.ch
-----------------------------------------------------------------------


  • Prev by Date: stop when not converge
  • Next by Date: Book on logic using Mma
  • Previous by thread: Re: Any uses for SequenceHold ?
  • Next by thread: Creating table with multiple lists