Re: Threading 'Append'
- To: mathgroup at smc.vnet.net
- Subject: [mg62821] Re: Threading 'Append'
- From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
- Date: Tue, 6 Dec 2005 00:03:17 -0500 (EST)
- Organization: Uni Leipzig
- References: <dn226p$ksm$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, Mathematica evaluate an expression from the inner parts to the outer parts. Since Append[{{1,2},{3,4},{5,6}},{a,b,c}] is evaluated to {{1,2},{3,4},{5,6},{a,b,c}} the later evaluation of Thread[] does not find a Append that it can thread .. Thread[Hold[Append][{{1, 2}, {3, 4}, {5, 6}}, {a, b, c}]] // ReleaseHold or MapThread[Append, {{{1, 2}, {3, 4}, {5, 6}}, {a, b, c}}] may help. Regards Jens "J Siehler" <jsiehler at gmail.com> schrieb im Newsbeitrag news:dn226p$ksm$1 at smc.vnet.net... | 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? |