MathGroup Archive 2005

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

Search the Archive

Re: Threading 'Append'

  • To: mathgroup at smc.vnet.net
  • Subject: [mg62841] Re: [mg62796] Threading 'Append'
  • From: <bsyehuda at Gmail.com>
  • Date: Tue, 6 Dec 2005 00:43:10 -0500 (EST)
  • References: <200512051840.NAA21108@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

You probably mean to use MapThread

MapThread[Append, {{{1, 2}, {3, 4}, {5, 6}}, {a, b, c}}]
returns
{{1, 2, a}, {3, 4, b}, {5, 6, c}}

look at the help to see the difference between Thread and MapThread
yehua
On 12/5/05, J Siehler <jsiehler at gmail.com> 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.
>
> On the other hand,
>
> Thread[foo[{{1,2},{3,4},{5,6}},{a,b,c}]]
> %/.foo->Append
>
> gives what I wanted.  Can someone explain what's going on?
>
>



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