Created
April 3, 2011 21:49
-
-
Save sritchie/900855 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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