Permalink
Browse files

Renaming and tag test

  • Loading branch information...
1 parent 855166e commit 7ea95d5cfcb9a604787ccdd4f12f61de5a00bb48 @fogus fogus committed Mar 23, 2013
Showing with 3 additions and 9 deletions.
  1. +1 −8 src/joy/unfix/infix.clj
  2. +2 −1 test/joy/unfix/infix_tests.clj
View
@@ -5,15 +5,14 @@
(def ^:dynamic *ops* '[- + * / < > && || =])
(def rank (zipmap *ops* (iterate inc 1)))
-(def op? rank)
(def ^:dynamic _ clojure.core/resolve)
(defn- infix*
[[a b & [c d e & more] :as v]]
(cond
(vector? a) (recur (list* (infix* a) b c d e more))
(vector? c) (recur (list* a b (infix* c) d e more))
- (op? b) (if (and d (< (rank b 0) (rank d 0)))
+ (rank b) (if (and d (< (rank b 0) (rank d 0)))
(recur (list a b (infix* (list* c d e more))))
(recur (list* (list (_ b) a c) d e more)))
:else a))
@@ -24,9 +23,3 @@
(defmacro infix [& args]
(infix* args))
-
-(comment
-
-
-
-)
@@ -22,4 +22,5 @@
(test/deftest test-infix-reader
(test/is (= '(+ 2 (* 3 4))
- (read-string "#joy/infix [2 + 3 * 4]"))))
+ (read-string "#joy/infix [2 + 3 * 4]")))
+ (test/is (= 14 (eval #joy/infix [2 + 3 * 4]))))

0 comments on commit 7ea95d5

Please sign in to comment.