Common Lisp CFFI wrapper for the dablooms library
You will need an ANSI-compliant Common Lisp implementation (I use SBCL) and the quicklisp library manager. The first time you use quicklisp's quickload to load cl-dablooms, it will install CFFI (and its dependencies).
- Install the dablooms shared library on your system library path
- CD into the cl-dablooms directory and start your LISP REPL.
- Load cl-dablooms into the repl with
(dablooms:with-filter bloom (:capacity 1000 :error-rate .05 :filename "/tmp/bloom.bin") (dablooms:add bloom "foo" 2) (dablooms:check bloom "bar") (dablooms:remove bloom "foo" 2) (dablooms:check bloom "foo"))
with-filter macro will ensure that the filter is destroyed after the body
is finished running. You can make a bloom filter manually using
the same keyword arguments, but you will have to clean it up manually
The key argument to the
remove functions can be either
strings or symbols. However, the symbols and strings do not have separate
namespaces. That is,
(dablooms:check bloom "foo") and
(dablooms:check bloom :foo) are equivalent.