ham-fisted.set

->integer-random-access

(->integer-random-access s)

Given a set (or bitset), return a efficient, sorted random access structure. This assumes the set contains integers.

bitset

(bitset)(bitset data)(bitset start end)

Create a java.util.Bitset. The two argument version assumes you are passing in the start, end of a monotonically incrementing range.

bitset?

(bitset? s)

Return true if this is a bitset

cardinality

(cardinality s)

Return the cardinality (size) of a given set.

contains-fn

(contains-fn s)

Return an IFn that returns efficiently returns true if the set contains a given element.

contains-range?

(contains-range? s sidx eidx)

bitset-specific query that returns true if the set contains all the integers from sidx to eidx non-inclusive.

difference

(difference l r)

set difference

intersection

(intersection)(intersection l)(intersection l r)

set intersection

intersects-range?

(intersects-range? s sidx eidx)

bitset-specific query that returns true if the set contains any the integers from sidx to eidx non-inclusive.

java-concurrent-hashset

(java-concurrent-hashset)(java-concurrent-hashset data)

Create a concurrent hashset.

java-hashset

(java-hashset)(java-hashset data)

Return a java hashset

map-invert

(map-invert m)

invert a map such that the keys are the vals and the vals are the keys

max-set-value

(max-set-value s)

Given a bitset, return the maximum set value. Errors if the bitset is empty.

min-set-value

(min-set-value s)

Given a bitset, return the minimum set value. Errors if the bitset is empty.

mut-set

(mut-set)(mut-set data)

Return a mutable set.

reduce-intersection

(reduce-intersection)(reduce-intersection l)(reduce-intersection l & data)

reduce-union

(reduce-union)(reduce-union l)(reduce-union l & data)

Reduce a number of objects into one object via union

set

(set)(set data)

Return an immutable set

set?

(set? data)

union

(union l r)

set union

unique

(unique options data)(unique data)

Create a set of unique items. Parallelized and non-lazy.

See options for unique-reducer and ham-fisted.api/preduce-reducer.

unique-reducer

(unique-reducer options)

Create a parallel reducer that creates a set.

Options:

xor

(xor l r)

set xor - difference of intersection from union