Liking cljdoc? Tell your friends :D

active.data.realm

Namespace for constructing and using realms to describe the shape of data.

Also has contains? for dispatch on realms.

It also defines, via the compile function, a shorthand notation for realms, that is available in most places a realm is expected, i.e. in realm combinators and realm syntax.

Namespace for constructing and using realms to describe the shape of data.
      
Also has [[contains?]] for dispatch on realms.

It also defines, via the [[compile]] function, a shorthand
notation for realms, that is available in most places a realm is expected,
i.e. in realm combinators and realm syntax.
raw docstring

anyclj/s

Realm containing all Clojure values.

Realm containing all Clojure values.
sourceraw docstring

booleanclj/s

Realm containing true and false.

Realm containing true and false.
sourceraw docstring

charclj/s

Realm containing all chars.

Realm containing all chars.
sourceraw docstring

compileclj/s

(compile shorthand)

Compile a realm shorthand into a realm object.

This is called by most realm constructors and macros that generate realms from source code.

Shorthand notation includes:

  • A one-element vector containing a realm denotes a sequence-of that realm.
  • Any vector that does not have length 1 containing realms denotes a tuple of those realms.
  • A one-element set containing a realm denotes a set-of that realm.
  • A map containing one entry, whose key and value are both realms, denotes a map-of of those realms.
  • Any other map denotes a map-with-keys of its keys and value realms.
  • Record types from active.data.record or [[active.data.realm-record]] denote the corresponding record realm.
  • Struct types from active.data.struct denote the corresponding record realm.
Compile a realm shorthand into a realm object.

This is called by most realm constructors and macros that generate
realms from source code.

Shorthand notation includes:

* A one-element vector containing a realm denotes a [[sequence-of]] that realm.
* Any vector that does not have length 1 containing realms denotes a [[tuple]] of those realms.
* A one-element set containing a realm denotes a [[set-of]] that realm.
* A map containing one entry, whose key and value are both realms, denotes a [[map-of]] of those realms.
* Any other map denotes a [[map-with-keys]] of its keys and value realms.
* Record types from [[active.data.record]] or [[active.data.realm-record]] denote the corresponding record realm.
* Struct types from [[active.data.struct]] denote the corresponding record realm.
sourceraw docstring

contains?clj/s

(contains? realm x)

Does a realm contain a value?

Note this is intended for dispatch, not validation:

It only does a shallow check that runs in constant time, and does not perform full validation.

Does a realm contain a value?

Note this is intended for dispatch, not validation:

It only does a shallow check that runs in constant time, and does
not perform full validation.
sourceraw docstring

delayclj/smacro

(delay realm-expression)

Delay the evaluation of a realm.

Its operand must be an expression evaluating to a realm.

This is for generating recursive realms.

Delay the evaluation of a realm.

Its operand must be an expression evaluating to a realm.

This is for generating recursive realms.
sourceraw docstring

enumclj/s

(enum & values)

Creates a realm containing the values in values.

Creates a realm containing the values in `values`.
sourceraw docstring

fieldclj/s

(field name realm getter)

Create a record-field descriptor.

  • name is a symbol naming the field
  • realm is the realm for the field values
  • getter is the selector for that field
Create a record-field descriptor.

* `name` is a symbol naming the field
* `realm` is the realm for the field values
* `getter` is the selector for that field
sourceraw docstring

from-predicateclj/s

(from-predicate desc pred)

Make a realm from a predicate and a prescription.

Don't use this if you don't have to, as the predicate is by its nature opaque and not suitable for e.g. generation.

Make a realm from a predicate and a prescription.

Don't use this if you don't have to, as the predicate is by its
nature opaque and not suitable for e.g. generation.
sourceraw docstring

functionclj/smacro

(function & shorthand)

Shorthand for function realms with a single arity.

Here are the different forms:

  • `(function r1 r2 r3 -> r) for fixed arity
  • (function r1 r2 r3 & (rs) -> r) for rest arguments
  • (function r1 r2 r3 & [rr1 rr2]) -> r) for 2 optional args
  • (function r1 r2 r3 & {:a ra :b rb :c rc} -> r) for optional keyword args
Shorthand for function realms with a single arity.

Here are the different forms:

  * `(function r1 r2 r3 -> r) for fixed arity
  * `(function r1 r2 r3 & (rs) -> r)` for rest arguments
  * `(function r1 r2 r3 & [rr1 rr2]) -> r)` for 2 optional args
  * `(function r1 r2 r3 & {:a ra :b rb :c rc} -> r)` for optional keyword args
sourceraw docstring

function-casesclj/s

(function-cases & cases)

Create a realm for functions with several cases.

Typically applied to the return values of function.

Create a realm for functions with several cases.

Typically applied to the return values of `function`.
sourceraw docstring

integerclj/s

Realm containing all integers.

Realm containing all integers.
sourceraw docstring

integer-fromclj/s

(integer-from from)

Create a realm for integers above a lower bound.

from is inclusive.

Create a realm for integers above a lower bound.

`from` is inclusive.
sourceraw docstring

integer-from-toclj/s

(integer-from-to from to)

Create realm for integer range.

from and to are both inclusive.

Create realm for integer range.

`from` and `to` are both inclusive.
sourceraw docstring

integer-toclj/s

(integer-to to)

Create a realm for integers below an upper bound.

to is inclusive.

Create a realm for integers below an upper bound.

`to` is inclusive.
sourceraw docstring

intersectionclj/s

(intersection realm)
(intersection realm1 realm2)
(intersection realm1 realm2 & realms-rest)

