bloom-filters: fix docs.
parent
3c4dbf6ed5
commit
0b60d6cc4c
|
@ -3,10 +3,10 @@ IN: bloom-filters
|
|||
|
||||
HELP: <bloom-filter>
|
||||
{ $values { "error-rate" "The desired false positive rate. A " { $link float } " between 0 and 1." }
|
||||
{ "number-objects" "The expected number of object in the set. A positive " { $link integer } "." }
|
||||
{ "capacity" "The expected number of object in the set. A positive " { $link integer } "." }
|
||||
{ "bloom-filter" bloom-filter } }
|
||||
{ $description "Creates an empty Bloom filter." }
|
||||
{ $errors "Throws a " { $link capacity-error } " when unable to produce a filter meeting the given constraints. Throws a " { $link invalid-error-rate } " or a " { $link invalid-n-objects } " when input is invalid." } ;
|
||||
{ $errors "Throws a " { $link invalid-size } " when unable to produce a filter meeting the given constraints. Throws a " { $link invalid-error-rate } " or a " { $link invalid-capacity } " when input is invalid." } ;
|
||||
|
||||
|
||||
HELP: bloom-filter-insert
|
||||
|
|
|
@ -23,7 +23,7 @@ IN: bloom-filters.tests
|
|||
[ 4 32 ] [ 0.05 5 size-bloom-filter ] unit-test
|
||||
|
||||
! This is a lot of bits.
|
||||
[ 0.00000001 max-array-capacity size-bloom-filter ] [ capacity-error? ] must-fail-with
|
||||
[ 0.00000001 max-array-capacity size-bloom-filter ] [ invalid-size? ] must-fail-with
|
||||
|
||||
! Other error conditions.
|
||||
[ 1.0 2000 <bloom-filter> ] [ invalid-error-rate? ] must-fail-with
|
||||
|
|
|
@ -49,7 +49,7 @@ TUPLE: bloom-filter
|
|||
{ capacity fixnum read-only }
|
||||
{ count fixnum } ;
|
||||
|
||||
ERROR: capacity-error ;
|
||||
ERROR: invalid-size ;
|
||||
ERROR: invalid-error-rate error-rate ;
|
||||
ERROR: invalid-capacity capacity ;
|
||||
|
||||
|
@ -73,7 +73,7 @@ ERROR: invalid-capacity capacity ;
|
|||
! If the number of hashes isn't positive, we haven't found
|
||||
! anything smaller than the identity configuration.
|
||||
: check-hashes ( 2seq -- 2seq )
|
||||
dup first 0 <= [ capacity-error ] when ;
|
||||
dup first 0 <= [ invalid-size ] when ;
|
||||
|
||||
! The consensus on the tradeoff between increasing the number of
|
||||
! bits and increasing the number of hash functions seems to be
|
||||
|
|
Loading…
Reference in New Issue