Skip to content

Commit

Permalink
Refine hash table's type.
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahStoryM authored and pavpanchekha committed May 4, 2021
1 parent f3a105f commit f0b2e7c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions math-lib/math/private/statistics/counting.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

(: unweighted-samples->hash (All (A) ((Sequenceof A) -> (HashTable A Positive-Integer))))
(define (unweighted-samples->hash xs)
(define: h : (HashTable A Positive-Integer) (make-hash))
(define: h : (Mutable-HashTable A Positive-Integer) (make-hash))
(for: ([x : A xs])
(hash-set! h x (unsafe-fx+ 1 (hash-ref h x (λ () 0)))))
h)
Expand All @@ -28,7 +28,7 @@
-> (HashTable A Nonnegative-Real))))
(define (weighted-samples->hash xs ws)
(let-values ([(xs ws) (sequences->weighted-samples 'samples->hash xs ws)])
(define: h : (HashTable A Nonnegative-Real) (make-hash))
(define: h : (Mutable-HashTable A Nonnegative-Real) (make-hash))
(for: ([x : A xs] [w : Nonnegative-Real ws])
(hash-set! h x (+ w (hash-ref h x (λ () 0)))))
h))
Expand Down

3 comments on commit f0b2e7c

@jbclements
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the off-topic question: @NoahStoryM , how would you like your name to appear in the "Contributors" section of the 8.1 release notes? Also, I'm guessing this will apply to the name 'Noah W M" as well, let me know if I'm mistaken!

@NoahStoryM
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, “Noah W M” is me. I hope to use "Noah Ma" now, thank you!

@jbclements
Copy link
Contributor

@jbclements jbclements commented on f0b2e7c May 5, 2021 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.