Re: Sequence is funny !
- To: mathgroup at smc.vnet.net
- Subject: [mg8918] Re: [mg8852] Sequence is funny !
- From: seanross at worldnet.att.net
- Date: Thu, 2 Oct 1997 22:57:14 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Gilles BARBIER wrote: > > For some people who like to understand the internal mechanism > of Mathematica, I give them this little problem a friend sent to me : > > Why Table[i,{i,Sequence[1,3]}] gives {1,2,3,4} instead of {1,2,3} !! > > That's not a bug, I even have an explanation,if you are interested. > > Hope it's fun, > > Gilles. I have no explanation, but I will throw some more information into the pot. Table[i,{i,Sequence[1,n]}] returns {1,2,3...,n+1} Table[i,{i,1,n}] returns {1,2,3,...n} Table[i,{i,Sequence[0,n]}] returns {1,2,3,...n} Table[i,{i,0,n}] returns {0,1,2,3...n} Since Sequence is advertised as: "Sequence[expr1, expr2, ... ] represents a sequence of arguments to be spliced automatically into any function." The above behavior IS a bug in my opinion regardless of how you can explain it with internal structure etc. The command does not do as advertised=> a bug.