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
>
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to