From: arthur miller <arthur.miller@live.com>
To: Joost Kremers <joostkremers@fastmail.fm>,
"Alfred M. Szmidt" <ams@gnu.org>
Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: Sv: Better documentation for non-binding clauses of if-let and friends
Date: Mon, 11 Nov 2024 10:53:04 +0000 [thread overview]
Message-ID: <DU2PR02MB101095DA886BFBDF52938768696582@DU2PR02MB10109.eurprd02.prod.outlook.com> (raw)
In-Reply-To: <86msi69icp.fsf@fastmail.fm>
[-- Attachment #1: Type: text/plain, Size: 1397 bytes --]
>I just recently wrote a simple RDP that has a couple of functions of this
>form:
>
>```
>(if-let* (((parsebib--char "@"))
> ((parsebib--keyword '("string")))
> (open (parsebib--char "{("))
> (definition (parsebib--assignment))
> ((parsebib--char (alist-get open '((?\{ . "}") (?\( . ")"))))))
> definition
> (signal 'parsebib-error (list (format "Malformed @String definition at position %d,%d"
> (line-number-at-pos) (current-column)))))
>```
>
>This reads a complete BibTeX @String definition. The clauses in the
>`if-let*` specify what text should be read, and I can capture the result of
>those reads, but only for the parts that I need to capture.
>
>I think once you know how `if-let*` works, this is a fairly concise and
>quite readable way to code this rule. Not sure what the equivalent without
>`if-let*` would look like, TBH. (Short of creating a DSL, which would
>admittedly be nicer...)
In my opinion, if-let and when-let are no brainer. they are actualy useful as a
synctatic-sugar and help keep variables in the scope of ift- and when-let. Those
bindings are usable as ordinary let-bindings, since they are established only once.
Problem is when one introduce repetition: while-let re-establishes the bindings a new
for each repetition, which is a bit unusual I believe.
[-- Attachment #2: Type: text/html, Size: 5037 bytes --]
next prev parent reply other threads:[~2024-11-11 10:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-11 9:28 Better documentation for non-binding clauses of if-let and friends arthur miller
2024-11-11 9:58 ` Alfred M. Szmidt
2024-11-11 10:23 ` Sv: " arthur miller
2024-11-11 10:26 ` Joost Kremers
2024-11-11 10:53 ` arthur miller [this message]
2024-11-11 11:18 ` Sv: " Joost Kremers
2024-11-11 21:21 ` [External] : " Drew Adams
2024-11-11 22:51 ` Joost Kremers
2024-11-12 0:26 ` Drew Adams
2024-11-12 8:07 ` Joost Kremers
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DU2PR02MB101095DA886BFBDF52938768696582@DU2PR02MB10109.eurprd02.prod.outlook.com \
--to=arthur.miller@live.com \
--cc=ams@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=joostkremers@fastmail.fm \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.