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

11 lines
442 B
Racket

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