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