[racket] as-patterns?

From: Carl Eastlund (cce at ccs.neu.edu)
Date: Mon Sep 2 15:28:02 EDT 2013

Eric, use an "and" pattern.

(and elem (cons a b))

Carl Eastlund


On Mon, Sep 2, 2013 at 3:24 PM, Eric Tanter <etanter at dcc.uchile.cl> wrote:

> Hi,
>
> Is there a way to bind a name to a whole sub-value being matched in
> pattern?
>
> eg. like var at pat in Haskell:
> (match l
>   [(cons (@ elem (cons a b)) rest) ...elem...])
>
> It must be there somewhere, but I couldn't find it :/
>
> Thanks!
>
> -- Éric
>
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130902/ee66588d/attachment.html>

Posted on the users mailing list.