I'm looking for a simple way to extract the most common element of a list (or elements, if tied).
Thus, for this list:
("red", "green", "black", "red")
I want to return "red" or ("red") // list is okay
And, for this list:
("red", "green", "black", "red", "green")
I want to return ("red","green")
Also, I don't want to change the original list at all.
Any suggestions on a good technique for doing this?
Thanks!
ID:179192
Feb 5 2002, 9:17 am
|
|
As a matter of fact, I have one:
This is untested code but it should work.
Lummox JR