MathGroup Archive 2005

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

Search the Archive

Re: Threading 'Append'


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

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

may help.



"J Siehler" <jsiehler at> schrieb im 
Newsbeitrag news:dn226p$ksm$1 at
| 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' 
| 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: Zero or one
  • Next by Date: Re: Types in Mathematica
  • Previous by thread: Re: Threading 'Append'
  • Next by thread: Re: How to set up a diff equation for circuit with a diode?