bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to `cl-des


From: Richard Stallman
Subject: bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to `cl-destructuring-bind`
Date: Tue, 16 Jan 2024 22:29:57 -0500

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > > Would someone please tell me what syntax is being proposed here,
  > > and show me an example, saying what it would mean?

  > Common-lisp style lambda lists.  The ones containing the &key and
  > &optional with more features.

Thanks for answering, but its meaning is not concretely clear to me.

Could you tell me more concretely what this proposed feature would
look like in use?  Perhaps with an example including context?

pcase does not use lambda lists, and neither does cond*.  They are
based on the backquote construct, which does not use &-keywords.
I see a danger of conceptual incoherence here.

If we want to extend the kinds of constructs for destructuring lists,
we should extend the features of backquote.  That would give a more
coherent interface.

We could define ,? to specify an element that might br missing,
and ,& to specify a keyword argument.  These could work in backquote
for constructing lists as well as in destructiring.

(let ((x 9) (y 10) (z nil) (u 11) (v nil) (w '(12 13)))
  `(a ,x ,?y ,?z ,&(foo u) ,&(bar v) . ,w))

=> (a 9 10 foo 11 12 13)

That is my first stab at the design.  I think it is better,
for this purpose, than using parmlist keywords.
But maybe with more thinking we can find improvements.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)







reply via email to

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