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.
17 lines
611 B
Racket
17 lines
611 B
Racket
3 years ago
|
#lang racket/base
|
||
|
(require racket/match
|
||
|
"struct.rkt")
|
||
|
(provide (all-defined-out))
|
||
|
|
||
|
(define-syntax-rule (define-guarded-parameter ID PRED STARTING-VALUE)
|
||
|
(define ID
|
||
|
(make-parameter STARTING-VALUE
|
||
|
(λ (val)
|
||
|
(unless (PRED val)
|
||
|
(raise-argument-error 'ID (format "~a" (object-name PRED)) val))
|
||
|
val))))
|
||
|
|
||
|
(define-guarded-parameter current-attrs (λ (xs) (and (list? xs) (andmap attr? xs))) null)
|
||
|
(define-guarded-parameter show-timing boolean? #false)
|
||
|
(define-guarded-parameter current-strict-attrs boolean? #false)
|