update-state

clojure.contrib.monads

  • (update-state f)
Return a state-monad function that replaces the current state by the
result of f applied to the current state and that returns the old state.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/monads.clj:347 top

(defn update-state
  "Return a state-monad function that replaces the current state by the
   result of f applied to the current state and that returns the old state."
  [f]
  (fn [s] [s (f s)]))
Vars in clojure.contrib.monads/update-state: defn fn
Used in 0 other vars

Comments top

No comments for update-state. Log in to add a comment.