
Conflicts: redex-curnel.rkt With names finally fixed, many more tests can actually run. * Changed uses of case to eliminators * Fixed uses of new case* macro * Fixed some assorted bugs in reduction of eliminators
21 lines
524 B
Racket
21 lines
524 B
Racket
#lang s-exp "../redex-curnel.rkt"
|
|
(provide bool btrue bfalse if bnot)
|
|
|
|
(data bool : Type
|
|
(btrue : bool)
|
|
(bfalse : bool))
|
|
|
|
(define-syntax (if syn)
|
|
(syntax-case syn ()
|
|
[(_ t s f)
|
|
;; Compute the motive
|
|
(let ([M #`(lambda (x : #,(type-infer/syn #'t))
|
|
#,(type-infer/syn #'s))])
|
|
(quasisyntax/loc syn (elim bool t #,M s f)))]))
|
|
|
|
(define (bnot (x : bool)) (if x bfalse btrue))
|
|
(module+ test
|
|
(require rackunit)
|
|
(check-equal? (bnot btrue) bfalse)
|
|
(check-equal? (bnot bfalse) btrue))
|