emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pcase-setq


From: Michael Heerdegen
Subject: Re: pcase-setq
Date: Mon, 12 Oct 2015 14:36:30 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Nicolas Petton <address@hidden> writes:

> I don't know if it that's what you are looking for, but seq.el has
> `seq-let` and map.el has `map-let`, and they both use pcase.
>
>     (seq-let (a b (c &rest others)) '(1 2 [3 4 5 6])
>       (+ a b c))
>
>     (map-let (foo bar baz) '((foo . 1) (bar . 2))
>       (should (= foo 1))
>       (should (= bar 2))
>       (should (null baz)))

What I want is a _setter_ macro using pcase, not a binding construct
(sorry, I was confused about what `cl-destructuring-bind' does).

Like this:

(pcase-setq (seq a b (seq c)) '(1 2 [3 4 5 6]))
(+ a b c)  ==> 6


Michael.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]