Comment out tests for now.

Comment out tests for now.

--- test/test/datascript.cljs
+++ test/test/datascript.cljs
@@ -9,367 +9,365 @@

 (enable-console-print!)

-(deftest test-joins
-  (let [db (-> (d/empty-db)
-               (d/db-with [ { :db/id 1, :name  "Ivan", :age   15 }
-                            { :db/id 2, :name  "Petr", :age   37 }
-                            { :db/id 3, :name  "Ivan", :age   37 }
-                            { :db/id 4, :age 15 }]))]
-    (is (= (d/q '[:find ?e
-                  :where [?e :name]] db)
-           #{[1] [2] [3]}))
-    (is (= (d/q '[:find  ?e ?v
-                  :where [?e :name "Ivan"]
-                         [?e :age ?v]] db)
-           #{[1 15] [3 37]}))
-    (is (= (d/q '[:find  ?e1 ?e2
-                  :where [?e1 :name ?n]
-                         [?e2 :name ?n]] db)
-           #{[1 1] [2 2] [3 3] [1 3] [3 1]}))
-    (is (= (d/q '[:find  ?e ?e2 ?n
-                  :where [?e :name "Ivan"]
-                         [?e :age ?a]
-                         [?e2 :age ?a]
-                         [?e2 :name ?n]] db)
-           #{[1 1 "Ivan"]
-             [3 3 "Ivan"]
-             [3 2 "Petr"]}))))
-
-
-(deftest test-q-many
-  (let [db (-> (d/empty-db {:aka {:db/cardinality :db.cardinality/many}})
-               (d/db-with [ [:db/add 1 :name "Ivan"]
-                            [:db/add 1 :aka  "ivolga"]
-                            [:db/add 1 :aka  "pi"]
-                            [:db/add 2 :name "Petr"]
-                            [:db/add 2 :aka  "porosenok"]
-                            [:db/add 2 :aka  "pi"] ]))]
-    (is (= (d/q '[:find  ?n1 ?n2
-                  :where [?e1 :aka ?x]
-                         [?e2 :aka ?x]
-                         [?e1 :name ?n1]
-                         [?e2 :name ?n2]] db)
-           #{["Ivan" "Ivan"]
-             ["Petr" "Petr"]
-             ["Ivan" "Petr"]
-             ["Petr" "Ivan"]}))))
-
-
-(deftest test-q-coll
-  (let [db [ [1 :name "Ivan"]
-             [1 :age  19]
-             [1 :aka  "dragon_killer_94"]
-             [1 :aka  "-=autobot=-"] ] ]
-    (is (= (d/q '[ :find  ?n ?a
-                   :where [?e :aka "dragon_killer_94"]
-                          [?e :name ?n]
-                          [?e :age  ?a]] db)
-           #{["Ivan" 19]})))
-
-  (testing "Query over long tuples"
-    (let [db [ [1 :name "Ivan" 945 :db/add]
-               [1 :age  39     999 :db/retract]] ]
-      (is (= (d/q '[ :find  ?e ?v
-                     :where [?e :name ?v]] db)
-             #{[1 "Ivan"]}))
-      (is (= (d/q '[ :find  ?e ?a ?v ?t
-                     :where [?e ?a ?v ?t :db/retract]] db)
-             #{[1 :age 39 999]})))))
-
-
-(deftest test-q-in
-  (let [db (-> (d/empty-db)
-               (d/db-with [ { :db/id 1, :name  "Ivan", :age   15 }
-                            { :db/id 2, :name  "Petr", :age   37 }
-                            { :db/id 3, :name  "Ivan", :age   37 }]))
-        query '{:find  [?e]
-                :in    [$ ?attr ?value]
-                :where [[?e ?attr ?value]]}]
-    (is (= (d/q query db :name "Ivan")
-           #{[1] [3]}))
-    (is (= (d/q query db :age 37)
-           #{[2] [3]}))
-
-    (testing "Named DB"
-      (is (= (d/q '[:find  ?a ?v
-                    :in    $db ?e
-                    :where [$db ?e ?a ?v]] db 1)
-             #{[:name "Ivan"]
-               [:age 15]})))
-
-    (testing "DB join with collection"
-      (is (= (d/q '[:find  ?e ?email
-                    :in    $ $b
-                    :where [?e :name ?n]
-                           [$b ?n ?email]]
-                  db
-                  [["Ivan" "ivan@mail.ru"]
-                   ["Petr" "petr@gmail.com"]])
-             #{[1 "ivan@mail.ru"]
-               [2 "petr@gmail.com"]
-               [3 "ivan@mail.ru"]})))
-
-    (testing "Relation binding"
-      (is (= (d/q '[:find  ?e ?email
-                    :in    $ [[?n ?email]]
-                    :where [?e :name ?n]]
-                  db
-                  [["Ivan" "ivan@mail.ru"]
-                   ["Petr" "petr@gmail.com"]])
-             #{[1 "ivan@mail.ru"]
-               [2 "petr@gmail.com"]
-               [3 "ivan@mail.ru"]})))
-
-    (testing "Tuple binding"
-      (is (= (d/q '[:find  ?e
-                    :in    $ [?name ?age]
-                    :where [?e :name ?name]
-                           [?e :age ?age]]
-                  db ["Ivan" 37])
-             #{[3]})))
-
-    (testing "Collection binding"
-      (is (= (d/q '[:find  ?attr ?value
-                    :in    $ ?e [?attr ...]
-                    :where [?e ?attr ?value]]
-                  db 1 [:name :age])
-             #{[:name "Ivan"] [:age 15]}))))
-
-  (testing "Query without DB"
-    (is (= (d/q '[:find ?a ?b
-                  :in   ?a ?b]
-                10 20)
-           #{[10 20]}))))
-
-
-(deftest test-nested-bindings
-  (is (= (d/q '[:find  ?k ?v
-                :in    [[?k ?v] ...]
-                :where [(> ?v 1)]]
-              {:a 1, :b 2, :c 3})
-         #{[:b 2] [:c 3]}))
-
-  (is (= (d/q '[:find  ?k ?min ?max
-                :in    [[?k ?v] ...] ?minmax
-                :where [(?minmax ?v) [?min ?max]]
-                       [(> ?max ?min)]]
-              {:a [1 2 3 4]
-               :b [5 6 7]
-               :c [3]}
-              #(vector (reduce min %) (reduce max %)))
-         #{[:a 1 4] [:b 5 7]}))
-
-  (is (= (d/q '[:find  ?k ?x
-                :in    [[?k [?min ?max]] ...] ?range
-                :where [(?range ?min ?max) [?x ...]]
-                       [(even? ?x)]]
-              {:a [1 7]
-               :b [2 4]}
-              range)
-         #{[:a 2] [:a 4] [:a 6]
-           [:b 2]})))
-
-
-(deftest test-user-funs
-  (let [db (-> (d/empty-db {:parent {:parent {:db/valueType :db.valueType/ref}}})
-               (d/db-with [ { :db/id 1, :name  "Ivan",  :age   15 }
-                            { :db/id 2, :name  "Petr",  :age   22, :height 240 :parent 1}
-                            { :db/id 3, :name  "Slava", :age   37 :parent 2}]))]
-    (testing "get-else"
-      (is (= (d/q '[:find ?e ?age ?height
-                    :in $
-                    :where [?e :age ?age]
-                           [(get-else $ ?e :height 300) ?height]] db)
-             #{[1 15 300] [2 22 240] [3 37 300]})))
-
-    (testing "get-some"
-      (is (= (d/q '[:find ?e ?v
-                    :in $
-                    :where [?e :name ?name]
-                           [(get-some $ ?e :height :age) ?v]] db)
-             #{[1 15] [2 240] [3 37]})))
-
-    (testing "missing?"
-      (is (= (d/q '[:find ?e ?age
-                    :in $
-                    :where [?e :age ?age]
-                           [(missing? $ ?e :height)]] db)
-             #{[1 15] [3 37]})))
-
-    (testing "missing? back-ref"
-      (is (= (d/q '[:find ?e
-                    :in $
-                    :where [?e :age ?age]
-                    [(missing? $ ?e :_parent)]] db)
-             #{[3]})))
-
-    (testing "Built-in predicate"
-      (is (= (d/q '[:find  ?e1 ?e2
-                    :where [?e1 :age ?a1]
-                           [?e2 :age ?a2]
-                           [(< ?a1 18 ?a2)]] db)
-             #{[1 2] [1 3]})))
-
-    (testing "Passing predicate as source"
-      (is (= (d/q '[:find  ?e
-                    :in    $ ?adult
-                    :where [?e :age ?a]
-                           [(?adult ?a)]]
-                  db
-                  #(> % 18))
-             #{[2] [3]})))
-
-    (testing "Calling a function"
-      (is (= (d/q '[:find  ?e1 ?e2 ?e3
-                    :where [?e1 :age ?a1]
-                           [?e2 :age ?a2]
-                           [?e3 :age ?a3]
-                           [(+ ?a1 ?a2) ?a12]
-                           [(= ?a12 ?a3)]]
-                  db)
-             #{[1 2 3] [2 1 3]})))))
-
-
-(deftest test-rules
-  (let [db [                  [5 :follow 3]
-            [1 :follow 2] [2 :follow 3] [3 :follow 4] [4 :follow 6]
-                          [2         :follow           4]]]
-    (is (= (d/q '[:find  ?e1 ?e2
-                  :in    $ %
-                  :where (follow ?e1 ?e2)]
-                db
-               '[[(follow ?x ?y)
-                  [?x :follow ?y]]])
-           #{[1 2] [2 3] [3 4] [2 4] [5 3] [4 6]}))
-
-    (testing "Rule with branches"
-      (is (= (d/q '[:find  ?e2
-                    :in    $ ?e1 %
-                    :where (follow ?e1 ?e2)]
-                  db
-                  1
-                 '[[(follow ?e2 ?e1)
-                    [?e2 :follow ?e1]]
-                   [(follow ?e2 ?e1)
-                    [?e2 :follow ?t]
-                    [?t  :follow ?e1]]])
-             #{[2] [3] [4]})))
-
-    (testing "Recursive rules"
-      (is (= (d/q '[:find  ?e2
-                    :in    $ ?e1 %
-                    :where (follow ?e1 ?e2)]
-                  db
-                  1
-                 '[[(follow ?e1 ?e2)
-                    [?e1 :follow ?e2]]
-                   [(follow ?e1 ?e2)
-                    [?e1 :follow ?t]
-                    (follow ?t ?e2)]])
-             #{[2] [3] [4] [6]}))
-
-      (is (= (d/q '[:find ?e1 ?e2
-                     :in $ %
-                     :where (follow ?e1 ?e2)]
-                    [[1 :follow 2] [2 :follow 3]]
-                   '[[(follow ?e1 ?e2)
-                      [?e1 :follow ?e2]]
-                     [(follow ?e1 ?e2)
-                      (follow ?e2 ?e1)]])
-           #{[1 2] [2 3] [2 1] [3 2]}))
-
-      (is (= (d/q '[:find ?e1 ?e2
-                     :in $ %
-                     :where (follow ?e1 ?e2)]
-                    [[1 :follow 2] [2 :follow 3] [3 :follow 1]]
-                   '[[(follow ?e1 ?e2)
-                      [?e1 :follow ?e2]]
-                     [(follow ?e1 ?e2)
-                      (follow ?e2 ?e1)]])
-           #{[1 2] [2 3] [3 1] [2 1] [3 2] [1 3]})))
-
-    (testing "Mutually recursive rules"
-      (is (= (d/q '[:find  ?e1 ?e2
-                    :in    $ %
-                    :where (f1 ?e1 ?e2)]
-                  [[0 :f1 1]
-                   [1 :f2 2]
-                   [2 :f1 3]
-                   [3 :f2 4]
-                   [4 :f1 5]
-                   [5 :f2 6]]
-                 '[[(f1 ?e1 ?e2)
-                    [?e1 :f1 ?e2]]
-                   [(f1 ?e1 ?e2)
-                    [?t :f1 ?e2]
-                    (f2 ?e1 ?t)]
-                   [(f2 ?e1 ?e2)
-                    [?e1 :f2 ?e2]]
-                   [(f2 ?e1 ?e2)
-                    [?t :f2 ?e2]
-                    (f1 ?e1 ?t)]])
-            #{[0 1] [0 3] [0 5]
-              [1 3] [1 5]
-              [2 3] [2 5]
-              [3 5]
-              [4 5]}))))
-
-  (testing "Specifying db to rule"
-    (is (= (d/q '[ :find ?n
-                    :in   $sexes $ages %
-                    :where ($sexes male ?n)
-                           ($ages adult ?n) ]
-                  [["Ivan" :male] ["Darya" :female] ["Oleg" :male] ["Igor" :male]]
-                  [["Ivan" 15] ["Oleg" 66] ["Darya" 32]]
-                  '[[(male ?x)
-                     [?x :male]]
-                    [(adult ?y)
-                     [?y ?a]
-                     [(>= ?a 18)]]])
-           #{["Oleg"]}))))
-
-(deftest test-aggregates
-  (let [monsters [ ["Cerberus" 3]
-                   ["Medusa" 1]
-                   ["Cyclops" 1]
-                   ["Chimera" 1] ]]
-    (testing "with"
-      (is (= (d/q '[ :find ?heads
-                     :with ?monster
-                     :in   [[?monster ?heads]] ]
-                  [ ["Medusa" 1]
-                    ["Cyclops" 1]
-                    ["Chimera" 1] ])
-             [[1] [1] [1]])))
-
-    (testing "Wrong grouping without :with"
-      (is (= (d/q '[ :find (sum ?heads)
-                     :in   [[?monster ?heads]] ]
-                  monsters)
-             [[4]])))
-
-    (testing "Multiple aggregates, correct grouping with :with"
-      (is (= (d/q '[ :find (sum ?heads) (min ?heads) (max ?heads) (count ?heads)
-                     :with ?monster
-                     :in   [[?monster ?heads]] ]
-                  monsters)
-             [[6 1 3 4]])))
-
-    (testing "Grouping and parameter passing"
-      (is (= (set (d/q '[ :find ?color (max ?amount ?x) (min ?amount ?x)
-                          :in   [[?color ?x]] ?amount ]
-                       [[:red 1]  [:red 2] [:red 3] [:red 4] [:red 5]
-                        [:blue 7] [:blue 8]]
-                       3))
-             #{[:red  [3 4 5] [1 2 3]]
-               [:blue [7 8]   [7 8]]})))
-
-    (testing "Custom aggregates"
-      (is (= (set (d/q '[ :find ?color (?agg ?x)
-                          :in   [[?color ?x]] ?agg ]
-                       [[:red 1]  [:red 2] [:red 3] [:red 4] [:red 5]
-                        [:blue 7] [:blue 8]]
-                       #(reverse (sort %))))
-             #{[:red [5 4 3 2 1]] [:blue [8 7]]})))))
-
-(test-index-range)+;(deftest test-joins
+;  (let [db (-> (d/empty-db)
+;               (d/db-with [ { :db/id 1, :name  "Ivan", :age   15 }
+;                            { :db/id 2, :name  "Petr", :age   37 }
+;                            { :db/id 3, :name  "Ivan", :age   37 }
+;                            { :db/id 4, :age 15 }]))]
+;    (is (= (d/q '[:find ?e
+;                  :where [?e :name]] db)
+;           #{[1] [2] [3]}))
+;    (is (= (d/q '[:find  ?e ?v
+;                  :where [?e :name "Ivan"]
+;                         [?e :age ?v]] db)
+;           #{[1 15] [3 37]}))
+;    (is (= (d/q '[:find  ?e1 ?e2
+;                  :where [?e1 :name ?n]
+;                         [?e2 :name ?n]] db)
+;           #{[1 1] [2 2] [3 3] [1 3] [3 1]}))
+;    (is (= (d/q '[:find  ?e ?e2 ?n
+;                  :where [?e :name "Ivan"]
+;                         [?e :age ?a]
+;                         [?e2 :age ?a]
+;                         [?e2 :name ?n]] db)
+;           #{[1 1 "Ivan"]
+;             [3 3 "Ivan"]
+;             [3 2 "Petr"]}))))
+;
+;
+;(deftest test-q-many
+;  (let [db (-> (d/empty-db {:aka {:db/cardinality :db.cardinality/many}})
+;               (d/db-with [ [:db/add 1 :name "Ivan"]
+;                            [:db/add 1 :aka  "ivolga"]
+;                            [:db/add 1 :aka  "pi"]
+;                            [:db/add 2 :name "Petr"]
+;                            [:db/add 2 :aka  "porosenok"]
+;                            [:db/add 2 :aka  "pi"] ]))]
+;    (is (= (d/q '[:find  ?n1 ?n2
+;                  :where [?e1 :aka ?x]
+;                         [?e2 :aka ?x]
+;                         [?e1 :name ?n1]
+;                         [?e2 :name ?n2]] db)
+;           #{["Ivan" "Ivan"]
+;             ["Petr" "Petr"]
+;             ["Ivan" "Petr"]
+;             ["Petr" "Ivan"]}))))
+;
+;
+;(deftest test-q-coll
+;  (let [db [ [1 :name "Ivan"]
+;             [1 :age  19]
+;             [1 :aka  "dragon_killer_94"]
+;             [1 :aka  "-=autobot=-"] ] ]
+;    (is (= (d/q '[ :find  ?n ?a
+;                   :where [?e :aka "dragon_killer_94"]
+;                          [?e :name ?n]
+;                          [?e :age  ?a]] db)
+;           #{["Ivan" 19]})))
+;
+;  (testing "Query over long tuples"
+;    (let [db [ [1 :name "Ivan" 945 :db/add]
+;               [1 :age  39     999 :db/retract]] ]
+;      (is (= (d/q '[ :find  ?e ?v
+;                     :where [?e :name ?v]] db)
+;             #{[1 "Ivan"]}))
+;      (is (= (d/q '[ :find  ?e ?a ?v ?t
+;                     :where [?e ?a ?v ?t :db/retract]] db)
+;             #{[1 :age 39 999]})))))
+;
+;
+;(deftest test-q-in
+;  (let [db (-> (d/empty-db)
+;               (d/db-with [ { :db/id 1, :name  "Ivan", :age   15 }
+;                            { :db/id 2, :name  "Petr", :age   37 }
+;                            { :db/id 3, :name  "Ivan", :age   37 }]))
+;        query '{:find  [?e]
+;                :in    [$ ?attr ?value]
+;                :where [[?e ?attr ?value]]}]
+;    (is (= (d/q query db :name "Ivan")
+;           #{[1] [3]}))
+;    (is (= (d/q query db :age 37)
+;           #{[2] [3]}))
+;
+;    (testing "Named DB"
+;      (is (= (d/q '[:find  ?a ?v
+;                    :in    $db ?e
+;                    :where [$db ?e ?a ?v]] db 1)
+;             #{[:name "Ivan"]
+;               [:age 15]})))
+;
+;    (testing "DB join with collection"
+;      (is (= (d/q '[:find  ?e ?email
+;                    :in    $ $b
+;                    :where [?e :name ?n]
+;                           [$b ?n ?email]]
+;                  db
+;                  [["Ivan" "ivan@mail.ru"]
+;                   ["Petr" "petr@gmail.com"]])
+;             #{[1 "ivan@mail.ru"]
+;               [2 "petr@gmail.com"]
+;               [3 "ivan@mail.ru"]})))
+;
+;    (testing "Relation binding"
+;      (is (= (d/q '[:find  ?e ?email
+;                    :in    $ [[?n ?email]]
+;                    :where [?e :name ?n]]
+;                  db
+;                  [["Ivan" "ivan@mail.ru"]
+;                   ["Petr" "petr@gmail.com"]])
+;             #{[1 "ivan@mail.ru"]
+;               [2 "petr@gmail.com"]
+;               [3 "ivan@mail.ru"]})))
+;
+;    (testing "Tuple binding"
+;      (is (= (d/q '[:find  ?e
+;                    :in    $ [?name ?age]
+;                    :where [?e :name ?name]
+;                           [?e :age ?age]]
+;                  db ["Ivan" 37])
+;             #{[3]})))
+;
+;    (testing "Collection binding"
+;      (is (= (d/q '[:find  ?attr ?value
+;                    :in    $ ?e [?attr ...]
+;                    :where [?e ?attr ?value]]
+;                  db 1 [:name :age])
+;             #{[:name "Ivan"] [:age 15]}))))
+;
+;  (testing "Query without DB"
+;    (is (= (d/q '[:find ?a ?b
+;                  :in   ?a ?b]
+;                10 20)
+;           #{[10 20]}))))
+;
+;
+;(deftest test-nested-bindings
+;  (is (= (d/q '[:find  ?k ?v
+;                :in    [[?k ?v] ...]
+;                :where [(> ?v 1)]]
+;              {:a 1, :b 2, :c 3})
+;         #{[:b 2] [:c 3]}))
+;
+;  (is (= (d/q '[:find  ?k ?min ?max
+;                :in    [[?k ?v] ...] ?minmax
+;                :where [(?minmax ?v) [?min ?max]]
+;                       [(> ?max ?min)]]
+;              {:a [1 2 3 4]
+;               :b [5 6 7]
+;               :c [3]}
+;              #(vector (reduce min %) (reduce max %)))
+;         #{[:a 1 4] [:b 5 7]}))
+;
+;  (is (= (d/q '[:find  ?k ?x
+;                :in    [[?k [?min ?max]] ...] ?range
+;                :where [(?range ?min ?max) [?x ...]]
+;                       [(even? ?x)]]
+;              {:a [1 7]
+;               :b [2 4]}
+;              range)
+;         #{[:a 2] [:a 4] [:a 6]
+;           [:b 2]})))
+;
+;
+;(deftest test-user-funs
+;  (let [db (-> (d/empty-db {:parent {:parent {:db/valueType :db.valueType/ref}}})
+;               (d/db-with [ { :db/id 1, :name  "Ivan",  :age   15 }
+;                            { :db/id 2, :name  "Petr",  :age   22, :height 240 :parent 1}
+;                            { :db/id 3, :name  "Slava", :age   37 :parent 2}]))]
+;    (testing "get-else"
+;      (is (= (d/q '[:find ?e ?age ?height
+;                    :in $
+;                    :where [?e :age ?age]
+;                           [(get-else $ ?e :height 300) ?height]] db)
+;             #{[1 15 300] [2 22 240] [3 37 300]})))
+;
+;    (testing "get-some"
+;      (is (= (d/q '[:find ?e ?v
+;                    :in $
+;                    :where [?e :name ?name]
+;                           [(get-some $ ?e :height :age) ?v]] db)
+;             #{[1 15] [2 240] [3 37]})))
+;
+;    (testing "missing?"
+;      (is (= (d/q '[:find ?e ?age
+;                    :in $
+;                    :where [?e :age ?age]
+;                           [(missing? $ ?e :height)]] db)
+;             #{[1 15] [3 37]})))
+;
+;    (testing "missing? back-ref"
+;      (is (= (d/q '[:find ?e
+;                    :in $
+;                    :where [?e :age ?age]
+;                    [(missing? $ ?e :_parent)]] db)
+;             #{[3]})))
+;
+;    (testing "Built-in predicate"
+;      (is (= (d/q '[:find  ?e1 ?e2
+;                    :where [?e1 :age ?a1]
+;                           [?e2 :age ?a2]
+;                           [(< ?a1 18 ?a2)]] db)
+;             #{[1 2] [1 3]})))
+;
+;    (testing "Passing predicate as source"
+;      (is (= (d/q '[:find  ?e
+;                    :in    $ ?adult
+;                    :where [?e :age ?a]
+;                           [(?adult ?a)]]
+;                  db
+;                  #(> % 18))
+;             #{[2] [3]})))
+;
+;    (testing "Calling a function"
+;      (is (= (d/q '[:find  ?e1 ?e2 ?e3
+;                    :where [?e1 :age ?a1]
+;                           [?e2 :age ?a2]
+;                           [?e3 :age ?a3]
+;                           [(+ ?a1 ?a2) ?a12]
+;                           [(= ?a12 ?a3)]]
+;                  db)
+;             #{[1 2 3] [2 1 3]})))))
+;
+;
+;(deftest test-rules
+;  (let [db [                  [5 :follow 3]
+;            [1 :follow 2] [2 :follow 3] [3 :follow 4] [4 :follow 6]
+;                          [2         :follow           4]]]
+;    (is (= (d/q '[:find  ?e1 ?e2
+;                  :in    $ %
+;                  :where (follow ?e1 ?e2)]
+;                db
+;               '[[(follow ?x ?y)
+;                  [?x :follow ?y]]])
+;           #{[1 2] [2 3] [3 4] [2 4] [5 3] [4 6]}))
+;
+;    (testing "Rule with branches"
+;      (is (= (d/q '[:find  ?e2
+;                    :in    $ ?e1 %
+;                    :where (follow ?e1 ?e2)]
+;                  db
+;                  1
+;                 '[[(follow ?e2 ?e1)
+;                    [?e2 :follow ?e1]]
+;                   [(follow ?e2 ?e1)
+;                    [?e2 :follow ?t]
+;                    [?t  :follow ?e1]]])
+;             #{[2] [3] [4]})))
+;
+;    (testing "Recursive rules"
+;      (is (= (d/q '[:find  ?e2
+;                    :in    $ ?e1 %
+;                    :where (follow ?e1 ?e2)]
+;                  db
+;                  1
+;                 '[[(follow ?e1 ?e2)
+;                    [?e1 :follow ?e2]]
+;                   [(follow ?e1 ?e2)
+;                    [?e1 :follow ?t]
+;                    (follow ?t ?e2)]])
+;             #{[2] [3] [4] [6]}))
+;
+;      (is (= (d/q '[:find ?e1 ?e2
+;                     :in $ %
+;                     :where (follow ?e1 ?e2)]
+;                    [[1 :follow 2] [2 :follow 3]]
+;                   '[[(follow ?e1 ?e2)
+;                      [?e1 :follow ?e2]]
+;                     [(follow ?e1 ?e2)
+;                      (follow ?e2 ?e1)]])
+;           #{[1 2] [2 3] [2 1] [3 2]}))
+;
+;      (is (= (d/q '[:find ?e1 ?e2
+;                     :in $ %
+;                     :where (follow ?e1 ?e2)]
+;                    [[1 :follow 2] [2 :follow 3] [3 :follow 1]]
+;                   '[[(follow ?e1 ?e2)
+;                      [?e1 :follow ?e2]]
+;                     [(follow ?e1 ?e2)
+;                      (follow ?e2 ?e1)]])
+;           #{[1 2] [2 3] [3 1] [2 1] [3 2] [1 3]})))
+;
+;    (testing "Mutually recursive rules"
+;      (is (= (d/q '[:find  ?e1 ?e2
+;                    :in    $ %
+;                    :where (f1 ?e1 ?e2)]
+;                  [[0 :f1 1]
+;                   [1 :f2 2]
+;                   [2 :f1 3]
+;                   [3 :f2 4]
+;                   [4 :f1 5]
+;                   [5 :f2 6]]
+;                 '[[(f1 ?e1 ?e2)
+;                    [?e1 :f1 ?e2]]
+;                   [(f1 ?e1 ?e2)
+;                    [?t :f1 ?e2]
+;                    (f2 ?e1 ?t)]
+;                   [(f2 ?e1 ?e2)
+;                    [?e1 :f2 ?e2]]
+;                   [(f2 ?e1 ?e2)
+;                    [?t :f2 ?e2]
+;                    (f1 ?e1 ?t)]])
+;            #{[0 1] [0 3] [0 5]
+;              [1 3] [1 5]
+;              [2 3] [2 5]
+;              [3 5]
+;              [4 5]}))))
+;
+;  (testing "Specifying db to rule"
+;    (is (= (d/q '[ :find ?n
+;                    :in   $sexes $ages %
+;                    :where ($sexes male ?n)
+;                           ($ages adult ?n) ]
+;                  [["Ivan" :male] ["Darya" :female] ["Oleg" :male] ["Igor" :male]]
+;                  [["Ivan" 15] ["Oleg" 66] ["Darya" 32]]
+;                  '[[(male ?x)
+;                     [?x :male]]
+;                    [(adult ?y)
+;                     [?y ?a]
+;                     [(>= ?a 18)]]])
+;           #{["Oleg"]}))))
+;
+;(deftest test-aggregates
+;  (let [monsters [ ["Cerberus" 3]
+;                   ["Medusa" 1]
+;                   ["Cyclops" 1]
+;                   ["Chimera" 1] ]]
+;    (testing "with"
+;      (is (= (d/q '[ :find ?heads
+;                     :with ?monster
+;                     :in   [[?monster ?heads]] ]
+;                  [ ["Medusa" 1]
+;                    ["Cyclops" 1]
+;                    ["Chimera" 1] ])
+;             [[1] [1] [1]])))
+;
+;    (testing "Wrong grouping without :with"
+;      (is (= (d/q '[ :find (sum ?heads)
+;                     :in   [[?monster ?heads]] ]
+;                  monsters)
+;             [[4]])))
+;
+;    (testing "Multiple aggregates, correct grouping with :with"
+;      (is (= (d/q '[ :find (sum ?heads) (min ?heads) (max ?heads) (count ?heads)
+;                     :with ?monster
+;                     :in   [[?monster ?heads]] ]
+;                  monsters)
+;             [[6 1 3 4]])))
+;
+;    (testing "Grouping and parameter passing"
+;      (is (= (set (d/q '[ :find ?color (max ?amount ?x) (min ?amount ?x)
+;                          :in   [[?color ?x]] ?amount ]
+;                       [[:red 1]  [:red 2] [:red 3] [:red 4] [:red 5]
+;                        [:blue 7] [:blue 8]]
+;                       3))
+;             #{[:red  [3 4 5] [1 2 3]]
+;               [:blue [7 8]   [7 8]]})))
+;
+;    (testing "Custom aggregates"
+;      (is (= (set (d/q '[ :find ?color (?agg ?x)
+;                          :in   [[?color ?x]] ?agg ]
+;                       [[:red 1]  [:red 2] [:red 3] [:red 4] [:red 5]
+;                        [:blue 7] [:blue 8]]
+;                       #(reverse (sort %))))
+;             #{[:red [5 4 3 2 1]] [:blue [8 7]]})))))


more work on macros

more work on macros

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -19,8 +19,8 @@
    [clojure.set :as set]
    [dag_unify.core :refer [copy fail? get-in strip-refs unify]]))

-(defmacro deftest [test-name stuff]
-  `(apply realtest/deftest ~@[test-name stuff]))
+(defmacro deftest [test-name & stuff]
+  `(apply ~realtest/deftest ~test-name ~@stuff))

 (deftest analyze-1
   (let [singular (analyze "compito")


dry up the code

dry up the code

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -85,7 +85,7 @@
                                                          :number :top
                                                          :pred :top}}}
                                          np-grammar))]
-    (is (= 20
+    (is (= do-this-many
            (count (pmap (fn [expr]
                           (let [fo (fo expr)
                                 parsed (parse fo np-grammar)]
@@ -103,7 +103,7 @@
                                                 :sem {:tense :present}
                                                 :subcat '()}}
                                       small)))]
-    (is (= 20
+    (is (= do-this-many
            (count (pmap (fn [expr]
                           (let [fo (fo expr)
                                 parsed (parse fo)]
@@ -123,7 +123,7 @@
                                                       :aspect :progressive}
                                                 :subcat '()}}
                                       small)))]
-    (is (= 20
+    (is (= do-this-many
            (count (pmap (fn [expr]
                           (let [fo (fo expr)
                                 parsed (parse fo)]
@@ -143,7 +143,7 @@
                                                       :aspect :perfect}
                                                 :subcat '()}}
                                       small)))]
-    (is (= 20
+    (is (= do-this-many
            (count (pmap (fn [expr]
                           (let [fo (fo expr)
                                 parsed (parse fo)]
@@ -161,7 +161,7 @@
                                                 :sem {:tense :future}
                                                 :subcat '()}}
                                       small)))]
-    (is (= 20
+    (is (= do-this-many
            (count (pmap (fn [expr]
                           (let [fo (fo expr)
                                 parsed (parse fo)]
@@ -172,14 +172,14 @@
                         expressions))))))

 (deftest roundtrip-conditional
-  (let [do-this-many 20
+  (let [do-this-many 100
         expressions (take do-this-many
                           (repeatedly
                            #(generate {:synsem {:cat :verb
                                                 :sem {:tense :conditional}
                                                 :subcat '()}}
                                       small)))]
-    (is (= 20
+    (is (= do-this-many
            (count (pmap (fn [expr]
                           (let [fo (fo expr)
                                 parsed (parse fo)]


* src/clj/cljs/compiler.clj: we only need to look at the tag, e will be parsed

--- src/clj/cljs/compiler.clj
+++ src/clj/cljs/compiler.clj
@@ -312,10 +312,7 @@
     (emit-wrap env (emit-constant form))))

 (defn bool-expr? [e]
-  (or (= e true)
-      (= e false)
-      (= (-> e meta :tag) clojure.core$boolean)
-      (= (-> e :tag) clojure.core$boolean)))
+  (= (:tag e) clojure.core$boolean))

 (defmethod emit :if
   [{:keys [test then else env]}]


* src/clj/cljs/compiler.clj: don't warn on dynamic binding on vars from other namespaces. might not be analyzed yet. Clean up warning strings.

--- src/clj/cljs/compiler.clj
+++ src/clj/cljs/compiler.clj
@@ -170,7 +170,11 @@
   (doseq [name names]
     (let [env (merge env {:ns (@namespaces *cljs-ns*)})
           ev (resolve-existing-var env name)]
-      (when (and *cljs-warn-on-dynamic* ev (not (-> ev :dynamic)))
+      (when (and *cljs-warn-on-dynamic*
+                 ;; don't warn on vars from other namespaces because
+                 ;; dependency ordering happens *after* compilation
+                 (= (:ns ev) *cljs-ns*)
+                 ev (not (-> ev :dynamic)))
         (binding [*out* *err*]
           (println (str "WARNING: " (:name-sym ev) " not declared ^:dynamic"
                         (when (:line env)
@@ -788,8 +792,8 @@
                 (let [ev (resolve-existing-var (dissoc env :locals) sym)]
                   (when *cljs-warn-on-redef*
                     (binding [*out* *err*]
-                      (println (str "WARNING:" sym "already refers to:" (symbol (str (:ns ev)) (str sym))
-                                    "being replaced by:" (symbol (str ns-name) (str sym))
+                      (println (str "WARNING: " sym " already refers to: " (symbol (str (:ns ev)) (str sym))
+                                    " being replaced by: " (symbol (str ns-name) (str sym))
                                     (when (:line env)
                                       (str " at line " (:line env)))))))
                   (swap! namespaces update-in [ns-name :excludes] conj sym)


bug fix

bug fix

--- src/clj/closerve/util.clj
+++ src/clj/closerve/util.clj
@@ -53,12 +53,12 @@

 ;;;mainly used for access rule check
 (defn get-normalized-path [req]
-  "ring file middleware seems to be case in-sensitive, so change to lower case"
+  "ring file middleware is case sensitive"
   "change // to /"
   "remove .html"
   "remove index"
   (let [path (codec/url-decode (request/path-info req))
-        path (clojure.string/lower-case path)
+;        path (clojure.string/lower-case path)
         path (if (re-matches #".*[.]html$" path) (subs path 0 (- (.length path) 5)) path)
         path (if (re-matches #".*/index$" path) (subs path 0 (- (.length path) 5)) path)
         path (clojure.string/replace path #"/+" "/")]


Add ability to stop the economic model after configured number of iterations.

--- src/cljs/beatha/core.cljs
+++ src/cljs/beatha/core.cljs
@@ -235,7 +235,8 @@
                         (when reset-grid?
                           (om/transact!
                            data [:automaton :grid]
-                           (fn [grid] (assoc grid :cells {})))))
+                           (fn [grid] (assoc grid :cells {})))
+                          (om/update! data [:automaton :util :iteration] 0)))

                      grid-c
                      ([[width height]]
@@ -668,6 +669,7 @@
       [_]
       {:config-changed (chan)
        :year-period (:year-period data)
+       :stop-after (:stop-after data)
        :corp-quantity (:corp-quantity data)})
     om/IWillMount
     (will-mount [_]
@@ -675,14 +677,15 @@
             reset-c (om/get-state owner :reset)]
         (go
           (while true
-            (let [[corp-quantity year-period] (<! config-c)]
+            (let [[corp-quantity year-period stop-after] (<! config-c)]
               (om/transact! data #(assoc %
                                     :corp-quantity corp-quantity
-                                    :year-period year-period))
+                                    :year-period year-period
+                                    :stop-after stop-after))
               (put! reset-c true))))))
     om/IRenderState
     (render-state [_ {:keys [corp-quantity year-period config-changed
-                             command-info-channel]
+                             stop-after command-info-channel]
                       :as state}]
       (let [started (:started data)]
         (dom/div
@@ -699,10 +702,17 @@
                :disabled started
                :onChange
                #(handle-int-config-change % owner state :year-period)})
+         (dom/label nil "Stop after iteration (0 - never)")
+         (dom/input
+          #js {:type "text" :className "form-control" :value stop-after
+               :disabled started
+               :onChange
+               #(handle-int-config-change % owner state :stop-after)})
          (dom/button
           #js {:type "button" :className "btn btn-danger btn-lg btn-block"
                :disabled started
-               :onClick #(do (put! config-changed [corp-quantity year-period])
+               :onClick #(do (put! config-changed
+                                   [corp-quantity year-period stop-after])
                              (put! command-info-channel
                                    {:type :change-corp-quantity
                                     :cmd corp-quantity}))}
@@ -739,38 +749,45 @@
             (get-in @data [:automaton :specific :corp-quantity] 4)
             year-period
             (get-in @data [:automaton :specific :year-period] 12)
+            stop-after
+            (get-in @data [:automaton :specific :stop-after] 0)
             iteration
             (get-in @data [:automaton :util :iteration] 0)
             corps (corps corp-quantity)
             competitor-count
             (count (filter (fn [[k v]] (>= v 0))
                            (dissoc (:capital msg) :government)))
-            command-info-c (om/get-state owner :command-info-channel)]
-        (when (zero? (mod iteration (/ year-period 2)))
-          (doseq [corp corps]
-            (let [cmd
-                  (update-in (a/conservative-corp-price
-                              (cons competitor-count
-                                    ((juxt (:global-user-share msg)
-                                           (:capital msg)
-                                           (:capital-diff msg)
-                                           (:prices msg))
-                                     corp)))
-                             [:cmd]
-                             (fn [p] [corp p]))]
-              (put! command-info-c cmd))))
-        (when (zero? (mod iteration year-period))
-          (doseq [corp corps]
-            (let [cmd
-                  (update-in (a/conservative-corp-tax
-                              (:tax-rate msg)
-                              (:income-tax-rate msg)
-                              (:fixed-tax msg)
-                              (get-in msg [:capital-incomings corp])
-                              (get-in msg [:capital-expenditures corp]))
-                             [:cmd]
-                             (fn [p] [corp p]))]
-              (put! command-info-c cmd))))
+            command-info-c (om/get-state owner :command-info-channel)
+            started-c (om/get-state owner :started)]
+        (if (and (not (= stop-after 0))
+                 (>= iteration stop-after))
+          (put! started-c false)
+          (do
+            (when (zero? (mod iteration (/ year-period 2)))
+              (doseq [corp corps]
+                (let [cmd
+                      (update-in (a/conservative-corp-price
+                                  (cons competitor-count
+                                        ((juxt (:global-user-share msg)
+                                               (:capital msg)
+                                               (:capital-diff msg)
+                                               (:prices msg))
+                                         corp)))
+                                 [:cmd]
+                                 (fn [p] [corp p]))]
+                  (put! command-info-c cmd))))
+            (when (zero? (mod iteration year-period))
+              (doseq [corp corps]
+                (let [cmd
+                      (update-in (a/conservative-corp-tax
+                                  (:tax-rate msg)
+                                  (:income-tax-rate msg)
+                                  (:fixed-tax msg)
+                                  (get-in msg [:capital-incomings corp])
+                                  (get-in msg [:capital-expenditures corp]))
+                                 [:cmd]
+                                 (fn [p] [corp p]))]
+                  (put! command-info-c cmd))))))
         (om/transact! data (fn [d] (assoc d :market-state msg)))))
     (automaton-output-view [_] market-output-view)
     (automaton-output-reset [_ data _]
@@ -810,7 +827,8 @@
                   (gen-app-view
                    a/market-model market-model-customization)
                   {:corp-quantity 4
-                   :year-period 12}))))))
+                   :year-period 12
+                   :stop-after 0}))))))

 (defn render-menu-view
   []


Make the ordering of SparseGraph->OrderedGraph a bit more sensible

--- src/cljs/fatlip/core.cljs
+++ src/cljs/fatlip/core.cljs
@@ -550,36 +550,35 @@
   "Performs one layer-by-layer sweep of the graph using ESK's algorithm"
   [sparse-graph first-layer]
   (let [{:keys [ps qs preds succs characters layers]} sparse-graph
-        initial-graph (map->OrderedGraph {:layers [first-layer]
-                                          :succs succs
-                                          :preds preds
-                                          :ps ps
-                                          :qs qs
-                                          :minus-ps []
-                                          :minus-qs []
-                                          :characters characters})]
-    (->> (rest layers)
-         (reduce (fn [[ordered-graph prev-layer] sparse-layer]
-                   (let [minus-ps (replace-ps (:items prev-layer) ps succs)
-                         positions (set-positions minus-ps)
-                         [qs non-qs] (map set
-                                          ((juxt filter remove)
-                                           #(contains? qs %)
-                                           (:nodes sparse-layer)))
-                         measures (set-measures non-qs preds positions)
-                         minus-qs (merge-layer minus-ps positions
-                                               non-qs measures)
-                         items (add-qs minus-qs qs)
-                         ordered-layer (OrderedLayer. (:id sparse-layer)
-                                                      (:duration sparse-layer)
-                                                      items)
-                         g (-> ordered-graph
-                               (update-in [:layers] conj ordered-layer)
-                               (update-in [:minus-ps] conj minus-ps)
-                               (update-in [:minus-qs] conj minus-qs))]
-                     [g ordered-layer]))
-                 [initial-graph first-layer])
-         first)))
+        [ordered-layers minus-ps minus-qs]
+        (reduce (fn [[layers minus-ps minus-qs prev-layer] sparse-layer]
+                  (let [minus-p (replace-ps (:items prev-layer) ps succs)
+                        positions (set-positions minus-p)
+                        [qs non-qs] (map set
+                                         ((juxt filter remove)
+                                          #(contains? qs %)
+                                          (:nodes sparse-layer)))
+                        measures (set-measures non-qs preds positions)
+                        minus-q (merge-layer minus-p positions
+                                             non-qs measures)
+                        items (add-qs minus-q qs)
+                        ordered-layer (OrderedLayer. (:id sparse-layer)
+                                                     (:duration sparse-layer)
+                                                     items)]
+                    [(conj layers ordered-layer)
+                     (conj minus-ps minus-p)
+                     (conj minus-qs minus-q)
+                     ordered-layer]))
+                [[first-layer] [] [] first-layer]
+                (rest layers))]
+    (map->OrderedGraph {:layers ordered-layers
+                        :minus-ps minus-ps
+                        :minus-qs minus-qs
+                        :succs succs
+                        :preds preds
+                        :ps ps
+                        :qs qs
+                        :characters characters})))

 (defn get-ordered


partial not needed for calling apply

partial not needed for calling apply

--- src/cljs/fatlip/core.cljs
+++ src/cljs/fatlip/core.cljs
@@ -809,7 +809,7 @@
       (let [root-block (first sources)
             root (first root-block)
             proto-class (classify-source root-block (:succs block-graph))
-            class (apply (partial set/difference proto-class) (vals classes))]
+            class (apply set/difference proto-class (vals classes))]
         (recur (rest sources)
                (reduce #(assoc-in %1 [%2] root) roots class)
                (assoc classes root class))))))


Line up "create convention" fields in a row

--- src/cljs/herder/core.cljs
+++ src/cljs/herder/core.cljs
@@ -61,35 +61,40 @@
                        (str "Delete " name)]])]
        [:hr]

-       [:div {:class "form-group"}
-        [:label {:class "col-md-2 control-label text-left" :for "conventionName"} "Convention name"]
-        [:div {:class "col-md-10"}
+       [:div {:class "form-inline"}
+        [:div {:class "form-group"}
+         [:label {:for "conventionName"
+                  :style {:padding-left "5px"
+                          :padding-right "5px"}} "Convention name"]
          [:input {:id "conventionName"
                   :name "conventionName"
                   :type "text"
                   :placeholder "Convention name"
                   :class "form-control input-md"
                   :value (:name @val)
-                  :on-change #(swap! val assoc :name (-> % .-target .-value))}]]]
+                  :on-change #(swap! val assoc :name (-> % .-target .-value))}]]

-       [:div {:class "form-group"}
-        [:label {:class "col-md-2 control-label text-left" :for "daterange"} "Dates"]
-        [:div {:class "col-md-10"}
-         [daterange val :date]]]
-       [:button {:type "button"
-                 :class "btn btn-primary"
-                 :on-click #(do
-                              (.log js/console (pr-str @val))
-                              (POST "/api/convention"
-                                {:params
-                                 {:conventionName (:name @val)
-                                  :from (-> @val :date first js/moment (.format "YYYY-MM-DD"))
-                                  :to (-> @val :date second js/moment (.format "YYYY-MM-DD"))}
-                                 :format :json
-                                 :handler (fn [resp] (do
-                                                       (reset! val {:name "" :date nil})
-                                                       (get-convention :refresh true)))}))}
-        "Create a new convention"]])))
+        [:div {:class "form-group"}
+         [:label {:for "daterange"
+                  :style {:padding-left "5px"
+                          :padding-right "5px"}} "Dates"]
+         [daterange val :date]]
+        [:button {:type "button"
+                  :class "btn btn-primary"
+                  :style {:margin-left "5px"}
+
+                  :on-click #(do
+                               (.log js/console (pr-str @val))
+                               (POST "/api/convention"
+                                 {:params
+                                  {:conventionName (:name @val)
+                                   :from (-> @val :date first js/moment (.format "YYYY-MM-DD"))
+                                   :to (-> @val :date second js/moment (.format "YYYY-MM-DD"))}
+                                  :format :json
+                                  :handler (fn [resp] (do
+                                                        (reset! val {:name "" :date nil})
+                                                        (get-convention :refresh true)))}))}
+         "Create a new convention"]]])))

 (defn set-html! [dom content]
   (set! (. dom -innerHTML) content))


Remove debugging code.

Remove debugging code.

--- src/cljs/primes/core.cljs
+++ src/cljs/primes/core.cljs
@@ -106,19 +106,6 @@
             (dom/button #js {:onClick #(add-more app)}
                         "show more"))))

-(defn counter-view [app owner]
-  (reify
-    om/IInitState
-    (init-state [_]
-      {:expanded false})
-    om/IRenderState
-    (render-state [_ {:keys [expanded]}]
-      (dom/div #js {:className "counter-view-test"}
-               "Simple expander test: "
-               (dom/div
-                #js {:onClick (fn [e] (om/set-state! owner :expanded (not expanded)))}
-                (if expanded "EXPANDED" "NOT EXPANDED"))))))
-

 (defn group-view
   "Render the contents of one group (set) of numbers."
@@ -141,26 +128,6 @@
                                             (str/join ", " numbers)
                                             "{Click to expand}"))))))))

-
-(defn group-view-wrapper
-  "Render the contents of one group (set) of numbers."
-  [app owner]
-  (let [[signature numbers] (first (:groups app))]
-    (group-view [signature numbers] owner)))
-
-(defn group-view-wrapper2
-  "Render the contents of one group (set) of numbers."
-  [app-group owner]
-  (let [[signature numbers] (first app-group)]
-    (group-view [signature numbers] owner)))
-
-(defn group-view-wrapper3
-  "Render the contents of one group (set) of numbers."
-  [app-group owner]
-  (let [[signature numbers] app-group]
-    (group-view [signature numbers] owner)))
-
-
 (defn groups-view
   "Render all the groups"
   [app owner]
@@ -170,17 +137,6 @@
       (dom/div nil
                (om/build title app)
                (om/build numseq app)
-               (om/build counter-view app {})
-               (dom/div nil "Uses wrapper, works")
-               (dom/ul nil
-                       (om/build group-view-wrapper app))
-               (dom/div nil "Uses wrapper2, works")
-               (dom/ul nil
-                       (om/build group-view-wrapper2 (:groups app)))
-               (dom/div nil "Uses wrapper3, fails")
-               (dom/ul nil
-                       (om/build group-view-wrapper3 (first (:groups app))))
-               (dom/div nil "Build-all, fails")
                (apply dom/ul nil
                       (om/build-all group-view (:groups app)))))))


tight up a little

tight up a little

--- src/cljs/server/core.cljs
+++ src/cljs/server/core.cljs
@@ -16,9 +16,9 @@
       (.send res (string/join "\n\n" (<! jokes-chan))))))

 (defn server [handler port cb]
-  (let [app (express)]
-    (.get app "/" handler)
-    (.listen app port cb)))
+  (doto (express)
+    (.get "/" handler)
+    (.listen port cb)))

 (defn -main [& mess]
   (let [port (or (.-PORT (.-env js/process)) 1337)]


Replace proxy wrapper around Bundle with a deftype

--- src/clojure/neko/data.clj
+++ src/clojure/neko/data.clj
@@ -3,37 +3,45 @@
   Android entities via Bundles and Intents."
   (:import android.os.Bundle android.content.Intent))

-(defprotocol GenericKey
+(defprotocol GenericExtrasKey
   "If given a string returns itself, otherwise transforms a argument
   into a string."
   (generic-key [key]))

-(extend-protocol GenericKey
+(extend-protocol GenericExtrasKey
   String
   (generic-key [s] s)

   clojure.lang.Keyword
   (generic-key [k] (.getName k)))

+;; This type acts as a wrapper around Bundle instance to be able to
+;; access it like an ordinar map.
+;;
+(deftype MapLikeBundle [^Bundle bundle]
+  clojure.lang.Associative
+  (containsKey [this k] (.containsKey bundle (generic-key k)))
+  (entryAt [this k] (clojure.lang.MapEntry. k (.get bundle (generic-key k))))
+  (valAt [this k] (.get bundle (generic-key k)))
+  (valAt [this k default] (let [key (generic-key k)]
+                      (if (.containsKey bundle key)
+                        (.get bundle (generic-key key))
+                        default)))
+  (seq [this] (map (fn [k] [k (.get bundle k)])
+                   (.keySet bundle))))
+
 (defprotocol MapLike
-  "Returns a wrapper of the provided object that allows to extract
-  values from it like from an ordinar map."
+  "A protocol that helps to wrap objects of different types into
+  MapLikeBundle."
   (like-map [this]))

 (extend-protocol MapLike
   Bundle
   (like-map [b]
-    (proxy [clojure.lang.APersistentMap] []
-      (containsKey [k] (.containsKey b (generic-key k)))
-      (valAt
-        ([k] (.get b (generic-key k)))
-        ([k default] (let [key (generic-key k)]
-                       (if (.containsKey b key)
-                         (.get b (generic-key key))
-                         default))))
-      (seq [] (map (fn [k] [k (.get b k)])
-                   (.keySet b)))))
+    (MapLikeBundle. b))

   Intent
   (like-map [i]
-    (like-map (.getExtras i))))
+    (if-let [bundle (.getExtras i)]
+      (MapLikeBundle. bundle)
+      {})))


render image

render image

--- src/clojurecafe/core.cljs
+++ src/clojurecafe/core.cljs
@@ -46,7 +46,7 @@

 (get-events result-chan)

-(defn calendar-widget [{:keys [events] } ]
+(defn calendar-widget [{:keys [events]} ]
   (om/component
    (html [:ul {:id "events"}
           (for [event events]
@@ -54,6 +54,7 @@
              [:li (:start-date event)]
              [:li (:end-date event)]
              [:li (:name event)]
+             [:img {:src (:image event)}]
              [:ul {:id "location"}
               (let [location (:location event)]
                 [:li (:type location)]


Moar.

Moar.

--- src/clojurecraft/core.clj
+++ src/clojurecraft/core.clj
@@ -5,14 +5,15 @@
 (def minecraft-local {:name "localhost" :port 25565})

 ; Packet Type Maps -----------------------------------------------------------------
-(def packet-ids {
-     :keepalive 0x00
-     :login 0x01
-     :handshake 0x02
-     :chat 0x03
-     :timeupdate 0x04
+(def packet-types {
+     0x00 :keepalive
+     0x01 :login
+     0x02 :handshake
+     0x03 :chat
+     0x04 :timeupdate
+     0x05 :equipment
 })
-(def packet-types (apply assoc {} (mapcat reverse packet-ids)))
+(def packet-ids (apply assoc {} (mapcat reverse packet-types)))

 (declare conn-handler)

@@ -56,6 +57,11 @@
       (doto (:out @conn)
          (.writeChars s)))

+(defn -write-bool [conn b]
+      (println (str "-> BOOL: " b))
+      (doto (:out @conn)
+         (.writeBoolean b)))
+

 ; Writing Packets ------------------------------------------------------------------
 (defn write-packet-keepalive [conn _]
@@ -106,6 +112,10 @@
    (let [i (.readLong (:in @conn))]
      i))

+(defn -read-short [conn]
+   (let [i (.readShort (:in @conn))]
+     i))
+
 (defn -read-string16 [conn]
   (let [str-len (.readShort (:in @conn))
         s (apply str (repeatedly str-len #(.readChar (:in @conn))))]
@@ -134,6 +144,13 @@
 (defn read-packet-timeupdate [conn]
       (-> {}
           (assoc :time (-read-long conn))))
+
+(defn read-packet-equipment [conn]
+      (-> {}
+          (assoc :eid (-read-int conn))
+          (assoc :slot (-read-short conn))
+          (assoc :itemid (-read-short conn))
+          (assoc :unknown (-read-short conn))))

 (defn read-packet [conn packet-id]


Update spec for issue-timed-request.

Update spec for issue-timed-request.

--- test/frmr/dstt_test.clj
+++ test/frmr/dstt_test.clj
@@ -24,7 +24,7 @@
   (let [last-handler-string (atom "")
         test-request-invoker (fn [] {:status 200 :body "Bacon123"})
         test-handler (fn [_ body] (reset! last-handler-string body))
-        future (issue-timed-request test-request-invoker 0 test-handler)
+        future (issue-timed-request (System/nanoTime) test-request-invoker 0 test-handler :builtin)
         _ @future]
     (is (= @last-handler-string {:status 200, :body "Bacon123"}) "Handler receives body content.")))


Minor reformatting

Minor reformatting

--- src/matchmaker_sparql/evaluation/setup.clj
+++ src/matchmaker_sparql/evaluation/setup.clj
@@ -6,7 +6,7 @@
             [stencil.core :as stencil]
             [taoensso.timbre :as timbre]))

-(defn- has-contracts-with-multiple-winners
+(defn- has-contracts-with-multiple-winners?
   "Test if there are contracts awarded to multiple bidders."
   []
   (let [{{:keys [graph]} :data} config
@@ -88,7 +88,7 @@

 (defn count-bidders
   []
-  (count-query "templates/evaluation/setup/count_bidders"))
+  (count-query "templates/evaluation/setup/count_bidders"))

 (defn- fold-limits-and-offsets
   "Returns a sequence of limits and offsets delimiting the evaluation folds.
@@ -105,15 +105,17 @@
          (conj (butlast (reductions + sample-limits)) 0))))

 (defn- are-blank-nodes-present?
-  "Test if there are no blank nodes in data in the evaluated `graph`."
-  [{:keys [graph]}]
-  (let [query (stencil/render-file "templates/evaluation/setup/are_blank_nodes_present" {:graph graph})]
+  "Test if there are no blank nodes in the evaluated data."
+  []
+  (let [{{:keys [graph]} :data} config
+        query (stencil/render-file "templates/evaluation/setup/are_blank_nodes_present" {:graph graph})]
     (assert (not (sparql/ask-query endpoint query)) "Blank nodes detected!")))

 (defn- has-duplicate-tenders?
-  "Test if there are duplicate tenders in data in the evaluated `graph`."
-  [{:keys [graph]}]
-  (let [query (stencil/render-file "templates/evaluation/setup/has_duplicate_tenders" {:graph graph})]
+  "Test if there are duplicate tenders in the evaluated data."
+  []
+  (let [{{:keys [graph]} :data} config
+        query (stencil/render-file "templates/evaluation/setup/has_duplicate_tenders" {:graph graph})]
     (assert (not (sparql/ask-query endpoint query)) "Duplicate tenders detected!")))

 (defn setup-evaluation
@@ -131,9 +133,9 @@
                           :evaluation-graph evaluation-graph
                           :graph graph
                           :withheld-graph withheld-graph)]
-    (are-blank-nodes-present? evaluation)
-    (has-duplicate-tenders? evaluation)
-    (when (has-contracts-with-multiple-winners)
+    (are-blank-nodes-present?)
+    (has-duplicate-tenders?)
+    (when (has-contracts-with-multiple-winners?)
       (timbre/info "Deleting contracts with multiple awards...")
       (delete-multiple-awards))
     ; Reduce data when required.


move location of generated exemplars to read from bin/verify

--- test/transit/verify.clj
+++ test/transit/verify.clj
@@ -234,7 +234,7 @@
   [encoding]
   (map #(transit->test-input (read-bytes %) encoding)
        (filter #(and (.isFile %) (.endsWith (.getName %) (extension encoding)))
-               (file-seq (io/file "../transit/simple-examples")))))
+               (file-seq (io/file "../transit-format/examples/0.8/simple")))))

 (defn filter-tests
   "Given a process, an encoding and options provided by the user,


distinct should return a set not a vector

Like datomic https://docs.datomic.com/on-prem/query.html

--- src/datascript/query.cljc
+++ src/datascript/query.cljc
@@ -231,7 +231,7 @@
     'median   median
     'variance variance
     'stddev   stddev
-    'distinct (comp vec distinct)
+    'distinct set
     'min      (fn
                 ([coll] (reduce (fn [acc x]
                                   (if (neg? (compare x acc))


Move ring jetty interaction down to muxx.

--- src/degel/muxx/server.clj
+++ src/degel/muxx/server.clj
@@ -13,6 +13,7 @@
 (ns degel.muxx.server
   (:require [compojure.core :refer [defroutes GET]]
             [compojure.route :refer [resources not-found]]
+            [ring.adapter.jetty :refer [run-jetty]]
             [ring.util.response :refer [redirect]]
             [shoreleave.middleware.rpc :refer [wrap-rpc]]
             [net.cgrand.enlive-html :as html]
@@ -80,3 +81,12 @@

 (def app (-> app-routes wrap-rpc site))
+
+(defn run-servers [& {:keys [apps port]}]
+  ;; [TODO] Using an atom for this is kinda grody. Is there some
+  ;;        cleaner way to pass our state down to app-routes?
+  (dorun (map add-app apps))
+  (defonce ^:private server
+    (run-jetty #'app {:port port :join? false}))
+  server)
+


Added subheadings.

Added subheadings.


Minor cleanup

Minor cleanup

--- src/foreclojure/users.clj
+++ src/foreclojure/users.clj
@@ -3,7 +3,7 @@
             [clojure.string           :as string]
             [sandbar.stateful-session :as session]
             [cheshire.core            :as json])
-  (:use     [foreclojure.utils        :only [from-mongo row-class rank-class get-user if-user with-user flash-error ]]
+  (:use     [foreclojure.utils        :only [from-mongo row-class rank-class get-user if-user with-user]]
             [foreclojure.template     :only [def-page content-page]]
             [foreclojure.ring-utils   :only [*http-scheme* static-url]]
             [foreclojure.config       :only [config repo-url]]
@@ -164,7 +164,7 @@
        :heading-note [:span#all-users-link]
        :sub-heading (list (format-user-ranking user-ranking)
                           [:span.contributor "*"] " "
-                          (link-to repo-url "4clojure contributor") [:br])
+                          (link-to repo-url "4clojure contributor"))
        :main (generate-user-list top-100 "user-table")})}))

 ;; TODO: this is snagged from problems.clj but can't be imported due to cyclic dependency, must refactor this out.


A little more

A little more

--- web/test/immutant/web_test.clj
+++ web/test/immutant/web_test.clj
@@ -110,7 +110,7 @@
   (let [request (atom {})
         handler (comp hello #(swap! request into %))
         server (start handler)]
-    (get-body url {:content-type "text/html; charset=utf-8"})
+    (get-body (str url "?query=help") {:content-type "text/html; charset=utf-8"})
     (are [x expected] (= expected (x @request))
          :content-type        "text/html; charset=utf-8"
          :character-encoding  "utf-8"
@@ -119,8 +119,9 @@
          :content-length      -1
          :uri                 "/"
          :server-name         "localhost"
-         :query-string        ""
+         :query-string        "query=help"
          :scheme              :http
          :request-method      :get)
     (is (:body @request))
+    (is (map? (:headers @request)))
     (is (< 3 (count (:headers @request))))))


Getting args info for a multi arity fn works.

--- test/cli4clj/test/cli.clj
+++ test/cli4clj/test/cli.clj
@@ -121,3 +121,7 @@
     (is (= '[[arg]] (get-in result [:cmds :a :fn-args])))
     (is (= '[[summand1 summand2]] (get-in result [:cmds :b :fn-args])))))

+(deftest get-args-info-simple-multi-arity-fn-test
+  (let [result (add-args-info-m {:cmds {:a {:fn (fn ([a] (inc a)) ([a b] (+ a b)) ([a b c] (+ a b c)))}}})]
+    (is (= '[[a] [a b] [a b c]] (get-in result [:cmds :a :fn-args])))))
+


Remove leading and trailing whitespace for output string.

--- test/cli4clj/test/cli.clj
+++ test/cli4clj/test/cli.clj
@@ -67,5 +67,5 @@

 (deftest add-cmd-cli-interaction-stdout-test
   (let [out-string (test-cli-stdout {:cmds {:add {:fn #(+ %1 %2)}}} ["add 1 2"])]
-    (is (= "3\n" out-string))))
+    (is (= "3" out-string))))


made changes as suggested by technomancy

--- src/leiningen/compile.clj
+++ src/leiningen/compile.clj
@@ -41,19 +41,23 @@
       "sparc" "sparc"})

 (defn get-native-dir-name
+  "Gets a value from the native-dir-names map, but uses a regex
+  to check the prop-value for a match against keys instead of just
+  doing a map lookup. Reason for this is that e.g. windows may
+  report different names for different OS versions but will likely
+  always contain the string 'Windows'"
   [prop-value]
-  (native-dir-names
+  (native-dir-names
    (first (drop-while #(nil? (re-find (re-pattern %) prop-value))
-		      (keys native-dir-names)))))
+                      (keys native-dir-names)))))

 (defn find-native-lib-path
   "Returns a File representing the directory where native libs for the
   current platform are located."
   [project]
   (let [osdir (get-native-dir-name (System/getProperty "os.name"))
-	archdir (get-native-dir-name (System/getProperty "os.arch"))
-	sep (System/getProperty "file.separator")
-	f (file (str "native" sep osdir sep archdir sep))]
+        archdir (get-native-dir-name (System/getProperty "os.arch"))
+        f (file "native" osdir archdir)]
     (if (.exists f)
       f
       nil)))
@@ -78,14 +82,14 @@
                             (.setKey "clojure.compile.path")
                             (.setValue (:compile-path project))))
     (when-let [path (or (:native-path project)
-			(find-native-lib-path project))]
+                        (find-native-lib-path project))]
       (.addSysproperty java (doto (Environment$Variable.)
-			    (.setKey "java.library.path")
-			    (.setValue (cond
-					(= java.io.File (class path))
-					(.getAbsolutePath path)
-					(fn? path) (path)
-					:default path)))))
+                              (.setKey "java.library.path")
+                              (.setValue (cond
+                                          (= java.io.File (class path))
+                                          (.getAbsolutePath path)
+                                          (fn? path) (path)
+                                          :default path)))))
     (.setClasspath java (apply make-path
                                (:source-path project)
                                (:test-path project)


Add Neu im Sortiment fop output for debugging

--- src/catalog/core.clj
+++ src/catalog/core.clj
@@ -15,6 +15,12 @@
    vubis/order-and-group
    (layout.fop/document :all-formats nil nil)
    (layout.fop/generate-pdf! out)))
+
+(defn neu-im-sortiment-fop [in out]
+  (-> in
+   vubis/read-file
+   vubis/order-and-group
+   (layout.fop/generate-document :all-formats nil nil out)))

 (defn neu-in-grossdruck [in out editorial recommendations]
   (-> in


framework for invite tool.

framework for invite tool.

--- src/slack_invite/core.clj
+++ src/slack_invite/core.clj
@@ -1,7 +1,21 @@
 (ns slack-invite.core
-  (:gen-class))
+  (:require [bidi.bidi :as b]
+            [bidi.ring :refer (make-handler)]
+            [clj-slack.core :as slack]))

-(defn -main
-  "I don't do a whole lot ... yet."
-  [& args]
-  (println "Hello, World!"))
+(defn showForm
+  [request]
+  {:status 200
+   :headers {"Content-Type" "text/html"}
+   :body "
Hello world!
"})
+
+(defn handleForm
+  [request]
+)
+
+(def routes
+  ["/" {:get showForm
+        :post handleForm}])
+
+(def handler
+  (make-handler routes))


Remove println

Remove println

--- src/uxbox/main/ui/dashboard/images.cljs
+++ src/uxbox/main/ui/dashboard/images.cljs
@@ -293,7 +293,6 @@
                 (rs/emit! (di/update-opts :order value))))
             (on-clear [event]
               (rs/emit! (di/update-opts :filter "")))]
-      (println "menu:" ordering)
       [:section.dashboard-bar.library-gap
        [:div.dashboard-info


allow for other proxies in the `via` header test (#1603)

--- waiter/integration/waiter/basic_test.clj
+++ waiter/integration/waiter/basic_test.clj
@@ -242,8 +242,8 @@
               _ (assert-response-status response http-200-ok)
               body-json (try-parse-json (str body))
               expected-via-prefix "HTTP/1.1 waiter/"]
-          (is (str/starts-with? (str (get-in body-json ["headers" "via"])) expected-via-prefix) (str body))
-          (is (str/starts-with? (str (get headers "via")) expected-via-prefix) (str headers))))
+          (is (str/includes? (str (get-in body-json ["headers" "via"])) expected-via-prefix) (str body))
+          (is (str/includes? (str (get headers "via")) expected-via-prefix) (str headers))))

       (testing "query-string with special characters"
         (log/info "Basic test for query-string with special characters")


Added a couple more tests

Added a couple more tests

Looking good.

Need to provide a mech getting the rejected stls

--- test/stl_collector/flattener_test.clj
+++ test/stl_collector/flattener_test.clj
@@ -18,4 +18,10 @@

 (deftest collect
   (testing "if the stl fits"
-    (is (= stl (f/collect [40.0 40.0 40.0] 5.0 [stl])))))
+    (is (= stl (f/collect [40.0 40.0 40.0] 5.0 [stl]))))
+
+  (testing "works for N"
+    (is  (= 48 (count (f/collect [50.0 50.0 50.0] 5.0 [stl stl stl stl])))))
+
+  (testing "works for N"
+    (is  (= 48 (count (f/collect [50.0 50.0 50.0] 5.0 [stl stl stl stl stl]))))))


불필요 코드 제거.

불필요 코드 제거.

--- src/tweetbook/handler.clj
+++ src/tweetbook/handler.clj
@@ -2,7 +2,6 @@
   (:require [compojure.core :refer [defroutes routes]]
             [ring.middleware.resource :refer [wrap-resource]]
             [ring.middleware.file-info :refer [wrap-file-info]]
-            [hiccup.middleware :refer [wrap-base-url]]
             [compojure.handler :as handler]
             [compojure.route :as route]
             [noir.session :as session]
@@ -30,5 +29,4 @@
 (def app
   (-> (routes auth-routes home-routes app-routes)
       (handler/site)
-      (wrap-base-url)
       (session/wrap-noir-session {:store (memory-store)})))


Correct call error in site-traversal

Correct call error in site-traversal

--- test/comic_reader/sites_test.clj
+++ test/comic_reader/sites_test.clj
@@ -173,7 +173,7 @@
                last-chapter (last chapter-list)

                page-list (get-page-list site last-chapter)
-               third-page (nth 3 page-list)]
+               third-page (nth page-list 3)]
            (get-image-data site third-page)))))))

 (defn testdef-form [site-name]


Ensure instance is running.

Ensure instance is running.

--- src/onyx_benchmark/util.clj
+++ src/onyx_benchmark/util.clj
@@ -16,15 +16,20 @@
 (defn metrics? [tags]
   (seq (filter (fn [t] (and (= (:Key t) "stack-role") (= (:Value t) "metrics"))) tags)))

+(defn running? [i]
+  (= "running" (:Name (:State i))))
+
 (defn -main [stack-name stack-region file & args]
   (let [contents (parse-string (slurp file) true)
         instances (mapcat :Instances (:Reservations contents))]
-    (spit "/home/ubuntu/zookeeper.txt" (:PublicDnsName (first (filter (fn [i] (and (zk? (:Tags i))
-                                                                                (in-stack? stack-name (:Tags i))
-                                                                                (in-region? stack-region (:Tags i))))
+    (spit "/home/ubuntu/zookeeper.txt" (:PublicDnsName (first (filter (fn [i] (and (running? i)
+                                                                                (zk? (:Tags i))
+                                                                                (in-stack? stack-name (:Tags i))
+                                                                                (in-region? stack-region (:Tags i))))
                                                                       instances))))
-    (spit "/home/ubuntu/metrics.txt" (:PublicDnsName (first (filter (fn [i] (and (metrics? (:Tags i))
-                                                                                (in-stack? stack-name (:Tags i))
-                                                                                (in-region? stack-region (:Tags i))))
+    (spit "/home/ubuntu/metrics.txt" (:PublicDnsName (first (filter (fn [i] (and (running? i)
+                                                                                (metrics? (:Tags i))
+                                                                                (in-stack? stack-name (:Tags i))
+                                                                                (in-region? stack-region (:Tags i))))
                                                                     instances))))))


placeholders

placeholders

Former-commit-id: dfaf0806a0afd7bc33300ef8020f7006ccb3ca56

--- src/status_im/chat/views/new_message.cljs
+++ src/status_im/chat/views/new_message.cljs
@@ -16,7 +16,7 @@
    (for [command staged-commands]
      ^{:key command} [staged-command-view command])])

-(defn get-options [{:keys [type placeholder]}]
+(defn get-options [{:keys [type placeholder]} command-type]
   (let [options (case (keyword type)
                   :phone {:input-options {:keyboardType :phone-pad}
                           :validator     valid-mobile-number?}
@@ -24,13 +24,18 @@
                   :number {:input-options {:keyboardType :numeric}}
                   ;; todo maybe nil is fine for now :)
                   nil #_(throw (js/Error. "Uknown command type")))]
-    (assoc-in options [:input-options :placeholder] "")))
+    (if (= :response command-type)
+      (if placeholder
+        (assoc-in options [:input-options :placeholder] placeholder)
+        options)
+      (assoc-in options [:input-options :placeholder] ""))))

 (defview show-input []
   [parameter [:get-command-parameter]
-   command? [:command?]]
+   command? [:command?]
+   type [:command-type]]
   [plain-message-input-view
-   (when command? (get-options parameter))])
+   (when command? (get-options parameter type))])

 (defview chat-message-new []
   [staged-commands [:get-chat-staged-commands]]


adjacency domains

adjacency domains


Fix modal-panel to re-render with new props.

[modal-panel ...] was previously a Form-2 component with a no-arg render
function, meaning that it wouldn't be re-rendered when its component
props changed. Now changed to a Form-1 component.

--- src/re_com/modal_panel.cljs
+++ src/re_com/modal_panel.cljs
@@ -23,30 +23,29 @@
       :or   {wrap-nicely? true backdrop-color "black" backdrop-opacity 0.6}
       :as   args}]
   {:pre [(validate-args-macro modal-panel-args-desc args "modal-panel")]}
-  (fn []
-    [:div
-     (merge {:class  (str "rc-modal-panel display-flex " class)    ;; Containing div
-             :style (merge {:position "fixed"
-                            :left     "0px"
-                            :top      "0px"
-                            :width    "100%"
-                            :height   "100%"}
-                           style)}
-            attr)
-     [:div
-      {:style    {:position         "fixed"           ;; Backdrop
-                  :width            "100%"
-                  :height           "100%"
-                  :background-color backdrop-color
-                  :opacity          backdrop-opacity
-                  :z-index          1020
-                  :pointer-events   "none"}           ;; TODO: trying to prevent change of focus under the bwhen clicking on backdrop (also with the on-click below). Remove!
-       :on-click #(do (println "stopping propagation") (.preventDefault %) (.stopPropagation %))
-       }]
-     [:div
-      {:style (merge {:margin  "auto"                 ;; Child
-                      :z-index 1020}
-                     (when wrap-nicely? {:background-color "white"
-                                         :padding          "16px"
-                                         :border-radius    "6px"}))}
-      child]]))
+  [:div
+   (merge {:class  (str "rc-modal-panel display-flex " class)    ;; Containing div
+           :style (merge {:position "fixed"
+                          :left     "0px"
+                          :top      "0px"
+                          :width    "100%"
+                          :height   "100%"}
+                         style)}
+          attr)
+   [:div
+    {:style    {:position         "fixed"           ;; Backdrop
+                :width            "100%"
+                :height           "100%"
+                :background-color backdrop-color
+                :opacity          backdrop-opacity
+                :z-index          1020
+                :pointer-events   "none"}           ;; TODO: trying to prevent change of focus under the bwhen clicking on backdrop (also with the on-click below). Remove!
+     :on-click #(do (println "stopping propagation") (.preventDefault %) (.stopPropagation %))
+     }]
+   [:div
+    {:style (merge {:margin  "auto"                 ;; Child
+                    :z-index 1020}
+                   (when wrap-nicely? {:background-color "white"
+                                       :padding          "16px"
+                                       :border-radius    "6px"}))}
+    child]])


Remove unused circular dependency workaround

--- src/reagent/impl/input.cljs
+++ src/reagent/impl/input.cljs
@@ -2,9 +2,6 @@
   (:require [reagent.impl.component :as comp]
             [reagent.impl.batching :as batch]
             [reagent.impl.protocols :as p]))
-
-;; Workaround circular dependency
-(defonce make-element nil)

 ;; <input type="??" >
 ;; The properites 'selectionStart' and 'selectionEnd' only exist on some inputs


Gracefully fail on cljc files

Gracefully fail on cljc files

This was implemented for cljs and cljx but clojure 1.7 is out now and
people are bound to start using clj-refactor on cljc files.

--- src/refactor_nrepl/util.clj
+++ src/refactor_nrepl/util.clj
@@ -55,10 +55,10 @@
        (filter #(second %))
        ffirst))

-(defn throw-unless-clj-file [file]
-  (when (and file (not-empty file) (or (.endsWith file ".cljs") (.endsWith file ".cljx")))
+(defn throw-unless-clj-file [file-path]
+  (when-not (re-matches #".+\.clj$" file-path)
     (throw (IllegalArgumentException.
-            "Refactor nrepl doesn't work on cljs or cljx files!"))))
+            "Only .clj files are supported!"))))

 (defn- normalize-anon-fn-params
   "replaces anon fn params in a read form"


pooling

pooling

--- dev/user.clj
+++ dev/user.clj
@@ -33,9 +33,12 @@
   (println "Proceeding to refresh the database")
   ;(jcore/drop-database config/db-spec-without-db config/fp-db-name)
   ;(jcore/create-database config/db-spec-without-db config/fp-db-name)
-  (j/db-do-commands (config/db-spec)
-                    true
-                    fpddl/v6-create-postgis-extension)
+  (try
+    (j/db-do-commands (config/db-spec)
+                      true
+                      fpddl/v6-create-postgis-extension)
+    (catch Exception e
+      (log/debug "Exception caught executing 'fpddl/v6-create-postgis-extension'.  This is okay.")))
   (lifecycle/init-database)
   (reset! server (create-and-start-server))
   (println "Jetty server restarted."))


Changed % reliable threshold to 0.1, so we don't screen out tons more pixels just yet

--- src/clj/forma/hadoop/jobs/forma.clj
+++ src/clj/forma/hadoop/jobs/forma.clj
@@ -83,7 +83,7 @@
   "Return clean timeseries with telescoping window, nil if no (or not enough) good training data"
   [{:keys [est-start est-end t-res]}
    good-set bad-set start-period val-ts reli-ts]
-  (let [reli-thresh 0.5
+  (let [reli-thresh 0.1
         freq (date/res->period-count t-res)
         [start-idx end-idx] (date/relative-period t-res start-period
                                                   [est-start est-end])


Add redirection from /api/logout to /.

Add redirection from /api/logout to /.

--- src/clj/hatnik/web/server/login.clj
+++ src/clj/hatnik/web/server/login.clj
@@ -68,6 +68,8 @@

 (defn logout []
   (assoc (resp/response {:result :ok})
+    :headers {"Location" "/"}
+    :status 302
     :session nil))

 (defroutes login-api


New functions: get-command and job-name->url

--- src/clj_jenkins_api/jenkins_api.clj
+++ src/clj_jenkins_api/jenkins_api.clj
@@ -1,5 +1,5 @@
 ;
-;  (C) Copyright 2015  Pavel Tisnovsky
+;  (C) Copyright 2015, 2016  Pavel Tisnovsky
 ;
 ;  All rights reserved. This program and the accompanying materials
 ;  are made available under the terms of the Eclipse Public License v1.0
@@ -10,5 +10,24 @@
 ;      Pavel Tisnovsky
 ;

-(ns clj-jenkins-api.jenkins-api)
+(ns clj-jenkins-api.jenkins-api
+    "Module with functions implementing Jenkins API.")

+(require '[clj-http.client   :as http-client])
+
+(defn get-command
+    "The reimplementation of HTTP GET command that can use JVM keystore for
+     establishing secure connections."
+    [url]
+    (:body (http-client/get url {
+                    :keystore "keystore"
+                    :keystore-pass "changeit"
+                    :trust-store "keystore"
+                    :trust-store-pass "changeit"})))
+
+(defn job-name->url
+    "Transform job name (that can contain spaces) to the URL part."
+    [jenkins-url job-name]
+    (str jenkins-url "job/" (.replaceAll job-name " " "%20")))
+
+


Comments, hopefully the spelling is a little better.

--- src/clojure/neveragain/pdaparse.clj
+++ src/clojure/neveragain/pdaparse.clj
@@ -45,25 +45,36 @@
     (if p-sym
       ; For each rule S -> s make a transition from q1 to q1 popping and
       ; reading nothing and pushing s onto stack so whenever we see S in stack
+      ; it will be "replaced" by s
       (recur
         (if (every? char? rules)
-          ; If this transition only add non-terminal characters we can optimize
-          ; and pick the letter to push to stack based on the read symbol
+          ; If this transition only adds non-terminal characters we can
+          ; optimize by making the input symbol a set and making the push
+          ; symbol be whatever the input symbol was. The presence of :<> tells
+          ; the intrepreter to not pop from the input string as well.
           (conj q1 [:q1 rules p-sym :<>])
+
+          ; Otherwise make epsilon transitions replacing the non-terminal
+          ; symbol with each of it's possible expansions per the CFG.
           (apply conj q1
                  (map (fn [x] [:q1 :ε p-sym x]) rules)))
         (conj Σ rules) ; Remember we're going to flatten this
         remaining)
-      {:start-state :q0
+      ; All NDPFAs will look like q0 -> q1 -> q2 with the same accepting
+      ; configuration and transitions save those form q1 to itself.
+      {:start-state :q0
+       ; First move will always be to transform the stack to (first-symbol :Z)
+       ; where :Z will designate the end of string symbol.
        :program {:q0 [[:q1 :ε :ε (list (:start-symbol cfg) :Z)]]
-                 ; Make a transition from and to q1 for each input terminal
-                 ; symbol popping that same symbol from stack
+                 ; In addition to non terminal symbol expansion, we need to
+                 ; make a q1 -> q1 transtion poping the same symbol from stack
+                 ; and input for every terminal symbol.
                  :q1 (concat q1
                              (map (fn [x] [:q1 x x :ε])
-                                  ; Flatten and pull out non-terminals and ε
                                   (mset/difference (set (coll-flatten Σ))
                                                    (set (keys (:prod-rules cfg)))
                                                    #{:ε})))
+                 ; q2 doesn't do anything, it just accepts.
                  :q2 []}
        :accepting #{:q2}})))

@@ -109,14 +120,18 @@
   ([pda [next-sym & input-string] current-state stack]
    (if (and (not next-sym) (empty? stack))
      ; If there's nothing left to read and the stack is empty it's time to
-     ; check our accepting state.
+     ; check if current-state is accepting.
      (if (current-state (:accepting pda)) true false)
+
+     ; Otherwise figure out which transitions we can make given the current
+     ; configuration.
      (let [transitions (-> pda :program current-state)
            valid-trans (filter (fn [[_ i-sym s-sym __]]
                                 (and (ε= i-sym next-sym)
                                      (ε= s-sym (first stack))))
                                transitions)]

+       ; Some debugging stuff. This will get removed eventually.
        ;(if-not (empty? valid-trans) (do
        ; (println "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~")
        ; (println "Input: " (conj input-string next-sym))
@@ -124,13 +139,25 @@
        ; (println "Stack: " stack)
        ; (println "Valid: " valid-trans)))

+       ; If there's no valid moves for us to make and we're here it means
+       ; there's no path to an accepting state, computation has "locked", and
+       ; this particular search path does not accept the input string.
        (if-not (seq valid-trans) false
+         ; But if that isn't the case make the appropriate adjustments to the
+         ; configuration and recur for each potential transition.
          (true? (some (fn [[next-state i-sym s-sym p-sym]]
-                 ; Don't "read" if this is an ε trans or the transition is
-                 ; flagged as "no-read".
+                 ; If this is an ε transition then we don't touch the input
+                 ; string, we just manipulate the stack and carry on. If this
+                 ; transition uses the special :<> p-symbol it means we're
+                 ; cloning the current input symbol onto the stack and still
+                 ; don't touch the input string.
                  (let [i-string (if (or (ε? i-sym) (= p-sym :<>))
                                   (conj input-string next-sym)
                                   input-string)
+                       ; Likewise, if the transition doesn't care about stack
+                       ; state we don't pop anything. Again, the :<> symbol
+                       ; is a special value flagging that we should push
+                       ; next-sym on to the stack.
                        stack (εpush (if (= p-sym :<>) next-sym p-sym)
                                     (if (ε? s-sym) stack (rest stack)))]
                    (accepts? pda i-string next-state stack))) valid-trans)))))))


Only show widget if all parents are visible

--- src/clojure/nightcode/shortcuts.clj
+++ src/clojure/nightcode/shortcuts.clj
@@ -32,10 +32,17 @@
         (.setPositioner positioner)
         (.setVisible false)))))

+(defn is-visible?
+  [widget]
+  (if widget
+    (and (.isVisible widget)
+         (is-visible? (.getParent widget)))
+    true))
+
 (defn toggle-hints
   [target show?]
   (doseq [hint (s/select target [:BalloonTip])]
-    (if (and show? (s/config (.getAttachedComponent hint) :enabled?))
+    (if (and show? (is-visible? (.getAttachedComponent hint)))
       (s/show! hint)
       (s/hide! hint))))


Fix profile error catch for cljs

Fix profile error catch for cljs

--- src/com/wsscode/pathom/profile.cljc
+++ src/com/wsscode/pathom/profile.cljc
@@ -34,7 +34,7 @@
              (try
                (swap! profile* update-in path append-at
                  (- (current-time-ms) start-time))
-               (catch Exception _))
+               (catch #?(:clj Throwable :cljs :default) _))
              res)))))

    ::p/wrap-mutate


Refactor test to use `with-local-conn` macro.

--- test/expenses/db_test.clj
+++ test/expenses/db_test.clj
@@ -48,10 +48,9 @@
     => (contains-financial-record test-record)))

 (fact "we can import various FinancialRecords"
-  (with-redefs [conn (create-empty-in-memory-db)]
-    (do
-      (import-financial-records! [test-record test-record2])
-      (all-financial-records)))
+  (with-local-conn
+    (import-financial-records! [test-record test-record2])
+    (all-financial-records))
   => (contains-financial-records))

 ;; Going to think about what validation should be


No tests please

No tests please

--- test/hecuba/core_test.clj
+++ test/hecuba/core_test.clj
@@ -1,7 +0,0 @@
-(ns hecuba.core-test
-  (:require [clojure.test :refer :all]
-            [hecuba.core :refer :all]))
-
-(deftest a-test
-  (testing "FIXME, I fail."
-    (is (= 0 1))))


implicitly wait 25s

implicitly wait 25s

Former-commit-id: 0e3c1d10ba0ef3205efb800ce5d98f71f4266274

--- test/status_im/appium.clj
+++ test/status_im/appium.clj
@@ -22,8 +22,7 @@
     (-> driver
         .manage
         .timeouts
-        (.implicitlyWait 100 TimeUnit/MILLISECONDS))
-    (Thread/sleep 9000)
+        (.implicitlyWait 25 TimeUnit/SECONDS))
     driver))

 (defn by-xpath [driver xpath]


[CS] Re-alias util and db.util

[CS] Re-alias util and db.util

--- src/vip/data_processor/validation/csv.clj
+++ src/vip/data_processor/validation/csv.clj
@@ -6,8 +6,8 @@
             [com.climate.newrelic.trace :refer [defn-traced]]
             [korma.core :as korma]
             [korma.db :as db]
-            [vip.data-processor.util :as bom]
-            [vip.data-processor.db.util :as util]
+            [vip.data-processor.util :as util]
+            [vip.data-processor.db.util :as db.util]
             [vip.data-processor.validation.data-spec :as data-spec]
             [vip.data-processor.db.sqlite :as sqlite]))

@@ -45,7 +45,7 @@
   (if-let [file-to-load (find-input-file ctx filename)]
     (do
       (log/info "Loading" filename)
-      (with-open [in-file (bom/bom-safe-reader file-to-load :encoding "UTF-8")]
+      (with-open [in-file (util/bom-safe-reader file-to-load :encoding "UTF-8")]
         (let [headers (-> in-file
                           .readLine
                           csv/read-csv
@@ -88,12 +88,12 @@
                               (catch java.sql.SQLException e
                                 (let [message (.getMessage e)]
                                   (if (re-find #"UNIQUE constraint failed: (\w+).id" message)
-                                    (util/retry-chunk-without-dupe-ids ctx sql-table chunk-values)
+                                    (db.util/retry-chunk-without-dupe-ids ctx sql-table chunk-values)
                                     (assoc-in ctx [:fatal (:name table) @line-number :unknown-sql-error]
                                               [message]))))))
                           ctx))
-                      ctx (util/chunk-rows (csv/read-csv in-file)
-                                           sqlite/statement-parameter-limit)))))))
+                      ctx (db.util/chunk-rows (csv/read-csv in-file)
+                                              sqlite/statement-parameter-limit)))))))
     ctx))

 (defn-traced load-csvs [ctx]


Increment template version

Increment template version

--- template/project.clj
+++ template/project.clj
@@ -1,4 +1,4 @@
-(defproject play-clj/lein-template "0.4.7.1"
+(defproject play-clj/lein-template "0.4.8-SNAPSHOT"
   :description "A template for making play-clj projects"
   :url "https://github.com/oakes/play-clj"
   :license {:name "Public Domain"


make sure element-array-buffers are properly bound, unbound, cached and invalidated

--- src/gamma_driver/drivers/basic.cljs
+++ src/gamma_driver/drivers/basic.cljs
@@ -1,7 +1,8 @@
 (ns gamma-driver.drivers.basic
   (:require
     [gamma-driver.api :as gd]
-    [gamma-driver.protocols :as gdp]))
+    [gamma-driver.protocols :as gdp]
+    [goog.webgl :as ggl]))

@@ -20,10 +21,16 @@

 (defn input [driver program binder-fn variable new-spec]
-  (let [{:keys [input-fn input-state]} driver
-        old-spec (get-in @input-state [program variable] {})
-        new-spec (input-fn driver program binder-fn variable old-spec new-spec)]
-    (swap! input-state assoc-in [program variable] new-spec)))
+  (let [{:keys [input-fn input-state]} driver]
+    (if (= :element-index (:tag variable))
+      (let [old-spec (get-in @input-state [program variable] {})
+            new-spec (input-fn driver program binder-fn variable old-spec new-spec)]
+        (swap! input-state assoc-in [program variable] new-spec)
+        (swap! input-state assoc-in [variable] new-spec))
+      (let [old-spec (get-in @input-state [program variable] {})
+            new-spec (input-fn driver program binder-fn variable old-spec new-spec)]
+        (swap! input-state assoc-in [program variable] new-spec)))))
+

 (defn default-input-fn [driver program binder-fn variable old-spec new-spec]
@@ -72,16 +79,18 @@
      ;; catch it and present it to the user, e.g. in a shadertoy/live
      ;; editor?
      (throw (js/Error. (str "Program '" (pr-str (:id program)) "' inputs are incomplete."  (pr-str (map (juxt :name :type) missing-inputs)))))
-     (let [c (if-let [c (:count opts)]
-               c
-               (draw-count driver program))
-           new-opts (assoc opts :count c)]
-       (gd/draw-arrays
-        (gdp/gl driver)
-        program
-        ;; should supply below as an arg, with defaults
-        new-opts
-        target)))))
+     (if
+
+       (let [c (if-let [c (:count opts)]
+                c
+                (draw-count driver program))
+            new-opts (assoc opts :count c)]
+        (gd/draw-arrays
+          (gdp/gl driver)
+          program
+          ;; should supply below as an arg, with defaults
+          new-opts
+          target))))))

 (defn draw-elements*
@@ -90,17 +99,23 @@
   ([driver program opts target]
    (if-let [missing-inputs (input-incomplete? driver program)]
      (throw (js/Error. (str "Program '" (pr-str (:id program)) "' inputs are incomplete."  (pr-str (map (juxt :name :type) missing-inputs)))))
-     (gd/draw-elements
-      (gdp/gl driver)
-       program
-       ;; should supply below as an arg, with defaults
-       {:draw-mode  (:draw-mode opts :triangles)
-        :first      0
-        ;; Should we just throw an error if :index-type isn't specified,
-        ;; rather than default to :unsigned-short?  Seems kinder.
-        :index-type :unsigned-short
-        :count      (:count opts)}
-       target))))
+     (if-let [index (get-in @(:input-state driver) [program {:tag :element-index}])]
+       (do
+         (when (not= index (get-in @(:input-state driver) [{:tag :element-index}]))
+           (.bindBuffer (:gl driver) ggl/ELEMENT_ARRAY_BUFFER (:element-array-buffer index))
+           (swap! (:input-state driver) assoc {:tag :element-index} index))
+         (gd/draw-elements
+           (gdp/gl driver)
+           program
+           ;; should supply below as an arg, with defaults
+           {:draw-mode  (:draw-mode opts :triangles)
+            :first      0
+            ;; Should we just throw an error if :index-type isn't specified,
+            ;; rather than default to :unsigned-short?  Seems kinder.
+            :index-type :unsigned-short
+            :count      (:count opts)}
+           target))
+       (throw (js/Error. "Program '" (pr-str (:id program)) "' missing element index"))))))


Working on test cases.

Working on test cases.

--- test/blutwurst/tuple_generator_test.clj
+++ test/blutwurst/tuple_generator_test.clj
@@ -52,10 +52,10 @@
                 result)))))

   (testing "Foreign key values are all found in source table."
-    (let [weapon-table '{:name "Weapon" :schema "asdf" :properties ({:name "ID" :type :integer :constraints {:maximum-length 3 :nullable false}}
+    (let [weapon-table '{:name "Weapon" :schema "asdf" :properties ({:name "ID" :type :integer :constraints {:maximum-value 255 :nullable false}}
                                                                  {:name "Name" :type :string :constraints {:maximum-length 3 :nullable false}})}
           hero-table '{:name "Hero" :schema "asdf" :properties ({:name "Name" :type :string :constraints {:maximum-length 200}}
-                                                             {:name "PrimaryWeaponID" :type :integer :constraints {:maximum-length 3}})
+                                                             {:name "PrimaryWeaponID" :type :integer :constraints {:maximum-value 255}})
                        :dependencies [{:target-name "Weapon" :target-schema "asdf" :links {"PrimaryWeaponID" "ID"}}]}
           spec {:number-of-rows 100}
           result (generate-tuples-for-plan spec (list weapon-table hero-table))


Changed logging level of batch concept retrieval from debug to info. (#55)

Needed to support monitoring of batch indexing from splunk.

--- metadata-db-app/src/cmr/metadata_db/data/oracle/search.clj
+++ metadata-db-app/src/cmr/metadata_db/data/oracle/search.clj
@@ -151,7 +151,7 @@
                    [conn db]
                    (let [conditions [`(>= :id ~start-index)
                                      `(< :id ~(+ start-index batch-size))]
-                         _ (debug "Finding batch for provider" provider-id "from id >=" start-index " and id <" (+ start-index batch-size))
+                         _ (info "Finding batch for provider" provider-id "from id >=" start-index " and id <" (+ start-index batch-size))
                          conditions (if (empty? params)
                                       conditions
                                       (cons (sh/find-params->sql-clause params) conditions))
@@ -168,9 +168,9 @@
                      ;; We couldn't find any items  between start-index and start-index + batch-size
                      ;; Look for the next greatest id and to see if there's a gap that we can restart from.
                      (do
-                       (debug "Couldn't find batch so searching for more from" start-index)
+                       (info "Couldn't find batch so searching for more from" start-index)
                        (when-let [next-id (find-batch-starting-id db table params start-index)]
-                         (debug "Found next-id of" next-id)
+                         (info "Found next-id of" next-id)
                          (lazy-find next-id)))
                      ;; We found a batch. Return it and the next batch lazily
                      (cons batch (lazy-seq (lazy-find (+ start-index batch-size)))))))]


chats list UI fixes

chats list UI fixes

--- src/status_im/chats_list/screen.cljs
+++ src/status_im/chats_list/screen.cljs
@@ -53,9 +53,11 @@
   [toolbar {:nav-action (act/back #(dispatch [:set-in [:chat-list-ui-props :edit?] false]))
             :title      (label :t/edit-chats)}])

-(defn toolbar-search []
+(defview toolbar-search []
+  [search-text [:get-in [:toolbar-search :text]]]
   [toolbar-with-search
    {:show-search?       true
+    :search-text        search-text
     :search-key         :chat-list
     :title              (label :t/chats)
     :search-placeholder (label :t/search-for)}])


Print button press and repeat events.

Print button press and repeat events.

--- dev/user.clj
+++ dev/user.clj
@@ -59,7 +59,7 @@
                     (processing/display [1000 600] (:radius dimensions))
                     [:layout :event-channel])
          :handler (-> state/update-mode
-                      (middleware/print-events (comp #{} :type)))
+                      (middleware/print-events (comp #{:button/press :button/repeat} :type)))
          :state (state/initialize modes)}
         system/initialize
         (system/add-input :timer timer/timer


CMR-496: Fixed bug in delete from index by HTTP

--- ingest-app/src/cmr/ingest/data/indexer.clj
+++ ingest-app/src/cmr/ingest/data/indexer.clj
@@ -67,7 +67,8 @@
     (when-not (some #{200, 204} [status])
       (errors/internal-error!
         (format "Delete %s operation failed. Indexer app response status code: %s %s"
-                delete-url status response)))))
+                delete-url status response)))
+    response))

 (defn- delete-concept-from-index-via-queue
   "Put a delete concept request on the queue to be consumed by the indexer app"


fix mod

fix mod

--- Clojure-Websockets/src/cljs/birdwatch/tweets.cljs
+++ Clojure-Websockets/src/cljs/birdwatch/tweets.cljs
@@ -19,7 +19,7 @@
   "adds tweet to tweets-map"
   (swap! app
          assoc-in [tweets-map (keyword (:id_str tweet))]
-         (if (zero? (mod (:id tweet)))
+         (if (zero? (mod (:id tweet) 1000))
            tweet
            {:created_at (:created_at tweet)
             :id_str (:id_str tweet)})))


Fix eastwood warning.

Fix eastwood warning.

--- test/clj/hatnik/selenium/actions_test.clj
+++ test/clj/hatnik/selenium/actions_test.clj
@@ -57,7 +57,7 @@
       (assoc params
         :gh-pr-operations gh-pr-operations))))

-(deftest create-delete-test []
+(deftest create-delete-test
   (run-with-driver
    (fn [driver]
      (let [[project] (find-projects-on-page driver)]


Disablin actions-test.

Disablin actions-test.

--- test/clj/hatnik/selenium/actions_test.clj
+++ test/clj/hatnik/selenium/actions_test.clj
@@ -6,7 +6,7 @@
             [taoensso.timbre :as timbre]))

 ; Start web server once for all tests
-(use-fixtures :once system-fixture)
+;(use-fixtures :once system-fixture)

 (defn open-add-action-dialog [driver project]
   (.click (find-element (:element project) ".add-action"))


CLJS-1329: Support for reading #js tagged literals in bootstrap

Adds a cond branch to analyze form for JSValue
when in :cljs mode. Also makes a slight adjustment
to analyze-js-value to use `.-` for portable field
access between Clj and Cljs.

--- src/main/clojure/cljs/analyzer.cljc
+++ src/main/clojure/cljs/analyzer.cljc
@@ -27,6 +27,7 @@
      :cljs (:require [clojure.string :as string]
                      [clojure.set :as set]
                      [cljs.env :as env]
+                     [cljs.tagged-literals :as tags]
                      [cljs.tools.reader :as reader]
                      [cljs.tools.reader.reader-types :as readers]
                      [cljs.reader :as edn]))
@@ -2087,7 +2088,7 @@

 (defn analyze-js-value
   [env ^JSValue form]
-  (let [val (.val form)
+  (let [val (.-val form)
         expr-env (assoc env :context :expr)
         items (if (map? val)
                 (zipmap (keys val)
@@ -2132,7 +2133,8 @@
     (vector? form) (analyze-vector env form)
     (set? form) (analyze-set env form)
     (keyword? form) (analyze-keyword env form)
-    #?@(:clj [(instance? JSValue form) (analyze-js-value env form)])
+    #?@(:clj  [(instance? JSValue form) (analyze-js-value env form)]
+        :cljs [(instance? cljs.tagged-literals/JSValue form) (analyze-js-value env form)])
     (= () form) (analyze-list env form)
     :else
     (let [tag (cond