state-m-until

clojure.contrib.monads

  • (state-m-until p f x)
An optimized implementation of m-until for the state monad that
replaces recursion by a loop.

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:401 top

(defn state-m-until
  "An optimized implementation of m-until for the state monad that
   replaces recursion by a loop."
  [p f x]
  (letfn [(until [p f x s]
	    (if (p x)
	      [x s]
	      (let [[x s] ((f x) s)]
		(recur p f x s))))]
    (fn [s] (until p f x s))))
Vars in clojure.contrib.monads/state-m-until: defn fn letfn
Used in 0 other vars

Comments top

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