[plt-dev] struct match-expander a la struct-copy

From: Noel Welsh (noelwelsh at gmail.com)
Date: Wed Jun 3 06:32:19 EDT 2009

On Wed, Jun 3, 2009 at 3:49 AM, Jay McCarthy <jay.mccarthy at gmail.com> wrote:
> The structure patterns in scheme/match have always bugged me that they
> didn't let you put the fields in any order and you had to put in _ for
> the fields you didn't care about.

It would be nice to be able to use the field name as a pattern, which
I don't think your system does. So I could write:

(define-struct foo (left right))

(match (make-foo 'a 'b)
  [(struct* foo (right left))
   (cons right left)])


Posted on the dev mailing list.