MathGroup Archive 2005

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

Search the Archive

Re: Threading 'Append'

  • To: mathgroup at smc.vnet.net
  • Subject: [mg62840] Re: Threading 'Append'
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Tue, 6 Dec 2005 00:43:09 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

On 12/5/05 at 1:40 PM, jsiehler at Gmail.com (J Siehler) wrote:

>If I run

>Thread[Append[{{1,2},{3,4},{5,6}},{a,b,c}]]

>I would expect to get

>{{1,2,a},{3,4,b},{5,6,c}}

>but in fact I get an 'Objects of unequal length' error.

Try either

In[8]:=
Thread[Append[Transpose@{{1, 2}, {3, 4}, {5, 6}}, {a, b, c}]]

Out[8]=
{{1, 2, a}, {3, 4, b}, {5, 6, c}}

or

In[14]:=
MapThread[Append, {{{1, 2}, {3, 4}, {5, 6}}, {a, b, c}}]
Out[14]=
{{1, 2, a}, {3, 4, b}, {5, 6, c}}
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: Types in Mathematica thread
  • Next by Date: Re: Threading 'Append'
  • Previous by thread: Re: Threading 'Append'
  • Next by thread: Re: Threading 'Append'