here some code that doesn't use any (lingo) repeat loop, so might be a bit faster (but only works for lists that contain numbers only):

on howMany (tList, tValue)
 tmp = tList.duplicate()
 tmp.sort()
 n = tmp.getPos(tValue)
 if n = 0 then return 0
 tmp = - tmp
 tmp.sort()
 return (tmp.count + 2 - tmp.getPos(-tValue) - n)
end


Valentin


Rods wrote:
Hi,

How is the best way to count the occurrences of values in a list? I
have a
list with 6000+ random generated numbers and I need to count how many
times
each of one appear.

Thank's in advance



Rodrigo Peres

[To remove yourself from this list, or to change to digest mode, go
to http://www.penworks.com/lingo-l.cgi  To post messages to the list,
email lingo-l@penworks.com  (Problems, email
[EMAIL PROTECTED]). Lingo-L is for learning and helping with
programming Lingo. Thanks!]

[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
lingo-l@penworks.com  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to