Liking cljdoc? Tell your friends :D

active.clojure.sum-type


clause-with-extraction-bodyclj/s

(clause-with-extraction-body ClauseWithExtraction)
Lens for the `body` field from a [[ClauseWithExtraction]] record. See [[active.clojure.sum-type/make-clause-with-extraction]].
sourceraw docstring

clause-with-extraction-constructor-symbolclj/s

(clause-with-extraction-constructor-symbol ClauseWithExtraction)

Lens for the constructor-symbol field from a ClauseWithExtraction record. See active.clojure.sum-type/make-clause-with-extraction.

Lens for the `constructor-symbol` field from a [[ClauseWithExtraction]] record. See [[active.clojure.sum-type/make-clause-with-extraction]].
sourceraw docstring

clause-with-extraction-named-paramsclj/s

(clause-with-extraction-named-params ClauseWithExtraction)

Lens for the named-params field from a ClauseWithExtraction record. See active.clojure.sum-type/make-clause-with-extraction.

Lens for the `named-params` field from a [[ClauseWithExtraction]] record. See [[active.clojure.sum-type/make-clause-with-extraction]].
sourceraw docstring

clause-with-extraction?clj/s

(clause-with-extraction? thing)

Is object a ClauseWithExtraction record? See active.clojure.sum-type/make-clause-with-extraction.

Is object a `ClauseWithExtraction` record? See [[active.clojure.sum-type/make-clause-with-extraction]].
sourceraw docstring

clause-with-predicate-bodyclj/s

(clause-with-predicate-body ClauseWithPredicate)

Lens for the body field from a ClauseWithPredicate record. See active.clojure.sum-type/make-clause-with-predicate.

Lens for the `body` field from a [[ClauseWithPredicate]] record. See [[active.clojure.sum-type/make-clause-with-predicate]].
sourceraw docstring

clause-with-predicate-predicateclj/s

(clause-with-predicate-predicate ClauseWithPredicate)

Lens for the predicate field from a ClauseWithPredicate record. See active.clojure.sum-type/make-clause-with-predicate.

Lens for the `predicate` field from a [[ClauseWithPredicate]] record. See [[active.clojure.sum-type/make-clause-with-predicate]].
sourceraw docstring

clause-with-predicate?clj/s

(clause-with-predicate? thing)

Is object a ClauseWithPredicate record? See active.clojure.sum-type/make-clause-with-predicate.

Is object a `ClauseWithPredicate` record? See [[active.clojure.sum-type/make-clause-with-predicate]].
sourceraw docstring

ClauseWithExtractioncljs

source

ClauseWithPredicatecljs

source

colorizeclj/s

(colorize pred tree)

