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.
26 lines
682 B
Racket
26 lines
682 B
Racket
#lang debug racket/base
|
|
(require "pipeline.rkt"
|
|
"quad.rkt")
|
|
(provide (all-defined-out))
|
|
|
|
(define (quad-with-attrs? x)
|
|
(and (quad? x) (quad-attrs x)))
|
|
|
|
(define-pass (install-default-attrs qs)
|
|
;; make sure attrs are not #false
|
|
#:pre (list-of quad?)
|
|
#:post (list-of quad-with-attrs?)
|
|
(for ([q (in-list qs)]
|
|
#:unless (quad-attrs q))
|
|
(set-quad-attrs! q (make-hasheq))))
|
|
|
|
(define (quad-with-elems? x)
|
|
(and (quad? x) (quad-elems x)))
|
|
|
|
(define-pass (install-default-elems qs)
|
|
;; ensure elems are not #false
|
|
#:pre (list-of quad?)
|
|
#:post (list-of quad-with-elems?)
|
|
(for ([q (in-list qs)]
|
|
#:unless (quad-elems q))
|
|
(set-quad-elems! q null))) |