[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem with position and find (cl)
From: |
Barry Margolin |
Subject: |
Re: Problem with position and find (cl) |
Date: |
Fri, 20 Jun 2008 22:04:31 -0400 |
User-agent: |
MT-NewsWatcher/3.5.3b2 (Intel Mac OS X) |
In article <87abhfg0mn.fsf@sophokles.streitblatt.de>,
Florian Beck <abstraktion@t-online.de> wrote:
> Thierry Volpiatto <thierry.volpiatto@gmail.com> writes:
>
>
> > position default test is 'eq, try 'equal
>
> Indeed, many cl-tests default to 'eq.
>
> BTW, what is the reason for this (apart from being a language convention)?
Just because things look similar doesn't mean they're the same. Imagine
if you use a list like (firstname lastname) to represent people, and you
have two John Smiths in the group.
>
> When I try
>
> (let ((start-time (current-time)))
> (dotimes (i 1000000)
> (position '(1) '((2) (5) (2) 2 x 4 fer fer f r e wqf (1) fr r) :test
> 'eq))
> (format-time-string "%S" (time-since start-time)))
>
> with 'eq and 'equal I get the same result. So 'eq is not more efficent,
> is it?
For a single-element list the difference is almost negligible. Try
again with long lists, like 50 or 100 elements long.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
Re: Problem with position and find (cl), Thien-Thi Nguyen, 2008/06/20