add `make-proc<%>`

main
Matthew Butterick 10 years ago
parent e872ed7f64
commit b9263f0b37

@ -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])

@ -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)))

Loading…
Cancel
Save