Liking cljdoc? Tell your friends :D

cascalog.logic.ops


!countclj


allclj

(all & ops)

Accepts any number of filtering ops and returns a new op that checks that every every one of the original filters passes. For example:

((all #'even? #'positive? #'small?) ?x) ;; within some query

Is equivalent to:

;; within some query (even? ?x :> ?temp1) (positive? ?x :> ?temp2) (small? ?x) :> ?temp3) (and ?temp1 ?temp2 ?temp3)

Accepts any number of filtering ops and returns a new op that
checks that every every one of the original filters passes. For
example:

((all #'even? #'positive? #'small?) ?x) ;; within some query

Is equivalent to:

;; within some query
(even? ?x :> ?temp1)
(positive? ?x :> ?temp2)
(small? ?x) :> ?temp3)
(and ?temp1 ?temp2 ?temp3)
raw docstring

anyclj

(any & ops)

Accepts any number of filtering ops and returns a new op that checks that at least one of the original filters passes. For example:

((any #'even? #'positive? #'small?) ?x) ;; within some query

Is equivalent to:

;; within some query (even? ?x :> ?temp1) (positive? ?x :> ?temp2) (small? ?x :> ?temp3) (or ?temp1 ?temp2 ?temp3)

Accepts any number of filtering ops and returns a new op that
checks that at least one of the original filters passes. For
example:

((any #'even? #'positive? #'small?) ?x) ;; within some query

Is equivalent to:

;; within some query
(even? ?x :> ?temp1)
(positive? ?x :> ?temp2)
(small? ?x :> ?temp3)
(or ?temp1 ?temp2 ?temp3)
raw docstring

avgclj

Predicate operation that produces the average value of the supplied input variable. For example:

(let [src [[1] [2]]] (<- [?avg] (src ?x) (avg ?x :> ?avg))) ;;=> ([1.5])

Predicate operation that produces the average value of the
supplied input variable. For example:

(let [src [[1] [2]]]
  (<- [?avg]
      (src ?x)
      (avg ?x :> ?avg)))
;;=> ([1.5])
raw docstring

compclj

(comp & ops)

Accepts any number of predicate ops and returns an op that is the composition of those ops.

(require '[cascalog.ops :as c]) ((c/comp #'str #'+) ?x ?y :> ?sum-string) ;; within some query

Is equivalent to:

;; within some query (+ ?x ?y :> ?intermediate) (str ?intermediate :> ?sum-string)

Accepts any number of predicate ops and returns an op that is the
composition of those ops.

(require '[cascalog.ops :as c])
((c/comp #'str #'+) ?x ?y :> ?sum-string) ;; within some query

Is equivalent to:

;; within some query
(+ ?x ?y :> ?intermediate)
(str ?intermediate :> ?sum-string)
raw docstring

countclj


distinct-countclj

Predicate operation that produces a count of all distinct values of the supplied input variable. For example:

(let [src [[1] [2] [2]]] (<- [?count] (src ?x) (distinct-count ?x :> ?count))) ;;=> ([2])

Predicate operation that produces a count of all distinct
values of the supplied input variable. For example:

(let [src [[1] [2] [2]]]
(<- [?count]
    (src ?x)
    (distinct-count ?x :> ?count)))
;;=> ([2])
raw docstring

eachclj

(each op)

Accepts an operation and returns a predicate macro that maps op across any number of input variables. For example:

((each #'str) ?x ?y ?z :> ?x-str ?y-str ?z-str) ;; within some query

Is equivalent to

;; within some query (str ?x :> ?x-str) (str ?y :> ?y-str) (str ?z :> ?z-str)

Accepts an operation and returns a predicate macro that maps `op`
across any number of input variables. For example:

((each #'str) ?x ?y ?z :> ?x-str ?y-str ?z-str) ;; within some query

Is equivalent to

;; within some query
(str ?x :> ?x-str)
(str ?y :> ?y-str)
(str ?z :> ?z-str)
raw docstring

first-nclj

(first-n gen n & options__8569__auto__)

Accepts a generator and a number n and returns a subquery that produces the first n elements from the supplied generator. Two boolean keyword arguments are supported:

:sort -- accepts a vector of variables on which to sort. Defaults to nil (unsorted). :reverse -- If true, sorts items in reverse order. (false by default).

For example:

(def src [[1] [3] [2]]) ;; produces 3 tuples

;; produces ([1 2] [3 4] [2 3]) when executed (def query (<- [?x ?y] (src ?x) (inc ?x :> ?y)))

;; produces ([3 4]) when executed (first-n query 1 :sort ["?x"] :reverse true)

Accepts a generator and a number `n` and returns a subquery that
 produces the first n elements from the supplied generator. Two
 boolean keyword arguments are supported:

:sort -- accepts a vector of variables on which to sort. Defaults to
         nil (unsorted).
:reverse -- If true, sorts items in reverse order. (false by default).

For example:

(def src [[1] [3] [2]]) ;; produces 3 tuples

;; produces ([1 2] [3 4] [2 3]) when executed
(def query (<- [?x ?y] (src ?x) (inc ?x :> ?y)))

;; produces ([3 4]) when executed
(first-n query 1 :sort ["?x"] :reverse true)
raw docstring

fixed-sampleclj

(fixed-sample gen n)

Returns a subquery getting a random sample of n elements from the generator

Returns a subquery getting a random sample of n elements from the generator
raw docstring

fixed-sample-aggclj

(fixed-sample-agg amt)

juxtclj

(juxt & ops)

Accepts any number of predicate ops and returns an op that is the juxtaposition of those ops.

(require '[cascalog.ops :as c]) ((c/juxt #'+ #'- #'<) !x !y :> !sum !diff !mult) ;; within some query

Is equivalent to:

;; within some query (+ !x !y :> !sum) (- !x !y :> !diff) (* !x !y :> !mult)

Accepts any number of predicate ops and returns an op that is the
juxtaposition of those ops.

(require '[cascalog.ops :as c])
((c/juxt #'+ #'- #'<) !x !y :> !sum !diff !mult) ;; within some query

Is equivalent to:

;; within some query
(+ !x !y :> !sum)
(- !x !y :> !diff)
(* !x !y :> !mult)
raw docstring

limitclj

(limit n)

limit-bufferclj

(limit-buffer n)

limit-combineclj

(limit-combine options n)

limit-extractclj

(limit-extract options n)

limit-initclj

(limit-init sort-tuple & tuple)

limit-rankclj

(limit-rank n)

limit-rank-bufferclj

(limit-rank-buffer n)

maxclj


minclj


negateclj

(negate op)

Accepts a filtering op and returns an new op that acts as the negation (or complement) of the original. For example:

((negate #'string?) ?string-var) ;; within some query

Is equivalent to

;; within some query (string? ?string-var :> ?temp-bool) (not ?temp-bool)

Accepts a filtering op and returns an new op that acts as the
negation (or complement) of the original. For example:

((negate #'string?) ?string-var) ;; within some query

Is equivalent to

;; within some query
(string? ?string-var :> ?temp-bool)
(not ?temp-bool)
raw docstring

partialclj

(partial op & args)

Accepts an operation and fewer than normal arguments, and returns a new operation that can be called with the remaining unspecified args. For example, given this require and defmapop:

(require '[cascalog.logic.ops :as c]) (defmapop plus [x y] (+ x y))

The following two forms are equivalent:

(let [plus-10 (c/partial plus 10)] (<- [?y] (src ?x) (plus-10 ?x :> ?y)))

(<- [?y] (src ?x) (plus-10 ?x :> ?y))

With the benefit that 10 doesn't need to be hardcoded into the first query.

Accepts an operation and fewer than normal arguments, and returns a
new operation that can be called with the remaining unspecified
args. For example, given this require and defmapop:

(require '[cascalog.logic.ops :as c])
(defmapop plus [x y] (+ x y))

The following two forms are equivalent:

(let [plus-10 (c/partial plus 10)]
   (<- [?y] (src ?x) (plus-10 ?x :> ?y)))

(<- [?y] (src ?x) (plus-10 ?x :> ?y))

With the benefit that `10` doesn't need to be hardcoded into the
first query.
raw docstring

re-parseclj

(re-parse pattern)

Accepts a regex pattern and a string argument str and returns the groups within str that match the supplied pattern.

Accepts a regex `pattern` and a string argument `str` and returns
the groups within `str` that match the supplied `pattern`.
raw docstring

sumclj

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close