You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
typesetting/quad/quad2/pass.rkt

15 lines
571 B
Racket

#lang racket/base
(require racket/contract)
(provide (all-defined-out))
(define-syntax-rule (define-pass (PASS-NAME ARG OTHER-ARG ...)
#:precondition PRECOND-PROC
#:postcondition POSTCOND-PROC
EXPRS ...)
(define (PASS-NAME ARG OTHER-ARG ...)
(unless (PRECOND-PROC ARG)
(error 'PASS-NAME (format "precondition failed: ~a" 'PRECOND-PROC)))
(define res (let () EXPRS ...))
(unless (POSTCOND-PROC res)
(error 'PASS-NAME (format "postcondition failed: ~a" 'POSTCOND-PROC)))
res))