ggb / elm-bloom

Simple Elm bloom filter implementation using Murmur3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

elm-bloom: Bloom Filter for Elm

Elm Bloom filter implementation using Murmur3. It may not be the fastest implementation, but it is simple and easy to use. This blog post with rules of thumb for choosing m and k might be helpful.

Installation

elm package install ggb/elm-bloom

Usage

Usage is straightforward:

import Bloom exposing (empty, add, test)

-- create an empty filter with m elements and k hashes
emptyFilter = empty 1000 4

-- add elements to the filter
filter = 
  List.foldr 
    add
    emptyFilter 
    ["foo", "bar", "baz", ... ]

-- check if elements are recognized by the filter
test "bar" filter == True
test "barr" filter == False

About

Simple Elm bloom filter implementation using Murmur3

License:MIT License


Languages

Language:Elm 100.0%