bloom-filters: fix docs.

db4
John Benediktsson 2013-04-04 16:06:01 -07:00
parent 3c4dbf6ed5
commit 0b60d6cc4c
3 changed files with 5 additions and 5 deletions

View File

@ -3,10 +3,10 @@ IN: bloom-filters
HELP: <bloom-filter> HELP: <bloom-filter>
{ $values { "error-rate" "The desired false positive rate. A " { $link float } " between 0 and 1." } { $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 } } { "bloom-filter" bloom-filter } }
{ $description "Creates an empty 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 HELP: bloom-filter-insert

View File

@ -23,7 +23,7 @@ IN: bloom-filters.tests
[ 4 32 ] [ 0.05 5 size-bloom-filter ] unit-test [ 4 32 ] [ 0.05 5 size-bloom-filter ] unit-test
! This is a lot of bits. ! 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. ! Other error conditions.
[ 1.0 2000 <bloom-filter> ] [ invalid-error-rate? ] must-fail-with [ 1.0 2000 <bloom-filter> ] [ invalid-error-rate? ] must-fail-with

View File

@ -49,7 +49,7 @@ TUPLE: bloom-filter
{ capacity fixnum read-only } { capacity fixnum read-only }
{ count fixnum } ; { count fixnum } ;
ERROR: capacity-error ; ERROR: invalid-size ;
ERROR: invalid-error-rate error-rate ; ERROR: invalid-error-rate error-rate ;
ERROR: invalid-capacity capacity ; ERROR: invalid-capacity capacity ;
@ -73,7 +73,7 @@ ERROR: invalid-capacity capacity ;
! If the number of hashes isn't positive, we haven't found ! If the number of hashes isn't positive, we haven't found
! anything smaller than the identity configuration. ! anything smaller than the identity configuration.
: check-hashes ( 2seq -- 2seq ) : 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 ! The consensus on the tradeoff between increasing the number of
! bits and increasing the number of hash functions seems to be ! bits and increasing the number of hash functions seems to be