(attribute-entity-type attr-name)
Given an attribute name, return the entity it belongs to.
Given an attribute name, return the entity it belongs to.
(gen attrs pop)
Generate a world given attrs
and pop
.
Generate a world given `attrs` and `pop`.
(get-entities world [attr-name :as ref])
Get all entities with the given attribute - value pair (ref)
Get all entities with the given attribute - value pair (ref)
(get-entity world ref)
Get first entity with the given ref (attribute - value pair; assumed to be unique)
Get first entity with the given ref (attribute - value pair; assumed to be unique)
(get-referring-entities world attr-name entity)
Get all entities that refer to entity
through a ref value for
attr-name
Get all entities that refer to `entity` through a ref value for `attr-name`
(lookup-path world entity path)
Recursively lookup a value from path starting from an entity.
Recursively lookup a value from path starting from an entity.
(pick-ref)
(pick-ref {:keys [graph nilable]})
Select a random reference to an attribute (from deps) in world
(pick-ref options) (pick-ref)
Options is a map of keywords to values
:graph :tree
If option :graph is non-nil the refs should be recursive; the attribute should depend on an attribute of the same entity type, and the refs in the generated world will describe a directed graph.
If :graph option is :tree, the graph is an acyclic directed tree; there is a single nil reference in the world which describes the value for the tree's root, and there is only a single path between any two nodes in the graph.
:nilable CHANCE
If option :nilable is non-nil, the ref has a CHANCE (between 0 and
If option :nilable and :graph :tree are both specified this implies a forest; the refs describe a collection of unconnected trees.
Select a random reference to an attribute (from deps) in world (pick-ref options) (pick-ref) Options is a map of keywords to values * `:graph :tree` If option :graph is non-nil the refs should be recursive; the attribute should depend on an attribute of the same entity type, and the refs in the generated world will describe a directed graph. If :graph option is :tree, the graph is an acyclic directed tree; there is a single nil reference in the world which describes the value for the tree's root, and there is only a single path between any two nodes in the graph. * `:nilable CHANCE` If option :nilable is non-nil, the ref has a CHANCE (between 0 and 1) of becoming nil. If option :nilable and :graph :tree are both specified this implies a forest; the refs describe a collection of unconnected trees.
(pick-unique-ref)
Select a random attribute-value tuple (from deps) that hasn't been used for the current attribute.
Select a random attribute-value tuple (from deps) that hasn't been used for the current attribute.
(pick-unique-refs)
(pick-unique-refs at-least-once)
Select a combination of refs (from deps) that's unique for this attribute
Select a combination of refs (from deps) that's unique for this attribute
(refers-to? [attr-name value :as ref] entity)
True if ref refers to entity.
True if ref refers to entity.
(sort-attrs attrs)
Sort attrs
to ensure dependencies are met. Uses Kahn's algorithm, see
also: https://en.wikipedia.org/wiki/Topological_sorting#Kahn's_algorithm
Sort `attrs` to ensure dependencies are met. Uses Kahn's algorithm, see also: https://en.wikipedia.org/wiki/Topological_sorting#Kahn's_algorithm
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close