unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Rupert Swarbrick <rswarbrick@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: What to use instead of find-if?
Date: Mon, 01 Dec 2008 19:56:13 +0000	[thread overview]
Message-ID: <gh1fi0$i92$2@news.albasani.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 775 bytes --]


I was messing around last night and added a small feature to my local
copy of gnus. Cool. I reckon it'd be useful in general, so I was going
to post it to ding. Cool.

However

Looking back at the code, I realised I used cl's find-if (I know
somewhat more common lisp than elisp). And gnus doesn't (require
'cl). So the code I'm thinking about does the following:

  (let ((blah
         (find-if (lambda (elem)
                    (whopping-great-predicatey-thing))
                  some-list)))
    (if blah
        (something using blah)
      (something else)))

Can anyone suggest a vaguely idiomatic way to do this using the built-in
constructs of elisp? This is a genuine question, by the way. I'm sure
I'm being thick not spotting a neat way to write this.

Rupert

[-- Attachment #2: Type: application/pgp-signature, Size: 314 bytes --]

             reply	other threads:[~2008-12-01 19:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-01 19:56 Rupert Swarbrick [this message]
2008-12-01 21:24 ` What to use instead of find-if? Drew Adams
     [not found] ` <mailman.1649.1228166673.26697.help-gnu-emacs@gnu.org>
2008-12-03  0:29   ` Rupert Swarbrick
2008-12-03  0:58     ` Drew Adams
  -- strict thread matches above, loose matches on Subject: below --
2008-12-01 19:54 Rupert Swarbrick

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='gh1fi0$i92$2@news.albasani.net' \
    --to=rswarbrick@gmail.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).