MathGroup Archive 2002

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

Search the Archive

Re: Obtaining sequences from lists of lists

  • To: mathgroup at smc.vnet.net
  • Subject: [mg36236] Re: Obtaining sequences from lists of lists
  • From: Bill Rowe <listuser at earthlink.net>
  • Date: Tue, 27 Aug 2002 02:08:02 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 8/26/02 at 4:15 AM, rdobrow at carleton.edu (Bob) wrote:

>If I have an n-element list, (say where each element is itself a
>list), such as {{a,b}, {a,b}, {a,b}} is there a way to strip off the
>outermost nesting of the list to obtain just a sequence of of these n
>elements, that is {a,b},{a,b},{a,b} so that I can use this for input
>for some function.

Try Sequence@@ as in the following:

In[1]:=
x={{a,b},{a,b},{a,b}};

In[2]:=
g[x_,y_,z_]:=x(y.z)

In[3]:=
g[Sequence@@x]

Out[3]=
\!\({a\ \((a\^2 + b\^2)\), b\ \((a\^2 + b\^2)\)}\)


  • Prev by Date: Re: Generate all k-tuples
  • Next by Date: RE: How to use inversefunction
  • Previous by thread: Obtaining sequences from lists of lists
  • Next by thread: RE: Obtaining sequences from lists of lists