Re: style question
- To: mathgroup at smc.vnet.net
- Subject: [mg79358] Re: style question
- From: Chris Chiasson <chris.chiasson at gmail.com>
- Date: Wed, 25 Jul 2007 02:14:24 -0400 (EDT)
- References: <f84jp8$qmp$1@smc.vnet.net>
On Jul 24, 5:20 am, Yaroslav Bulatov <yarosla... at gmail.com> wrote:
> What is the recommended way of counting the number of matches in two
> lists?
>
> The natural way would be to thread over Equal, but Equal will evaluate
> before Thread gets to it. The method below works, but somehow feels
> wrong
>
> m1 = RandomInteger[{1}, {10^5, 2, 2}];
> m2 = RandomInteger[{1}, {10^5, 2, 2}];
> matches = Thread[temporary[m1, m2]] /. temporary -> Equal;
> Count[matches, True]
With[{m1 = m1, m2 = m2}, Thread[Unevaluated@Equal[m1, m2]]]