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/pitfall/restructure/utils.rkt

13 lines
470 B
Racket

8 years ago
#lang restructure/racket
(provide (all-defined-out))
(require "number.rkt")
7 years ago
(define (resolveLength length [stream #f] [parent #f])
(define res
(cond
[(number? length) length]
[(procedure? length) (length parent)]
[(and parent (symbol? length)) (*ref parent length)] ; treat as key into RStruct parent
[(and stream (Number? length)) (send length decode stream)]
[else (raise-argument-error 'resolveLength "fixed-size argument" length)]))
res)