Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Any uses for SequenceHold ?
Replies: 2   Last Post: Jun 18, 1997 10:01 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Roman Maeder

Posts: 8
Registered: 12/4/04
Re: Any uses for SequenceHold ?
Posted: Jun 18, 1997 10:01 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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@mathconsult.ch
F: +41-1-991 6345 http://www.mathconsult.ch
-----------------------------------------------------------------------





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.