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.
11 lines
447 B
Racket
11 lines
447 B
Racket
#lang restructure/racket
|
|
(provide (all-defined-out))
|
|
(require "number.rkt")
|
|
|
|
(define (resolveLength length [stream #f] [parent #f])
|
|
(cond
|
|
[(number? length) length]
|
|
[(procedure? length) (length parent)]
|
|
[(and parent (symbol? length)) (ref parent length)] ; treat as key into RStruct parent
|
|
[(and stream (NumberT? length)) (send length decode stream)]
|
|
[else (raise-argument-error 'resolveLength "fixed-size argument" length)])) |