Liking cljdoc? Tell your friends :D
Mostly clj/s.
Exceptions indicated.

protocol55.step-cljs.alpha


step*clj

(step* forms & {:keys [restrict]})

stepdefclj/smacro

(stepdef k & forms)

Defines a spec that validates a step as-per the transitions specified in forms. A step is a tuple of [state action state'].

Forms are of the shape:

(:in-between/state ::drink (:in-between/state :empty/state) ::fill (:in-between/state :full/state))

where all keywords are registered specs.

Optionally, the second argument can be a map of options that excepts a single key, :extra-defs, which is a vector of bindings of key => step restrict key. This outputs the extra defs as specs with the specified restriction.

Restriction keys are as follows:

:no-state' - [state action] :only-states - [state state'] :only-action - [action]

For example:

(stepdef ::step {:extra-defs [::state-action :no-state' ::states :only-states ::action :only-action]} (:in-between/state ::drink (:in-between/state :empty/state) ::fill (:in-between/state :full/state)) (:empty/state ::fill (:in-between/state)) (:full/state ::drink (:in-between/state)))

will define ::step, ::state-action, ::states, and ::action specs.

Defines a spec that validates a step as-per the transitions
specified in forms. A step is a tuple of [state action state'].

Forms are of the shape:

(:in-between/state
  ::drink (:in-between/state :empty/state)
  ::fill  (:in-between/state :full/state))

where all keywords are registered specs.

Optionally, the second argument can be a map of options that excepts a single
key, :extra-defs, which is a vector of bindings of key => step restrict key.
This outputs the extra defs as specs with the specified restriction.

Restriction keys are as follows:

:no-state'   - [state action]
:only-states - [state state']
:only-action - [action]

For example:

(stepdef ::step
  {:extra-defs [::state-action :no-state'
                ::states       :only-states
                ::action       :only-action]}
  (:in-between/state
    ::drink (:in-between/state :empty/state)
    ::fill  (:in-between/state :full/state))
  (:empty/state
    ::fill (:in-between/state))
  (:full/state
    ::drink (:in-between/state)))

will define ::step, ::state-action, ::states, and ::action specs.
raw docstring

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

× close