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

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

Re: Problem with position and find (cl)


From: Thierry Volpiatto
Subject: Re: Problem with position and find (cl)
Date: Sat, 21 Jun 2008 06:57:32 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Florian Beck <abstraktion@t-online.de> writes:

> 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)?
>
> 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?
eq compare two objects and say if they are the same.
equal compare two objects and say if the value of these object is the
same.

,----
| ELISP> (setq A '(1 2))
| (1 2)
| 
| ELISP> (setq B '(1 2))
| (1 2)
| 
| ELISP> (eq A B)
| nil
| ELISP> (equal A B)
| t
`----

-- 
A + Thierry
Pub key: http://pgp.mit.edu




reply via email to

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