RE: M.Trott
- To: MathGroup at yoda.physics.unc.edu
- Subject: RE: M.Trott
- From: reiszig at e-technik.tu-dresden.dbp.de
- Date: Tue, 6 Apr 1993 13:47:20 +0200
Hi,
Michael Trott asked why
(1) {a,b}/.{x___,a,y___}:> Print[z;x]
prints "z" but
(2) {a,b}/.{x___,a,y___}:> Print[z;xx]
prints "xx".
That is because while applying the 1st rule, x is assigned
the actual value of x___, namely a sequence of length 0 (I
guess: Sequence[]).
CompoundExpression[z, Sequence[]] seems to become always z, so Print[z;x] in
(1) becomes Print[z]:
LogBook V. 1.2 opened (OpenWrite) for In and Out 1993-04-05 18:45:32
Mma-Version: 386 2.1 (July 21, 1992)
Operating System: MSDOS (386)
Packages: {Global`, System`}
In[3]:= {a,b}/.{x___,a,y___}:> Print[z;x]
z (* Printed *)
In[4]:= CompoundExpression[ z,Sequence[]]
Out[4]= z
In[5]:= FullForm[z;Sequence[]]
Out[5]//FullForm= z
In[6]:= CloseLog[];
LogBook V. 1.2 closed 1993-04-05 18:45:33
Gunther Reiszig