GNU bug report logs -
#67611
[PATCH] Add a Pcase pattern `cl-lambda` equivalent to `cl-destructuring-bind`
Previous Next
Reported by: Okamsn <okamsn <at> protonmail.com>
Date: Sun, 3 Dec 2023 20:35:01 UTC
Severity: wishlist
Tags: patch
Done: Stefan Kangas <stefankangas <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hello,
The attached patch adds the pattern `cl-lambda` for Pcase, which works
like `cl-destructuring-bind`. There are two differences with the lambda
lists:
1. It does not support `&environment`
2. Without `&allow-other-keys` or `:allow-other-keys t`, the pattern
will fail to match if their are unmatched keys in EXPVAL, but it does
not throw an error.
The variable that would be bound in the lambda list can be Pcase
patterns themselves, with two exceptions:
1. Using a sub-pattern as the cdr of a dotted list, like "(cl-lambda (a
. `(,b . ,c))" doesn't work, since the pattern won't always look like a
dotted list.
2. For constructs that use a sub-list to provide additional values, such
as `&optional`, `&key`, and `&aux`, the sub-pattern only works inside
the sub-list. For example, one could do "(cl-lambda (&optional (`(,a
,b))" but not "(cl-lambda (&optional `(,a ,b)))".
The pattern is useful when one wants to combine the features of `pcase`
and `cl-destructuring-bind`, such combining the optional values with the
`pred` or `guard` patterns.
Thank you.
[0001-Add-the-Pcase-pattern-cl-lambda-for-matching-lambda-.patch (text/x-patch, attachment)]
This bug report was last modified 147 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.