On Sun, 30 Nov 2014 22:21:14 +0100 Manfred Lotz <manfred.l...@arcor.de> wrote:
> No I hadn't considered the variant using type?. Thanks for this. > > Not quite sure if I'm happy about it as I would prefer to have the > type checking at one place instead of providing a type each time I > check/use options. > Saying this I think I like this version: (define-syntax-rule (optval s ol) (let ([found (assoc s ol)]) (if found (let ([val (cdr found)]) (case s ['size (assert val integer?)] ['dir (assert val string?)] ['verbose (assert val boolean?)] [else (error "Forgot to check in optval: option" s)])) (error "not found")))) -- Manfred ____________________ Racket Users list: http://lists.racket-lang.org/users