[racket] Any way to get "true" quasiquote behavior in match form?

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Fri Mar 9 19:44:21 EST 2012

You can write

(match l1
 [`(1 2 ,(? (lambda (x) (equal? x a)))) #t]
 [_ #f])

Robby

On Friday, March 9, 2012, rob cook wrote:

> That is, without using a macro or eval. Id like to do:
>
> (define a 4)
> (define l1 '(1 2 3))
> (match l1
>   (`(1 2 ,a) #t)
>   (_ #f))
>
> So that this example would result in #f, and #t if a bound to 3.
>
> Since of course match has its own quasiquote behavior, this does not seem
> possible w/o making a macro for "dynamic" match, or building the s-exp and
> using eval (yuck!).
>
> Is this correct, or have I missed something obvious?
>
> Thnx
> Rob
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120309/5883c99c/attachment.html>

Posted on the users mailing list.