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/quad2/param.rkt

22 lines
748 B
Racket

#lang racket/base
(require racket/match
"constants.rkt"
"struct.rkt")
(provide (all-defined-out))
(define-syntax-rule (define-guarded-parameters [ID PRED STARTING-VALUE] ...)
(begin
(define ID
(make-parameter STARTING-VALUE
(λ (val)
(unless (PRED val)
(raise-argument-error 'ID (format "~a" (object-name PRED)) val))
val))) ...))
(define-guarded-parameters
[current-attr-keys (λ (xs) (and (list? xs) (andmap attr-key? xs))) all-attr-keys]
[current-show-timing? boolean? #false]
[current-strict-attrs? boolean? #false]
[current-use-preconditions? boolean? #true]
[current-use-postconditions? boolean? #true])