(approval ballots)
Perform an approval election. Returns a priority map of candidate keys and number of ballots which approved of them values, in descending order. The ordering of candidates with the same number of approved ballots is not specified.
Each ballot should contain a key for each candidate. A truthy value indicates approval and a falsey value disapproval.
Perform an approval election. Returns a priority map of candidate keys and number of ballots which approved of them values, in descending order. The ordering of candidates with the same number of approved ballots is not specified. Each ballot should contain a key for each candidate. A truthy value indicates approval and a falsey value disapproval.
(borda-count ballots)
(borda-count ballots sc)
Perform a Borda count election. Returns a priority map of candidate keys and total score values. The ordering of candidates with the same score is not specified. Takes an optional scoring function sc which translates the value assigned to each candidate on a ballot into a score; defaults to identity.
Each ballot should contain a key for each candidate.
Perform a Borda count election. Returns a priority map of candidate keys and total score values. The ordering of candidates with the same score is not specified. Takes an optional scoring function sc which translates the value assigned to each candidate on a ballot into a score; defaults to identity. Each ballot should contain a key for each candidate.
(plurality ballots)
Perform a plurality (first-past-the-post) election. Returns a priority map of candidate keys and the number of ballots in which they were ranked first values, in descending order. The ordering of candidates with the same number of ranked first ballots is not specified.
Each ballot should contain exactly one candidate assigned a rank of 1, and each ballot should contain a key for each candidate. Candidates with a rank of <=0 are not preferred over the candidate of rank 1. The behaviour in the case of ballots with multiple candidates of rank 1 is undefined.
Perform a plurality (first-past-the-post) election. Returns a priority map of candidate keys and the number of ballots in which they were ranked first values, in descending order. The ordering of candidates with the same number of ranked first ballots is not specified. Each ballot should contain exactly one candidate assigned a rank of 1, and each ballot should contain a key for each candidate. Candidates with a rank of <=0 are not preferred over the candidate of rank 1. The behaviour in the case of ballots with multiple candidates of rank 1 is undefined.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close