#lang racket/base (require racket/class racket/list (for-syntax racket/base racket/syntax)) (provide (all-defined-out)) (require rackunit) (define-syntax-rule (make-proc<%> proc-name) (interface* () ([prop:procedure (λ(this . args) (send/apply this proc-name args))]) proc-name)) (define-simple-check (check-hash-items h1 h2) (for/and ([(k1 v1) (in-hash h1)]) (equal? (hash-ref h2 k1) v1))) (define (list-comparator xs ys) ;; For use in sort. Compares two lists element by element. (cond [(equal? xs ys) #f] ; elements are same, so no sort preference [(and (null? xs) (not (null? ys))) #t] ; ys is longer, so #t [(and (not (null? xs)) (null? ys)) #f] ; xs is longer, so #f makes it sort later [else (let ([x (car xs)][y (car ys)]) (cond [(equal? x y) (list-comparator (cdr xs) (cdr ys))] [(and (real? x) (real? y)) (< x y)] [(and (symbol? x) (symbol? y)) (apply stringstring (list x y)))] [(and (string? x) (string? y)) (string