John Cowan <co...@mercury.ccil.org> writes:

> Jim Wise scripsit:
>
>> Are there plans to include explicit pattern matching operations, such as
>> Common Lisp's DESTRUCTURING-BIND or Racket's match[1]?
>
> We don't work in terms of plans, but in terms of proposals, and right now
> there are no concrete proposals.  If you put together a concrete proposal
> (doesn't have to be detailed, just clear) and send it to me, I will be
> happy to post it for WG consideration.

I'd be willing to cull the list discussion as a proposal, if there seems
to be a common thread.  Are there any details on what's wanted in such a
proposal?  Or just the discussion on the list?  Any standard formatting?

FWIW, racket provides the following in its racket/match library:

      (match <val>
             (<pattern> <body>)
             ...)
      (match* (<val> ...)
             ((<pattern> ...) <body>)
             ...)

and derivative forms

      (match-lambda (<pattern> <body>) ...)
      (match-lambda* (<pattern> <body>) ...)
      (match-let ((<pattern> <expr>) ...)

which are equivalent to

      (lambda (x) (match x (<pattern> <body>) ...)
      (lambda l (match l (<pattern> <body>) ...)
      ((lambda (x ...) (match* (x ...) (<pattern> <body>) ...))
        <expr> ...)

and 
      (match-let* ((<pattern> <expr>) ...)
      (match-letrec ((<pattern> <expr>) ...)

Optionally, a second module could re-export match-lambda* as `lambda',
though I'm not sure is needed (it should certainly be possible to use
the matching module without getting this).

Common Lisp's DESTRUCTURING-BIND is provided here by match-let.

What pattern matching capabilities do other Scheme(-like)s provide?

-- 
                                Jim Wise
                                jw...@draga.com

Attachment: pgpYJtVJcGFO3.pgp
Description: PGP signature

_______________________________________________
r6rs-discuss mailing list
r6rs-discuss@lists.r6rs.org
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to