Skip to content

Instantly share code, notes, and snippets.

@sritchie
Created April 3, 2011 21:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sritchie/900855 to your computer and use it in GitHub Desktop.
Save sritchie/900855 to your computer and use it in GitHub Desktop.
(defn phase1 [x y]
(fn [request]
(let [newstate (cons (str "a list of " x y) request)]
["First return." newstate])))
(defn phase2 [z]
(fn [request]
(let [newstate (cons (str "building " z) request)]
["Next return." newstate])))
(with-monad state-m
(defn build [x y z]
(domonad [a (phase1 x y)
b (phase2 z)]
[a b]))
(defn build-chain [request]
((m-chain [(phase1 1 2)
(phase2 3)])
request)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment