MathGroup Archive 2007

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

Search the Archive

style question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg79315] style question
  • From: Yaroslav Bulatov <yaroslavvb at gmail.com>
  • Date: Tue, 24 Jul 2007 06:08:18 -0400 (EDT)

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]



  • Prev by Date: Novice/Integral
  • Next by Date: Usage Messages and Font Size in 6.0.1
  • Previous by thread: Re: Novice/Integral
  • Next by thread: Re: style question