Mathematica 9 is now available
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: 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


  • Prev by Date: Integrate got slower in Version 3.0/Example
  • Next by Date: Re: Re: Sequence is funny !
  • Previous by thread: Re: Sequence is funny !
  • Next by thread: Re: Re: Sequence is funny !