MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How do you take apart a sequence?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg102049] Re: [mg102030] How do you take apart a sequence?
  • From: "David Park" <djmpark at comcast.net>
  • Date: Mon, 27 Jul 2009 06:53:31 -0400 (EDT)
  • References: <17567590.1248688813131.JavaMail.root@n11>

Sequence is meant to splice arguments into some function. Part is a function
so when you splice you obtain:

Part[Sequence[3,5],1] goes to Part[3,5,1].

This means you are looking for the 1st part of the 5th part of the Integer
3. But 3 has no parts so you obtain an error message.

You could use:

Unevaluated[Sequence[3, 5]][[1]]
3


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/  




From: zslevi [mailto:zslevi at gmail.com] 

In[75]:=
b[3, 5, 7][[1]]

Out[75]= 3

In[77]:= Sequence[3, 5][[1]]

During evaluation of In[77]:= Part::partd: Part specification \
3[[5,1]] is longer than depth of object. >>

Out[77]= 3[[5, 1]]

I'm new to Mathematica.
Is there a way to take apart a sequence?




  • Prev by Date: Re: Re: Show doesn't work inside Do loop ?
  • Next by Date: How to group the graph
  • Previous by thread: Re: How do you take apart a sequence?
  • Next by thread: Re: How do you take apart a sequence?