Wolfram ResearchPRODUCTSPURCHASEFOR USERSCOMPANYOUR SITES
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Previous section-----Next section

2.2.11 Sequences

The function Flatten allows you to explicitly flatten out all sublists.

In[1]:=  Flatten[{a, {b, c}, {d, e}}]

Out[1]=

FlattenAt lets you specify at what positions you want sublists flattened.

In[2]:=  FlattenAt[{a, {b, c}, {d, e}}, 2]

Out[2]=

Sequence objects automatically get spliced in, and do not require any explicit flattening.

In[3]:=  {a, Sequence[b, c], Sequence[d, e]}

Out[3]=

Sequence[ ,  , ... ] a sequence of arguments that will automatically be spliced into any function

Representing sequences of arguments in functions.
Sequence works in any function.

In[4]:=  f[Sequence[a, b], c]

Out[4]=

This includes functions with special input forms.

In[5]:=  a Equal Sequence[b, c]

Out[5]=

Here is a common way that Sequence is used.

In[6]:=  {a, b, f[x, y], g[w], f[z, y]} /. f->Sequence

Out[6]=


Any questions about topics on this page? Click here to get an individual response.Buy NowFree TrialMore Information



 © 2009 Wolfram Research, Inc.  Terms of Use  Privacy Policy |
Sign up for our newsletter: