Liking cljdoc? Tell your friends :D

disultory.spec


boolean-attributeclj

(boolean-attribute id prob)

Boolean attributes are either true or false, and are specified with a probability which is <= 1. A prob of 0.4 means the attribute is 40% likely to be true, and 60% likely to be false.

Boolean attributes are either true or false, and are specified with
a probability which is <= 1. A prob of 0.4 means the attribute is 40%
likely to be true, and 60% likely to be false.
raw docstring

diceclj

(dice fn number)
(dice fn number sides)

Helper function for specifying dice, takes sides, number, and fn.

Helper function for specifying dice, takes sides, number, and fn.
raw docstring

dice-attributeclj

(dice-attribute id args)

Dice attributes work much like random attributes, except that they are returned in a nested structure i.e. {:stats {:strength ...}}.

Dice attributes work much like random attributes, except that they
are returned in a nested structure i.e. {:stats {:strength ...}}.
raw docstring

distinct-attributeclj

(distinct-attribute id args)

Distinct attributes are provided as a list of mutually exclusive options: (with-distinct-attribute :species [[:human 3] [:cat 5]]). Probability is treated as the numerator over a denominator which is the sum of all probabilities, so in this example the spec would have a 3/8 probability of generating a human, and a 5/8 probability of generating a cat.

Distinct attributes are provided as a list of mutually exclusive
options: (with-distinct-attribute :species [[:human 3] [:cat 5]]).
Probability is treated as the numerator over a denominator which
is the sum of all probabilities, so in this example the spec would
have a 3/8 probability of generating a human, and a 5/8 probability
of generating a cat.
raw docstring

fixed-attributeclj

(fixed-attribute id value)

Fixed attributes are values which are set in stone. This may not seem useful when procedurally generating datasets, but it's surprisingly helpful, especially with conditional attributes. For example, you might want to express a conditional fixed attribute with a number of legs derived from species.

Fixed attributes are values which are set in stone. This may not seem
useful when procedurally generating datasets, but it's surprisingly
helpful, especially with conditional attributes. For example, you
might want to express a conditional fixed attribute with a number of
legs derived from species.
raw docstring

fn-attributeclj

(fn-attribute id fun)

Function attributes are useful when none of the other attribute types is expressive enough to generate the required information. The fn takes a single argument, the specification as processed so far.

Function attributes are useful when none of the other attribute types
is expressive enough to generate the required information. The fn
takes a single argument, the specification as processed so far.
raw docstring

multiple-choice-attributeclj

(multiple-choice-attribute id args)

Multiple choice attributes are like a combination between boolean attributes and distinct attributes, and are returned as a vector of selected attributes. Probabilities, like with the boolean attributes, are specified as a number <= 1.

Multiple choice attributes are like a combination between boolean
attributes and distinct attributes, and are returned as a vector of
selected attributes. Probabilities, like with the boolean attributes,
are specified as a number <= 1.
raw docstring

n-choice-attributeclj

(n-choice-attribute id choices args)

n-Choice attributes are like multiple choice attributes, but only a maximum of n choices can be selected.

n-Choice attributes are like multiple choice attributes, but only a
maximum of n choices can be selected.
raw docstring

random-attributeclj

(random-attribute id args)

Random attributes resolve their values by rolling dice. These can have any number of sides, and be additive or subtractive. Each dice should be specified in the following format:

{:sides - The number of sides of each dice (optional, defaults to 1) :number - The number of dice to roll :function - Either + or -}

So, 3d6 can be written as [{:sides 6 :number 3 :function +}] whilst 2d6 + 1d4 - 1 would be [{:sides 6 :number 2 :function +}, {:sides 4 :number 1, :function +}, {:number 1 :function -}]

Random attributes resolve their values by rolling dice. These can
 have any number of sides, and be additive or subtractive. Each dice
 should be specified in the following format:

 {:sides - The number of sides of each dice (optional, defaults to 1)
  :number - The number of dice to roll
  :function - Either + or -}

So, 3d6 can be written as [{:sides 6 :number 3 :function +}] whilst
2d6 + 1d4 - 1 would be [{:sides 6 :number 2 :function +}, {:sides 4
:number 1, :function +}, {:number 1 :function -}]
raw docstring

withclj

(with parent attr)

Returns the parent specification with a new attribute as specified by attr. This will usually be used in conjunction with the *-attribute functions below.

Returns the parent specification with a new attribute as specified by
attr. This will usually be used in conjunction with the *-attribute
functions below.
raw docstring

with-conditionalclj

(with-conditional parent condition attr)

Like (with), but takes a condition and an attribute, which will be generated only when the condition resolves true.

Like (with), but takes a condition and an attribute, which will be
generated only when the condition resolves true.
raw docstring

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

× close