unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: pjb@informatimago.com (Pascal J. Bourguignon)
To: help-gnu-emacs@gnu.org
Subject: Re: How do lisp gurus truncate?
Date: Thu, 23 Jul 2009 19:31:29 +0200	[thread overview]
Message-ID: <87zlavjoge.fsf@galatea.local> (raw)
In-Reply-To: 87hbx31gah.fsf@kobe.laptop

Giorgos Keramidas <keramida@ceid.upatras.gr> writes:

> My only concern about find/nthcdr is that if the list can get very very
> long, you are essentially going to iterate over it twice.  But I am not
> sure if there's a function like `find' that will return the cons cell
> instead of the value at position N.

Too bad you discarded member earlier...  In Common Lisp it takes a
:test argument like find and other functions.  In emacs, a variant
named member* provides the same feature:

(require 'cl)
(member* 3 '(1.5 2.5 3.5 4.5 5.5) :test (function <)) --> (3.5 4.5 5.5)


-- 
__Pascal Bourguignon__


  reply	other threads:[~2009-07-23 17:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.2999.1248330784.2239.help-gnu-emacs@gnu.org>
2009-07-23 17:05 ` How do lisp gurus truncate? Giorgos Keramidas
2009-07-23 17:31   ` Pascal J. Bourguignon [this message]
2009-07-23 20:35     ` Giorgos Keramidas
2009-07-23 18:11   ` Lennart Borgman
2009-07-23 19:44 ` Pascal J. Bourguignon
2009-07-23  6:32 Lennart Borgman

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=87zlavjoge.fsf@galatea.local \
    --to=pjb@informatimago.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).