1.2.0 permalink Arrow_down_16x16
Return the reduction of (m-lift 2 f) over the list of monadic values mvs
with initial value (m-result val).

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

(defmonadfn m-reduce
  "Return the reduction of (m-lift 2 f) over the list of monadic values mvs
   with initial value (m-result val)."
  ([f mvs]
   (if (empty? mvs)
     (m-result (f))
     (let [m-f (m-lift 2 f)]
       (reduce m-f mvs))))
  ([f val mvs]
   (let [m-f    (m-lift 2 f)
	 m-val  (m-result val)]
     (reduce m-f m-val mvs))))
Vars in clojure.contrib.monads/m-reduce: empty? let reduce
Used in 0 other vars

Comments top

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