Changeset 36631 in project
 Timestamp:
 09/16/18 22:43:45 (9 months ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

release/5/bloomfilter/trunk/bloomfilter.scm
r36576 r36631 55 55 (only typeerrorsbasic signalboundserror)) 56 56 57 ;;;(should be able to get from module) 58 59 (definetype iset:integerset *) 60 57 61 ;;; 58 62 59 (definetype iset:integerset *)63 (definetype booleanset iset:integerset) 60 64 61 65 (definetype messagedigestprimitive (struct messagedigestprimitive)) … … 116 120 (definetype bloomfilter (struct bloomfilter)) 117 121 118 (: *makebloomfilter (fixnum fixnum fixnum iset:integerset bloomfilterhashers messagedigestprimitives > bloomfilter))122 (: *makebloomfilter (fixnum fixnum fixnum booleanset bloomfilterhashers messagedigestprimitives > bloomfilter)) 119 123 (: bloomfilter? (* > boolean : bloomfilter)) 120 124 (: *bloomfiltern (bloomfilter > fixnum)) … … 122 126 (: *bloomfilterm (bloomfilter > fixnum)) 123 127 (: *bloomfilterk (bloomfilter > fixnum)) 124 (: *bloomfilterbits (bloomfilter > iset:integerset))125 (: *bloomfilterbitsset! (bloomfilter iset:integerset > void))128 (: *bloomfilterbits (bloomfilter > booleanset)) 129 (: *bloomfilterbitsset! (bloomfilter booleanset > void)) 126 130 (: *bloomfilterhashers (bloomfilter > bloomfilterhashers)) 127 131 (: *bloomfilteralgorithms (bloomfilter > messagedigestprimitives)) … … 345 349 (*bloomfilterm bf)) ) 346 350 347 (: *biton! ( iset:integerset fixnum > iset:integerset))351 (: *biton! (booleanset fixnum > booleanset)) 348 352 ; 349 353 (define (*biton! bits idx) … … 362 366 (*bloomfilternset! bf (fx+ (*bloomfiltern bf) 1)) ) ) 363 367 368 (: makebitcounter (booleanset > (fixnum fixnum > fixnum))) 369 ; 370 (define ((makebitcounter bits) cnt idx) 371 (if (bitvectorref bits idx) (fx+ cnt 1) cnt) ) 372 364 373 (: bloomfilterexists? (bloomfilter * > boolean)) 365 374 ; 366 375 (define (bloomfilterexists? bf obj) 367 376 (let* ( 368 (bits 369 (*bloomfilterbits (checkbloomfilter 'bloomfilterexists? bf)) ) 370 (bitcnt 371 (lambda (cnt idx) (if (bitvectorref bits idx) (fx+ cnt 1) cnt)) ) 372 (refs 373 (bloomfilterfoldl bf bitcnt 0 obj)) ) 374 (fx<= (*bloomfilterk bf) refs) ) ) 377 (bits (*bloomfilterbits (checkbloomfilter 'bloomfilterexists? bf))) 378 (bitcnt (bloomfilterfoldl bf (makebitcounter bits) 0 obj)) ) 379 (fx<= (*bloomfilterk bf) bitcnt) ) ) 375 380 376 381 ) ;module bloomfilter
Note: See TracChangeset
for help on using the changeset viewer.