scsh-users
[Top] [All Lists]

let-match mvars

To: scsh-news@zurich.ai.mit.edu
Subject: let-match mvars
From: stktrc <stktrc@yahoo.com>
Date: Fri, 13 Dec 2002 02:59:50 +0100
Organization: News UmU SE
Is it intentional that let-match binds the first of mvars to the match
object itself?

The documentation uses the example

(let-match (regexp-search date s) (whole-date month day year)
  ... body ...)

which indicates that the first of mvars (whole-date) probably should
be the whole string match, and the subsequent mvars the submatches.

But:

(let-match 
 (regexp-search (rx (submatch "foo") (submatch "bar")) "foobar")
 (one two three four) ; mvars
 (write one) (newline) ; body
 (write two) (newline)
 (write three) (newline)
 (write four) (newline))

Gives the following output:

#{regexp-match}
"foobar"
"foo"
"bar"

The following was expected:

"foobar"
"foo"
"bar"

<Prev in Thread] Current Thread [Next in Thread>