1.2.0 permalink Arrow_down_16x16
  • (m-lift n f)
Converts a function f of n arguments into a function of n
monadic arguments returning a monadic value.

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

(defmacro m-lift
  "Converts a function f of n arguments into a function of n
  monadic arguments returning a monadic value."
  [n f]
  (let [expr (take n (repeatedly #(gensym "x_")))
	vars (vec (take n (repeatedly #(gensym "mv_"))))
	steps (vec (interleave expr vars))]
    (list `fn vars (monad-expr steps (cons f expr)))))
Vars in clojure.contrib.monads/m-lift: cons defmacro let list fn
Used in 0 other vars

Comments top

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