Contract| Return type | vector | | No input parameters. | | Parameter kind | Default value | Type | | Other unkeyed arguments | <vector/> | vector | | Other keyed arguments | opt | | Water Contract<method number.mode
_other_keyed=opt=wob=ekind.code="_add_to_environment"
_other_unkeyed=<vector/>=wob=ekind.code="_body"
_return_type=vector/> | |
Mode finds the most common values in a vector.
If one value occurs more often than any other value in the vector,
a vector of that one value is returned.
If there are two or more values that "tie" for the most common value,
a vector of all those values is returned.
If no values are passed in to mode, the empty vector is returned.
Thus, mode always returns a vector.
4.<mode 17 3.3 17/>
 | <vector 17/>
|
number.<mode _other_unkeyed=<v 12 13 13 14/>/>
 | <v 13/>
|
number.<mode _other_unkeyed=<v 12 12 12 13 13 14 14 14/>/>
 | <v 12 14/>
|
number.<mode _other_unkeyed=<v 12 13.5 14/>/>
 | <v 12 13.5 14/>
|
number.<mode _other_unkeyed=<v 7/>/>
 | <v 7/>
|
Mode accepts a vector of non-numbers as well.
number.<mode _other_unkeyed=<v "red" "green" "green" "red" "blue"/>/>
 | <vector "green" "red"/>
|
You can also pass in _other_keyed args to mode. Thus neither the keys nor
the values of fields need be numeric for mode to find the most common values.
number.<mode _other_keyed=<thing a="aa" b="bb" c="aa" d="bb" e="x"/>/>
 | <vector "aa" "bb"/>
|
The resulting vector is sorted to have the lowest numbers and the lexically
first elements first.
© Copyright 2007 Clear Methods, Inc.