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

12 lines
437 B
Racket

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