[Top][All Lists]

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

Re: The poor state of documentation of pcase like things.

From: Michael Heerdegen
Subject: Re: The poor state of documentation of pcase like things.
Date: Sun, 20 Dec 2015 13:45:43 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

address@hidden (Phillip Lord) writes:

> (pcase '(:a 1)

(:a 1) is not a map in the sense of map.el.  You probably want an alist:
((:a . 1)).

>   ((map `(:a ,a)) a))

``' is a different pattern type.  You want to use the `map', and
backquote is not part of its syntax.  So, this is how the example should
look like:

(pcase '((:a . 1))
  ((map (:a a)) a))

But the doc is not correct indeed:

@Nicolas: Can you please correct these sentences of the "map" pcase
pattern documentation:

| ARGS can be a list of the form (KEY PAT), in which case KEY in an
| unquoted form.
| ARGS can also be a list of symbols, which stands for (’SYMBOL

It should say that ARGS can be a list of elements of the form (KEY PAT)

(at least that's how I think it is meant.  OTOH,

(pcase '((:a . 1) (:b . 2))
  ((map (:a a :b b)) (list a b)))

gives an error (void variable: b), so I'm not sure)

In the second sentence, our new quoting magic messes the quote character
in the doc shown in the help buffer.



reply via email to

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