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 -----------------------------------------------------------------------