~edwargix/tallyard

9fa7f182841794550ced391312597ccaf7d2c6fc — David Florness 5 years ago 134d900
Better way to find the minimum value in a hash
1 files changed, 1 insertions(+), 2 deletions(-)

M server.rkt
M server.rkt => server.rkt +1 -2
@@ 69,8 69,7 @@
    (if (empty? votes)
        (if (hash-empty? firsts)
            done
            (let ([last-place (caar (sort (hash->list firsts)
                                          (λ (p1 p2) (< (cadr p1) (cadr p2)))))])
            (let ([last-place (car (argmin cadr (hash->list firsts)))])
              (res (cdr (hash-ref firsts last-place))
                   (hash-remove firsts last-place)
                   (cons last-place done))))