(ensure-step value)
Internal use only.
Given a state-flow step, returns value as/is, else wraps value in a state-flow step.
Internal use only. Given a state-flow step, returns value as/is, else wraps value in a state-flow step.
(fmap f flow)
Creates a flow that returns the application of f to the return of flow
Creates a flow that returns the application of f to the return of flow
(get)
Creates a flow that returns the value of state.
Creates a flow that returns the value of state.
(gets)
(gets f & args)
Creates a flow that returns the result of applying f (default identity) to state with any additional args.
Creates a flow that returns the result of applying f (default identity) to state with any additional args.
(invoke my-fn)
Creates a flow that invokes a function of no arguments and returns the result. Used to invoke side effects e.g.
(state-flow.core/invoke #(Thread/sleep 1000))
Creates a flow that invokes a function of no arguments and returns the result. Used to invoke side effects e.g. (state-flow.core/invoke #(Thread/sleep 1000))
(modify f & args)
Creates a flow that replaces state with the result of applying f to state with any additional args.
Creates a flow that replaces state with the result of applying f to state with any additional args.
(put new-state)
Creates a flow that replaces state with new-state.
Creates a flow that replaces state with new-state.
(return v)
Creates a flow that returns v. Use this as the last step in a flow that you want to reuse in other flows, in order to clarify the return value, e.g.
(def increment-count (flow "increments :count and returns it" (state/modify update :count inc) [new-count (state/gets :count)] (state-flow/return new-count)))
Creates a flow that returns v. Use this as the last step in a flow that you want to reuse in other flows, in order to clarify the return value, e.g. (def increment-count (flow "increments :count and returns it" (state/modify update :count inc) [new-count (state/gets :count)] (state-flow/return new-count)))
Same as state monad context, but short circuits if error happens, place error in return value
Same as state monad context, but short circuits if error happens, place error in return value
(swap f)
DEPRECATED: use state-flow.state/modify instead.
DEPRECATED: use state-flow.state/modify instead.
DEPRECATED: Use state-flow.state/invoke instead.
DEPRECATED: Use state-flow.state/invoke instead.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close