Skip to content

Instantly share code, notes, and snippets.

@lexi-lambda
Created September 12, 2017 00:47
Show Gist options
  • Save lexi-lambda/1dbcb802bb81c9fefdf33902ae41f09c to your computer and use it in GitHub Desktop.
Save lexi-lambda/1dbcb802bb81c9fefdf33902ae41f09c to your computer and use it in GitHub Desktop.
#!/usr/bin/env racket
#lang racket
(require net/url)
(define canonicalize-email
(let ([aliases #hash(("mflatt@cs.utah.edu" . "mflatt@racket-lang.org")
("samth@racket-lang.org" . "samth@ccs.neu.edu")
("jay@racket-lang.org" . "jay.mccarthy@gmail.com"))])
(λ (email) (hash-ref aliases email email))))
(define (canonicalize-emails emails)
(remove-duplicates (map canonicalize-email emails)))
(define pkgs
(call/input-url (string->url "https://pkgs.racket-lang.org/pkgs-all") get-pure-port read))
(define pkgs-per-author
(for*/fold ([acc (hash)])
([(name info) (in-hash pkgs)]
#:unless (regexp-match? #px"-(lib|doc|test)$" name)
#:unless (hash-ref (hash-ref info 'search-terms) 'deprecated #f)
[author (in-list (canonicalize-emails (hash-ref info 'authors)))])
(hash-update acc author add1 0)))
(sort (hash->list pkgs-per-author) > #:key cdr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment