basilisp.set

Set manipulation utilities.

fn (difference s)
fn (difference s & others)

Return a new set with elements from set s not in the others. If no others are provided, return s.

fn (disjoint? s1 s2)

Return true if set s1 shares no common elements with set s2.

Sets are considered disjoint if and only if their intersection is the empty set.

fn (index rel ks)

Given a set of maps rel, return a mapping of unique selections of keys from ks to the set of values which have those mappings.

fn (intersection s)
fn (intersection s & others)

Return a new set with only elements in set s that are in all the others. If no others are provided, return s.

fn (join lrel rrel)
fn (join lrel rrel keymap)

Perform a natural join on the maps in lrel and rrel using keys shared by elements of each relation. If keymap is specified, join only on the given keys.

fn (map-invert m)

Return a map whose vals and keys are swapped.

Duplicate values used as keys will overwrite each other as iteration order is non-deterministic.

fn (project rel ks)

Given a set of maps rel, return a set of those maps with only the keys in ks.

fn (rename rel kmap)

Given a set of maps rel, return a set whose maps have had any keys in kmap renamed to the value in kmap.

fn (rename-keys m kmap)

Return m with any keys appearing in kmap replaced with the value in kmap.

fn (select pred xset)

Return a set of values in xset for which pred is true.

fn (subset? s1 s2)

Return true if every element in s1 is also in s2.

fn (superset? s1 s2)

Return true if every element in s2 is also in s1.

fn (symmetric-difference s)
fn (symmetric-difference s & others)

Return a new set with elements which are not shared by any of the set s and others. If no others are provided, return s.

fn (union s)
fn (union s & others)

Return a new set with elements in set s that are in the others. If no others are provided, return s.