help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do lisp gurus truncate?


From: Pascal J. Bourguignon
Subject: Re: How do lisp gurus truncate?
Date: Thu, 23 Jul 2009 19:31:29 +0200
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.3 (darwin)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]