Question on Thread
- To: mathgroup at smc.vnet.net
 - Subject: [mg64418] Question on Thread
 - From: "Matt" <anonmous69 at netscape.net>
 - Date: Thu, 16 Feb 2006 03:05:29 -0500 (EST)
 - Sender: owner-wri-mathgroup at wolfram.com
 
Hello,
Clear[f]
Thread[(f[#1, #2] & )[{1, 2, 3}, {{a, 1}, {b, 2}, {c, 3}}]]
Gives the expected output, i.e. {f[1,{a,1}], f[2,{b,2}],...}
but
Clear[f, g]
Thread[(f[g[#1], #2] & )[{1, 2, 3}, {{a, 1}, {b, 2}, {c, 3}}]]
gives me:
f[g[{1, 2, 3}], {a, 1}], f[g[{1, 2, 3}], {b, 2}], ..., etc.
whereas I would have expected:
f[g[1], {a, 1}], f[g[2], {b, 2}], ..., etc.
I've looked at the 'Thread' documentation and in the Mathematica Book,
but I can't see why the second case doesn't work.
BTW, I used MapThread as follows, which does work:
MapThread[f[g[#1], #2] & , {{1, 2, 3}, {{a, 1}, {b, 2}, {c, 3}}}
Thanks for your time,
Matt
- Follow-Ups:
- Re: Question on Thread
- From: Andrzej Kozlowski <akoz@mimuw.edu.pl>
 
 
 - Re: Question on Thread