Re: Re: Sequence is funny !
- To: mathgroup at smc.vnet.net
- Subject: [mg8972] Re: [mg8904] Re: [mg8852] Sequence is funny !
- From: David Withoff <withoff>
- Date: Mon, 6 Oct 1997 01:59:41 -0400
- Sender: owner-wri-mathgroup at wolfram.com
> But there is something amusing I have found trying
> this with Do:
>
> If you ask for:
>
> In[3] := Do[ Print[i], {i,1,3}]
>
> 1
> 2
> 3
>
> but if you try
>
> In[4] := Do[ Print[i], {i,Sequence[1,-5,-2],10}]
>
> 1-5-2
>
> (without newlines between them)
There is one iteration in the Do loop because 10-Sequence[1,-5,-2]+1
evaluates to 1.
Print[Sequence[1,-5,-2]] becomes Print[1, -5, 2] which prints
with the elements concatenated together.
Dave Withoff
Wolfram Research