unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Richard Stallman <rms@gnu.org>
To: "João Távora" <joaotavora@gmail.com>
Cc: 67611@debbugs.gnu.org
Subject: bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to `cl-destructuring-bind`
Date: Tue, 16 Jan 2024 22:29:57 -0500	[thread overview]
Message-ID: <E1rPwcn-0004ln-Ml@fencepost.gnu.org> (raw)
In-Reply-To: <875xzw4ngq.fsf@gmail.com> (message from João Távora on Sun, 14 Jan 2024 03:12:53 +0000)

[[[ 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	other threads:[~2024-01-17  3:29 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-03 20:33 bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to `cl-destructuring-bind` Okamsn via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-04 19:08 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-05  2:42   ` Okamsn via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-05  9:26     ` João Távora
2023-12-05  9:21   ` João Távora
2023-12-25 21:30   ` Okamsn via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-11 21:12     ` Stefan Kangas
2024-01-11 21:56       ` João Távora
2024-01-11 22:13         ` Stefan Kangas
2024-01-11 22:46           ` João Távora
2024-01-12  0:55             ` Okamsn via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-13  6:38             ` Stefan Kangas
2024-01-12  3:04         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-12 10:46           ` João Távora
2024-01-12 15:38             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-12 16:56               ` João Távora
2024-01-13  6:58                 ` Stefan Kangas
2024-01-14  3:08               ` Richard Stallman
2024-01-14  3:12                 ` João Távora
2024-01-17  3:29                   ` Richard Stallman [this message]
2024-01-17  9:12                     ` João Távora
2024-02-08  3:49                       ` Richard Stallman
2024-02-08 13:41                         ` João Távora
2024-02-11  3:28                           ` Richard Stallman
2024-02-12 15:25                             ` João Távora

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1rPwcn-0004ln-Ml@fencepost.gnu.org \
    --to=rms@gnu.org \
    --cc=67611@debbugs.gnu.org \
    --cc=joaotavora@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).