diff --git a/csp/domain.rkt b/csp/domain.rkt index a9063e6f..a04b7db8 100644 --- a/csp/domain.rkt +++ b/csp/domain.rkt @@ -2,18 +2,11 @@ (require racket/class racket/list "helper.rkt") (provide (all-defined-out)) -(define proc<%> - (interface* () - ([prop:procedure - (λ(this) - (send this get-values))]) - get-values)) - ;; Class used to control possible values for variables ;; When list or tuples are used as domains, they are automatically ;; converted to an instance of that class. (define domain% - (class* object% (printable<%> proc<%>) + (class* object% (printable<%> (make-proc<%> get-values)) (super-new) (init-field set) (field [_list set][_hidden null][_states null]) diff --git a/csp/helper.rkt b/csp/helper.rkt index ffb993ce..71bc942f 100644 --- a/csp/helper.rkt +++ b/csp/helper.rkt @@ -1,8 +1,15 @@ #lang racket/base -(require racket/list) +(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)))