(aggregate xrel m)
(aggregate xrel k f)
Applies f to the xrel and returns a relation with one tuple.
In the case a map is provided in place of k and f, the same procedure will be applied to all pairs of k and f in m.
Applies f to the xrel and returns a relation with one tuple. In the case a map is provided in place of k and f, the same procedure will be applied to all pairs of k and f in m.
(aggregate-by xrel agg-ks m-or-f)
(aggregate-by xrel agg-ks k f)
Groups by agg-ks and aggregates the grouped relations.
If a function is provided, it is expected to take a relation and return a relation
Groups by agg-ks and aggregates the grouped relations. If a function is provided, it is expected to take a relation and return a relation
(difference s1)
(difference s1 s2)
(difference s1 s2 & sets)
Return a coll that is the first coll without elements of the remaining colls
Return a coll that is the first coll without elements of the remaining colls
(extend xrel m)
(extend xrel k f)
Extends each tuple by assoc:ing k to the result of (f tuple). k can either be a new key or an existing key.
A map from k to f can also be specified, to extend multiple attributes in one call.
Extends each tuple by assoc:ing k to the result of (f tuple). k can either be a new key or an existing key. A map from k to f can also be specified, to extend multiple attributes in one call.
(index xrel ks)
Returns a map of the distinct values of ks in the xrel mapped to a set of the maps in xrel with the corresponding values of ks.
Returns a map of the distinct values of ks in the xrel mapped to a set of the maps in xrel with the corresponding values of ks.
(index-unique xrel ks)
Like index
but requires that each key only have one value. The vals in the
index is a single value and not in a collection like with index
. Throws
if the unique constraint is not met.
Like `index` but requires that each key only have one value. The vals in the index is a single value and not in a collection like with `index`. Throws if the unique constraint is not met.
(intersection s1)
(intersection s1 s2)
(intersection s1 s2 & sets)
Return a coll that is the intersection of the input colls
Return a coll that is the intersection of the input colls
(join xrel yrel)
(join xrel yrel km)
When passed 2 rels, returns the rel corresponding to the natural join. When passed an additional keymap, joins on the corresponding keys.
When passed 2 rels, returns the rel corresponding to the natural join. When passed an additional keymap, joins on the corresponding keys.
(left-join xrel yrel km)
Joins, but always keeps enerything on the left, even if there is no match on the right. Each row will contain all keys from the left, plus all keys in the km (possibly with nil values), and, when there is a match, all keys from the right.
Joins, but always keeps enerything on the left, even if there is no match on the right. Each row will contain all keys from the left, plus all keys in the km (possibly with nil values), and, when there is a match, all keys from the right.
Returns the map with the vals mapped to the keys.
Returns the map with the vals mapped to the keys.
(order-by xrel keyfn)
(order-by xrel keyfn comp)
Orders the tuples according to keyfn and an optional comparator.
Same behavior as clojure.core/sort-by
, but with xrel in first position.
Orders the tuples according to keyfn and an optional comparator. Same behavior as `clojure.core/sort-by`, but with xrel in first position.
(project xrel attr-names)
Returns a rel of the elements of xrel with only the keys in ks
Returns a rel of the elements of xrel with only the keys in ks
(project-away xrel attr-names)
Returns a rel of the elements of xrel without the keys in ks
Returns a rel of the elements of xrel without the keys in ks
(rename xrel kmap)
Returns a rel of the maps in xrel with the keys in kmap renamed to the vals in kmap
Returns a rel of the maps in xrel with the keys in kmap renamed to the vals in kmap
Returns the map with the keys in kmap renamed to the vals in kmap
Returns the map with the keys in kmap renamed to the vals in kmap
(restrict xrel pred?)
Returns a coll of the elements for which pred is true. Same as select
but
with the rel in first position to be more useful in a -> chain.
Returns a coll of the elements for which pred is true. Same as `select` but with the rel in first position to be more useful in a -> chain.
(select pred? xrel)
Returns a coll of the elements for which pred is true
Returns a coll of the elements for which pred is true
(setish xs)
Return a coll of the same type as xs but without duplicates.
Return a coll of the same type as xs but without duplicates.
(subset? coll1 coll2)
Is coll1 a subset of coll2
Is coll1 a subset of coll2
(sum k)
Convenience function to use with set aggregations.
Convenience function to use with set aggregations.
(superset? coll1 coll2)
Is coll1 a superset of coll2?
Is coll1 a superset of coll2?
(union)
(union s1)
(union s1 s2)
(union s1 s2 & sets)
Return a coll that is the union of the input colls
Return a coll that is the union of the input colls
(update xrel k f & args)
Like clojure.core/update, but works on each tuple in a rel.
Like clojure.core/update, but works on each tuple in a rel.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close