talan v0.1.1 Talan.Stream View Source
Link to this section Summary
Link to this section Functions
uniq(enum, bloom_filter)View Source
Returns a probabilistically uniq stream.
Its main advantage is that it doesn't store elements emitted by the stream. Instead it uses a bloom filter for membership check.
The stream never returns duplicate elements but it sometimes detects false positive duplicates depending on the bloom filter it uses. False positives are faulty duplicate detections that get rejected.
iex> list = ["a", "b", "c", "a", "b"] iex> bloom_filter = Talan.BloomFilter.new(100_000, false_positive_probability: 0.001) iex> Talan.Stream.uniq(list, bloom_filter) |> Enum.to_list ["a", "b", "c"]