[plt-scheme] Dybvig's record-case better error message

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Sat Aug 10 05:49:49 EDT 2002

Jens Axel Søgaard wrote:

> This macro works:
>
> (define-syntax (record-case stx)

Oops. I forgot that it dependd on record:

  ;;; record

  ; Description: bind a set of variables to the elements of
  ;              a list (this list, or /record/, must contain as many
  ;              elements as there are variables; the variables name the
  ;              /fields/ of the record)
  ; Example:
  ;              ((lambda (x)
  ;                   (record (a b c) x
  ;                           (list c b a)))
  ;                 (list 1 2 3))

  (define-syntax record
    (syntax-rules ()
      ((record (var ...) val exp ...)
       (apply (lambda (var ...) exp ...) val))))

--
Jens Axel Søgaard





Posted on the users mailing list.