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: [mg102077] Re: How do you take apart a sequence?
  • From: Helen Read <hpr at together.net>
  • Date: Wed, 29 Jul 2009 05:06:59 -0400 (EDT)
  • References: <h4jtdr$3fo$1@smc.vnet.net> <h4juht$4g0$1@smc.vnet.net>
  • Reply-to: HPR <read at math.uvm.edu>

zslevi wrote:
> On Jul 27, 11:52 am, zslevi <zsl... at gmail.com> wrote:
>> 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?
> 
> I guess I found the answer: you make it to a list with wrapping {}
> around, and if you need to make a list to a sequence, then use Apply.

I'm not sure why you would go to the trouble. If you want the list 
{3,5}, why not just enter it that way to begin with, instead of the 
ungainly {Sequence[3,5]}?

For creating longer lists, Table is useful. For example:

a[n_] := 2^n;
Table[a[n], {n, 0, 15}]

-- 
Helen Read
University of  Vermont


  • Prev by Date: Re: How to group the graph
  • Next by Date: Re: How to group the graph
  • Previous by thread: Re: How do you take apart a sequence?
  • Next by thread: curve