From: Bruce L. Lambert
Subject: sets as bit vectors vs. integers (e.g., logand vs. bit-and)
Date: 
Message-ID: <7c3rbl$1up6$1@piglet.cc.uic.edu>
I have an information retrieval application in which I need to quickly do an
intersection between two sets and then count the number of elements in the
resulting set. There seem to be (at least) two good ways to do this in Lisp.
The first involves logical operations on integers (i.e., logand). The second
involves logical operations on bit vectors (i.e., bit-and).

I'd prefer to do the logic on integers because after I do the intersections,
I want to count the number of bits that are set to 1. This can be done
easily with logcount.

Here's my problem (question). When building the sets, it seems much more
intuitive to use the bit vectors. When doing logical operations on the sets,
it seems better to use integers (especially because of the usefulness of
logcount).

Is there a functional equivalent of logcount for bit vectors? (Of course I
could write one, but it seems that one might be built in.) Alternatively, is
there an easy (built-in) way to convert a bit vector to an integer so that I
could build the sets using bit vectors but do the logic on integers?

Other advice?

Thanks.

--
Bruce Lambert, PhD
Department of Pharmacy Administration
University of Illinois at Chicago
833 S. Wood St. (M/C 871)
Chicago, IL 60612-7231

Ph: (312) 996-2411
Fax: (312) 996-0868
From: Barry Margolin
Subject: Re: sets as bit vectors vs. integers (e.g., logand vs. bit-and)
Date: 
Message-ID: <UBRF2.155$p4.16938@burlma1-snr2>
In article <·············@piglet.cc.uic.edu>,
Bruce L. Lambert <········@uic.edu> wrote:
>Is there a functional equivalent of logcount for bit vectors? (Of course I

(count 1 bit-vector)

-- 
Barry Margolin, ······@bbnplanet.com
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.