Re: MapThread and If
- To: mathgroup at smc.vnet.net
- Subject: [mg68031] Re: MapThread and If
- From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
- Date: Fri, 21 Jul 2006 05:37:16 -0400 (EDT)
- Organization: Uni Leipzig
- References: <e9nkro$9u3$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, MapThread[If[#1 === #2, 0, tr] &, {{1, 2, 3}, {2, 2, {3, 4}}}] MapThread[If[TrueQ[#1 == #2], 0, tr] &, {{1, 2, 3}, {2, 2, {3, 4}}}] ?? Regards Jens "Arkadiusz Majka" <Arkadiusz.Majka at telekomunikacja.pl> schrieb im Newsbeitrag news:e9nkro$9u3$1 at smc.vnet.net... | Hi, | | Of course | | MapThread[If[#1 == #2, 0, tr] &, {{1, 2, 3}, {2, 2, 4}}] | | I get | | {tr, 0, tr} | | and for | | MapThread[If[#1 == #2, 0, tr] &, {{1, 2, 3}, {2, 2, {3, 4}}}] | | I get | | {tr, 0, If[3 == {3, 4}, 0, tr]} | | How I can build in above MapThread expression information that if 'a' | is equal to any element from the list {a,b,c,d} the result is 0. In | above example we have If[3=={3,4},0,tr] what I want to be 0, because 3 | is equal to an element belonging to {3,4}. | | Thx, | | Arek |