Monad describing stream computations. The monadic values can be
of any type handled by stream-next.
(defmonad stream-m "Monad describing stream computations. The monadic values can be of any type handled by stream-next." [m-result (fn m-result-stream [v] (fn [s] [v s])) m-bind (fn m-bind-stream [mv f] (fn [s] (let [[v ss :as r] (mv s)] (if (or (nil? ss) (stream-skip? v)) r ((f v) ss))))) m-zero (fn [s] [stream-skip s]) ])
Comments top
No comments for stream-m. Log in to add a comment.