Is there something like containp?
Otherwise I have to write my own function to loop and search in the
list.
If possible, I also want this container to be efficient so that the
existence of an object can be tested using binary search or hash
table?
Thanks.
smartnose wrote:
> Is there something like containp?
>
> Otherwise I have to write my own function to loop and search in the
> list.
>
> If possible, I also want this container to be efficient so that the
> existence of an object can be tested using binary search or hash
> table?
Well then you do not want a Lisp (linked) list. You could do a binary
search with a vector, a hashed search with a hash table.
kt
From: alien_guy
Subject: Re: How to test whether a list has a certain atom?
Date:
Message-ID: <pan.2008.10.04.02.40.24@l.org>
On Fri, 03 Oct 2008 19:28:22 -0700, smartnose wrote:
> Is there something like containp?
member
In article
<····································@u28g2000hsc.googlegroups.com>,
smartnose <·········@gmail.com> wrote:
> Is there something like containp?
>
> Otherwise I have to write my own function to loop and search in the
> list.
MEMBER works for lists. FIND works for sequences (lists, vectors, strings, ..).
>
> If possible, I also want this container to be efficient so that the
> existence of an object can be tested using binary search or hash
> table?
Then you may want to use a hash table.
See the Common Lisp Hyperspec for the various facilities
in the language. Also some other book as an introduction might
be useful - if you don't have one already. Graham's book
ANSI Common Lisp gives a compact overview.
>
> Thanks.
--
http://lispm.dyndns.org/