you could try to

1) sort the list from low to high
2) count the list (so you have the total number of items in the list)
3) the trick

x = getPos(mysortedlist,mysortedlist[nrofitemsinthelist]) -- this will give you the FIRST occurence of the last item in the list y = mysortedlist[x-1]) --gives the value of the second last item in the list x = getPos(mysortedlist,mysortedlist[y]) -- this will give you the FIRST occurence of the SECOND last item in the list

do this inside a repeat loop and store the x and y's as a property list and there you go

repeat


if(x = 1) then exit repeat

end repeat


WARNING: of course this is completely untested pseudocode out of the top of my head and should be treated this way (luckely you can't see my head)

HTH

Bart


On 30 Jun 2005, at 20:09, 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