grenada.things

Programmatic definitions of type Thing and the Main Aspects of Things as well
as a bunch of auxiliary functions and procedures.

->thing

(->thing coords aspects bars)
Generated constructor for the thing type.

above-incl?

(above-incl? aspect-name thing-or-aspect)
Returns true if THING-OR-ASPECT is on the same level as or a higher level
than the Main Aspect with ASPECT-NAME. Otherwise returns false.

THING-OR-ASPECT must be something that can be resolved to a Main Aspect name
by resolve-main-aspect, currently a Thing or an Aspect name.

assert-aspect-attachable

(assert-aspect-attachable aspect-def thing)
Throws an exception if THING isn't fit for attaching the Aspect with
ASPECT-DEF to it.

assert-bar-attachable

(assert-bar-attachable bar-type-def thing)
Throws an exception if THING isn't fit for attaching a Bar of the type
defined by BAR-TYPE-DEF to it.

attach-aspect

(attach-aspect aspect-defs aspect-tag thing)
Attaches Aspect with name ASPECT-TAG to THING.

Looks up its definition in ASPECT-DEFs, which has to be map as returned by
clj::grenada.things.def/map-from-defs.

attach-aspects

(attach-aspects aspect-defs aspect-tags thing)
Attaches all Aspects indicated by ASPECT-TAGS to THING using
clj::grenada.things/attach-aspect.

Aspects are attached in the order given by ASPECT-TAGS. You have to take care
that they are in dependency order.

ASPECT-DEFS is passed to `attach-aspect` unchanged.

attach-bar

(attach-bar bar-type-defs bar-tag bar thing)
Attaches the BAR of the type with name BAR-TAG to THING.

Looks up the Bar type's definition in BAR-TYPE-DEFS, which has to be a map as
returned by clj::grenada.things.def/map-from-defs. 

attach-bars

(attach-bars bar-type-defs tags-and-bars thing)
Attaches all Bars from TAGS-AND-BARS to THING using attach-bar.

TAGS-AND-BARS is a map from Bar type names to Bars.

below-incl?

(below-incl? aspect-name thing-or-aspect)
Same principle as above-incl?, but returns true if THING-OR-ASPECT is on the
same level as or a _lower_ level than the Main Aspect with ASPECT-NAME,
otherwise false.

def-for-aspect

Map mapping Main Aspect name to the programmatic part of
programmatic definition.

For the non-programmatic part, see the spec.

detach-bar

(detach-bar bar-tag thing)
Removes the Bar of type with name BAR-TAG from THING.

has-aspect?

(has-aspect? aspect-tag thing)
Returns true if THING has an Aspect with the name ASPECT-TAG, false
otherwise.

has-bar?

(has-bar? bar-tag thing)
Returns true if THING has a Bar of the Bar type with name BAR-TAG.

main-aspect-defaults

Default values for the programmatic parts of Main Aspect definitions.

main-aspect-names

Names of the main aspects, ordered from highest to lowest level.

main-aspect-specials

Map from Main Aspect name to a map containing the non-common entries for its
definition map.

map->thing

(map->thing m)
Checks whether M is a map adhering to the schema of tag type thing. If so,
constructs a tagged value of type thing with this map. Otherwise throws an
exception.

pick-main-aspect

(pick-main-aspect aspects)
Given a collection of Aspect names, returns the one that is the name of a
Main Aspect.

Throws and exception if there is more than one Main Aspect name in the
collection.

replace-bar

(replace-bar bar-type-defs bar-tag bar thing)
Removes the Bar of type with name BAR-TAG from THING and attaches BAR of the
same type.

BAR-TYPE-DEFS are the same as for attach-bar.

thing?

(thing? x__560__auto__)
Generated predicate for the thing type.

thing?+

(thing?+ x)
Checks whether X is a tagged value of tag type thing. Throws an exception
if X doesn't adhere to the schema for values of tag type thing.

vec->thing

(vec->thing [tag m])
Converts a [tag map] vector to a Thing, throwing an exception if the result
is not a valid Thing according to thing?+.