nfreq is a little program that answers the question "who has the most repeated letters in their name?"
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
458B

  1. package main
  2. func (r results) Len() int { return len(r) }
  3. func (r results) Swap(i, j int) { r[i], r[j] = r[j], r[i] }
  4. func (r results) Less(i, j int) bool {
  5. if len(r[i].h) == 0 || len(r[j].h) == 0 {
  6. return false
  7. }
  8. return r[i].h[0].count > r[j].h[0].count
  9. }
  10. func (h histogram) Len() int { return len(h) }
  11. func (h histogram) Swap(i, j int) { h[i], h[j] = h[j], h[i] }
  12. func (h histogram) Less(i, j int) bool {
  13. return h[i].count > h[j].count
  14. }