From: Drew Adams <drew.adams@oracle.com>
To: uzibalqa <uzibalqa@proton.me>
Cc: Platon Pronko <platon7pronko@gmail.com>,
uzibalqa via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org>
Subject: RE: [External] : Determine whether a list is an alist
Date: Thu, 13 Jul 2023 16:07:49 +0000 [thread overview]
Message-ID: <CO6PR10MB5473021C061A351009904ECBF337A@CO6PR10MB5473.namprd10.prod.outlook.com> (raw)
In-Reply-To: <NmVeAIqQQ2YUPDg6_9AlFZzpEB1TZQzvBwUqZQeDfAbjfOqv0TyebM8pQmSIxnLfRx4QDQ82ETPXHGKMvR6WYy9dq-PaN5YX6zALp1YbrlQ=@proton.me>
> > In many (most?) cases you don't really care
> > whether each element of the list is a cons - you
> > just want to retrieve the first match, and you
> > only want to traverse then entire list if you
> > have to (i.e., when there's no match or the last
> > element matches), and you don't want to traverse
> > it more than once.
>
> If I want to print the alist in (Key . Value) way, how would one skip
> extraneous (non-cons) list entries ?
`dolist' is your friend.
Printing is a side-effect thingie. `dolist' is
a natural for iterating over a list, performing
side effects. Just test each list element and
do what you want with it - that can include
doing nothing with it. "Extraneous" is in the
eye of the caller-beholder.
This is no different from C, Fortran, assembler,
etc., except that Lisp gives you easy to use
lists and list iterators, ready-made.
LISP: LISt Processing.
next prev parent reply other threads:[~2023-07-13 16:07 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-13 10:40 Determine whether a list is an alist uzibalqa
2023-07-13 14:31 ` [External] : " Drew Adams
2023-07-13 14:40 ` Platon Pronko
2023-07-13 15:40 ` Drew Adams
2023-07-13 15:44 ` Drew Adams
2023-07-13 15:49 ` Platon Pronko
2023-07-13 15:56 ` Drew Adams
2023-07-13 15:57 ` uzibalqa
2023-07-13 16:06 ` Platon Pronko
2023-07-13 16:14 ` Drew Adams
2023-07-13 16:07 ` Drew Adams [this message]
2023-07-13 16:12 ` Robert Pluim
2023-07-13 16:16 ` Drew Adams
2023-07-13 15:59 ` Drew Adams
2023-07-13 14:42 ` uzibalqa
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=CO6PR10MB5473021C061A351009904ECBF337A@CO6PR10MB5473.namprd10.prod.outlook.com \
--to=drew.adams@oracle.com \
--cc=help-gnu-emacs@gnu.org \
--cc=platon7pronko@gmail.com \
--cc=uzibalqa@proton.me \
/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).