Colorizes a node if pred matches (that is, setting colored? to true

Colorizes a node if pred matches (that is, setting colored? to `true`
sourceraw docstring

constr-or-pred?-fnclj/s

(constr-or-pred?-fn sym)
source

debug-infoclj

(debug-info form ns)
source

debug-info-strclj/s

(debug-info-str debug-info)
source

default-clause-bodyclj/s

(default-clause-body DefaultClause)

Lens for the body field from a DefaultClause record. See active.clojure.sum-type/make-default-clause.

Lens for the `body` field from a [[DefaultClause]] record. See [[active.clojure.sum-type/make-default-clause]].
sourceraw docstring

default-clause?clj/s

(default-clause? thing)

Is object a DefaultClause record? See active.clojure.sum-type/make-default-clause.

Is object a `DefaultClause` record? See [[active.clojure.sum-type/make-default-clause]].
sourceraw docstring

DefaultClausecljs

source

define-sum-typecljmacro

(define-sum-type type-name predicate type-symbols)
source

find-non-colored-leafsclj/s

(find-non-colored-leafs tree)

Finds non-colored leafs by recursion. Stops descending if colored intermediate node occurs

Finds non-colored leafs by recursion. Stops descending if colored intermediate node occurs
sourceraw docstring

find-non-type-functionsclj/s

(find-non-type-functions tree symbols)
source

find-not-coveredclj/s

(find-not-covered tree symbols)

Finds all predicates in the type-tree that are not covered by symbols

Finds all predicates in the type-tree that are not covered by symbols
sourceraw docstring

make-clause-with-extractionclj/s

(make-clause-with-extraction constructor-symbol named-params body)

Construct a ClauseWithExtraction record.

constructor-symbol: access via active.clojure.sum-type/clause-with-extraction-constructor-symbol named-params: access via active.clojure.sum-type/clause-with-extraction-named-params body: access via active.clojure.sum-type/clause-with-extraction-body

Construct a `ClauseWithExtraction` record.

`constructor-symbol`: access via [[active.clojure.sum-type/clause-with-extraction-constructor-symbol]]
`named-params`: access via [[active.clojure.sum-type/clause-with-extraction-named-params]]
`body`: access via [[active.clojure.sum-type/clause-with-extraction-body]]
sourceraw docstring

make-clause-with-predicateclj/s

(make-clause-with-predicate predicate body)

Construct a ClauseWithPredicate record.

predicate: access via active.clojure.sum-type/clause-with-predicate-predicate body: access via active.clojure.sum-type/clause-with-predicate-body

Construct a `ClauseWithPredicate` record.

`predicate`: access via [[active.clojure.sum-type/clause-with-predicate-predicate]]
`body`: access via [[active.clojure.sum-type/clause-with-predicate-body]]
sourceraw docstring

make-default-clauseclj/s

(make-default-clause body)

Construct a DefaultClause record.

body: access via active.clojure.sum-type/default-clause-body

Construct a `DefaultClause` record.

`body`: access via [[active.clojure.sum-type/default-clause-body]]
sourceraw docstring

matchcljmacro

(match sum-type arg & clauses)

Takes a sum-type, a argument and a list of clauses, and expands it to a cond form. sum-type is a type identifier, as defined by define-sum-type. arg is the argument to be matched upon. clauses are pairs of conditions and bodies, e.g.:

(match rgb-color a red? "red" (make-green a) (str "Green with " a) blue? "blue")

There is also a default clause, denoted by the keyword :default as the condition.

This macro throws at compile time if (ordered):

  • sum-type is no symbol
  • sum-type doesn't resolve to a sum-type
  • an uneven number of clauses is passed
  • conditions contain a non-related function, that is, not a predicate or constructor of the passed sum-type in sum-type.
  • The matching is not exhaustive, i.e. a particular predicate/constrcutor is missing.

The resulting form throws at runtime if the passed argument is not of type sum-type

Takes a sum-type, a argument and a list of clauses, and expands it to a cond form.
`sum-type` is a type identifier, as defined by `define-sum-type`.
`arg` is the argument to be matched upon.
`clauses` are pairs of conditions and bodies, e.g.:

`(match rgb-color a
    red? "red"
    (make-green a) (str "Green with " a)
    blue? "blue")
`

There is also a default clause, denoted by the keyword `:default` as the condition.

This macro throws at compile time if (ordered):
- `sum-type` is no symbol
- `sum-type` doesn't resolve to a sum-type
- an uneven number of clauses is passed
- conditions contain a non-related function, that is, not a predicate or constructor of
  the passed sum-type in `sum-type`.
- The matching is not exhaustive, i.e. a particular predicate/constrcutor is missing.

The resulting form throws at runtime if the passed argument is not of type `sum-type`
sourceraw docstring

runtime-errorclj/s≠

clj
cljs
(runtime-error msg)
source (clj)source (cljs)

sum-type-identifierclj/s

source

throw-illegal-argument-exceptionclj

(throw-illegal-argument-exception msg)
source

throw-non-type-functions!clj

(throw-non-type-functions! t st debug)
source

throw-when-non-type-functions!clj

(throw-when-non-type-functions! tree fun-symbols t debug)

Throws if fun-symbols contains functions that are neither a predicate nor a constructor in the type-tree

Throws if fun-symbols contains functions that are neither
a predicate nor a constructor in the type-tree
sourceraw docstring

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

× close