[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Semantic of pcase `seq' and `map' patterns
From: |
Nicolas Petton |
Subject: |
Re: Semantic of pcase `seq' and `map' patterns |
Date: |
Mon, 12 Oct 2015 15:55:13 +0200 |
User-agent: |
Notmuch/0.19 (http://notmuchmail.org) Emacs/25.0.50.7 (x86_64-unknown-linux-gnu) |
Michael Heerdegen <address@hidden> writes:
> It should probably also say that supernumerary elements of the object
> sequence are ignored if less PATTERNS are given, and the match doesn't
> fail.
Yes.
>
> BTW, if I want to match [1 2 3 4] and bind a to 1 and b to (2 3 4), is
> this possible using the `seq' pattern?
Sure, using "&rest":
(seq-let (a &rest b) [1 2 3 4]
(format "The first is %s and the rest is %s" a b))
You can also ignore elements:
(seq-let (a _ &rest b) [1 2 3 4]
(format "The first is %s and the rest without the second is %s" a
b))
Nico
signature.asc
Description: PGP signature
Re: pcase-setq (was: pcase-dolist), Nicolas Petton, 2015/10/15
Re: Semantic of pcase `seq' and `map' patterns (was: pcase-setq), Nicolas Petton, 2015/10/15
Re: pcase-setq, Michael Heerdegen, 2015/10/15