structural-typing.api.path

Functions used in the construction of paths into structures.

Much of this is gathered into the catchall structural-typing.types namespace.

ALL

Use this in a path to select all values of a collection.

(type! :Figure {:points ALL (type/include :Point)})

forks

When writing a forking path, you may end up with vectors within vectors within vectors. You can use forks instead of a vector to mark where the path forks.

 (type! :Figure (type/requires [:a (forks :b1 :b2) :c]))

forks is nothing but an alias for vector.

includes

(includes type-signifier)

During creation of a type by named or type!, a call to includes is replaced with the type the type-signifier refers to. The exact meaning of that replacement depends on whether it’s used in a path, as the value of a path, or as an entire argument itself. See the wiki documentation.

requires

Used to create an argument to named or type!. All of the elements are keys or paths that are required (as with required-key) to be present in any matching candidate. This is exactly the same thing as putting the arguments in a vector.

(type! :Figure (type/requires :color 
                              [:points ALL (type/include :Point)]))