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: [mg36216] Re: [mg36168] Obtaining sequences from lists of lists
  • From: Richard Palmer <mapsinc at bellatlantic.net>
  • Date: Tue, 27 Aug 2002 02:07:24 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

The trick is to use the Sequence Function.  Try the following code and you
will see how it works.

abcd = CharacterRange["a", "d"]
abcd1 = Flatten[Outer[{#1, #2} &, abcd, abcd], 1]
abcd2 = Outer[First[#]*Last[#] &, Sequence[abcd1], 1]

abcd2 uses the list of lists you have created to load as a sequence of
arguments to outer. You need the third argument to operate on the parts of
the list if this is your goal.

Read the description of Sequence.  It also works in contexts other than
Outer.

Regards,

Richard Palmer


On 8/26/02 4:15 AM, "Bob" <rdobrow at carleton.edu> wrote:

> Can anyone help me with this problem.
> 
> 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.
> 
> I would like to do something like
> Outer[SomeFunction, Table[{a,b},{N} ]] where I can enter N
> dynamically.
> The problem, of course, is that the output of the Table command is one
> big list
> and Outer is expecting a sequence of N separate lists after
> SomeFunction.
> 
> Thanks for your help in advance.
> 



  • Prev by Date: Re: a question about pattern replacements
  • Next by Date: Re: Functions with vector arguments
  • Previous by thread: Re: Obtaining sequences from lists of lists
  • Next by thread: RE: Obtaining sequences from lists of lists