From: "Björn Bidar" <bjorn.bidar@thaodan.de>
To: Drew Adams <drew.adams@oracle.com>
Cc: Heime <heimeborgia@protonmail.com>,
Heime via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org>
Subject: Re: [External] : Exiting from mapc
Date: Wed, 01 Jan 2025 21:40:04 +0200 [thread overview]
Message-ID: <38521.53879577$1735760439@news.gmane.org> (raw)
In-Reply-To: <DS7PR10MB52327BA9069DB9B925A9FB62F30B2@DS7PR10MB5232.namprd10.prod.outlook.com> (Drew Adams's message of "Wed, 1 Jan 2025 02:02:44 +0000")
Drew Adams <drew.adams@oracle.com> writes:
>> >> How can I exit when encountering 'safg or 'nogo
>> >
>> > As usual, wrap with a `catch', and `throw' to it whenever you like.
>>
>> Should dolist be better in this context anyway?
>
> Of course, but it doesn't answer his question. ;-)
Sure I'm just saying this as an added comment. macp can be expensive
unless you invoke a handler for function anyway or use a mapc style
filter function such as seq-filter.
> If a plain iteration, with no intermediate escape
> to throw a value, is appropriate for what you want
> to do, then by all means use it.
>
> IOW, don't go catching and throwing willy nilly.
> Like `GO TO'.
>
> `dolist' and `mapc' etc. don't let you escape;
> you must go through the whole list. Catch and
> throw are available for when you need to get out
> and return or do something directly, and not
> waste time running down the rest of the list for
> nothing.
Another approach is to use second status variable when using while.
Are there instances where a throw and catch does not work in while loop?
next prev parent reply other threads:[~2025-01-01 19:40 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-31 19:35 Exiting from mapc Heime via Users list for the GNU Emacs text editor
2024-12-31 20:13 ` [External] : " Drew Adams
2024-12-31 20:20 ` Heime via Users list for the GNU Emacs text editor
2024-12-31 22:30 ` Drew Adams
2025-01-01 23:14 ` Heime via Users list for the GNU Emacs text editor
2025-01-02 0:31 ` Joel Reicher
2025-01-02 10:33 ` Jean Louis
2025-01-03 0:23 ` Joel Reicher
2025-01-02 0:33 ` Drew Adams
2025-01-02 2:21 ` Eduardo Ochs
2025-01-01 1:53 ` Björn Bidar
[not found] ` <87wmffwb8w.fsf@>
2025-01-01 2:02 ` Drew Adams
2025-01-01 19:40 ` Björn Bidar [this message]
[not found] ` <874j2iwcff.fsf@>
2025-01-01 20:00 ` Drew Adams
2025-01-01 21:09 ` Björn Bidar
[not found] ` <87a5cautqb.fsf@>
2025-01-01 21:59 ` Drew Adams
2025-01-02 10:53 ` Jean Louis
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='38521.53879577$1735760439@news.gmane.org' \
--to=bjorn.bidar@thaodan.de \
--cc=drew.adams@oracle.com \
--cc=heimeborgia@protonmail.com \
--cc=help-gnu-emacs@gnu.org \
/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.
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).