{"size": 1070, "ext": "rktd", "max_stars_repo_path": "find-unpaired-users.rktd", "max_stars_repo_name": "schuster/cs2500-pairer", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "find-unpaired-users.rktd", "max_issues_repo_name": "schuster/cs2500-pairer", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "find-unpaired-users.rktd", "max_forks_repo_name": "schuster/cs2500-pairer", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 29.7222222222, "max_line_length": 98, "alphanum_fraction": 0.6757009346}
#!/usr/bin/env racket
#lang racket

;; Usage: ./find-unpaired-users.rktd
;;
;; Reports any users in users.rktd not in any student-tuple in pairs.rktd. Expects to find both of
;; those files in the directory where this script lives.

(require
 racket/runtime-path)

(define-runtime-path this-dir ".")

(define (get-user-id user)
  (symbol->string (first user)))

(define (get-user-name user)
  (match user
    [(list _ (list _ name _ _ _)) name]))

(define all-users
  (call-with-input-file (build-path this-dir "users.rktd")
    (lambda (users-file) (read users-file))))

;; Every "pair" is a list of either one or two username strings
(define current-pairs (call-with-input-file (build-path this-dir "pairs.rktd") read))

(match (filter (lambda (user) (not (findf (curry member (get-user-id user)) current-pairs)))
               all-users)
  [(list)
   (displayln "All users are registered")]
  [unregistered-users
   (displayln "Users not found in pairs.rktd:")
   (for ([user unregistered-users])
     (printf "~a (~a)\n" (get-user-id user) (get-user-name user)))])
