Practical Common Lisp in Racket

I think the following macro may be useful to map binary values to symbols.

(define-syntax symbolic-binary
  (syntax-rules ()
    ((_ type (sym val) ...)
     (let ((t type))
       (binary
        (lambda (in)
          (let* ((value (read-value t in))
                 (symbol (cond
                           ((equal? value val) 'sym)
                           ...
                           (else (raise-argument-error
                                  'symbolic-binary "invalid value" value)))))
            symbol))
        (lambda (out symbol)
          (let ((value (cond
                         ((eqv? symbol 'sym) val)
                         ...
                         (else (raise-argument-error
                                'symbolic-binary "invalid symbol" symbol)))))
            (write-value t value))))))))

It can be used to parse the beginning of a TIFF file.

(define-binary-class tiff
  ((endian (endian-binary))
   (type (type-binary)))

  (define (endian-binary)
    (symbolic-binary (iso-8859-1-string 2)
                     (big    "MM")
                     (little "II")))

  (define/public (int16-binary)
    (case endian
      ((big) (integer-be 2))
      ((little) (integer-le 2))
      (else (raise-argument-error
             'int16-binary "endian symbol" endian))))

  (define (type-binary)
    (symbolic-binary (send this int16-binary)
                     (tiff          42)
                     (bigtiff       43)
                     (panasonic-rw2 85))))