Re: Problem with Thread over Plus?
- To: mathgroup at smc.vnet.net
- Subject: [mg65392] Re: Problem with Thread over Plus?
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Thu, 30 Mar 2006 05:29:42 -0500 (EST)
- Organization: The Open University, Milton Keynes, UK
- References: <e0dsg9$r67$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Virgilio, Vincent - SSD wrote: > Hello, > > Why does this work: > > Thread[ Plus[ {1,1} , { {1,1} , {2,2} } ] ] > > but this doesn't? > > Thread[ Plus[ {1,1} , { {1,1} , {2,2} , {3,3} } ] ] > > Thanks, > > Vince Virgilio As stated by the error message returned by In[1], both list must be of equal lengths. Therefore, In[2], with three 1s rather than two, works as expected. In[1]:= Thread[{1, 1} + {{1, 1}, {2, 2}, {3, 3}}] Thread::tdlen: Objects of unequal length in {1, 1} + {{1, 1}, {2, 2}, {3, 3}} cannot be combined. Thread::tdlen: Objects of unequal length in {1, 1} + {{1, 1}, {2, 2}, {3, 3}} cannot be combined. Out[1]= {1, 1} + {{1, 1}, {2, 2}, {3, 3}} In[2]:= Thread[{1, 1, 1} + {{1, 1}, {2, 2}, {3, 3}}] Out[2]= {{2, 3, 4}, {2, 3, 4}} Regards, JM