diff options
author | Konrad Hinsen <konrad.hinsen@laposte.net> | 2009-05-06 15:18:29 +0000 |
---|---|---|
committer | Konrad Hinsen <konrad.hinsen@laposte.net> | 2009-05-06 15:18:29 +0000 |
commit | eec8b11cbbd53f94e510161998e54992fccb0de8 (patch) | |
tree | 13c250e0199389816812b2283eee7ee0c1c96619 /src/clojure/contrib/test_contrib/macro_utils.clj | |
parent | 637ce542010b34381948f914e0b6829b41602e34 (diff) |
monads: monad functions are now real functions defined as symbol macros
Diffstat (limited to 'src/clojure/contrib/test_contrib/macro_utils.clj')
-rw-r--r-- | src/clojure/contrib/test_contrib/macro_utils.clj | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/clojure/contrib/test_contrib/macro_utils.clj b/src/clojure/contrib/test_contrib/macro_utils.clj index 25a0fcaf..47d947a5 100644 --- a/src/clojure/contrib/test_contrib/macro_utils.clj +++ b/src/clojure/contrib/test_contrib/macro_utils.clj @@ -1,7 +1,7 @@ ;; Test routines for macro_utils.clj ;; by Konrad Hinsen -;; last updated May 4, 2009 +;; last updated May 6, 2009 ;; Copyright (c) Konrad Hinsen, 2008. All rights reserved. The use ;; and distribution terms for this software are covered by the Eclipse @@ -45,15 +45,13 @@ '(symbol-macrolet [x foo z bar] (fn f ([x y] [x y z]) ([x y z] [x y z])))) '(do (fn* f ([x y] [x y bar]) ([x y z] [x y z]))))) - (is (= (macroexpand-1 - '(symbol-macrolet [x xx y yy z zz] - (domonad m [a x b y x z] [a b x z]))) - '(do (let* [m-bind (:m-bind m) m-result (:m-result m) - m-zero (:m-zero m) m-plus (:m-plus m)] - (do (m-bind xx (fn* ([a] - (m-bind yy (fn* ([b] - (m-bind zz (fn* ([x] - (m-result [a b x zz])))))))))))))))) + (is (= (nth (second (macroexpand-1 + '(symbol-macrolet [x xx y yy z zz] + (domonad m [a x b y x z] [a b x z])))) 2) + '(do (m-bind xx (fn* ([a] + (m-bind yy (fn* ([b] + (m-bind zz (fn* ([x] + (m-result [a b x zz])))))))))))))) (deftest symbol-test (defsymbolmacro sum-2-3 (plus 2 3)) |