Creates an intersection realm of its arguments.

The returned realm contains the values that are contained by all the argument realms.

Creates an intersection realm of its arguments.

The returned realm contains the values that are contained
by all the argument realms.
sourceraw docstring

keywordclj/s

Realm containing all keywords.

Realm containing all keywords.
sourceraw docstring

map-ofclj/s

(map-of key-realm value-realm)

Create realm containing uniform maps, where keys and value are each from a fixed realm.

key-realm is the realm of the keys, value-realm is the realm of the values.

Create realm containing uniform maps, where keys and value are each from a fixed realm.

`key-realm` is the realm of the keys,
`value-realm` is the realm of the values.
sourceraw docstring

map-with-keysclj/s

(map-with-keys keys-realm-map)

Create realm containing certain keys and a different realm for the value associated with each key.

keys-realm-map is map from keys to the realms of their values.

Create realm containing certain keys and a different realm for the value associated with each key.

`keys-realm-map` is map from keys to the realms of their values.
sourceraw docstring

map-with-tagclj/s

(map-with-tag key value)

Create realm for maps containing a tag.

I.e. a certain key mapping to a certain value.

Create realm for maps containing a tag.

I.e. a certain `key` mapping to a certain `value`.
sourceraw docstring

namedclj/s

(named name realm)

Name a realm.

Returns a realm that describes the same values as realm. The name intended is for printing in polymorphic realms.

Name a realm.

Returns a realm that describes the same values as `realm`.
The name intended is for printing in polymorphic realms.
sourceraw docstring

naturalclj/s

Realm containing all natural numbers.

I.e. all integers >= 0.

Realm containing all natural numbers.

I.e. all integers >= 0.
sourceraw docstring

numberclj/s

Realm containing all numbers.

Realm containing all numbers.
sourceraw docstring

optionalclj/s

(optional realm)
source

rationalclj

source

realclj/s

Realm containing all real numbers.

Realm containing all real numbers.
sourceraw docstring

real-rangeclj/s

(real-range lr1 lr2)
(real-range clusive-left left right clusive-right)

Create a realm containg a real range.

With the four-argument version, the four arguments specify:

  • clusive-left is one of the keywords :in, :ex, specifying whether the lower bound is inclusive or exclusive.
  • left is the lower bound
  • right is the upper bound
  • clusive-right is one of the keywords :in, :ex, specifying whether the upper bound is inclusive or exclusive.

The two-argument version can be called as follows:

  • (real-range :in lower-bound) for a real range with inclusive lower bound
  • (real-range :ex lower-bound) for a real range with exclusive lower bound
  • (real-range upper-bound :in) for a real range with inclusive upper bound
  • (real-range upper-bound :ex) for a real range with exclusive upper bound
Create a realm containg a real range.

With the four-argument version, the four arguments specify:

* `clusive-left` is one of the keywords `:in`, `:ex`, specifying
   whether the lower bound is inclusive or exclusive.
* `left` is the lower bound
* `right` is the upper bound
* `clusive-right` is one of the keywords `:in`, `:ex`, specifying
   whether the upper bound is inclusive or exclusive.

The two-argument version can be called as follows:

* `(real-range :in lower-bound)` for a real range with inclusive lower bound
* `(real-range :ex lower-bound)` for a real range with exclusive lower bound
* `(real-range upper-bound :in)` for a real range with inclusive upper bound
* `(real-range upper-bound :ex)` for a real range with exclusive upper bound
sourceraw docstring

recordclj/s

(record name constructor pred fields)

Create a record realm.

  • name is a symbol naming the record
  • constructor is a positional constructor
  • pred is a prediucate for the record
  • fields is a sequence of fields
Create a record realm.

* `name` is a symbol naming the record
* `constructor` is a positional constructor
* `pred` is a prediucate for the record
* `fields` is a sequence of [[field]]s
sourceraw docstring

restrictedclj/s

(restricted realm pred predicate-description)

Restrict a realm with a predicate.

The resulting realm contains only those values of the input realm for which pred (a unary function) returns a true value.

Only use this if you have to, as it forfeits inspectability.

Restrict a realm with a predicate.

The resulting realm contains only those values of the input
realm for which `pred` (a unary function) returns a true value.

Only use this if you have to, as it forfeits inspectability.
sourceraw docstring

sequence-ofclj/s

(sequence-of realm)

Create realm containing uniform sequences.

realm is the realm of the elements of the sequences.

Create realm containing uniform sequences.

`realm` is the realm of the elements of the sequences.
sourceraw docstring

set-ofclj/s

(set-of realm)

Create realm containing uniform sets.

realm is the realm of the elements of the sets.

Create realm containing uniform sets.

`realm` is the realm of the elements of the sets.
sourceraw docstring

stringclj/s

Realm containing all strings.

Realm containing all strings.
sourceraw docstring

symbolclj/s

Realm containing all symbols.

Realm containing all symbols.
sourceraw docstring

tupleclj/s

(tuple & realms)

Create realm for tuples.

These are sequences of a fixed length. realms is a sequence of the realms of the elements of the tuples.

Create realm for tuples.

These are sequences of a fixed length.
`realms` is a sequence of the realms of the elements
of the tuples.
sourceraw docstring

unionclj/s

(union & realms)
source

uuidclj/s

Realm containing UUIDs.

Realm containing UUIDs.
sourceraw docstring

with-metadataclj/s

(with-metadata realm key data)

Return a new realm with added or changed metadata for one key.

Return a new realm with added or changed metadata for one key.
sourceraw docstring

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

× close