Simplify bb_test.clj

Simplify bb_test.clj

--- bin/bb_test.clj
+++ bin/bb_test.clj
@@ -13,16 +13,8 @@
 (require 'spartan.spec
          '[clojure.spec.alpha :as s]
          '[expound.alpha :as expound]
-         '[expound.printer :as printer]
          '[expound.problems :as problems]
          '[expound.ansi :as ansi])
-
-(defn pf
-  "Fixes platform-specific namespaces and also formats using printf syntax"
-  [s & args]
-  (apply printer/format
-         (string/replace s "pf." "clojure.")
-         args))

 (defn formatted-exception [printer-options f]
   (let [printer (expound/custom-printer printer-options)
@@ -64,7 +56,7 @@
        (with-out-str (expound/expound string? 1)))))

 (deftest predicate-spec
-  (is (= (pf "-- Spec failed --------------------
+  (is (= "-- Spec failed --------------------

   1

@@ -73,7 +65,7 @@
   string?

 -------------------------
-Detected 1 error\n")
+Detected 1 error\n"
          (expound/expound-str string? 1))))

 (s/def :simple-type-based-spec/str string?)
@@ -85,7 +77,7 @@

   (testing "invalid value"
     (is (=
-         (pf "-- Spec failed --------------------
+         "-- Spec failed --------------------

   1

@@ -96,10 +88,10 @@
 -- Relevant specs -------

 :simple-type-based-spec/str:
-  pf.core/string?
-
--------------------------
-Detected 1 error\n")
+  clojure.core/string?
+
+-------------------------
+Detected 1 error\n"
          (expound/expound-str :simple-type-based-spec/str 1)))))

 (s/def :set-based-spec/tag #{:foo :bar})
@@ -128,7 +120,7 @@
            (expound/expound-str :set-based-spec/tag :baz))))

   (testing "prints combined options for various specs"
-    (is (= (pf "-- Spec failed --------------------
+    (is (= "-- Spec failed --------------------

   [:three]
    ^^^^^^
@@ -138,18 +130,18 @@
 -- Relevant specs -------

 :set-based-spec/one-or-two:
-  (pf.spec.alpha/or
+  (clojure.spec.alpha/or
    :one
-   (pf.spec.alpha/cat :a #{:one})
+   (clojure.spec.alpha/cat :a #{:one})
    :two
-   (pf.spec.alpha/cat :b #{:two}))
-
--------------------------
-Detected 1 error\n")
+   (clojure.spec.alpha/cat :b #{:two}))
+
+-------------------------
+Detected 1 error\n"
            (expound/expound-str :set-based-spec/one-or-two [:three]))))

   (testing "nilable version"
-    (is (= (pf "-- Spec failed --------------------
+    (is (= "-- Spec failed --------------------

   :baz

@@ -166,13 +158,13 @@
 :set-based-spec/tag:
   #{:bar :foo}
 :set-based-spec/nilable-tag:
-  (pf.spec.alpha/nilable :set-based-spec/tag)
-
--------------------------
-Detected 1 error\n")
+  (clojure.spec.alpha/nilable :set-based-spec/tag)
+
+-------------------------
+Detected 1 error\n"
            (expound/expound-str :set-based-spec/nilable-tag :baz))))
   (testing "single element spec"
-    (is (= (pf "-- Spec failed --------------------
+    (is (= "-- Spec failed --------------------

   :baz

@@ -184,7 +176,7 @@
   #{:foobar}

 -------------------------
-Detected 1 error\n")
+Detected 1 error\n"
            (expound/expound-str :set-based-spec/set-of-one :baz)))))

 (s/def :nested-type-based-spec/str string?)
@@ -192,7 +184,7 @@

 (deftest nested-type-based-spec
   (is (=
-       (pf "-- Spec failed --------------------
+       "-- Spec failed --------------------

   [... ... 33]
            ^^
@@ -204,12 +196,12 @@
 -- Relevant specs -------

 :nested-type-based-spec/str:
-  pf.core/string?
+  clojure.core/string?
 :nested-type-based-spec/strs:
-  (pf.spec.alpha/coll-of :nested-type-based-spec/str)
-
--------------------------
-Detected 1 error\n")
+  (clojure.spec.alpha/coll-of :nested-type-based-spec/str)
+
+-------------------------
+Detected 1 error\n"
        (expound/expound-str :nested-type-based-spec/strs ["one" "two" 33]))))

 (s/def :nested-type-based-spec-special-summary-string/int int?)
@@ -217,7 +209,7 @@

 (deftest nested-type-based-spec-special-summary-string
   (is (=
-       (pf "-- Spec failed --------------------
+       "-- Spec failed --------------------

   [... ... \"...\"]
            ^^^^^
@@ -229,13 +221,13 @@
 -- Relevant specs -------

 :nested-type-based-spec-special-summary-string/int:
-  pf.core/int?
+  clojure.core/int?
 :nested-type-based-spec-special-summary-string/ints:
-  (pf.spec.alpha/coll-of
+  (clojure.spec.alpha/coll-of
    :nested-type-based-spec-special-summary-string/int)

 -------------------------
-Detected 1 error\n")
+Detected 1 error\n"
        (expound/expound-str :nested-type-based-spec-special-summary-string/ints [1 2 "..."]))))

 (s/def :or-spec/str-or-int (s/or :int int? :str string?))
@@ -250,7 +242,7 @@

 (deftest or-spec
   (testing "simple value"
-    (is (= (pf "-- Spec failed --------------------
+    (is (= "-- Spec failed --------------------

   :kw

@@ -265,13 +257,13 @@
 -- Relevant specs -------

 :or-spec/str-or-int:
-  (pf.spec.alpha/or :int pf.core/int? :str pf.core/string?)
-
--------------------------
-Detected 1 error\n")
+  (clojure.spec.alpha/or :int clojure.core/int? :str clojure.core/string?)
+
+-------------------------
+Detected 1 error\n"
            (expound/expound-str :or-spec/str-or-int :kw))))
   (testing "collection of values"
-    (is (= (pf "-- Spec failed --------------------
+    (is (= "-- Spec failed --------------------

   [... ... :kw ...]
            ^^^
@@ -287,12 +279,12 @@
 -- Relevant specs -------

 :or-spec/str-or-int:
-  (pf.spec.alpha/or :int pf.core/int? :str pf.core/string?)
+  (clojure.spec.alpha/or :int clojure.core/int? :str clojure.core/string?)
 :or-spec/vals:
-  (pf.spec.alpha/coll-of :or-spec/str-or-int)
-
--------------------------
-Detected 1 error\n")
+  (clojure.spec.alpha/coll-of :or-spec/str-or-int)
+
+-------------------------
+Detected 1 error\n"
            (expound/expound-str :or-spec/vals [0 "hi" :kw "bye"]))))
   (is (= "-- Spec failed --------------------

@@ -323,7 +315,7 @@
            :letters #{"a" "b"}
            :ints #{1 2})
           50)))
-  (is (= (pf "-- Spec failed --------------------
+  (is (= "-- Spec failed --------------------

   {}

@@ -338,11 +330,11 @@
 -- Relevant specs -------

 :or-spec/m-with-int:
-  (pf.spec.alpha/keys :req [:or-spec/int])
+  (clojure.spec.alpha/keys :req [:or-spec/int])
 :or-spec/m-with-str:
-  (pf.spec.alpha/keys :req [:or-spec/str])
+  (clojure.spec.alpha/keys :req [:or-spec/str])
 :or-spec/m-with-str-or-int:
-  (pf.spec.alpha/or
+  (clojure.spec.alpha/or
    :m-with-str
    :or-spec/m-with-str
    :m-with-int
@@ -350,7 +342,7 @@

 -------------------------
 Detected 1 error
-")
+"
          (expound/expound-str :or-spec/m-with-str-or-int {})))
   (testing "de-dupes keys"
     (is (= "-- Spec failed --------------------
@@ -374,44 +366,44 @@

 (deftest and-spec
   (testing "simple value"
-    (is (= (pf "-- Spec failed --------------------
+    (is (= "-- Spec failed --------------------

   \"\"

 should satisfy

-  (fn [%%] (pos? (count %%)))
+  (fn [%] (pos? (count %)))

 -- Relevant specs -------

 :and-spec/name:
-  (pf.spec.alpha/and
-   pf.core/string?
-   (fn [%%] (pf.core/pos? (pf.core/count %%))))
-
--------------------------
-Detected 1 error\n")
+  (clojure.spec.alpha/and
+   clojure.core/string?
+   (fn [%] (clojure.core/pos? (clojure.core/count %))))
+
+-------------------------
+Detected 1 error\n"
            (expound/expound-str :and-spec/name ""))))

   (testing "shows both failures in order"
     (is (=
-         (pf "-- Spec failed --------------------
+         "-- Spec failed --------------------

   [... ... \"\" ...]
            ^^

 should satisfy

-  %s
+  (fn [%] (pos? (count %)))

 -- Relevant specs -------

 :and-spec/name:
-  (pf.spec.alpha/and
-   pf.core/string?
-   (fn [%%] (pf.core/pos? (pf.core/count %%))))
+  (clojure.spec.alpha/and
+   clojure.core/string?
+   (fn [%] (clojure.core/pos? (clojure.core/count %))))
 :and-spec/names:
-  (pf.spec.alpha/coll-of :and-spec/name)
+  (clojure.spec.alpha/coll-of :and-spec/name)

 -- Spec failed --------------------

@@ -425,38 +417,39 @@
 -- Relevant specs -------

 :and-spec/name:
-  (pf.spec.alpha/and
-   pf.core/string?
-   (fn [%%] (pf.core/pos? (pf.core/count %%))))
+  (clojure.spec.alpha/and
+   clojure.core/string?
+   (fn [%] (clojure.core/pos? (clojure.core/count %))))
 :and-spec/names:
-  (pf.spec.alpha/coll-of :and-spec/name)
+  (clojure.spec.alpha/coll-of :and-spec/name)

 -------------------------
 Detected 2 errors\n"
-             "(fn [%] (pos? (count %)))")
          (expound/expound-str :and-spec/names ["bob" "sally" "" 1])))))

 (s/def :coll-of-spec/big-int-coll (s/coll-of int? :min-count 10))
+
+"-- Spec failed --------------------\n\n  []\n\nshould satisfy\n\n  (<= 10 (count Integer/MAX_VALUE) %s)\n\n-- Relevant specs -------\n\n:coll-of-spec/big-int-coll:\n  (clojure.spec.alpha/coll-of clojure.core/int? :min-count 10)\n\n-------------------------\nDetected 1 error\n"
+"-- Spec failed --------------------\n\n  []\n\nshould satisfy\n\n  (<= 10 (count %) Integer/MAX_VALUE)\n\n-- Relevant specs -------\n\n:coll-of-spec/big-int-coll:\n  (clojure.spec.alpha/coll-of clojure.core/int? :min-count 10)\n\n-------------------------\nDetected 1 error\n"

 (deftest coll-of-spec
   (testing "min count"
     (is (=
-         (pf "-- Spec failed --------------------
+         "-- Spec failed --------------------

   []

 should satisfy

-  (<= 10 (count %%) %s)
+  (<= 10 (count %) Integer/MAX_VALUE)

 -- Relevant specs -------

 :coll-of-spec/big-int-coll:
-  (pf.spec.alpha/coll-of pf.core/int? :min-count 10)
-
--------------------------
-Detected 1 error\n"
-             "Integer/MAX_VALUE")
+  (clojure.spec.alpha/coll-of clojure.core/int? :min-count 10)
+
+-------------------------
+Detected 1 error\n"
          (expound/expound-str :coll-of-spec/big-int-coll [])))))

 (s/def :cat-spec/kw (s/cat :k keyword? :v any?))
@@ -468,7 +461,7 @@

 (deftest cat-spec
   (testing "too few elements"
-    (is (= (pf "-- Syntax error -------------------
+    (is (= "-- Syntax error -------------------

   []

@@ -479,12 +472,12 @@
 -- Relevant specs -------

 :cat-spec/kw:
-  (pf.spec.alpha/cat :k pf.core/keyword? :v pf.core/any?)
-
--------------------------
-Detected 1 error\n")
+  (clojure.spec.alpha/cat :k clojure.core/keyword? :v clojure.core/any?)
+
+-------------------------
+Detected 1 error\n"
            (expound/expound-str :cat-spec/kw [])))
-    (is (= (pf "-- Syntax error -------------------
+    (is (= "-- Syntax error -------------------

   []

@@ -493,12 +486,12 @@
 -- Relevant specs -------

 :cat-spec/set:
-  (pf.spec.alpha/cat :type #{:bar :foo} :str pf.core/string?)
-
--------------------------
-Detected 1 error\n")
+  (clojure.spec.alpha/cat :type #{:bar :foo} :str clojure.core/string?)
+
+-------------------------
+Detected 1 error\n"
            (expound/expound-str :cat-spec/set [])))
-    (is (= (pf "-- Syntax error -------------------
+    (is (= "-- Syntax error -------------------

   [:foo]

@@ -509,50 +502,50 @@
 -- Relevant specs -------

 :cat-spec/kw:
-  (pf.spec.alpha/cat :k pf.core/keyword? :v pf.core/any?)
-
--------------------------
-Detected 1 error\n")
+  (clojure.spec.alpha/cat :k clojure.core/keyword? :v clojure.core/any?)
+
+-------------------------
+Detected 1 error\n"
            (expound/expound-str :cat-spec/kw [:foo])))
     ;; This isn't ideal, but requires a fix from clojure
     ;; https://clojure.atlassian.net/browse/CLJ-2364
     ;; Commenting out since I don't think Clojure has this right either
-    #_(is (= (pf "-- Syntax error -------------------
+    #_(is (= "-- Syntax error -------------------

   []

 should have additional elements. The next element should satisfy

-  (pf.spec.alpha/alt :s string? :i int?)
+  (clojure.spec.alpha/alt :s string? :i int?)

 -- Relevant specs -------

 :cat-spec/alt*:
-  (pf.spec.alpha/alt :s pf.core/string? :i pf.core/int?)
+  (clojure.spec.alpha/alt :s clojure.core/string? :i clojure.core/int?)
 :cat-spec/alt:
-  (pf.spec.alpha/+ :cat-spec/alt*)
-
--------------------------
-Detected 1 error\n")
+  (clojure.spec.alpha/+ :cat-spec/alt*)
+
+-------------------------
+Detected 1 error\n"
            (expound/expound-str :cat-spec/alt [])))
-    (is (= (pf "-- Syntax error -------------------
+    (is (= "-- Syntax error -------------------

   []

 should have additional elements. The next element should satisfy

-  (pf.spec.alpha/alt :s string? :i int?)
+  (clojure.spec.alpha/alt :s string? :i int?)

 -- Relevant specs -------

 :cat-spec/alt-inline:
-  (pf.spec.alpha/+
-   (pf.spec.alpha/alt :s pf.core/string? :i pf.core/int?))
-
--------------------------
-Detected 1 error\n")
+  (clojure.spec.alpha/+
+   (clojure.spec.alpha/alt :s clojure.core/string? :i clojure.core/int?))
+
+-------------------------
+Detected 1 error\n"
            (expound/expound-str :cat-spec/alt-inline [])))
-    (is (= (pf "-- Syntax error -------------------
+    (is (= "-- Syntax error -------------------

   []

@@ -563,13 +556,13 @@
 -- Relevant specs -------

 :cat-spec/any:
-  (pf.spec.alpha/cat :x (pf.spec.alpha/+ pf.core/any?))
-
--------------------------
-Detected 1 error\n")
+  (clojure.spec.alpha/cat :x (clojure.spec.alpha/+ clojure.core/any?))
+
+-------------------------
+Detected 1 error\n"
            (expound/expound-str :cat-spec/any []))))
   (testing "too many elements"
-    (is (= (pf "-- Syntax error -------------------
+    (is (= "-- Syntax error -------------------

   [... ... :bar ...]
            ^^^^
@@ -579,10 +572,10 @@
 -- Relevant specs -------

 :cat-spec/kw:
-  (pf.spec.alpha/cat :k pf.core/keyword? :v pf.core/any?)
-
--------------------------
-Detected 1 error\n")
+  (clojure.spec.alpha/cat :k clojure.core/keyword? :v clojure.core/any?)
+
+-------------------------
+Detected 1 error\n"
            (expound/expound-str :cat-spec/kw [:foo 1 :bar :baz])))))

 (s/def :keys-spec/name string?)
@@ -616,7 +609,7 @@

 (deftest keys-spec
   (testing "missing keys"
-    (is (= (pf "-- Spec failed --------------------
+    (is (= "-- Spec failed --------------------

   {}

@@ -631,15 +624,14 @@
 -- Relevant specs -------

 :keys-spec/user:
-  %s
-
--------------------------
-Detected 1 error\n"
-               "(clojure.spec.alpha/keys\n   :req\n   [:keys-spec/name]\n   :req-un\n   [:keys-spec/age])")
+  (clojure.spec.alpha/keys\n   :req\n   [:keys-spec/name]\n   :req-un\n   [:keys-spec/age])
+
+-------------------------
+Detected 1 error\n"
            (expound/expound-str :keys-spec/user {}))))

   (testing "invalid key"
-    (is (= (pf "-- Spec failed --------------------
+    (is (= "-- Spec failed --------------------

   {:age ..., :keys-spec/name :bob}
                              ^^^^
@@ -651,13 +643,12 @@
 -- Relevant specs -------

 :keys-spec/name:
-  pf.core/string?
+  clojure.core/string?
 :keys-spec/user:
-  %s
-
--------------------------
-Detected 1 error\n"
-               "(clojure.spec.alpha/keys\n   :req\n   [:keys-spec/name]\n   :req-un\n   [:keys-spec/age])")
+  (clojure.spec.alpha/keys\n   :req\n   [:keys-spec/name]\n   :req-un\n   [:keys-spec/age])
+
+-------------------------
+Detected 1 error\n"
            (expound/expound-str :keys-spec/user {:age 1 :keys-spec/name :bob}))))
   (testing "contains compound specs"
     (s/def :keys-spec/states (s/coll-of :key-spec/state :kind vector?))
@@ -706,8 +697,7 @@
                                               :keys-spec/child-2]))

 (deftest grouping-and-key-specs
-  (is (= (pf
-          "-- Spec failed --------------------
+  (is (= "-- Spec failed --------------------

   {:foo 1.2, :bar ..., :baz ...}
         ^^^
@@ -735,13 +725,12 @@
   string?

 -------------------------
-Detected 3 errors\n")
+Detected 3 errors\n"
          (expound/expound-str :keys-spec/map-spec-1 {:foo 1.2
                                                      :bar 123
                                                      :baz true}
                               {:print-specs? false})))
-  (is (= (pf
-          "-- Spec failed --------------------
+  (is (= "-- Spec failed --------------------

   {:foo 1.2, :bar ..., :qux ...}
         ^^^
@@ -773,7 +762,7 @@
   int?

 -------------------------
-Detected 3 errors\n")
+Detected 3 errors\n"
          (expound/expound-str :keys-spec/map-spec-2 {:foo 1.2
                                                      :bar 123
                                                      :qux false}
@@ -851,7 +840,7 @@
 #_(deftest multi-spec
   (testing "missing dispatch key"
     (is (=
-         (pf "-- Missing spec -------------------
+         "-- Missing spec -------------------

 Cannot find spec for

@@ -865,16 +854,16 @@
 -- Relevant specs -------

 :multi-spec/el:
-  (pf.spec.alpha/multi-spec
+  (clojure.spec.alpha/multi-spec
    expound.alpha-test/el-type
    :multi-spec/el-type)

 -------------------------
-Detected 1 error\n")
+Detected 1 error\n"
          (expound/expound-str :multi-spec/el {}))))
   (testing "invalid dispatch value"
     (is (=
-         (pf "-- Missing spec -------------------
+         "-- Missing spec -------------------

 Cannot find spec for

@@ -888,17 +877,17 @@
 -- Relevant specs -------

 :multi-spec/el:
-  (pf.spec.alpha/multi-spec
+  (clojure.spec.alpha/multi-spec
    expound.alpha-test/el-type
    :multi-spec/el-type)

 -------------------------
-Detected 1 error\n")
+Detected 1 error\n"
          (expound/expound-str :multi-spec/el {:multi-spec/el-type :image}))))

   (testing "valid dispatch value, but other error"
     (is (=
-         (pf "-- Spec failed --------------------
+         "-- Spec failed --------------------

   {:multi-spec/el-type :text}

@@ -911,12 +900,12 @@
 -- Relevant specs -------

 :multi-spec/el:
-  (pf.spec.alpha/multi-spec
+  (clojure.spec.alpha/multi-spec
    expound.alpha-test/el-type
    :multi-spec/el-type)

 -------------------------
-Detected 1 error\n")
+Detected 1 error\n"
          (expound/expound-str :multi-spec/el {:multi-spec/el-type :text}))))

   ;; https://github.com/bhb/expound/issues/122
@@ -957,8 +946,7 @@

 (deftest recursive-spec
   (testing "only shows problem with data at 'leaves' (not problems with all parents in tree)"
-    (is (= (pf
-            "-- Spec failed --------------------
+    (is (= "-- Spec failed --------------------

   {:tag ..., :children [{:tag :group, :children [{:tag :group, :props {:on-tap {}}}]}]}
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -991,7 +979,7 @@
   vector?

 -------------------------
-Detected 1 error\n")
+Detected 1 error\n"
            (expound/expound-str
             :recursive-spec/el
             {:tag :group
@@ -1001,8 +989,7 @@
             {:print-specs? false}))))

   (testing "test that our new recursive spec grouping function works with alternative paths"
-    (is (= (pf
-             "-- Spec failed --------------------
+    (is (= "-- Spec failed --------------------

   {:tag-2 ..., :children-2 [{:tag-2 :group, :children-2 [{:tag-2 :group, :props-2 {:on-tap-2 {}}}]}]}
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -1036,7 +1023,7 @@

 -------------------------
 Detected 1 error
-")
+"
            (expound/expound-str
             :recursive-spec/el-2
             {:tag-2 :group
@@ -1054,7 +1041,7 @@
                                              :kv :cat-wrapped-in-or-spec/kv))

 (deftest cat-wrapped-in-or-spec
-  (is (= (pf "-- Spec failed --------------------
+  (is (= "-- Spec failed --------------------

   {\"foo\" \"hi\"}

@@ -1073,25 +1060,25 @@
 -- Relevant specs -------

 :cat-wrapped-in-or-spec/kv:
-  (pf.spec.alpha/and
-   pf.core/sequential?
-   (pf.spec.alpha/cat :k pf.core/keyword? :v pf.core/any?))
+  (clojure.spec.alpha/and
+   clojure.core/sequential?
+   (clojure.spec.alpha/cat :k clojure.core/keyword? :v clojure.core/any?))
 :cat-wrapped-in-or-spec/kv-or-string:
-  (pf.spec.alpha/or
+  (clojure.spec.alpha/or
    :map
-   (pf.spec.alpha/keys :req [:cat-wrapped-in-or-spec/type])
+   (clojure.spec.alpha/keys :req [:cat-wrapped-in-or-spec/type])
    :kv
    :cat-wrapped-in-or-spec/kv)

 -------------------------
-Detected 1 error\n")
+Detected 1 error\n"
          (expound/expound-str :cat-wrapped-in-or-spec/kv-or-string {"foo" "hi"}))))

 (s/def :map-of-spec/name string?)
 (s/def :map-of-spec/age pos-int?)
 (s/def :map-of-spec/name->age (s/map-of :map-of-spec/name :map-of-spec/age))
 (deftest map-of-spec
-  (is (= (pf "-- Spec failed --------------------
+  (is (= "-- Spec failed --------------------

   {\"Sally\" \"30\"}
            ^^^^
@@ -1103,14 +1090,14 @@
 -- Relevant specs -------

 :map-of-spec/age:
-  pf.core/pos-int?
+  clojure.core/pos-int?
 :map-of-spec/name->age:
-  (pf.spec.alpha/map-of :map-of-spec/name :map-of-spec/age)
-
--------------------------
-Detected 1 error\n")
+  (clojure.spec.alpha/map-of :map-of-spec/name :map-of-spec/age)
+
+-------------------------
+Detected 1 error\n"
          (expound/expound-str :map-of-spec/name->age {"Sally" "30"})))
-  (is (= (pf "-- Spec failed --------------------
+  (is (= "-- Spec failed --------------------

   {:sally ...}
    ^^^^^^
@@ -1122,12 +1109,12 @@
 -- Relevant specs -------

 :map-of-spec/name:
-  pf.core/string?
+  clojure.core/string?
 :map-of-spec/name->age:
-  (pf.spec.alpha/map-of :map-of-spec/name :map-of-spec/age)
-
--------------------------
-Detected 1 error\n")
+  (clojure.spec.alpha/map-of :map-of-spec/name :map-of-spec/age)
+
+-------------------------
+Detected 1 error\n"
          (expound/expound-str :map-of-spec/name->age {:sally 30}))))

 (s/def :expound.ds/spec-key (s/or :kw keyword?
@@ -1219,7 +1206,7 @@

 (s/def :test-explain-str/name string?)
 (deftest test-explain-str
-  (is (= (pf "-- Spec failed --------------------
+  (is (= "-- Spec failed --------------------

   :hello

@@ -1230,10 +1217,10 @@
 -- Relevant specs -------

 :test-explain-str/name:
-  pf.core/string?
-
--------------------------
-Detected 1 error\n")
+  clojure.core/string?
+
+-------------------------
+Detected 1 error\n"
          (binding [s/*explain-out* expound/printer]
            (s/explain-str :test-explain-str/name :hello)))))

@@ -1247,7 +1234,7 @@
 (s/def :custom-printer/strings (s/coll-of string?))
 (deftest custom-printer
   (testing "custom value printer"
-    (is (= (pf "-- Spec failed --------------------
+    (is (= "-- Spec failed --------------------

   <HIDDEN>

@@ -1258,11 +1245,11 @@
 -- Relevant specs -------

 :custom-printer/strings:
-  (pf.spec.alpha/coll-of pf.core/string?)
+  (clojure.spec.alpha/coll-of clojure.core/string?)

 -------------------------
 Detected 1 error
-")
+"
            (binding [s/*explain-out* (expound/custom-printer {:value-str-fn (fn [_spec-name _form _path _val] "  <HIDDEN>")})]
              (s/explain-str :custom-printer/strings ["a" "b" :c]))))))

@@ -1315,7 +1302,7 @@
     (s/def :alt-spec/one-many-int (s/cat :bs (s/alt :one int?
                                                     :many (s/spec (s/+ int?)))))

-    (is (= (pf "-- Spec failed --------------------
+    (is (= "-- Spec failed --------------------

   [[\"1\"]]
    ^^^^^
@@ -1336,16 +1323,16 @@
 -- Relevant specs -------

 :alt-spec/one-many-int:
-  (pf.spec.alpha/cat
+  (clojure.spec.alpha/cat
    :bs
-   (pf.spec.alpha/alt
+   (clojure.spec.alpha/alt
     :one
-    pf.core/int?
+    clojure.core/int?
     :many
-    (pf.spec.alpha/spec (pf.spec.alpha/+ pf.core/int?))))
-
--------------------------
-Detected 1 error\n")
+    (clojure.spec.alpha/spec (clojure.spec.alpha/+ clojure.core/int?))))
+
+-------------------------
+Detected 1 error\n"
            (binding [s/*explain-out* (expound/custom-printer {})]
              (s/explain-str
               :alt-spec/one-many-int
@@ -1421,7 +1408,7 @@
              (s/explain-str
               :alt-spec/one-many-int-or-str
               [[:one]])))))
-  (is (= (pf "-- Spec failed --------------------
+  (is (= "-- Spec failed --------------------

   [:hi]
    ^^^
@@ -1437,15 +1424,14 @@
 -- Relevant specs -------

 :alt-spec/int-alt-str:
-  %s
-
--------------------------
-Detected 1 error\n"
-             "(clojure.spec.alpha/alt
+  (clojure.spec.alpha/alt
    :int
    clojure.core/int?
    :string
-   clojure.core/string?)")
+   clojure.core/string?)
+
+-------------------------
+Detected 1 error\n"
          (expound/expound-str :alt-spec/int-alt-str [:hi])))

   (is (= "-- Spec failed --------------------
@@ -1801,7 +1787,7 @@
            (s/explain-str :conformers-test/string-AB "AC"))))
     (testing "s/cat"
       (s/def :conformers-test/sorted-pair (s/and (s/cat :x int? :y int?) #(< (-> % :x) (-> % :y))))
-      (is (= (pf "-- Spec failed --------------------
+      (is (= "-- Spec failed --------------------

   [1 0]

@@ -1811,16 +1797,15 @@

 should satisfy

-  %s
+  (fn
+   [%]
+   (< (-> % :x) (-> % :y)))

 -------------------------
 Detected 1 error
 "
-                 "(fn
-   [%]
-   (< (-> % :x) (-> % :y)))")
              (expound/expound-str :conformers-test/sorted-pair [1 0] {:print-specs? false})))
-      (is (= (pf "-- Spec failed --------------------
+      (is (= "-- Spec failed --------------------

   [... [1 0]]
        ^^^^^
@@ -1831,15 +1816,14 @@

 should satisfy

-  %s
-
--------------------------
-Detected 1 error\n"
-                 "(fn
+  (fn
    [%]
-   (< (-> % :x) (-> % :y)))")
+   (< (-> % :x) (-> % :y)))
+
+-------------------------
+Detected 1 error\n"
              (expound/expound-str (s/coll-of :conformers-test/sorted-pair) [[0 1] [1 0]] {:print-specs? false})))
-      (is (= (pf "-- Spec failed --------------------
+      (is (= "-- Spec failed --------------------

   {:a [1 0]}
       ^^^^^
@@ -1850,15 +1834,14 @@

 should satisfy

-  %s
-
--------------------------
-Detected 1 error\n"
-                 "(fn
+  (fn
    [%]
-   (< (-> % :x) (-> % :y)))")
+   (< (-> % :x) (-> % :y)))
+
+-------------------------
+Detected 1 error\n"
              (expound/expound-str (s/map-of keyword? :conformers-test/sorted-pair) {:a [1 0]} {:print-specs? false})))
-      (is (= (pf "-- Spec failed --------------------
+      (is (= "-- Spec failed --------------------

   [... \"a\"]
        ^^^
@@ -1868,7 +1851,7 @@
   int?

 -------------------------
-Detected 1 error\n")
+Detected 1 error\n"
              (expound/expound-str :conformers-test/sorted-pair [1 "a"] {:print-specs? false}))))
     (testing "conformers that modify path of values"
       (s/def :conformers-test/vals (s/coll-of (s/and string?
@@ -1902,44 +1885,44 @@
                                                               ::s/invalid))
                                               keyword?))
     (testing "coercion"
-      (is (= (pf "-- Spec failed --------------------
+      (is (= "-- Spec failed --------------------

   nil

 should satisfy

-  (pf.spec.alpha/conformer
+  (clojure.spec.alpha/conformer
    (fn
-    [%%]
+    [%]
     (if
-     (string? %%)
-     (keyword %%)
-     :pf.spec.alpha/invalid)))
+     (string? %)
+     (keyword %)
+     :clojure.spec.alpha/invalid)))

 -------------------------
 Detected 1 error
-")
+"
              (binding [s/*explain-out* (expound/custom-printer {:print-specs? false})]
                (s/explain-str :conformers-test/coerced-kw nil))))

-      (is (= (pf "-- Spec failed --------------------
+      (is (= "-- Spec failed --------------------

   [... ... ... 0]
                ^

 should satisfy

-  (pf.spec.alpha/conformer
+  (clojure.spec.alpha/conformer
    (fn
-    [%%]
+    [%]
     (if
-     (string? %%)
-     (keyword %%)
-     :pf.spec.alpha/invalid)))
+     (string? %)
+     (keyword %)
+     :clojure.spec.alpha/invalid)))

 -------------------------
 Detected 1 error
-")
+"
              (binding [s/*explain-out* (expound/custom-printer {:print-specs? false})]
                (s/explain-str (s/coll-of :conformers-test/coerced-kw) ["a" "b" "c" 0])))))
     ;; Also not recommended
@@ -1948,44 +1931,44 @@
                                                            ::s/invalid)
                                                         name) keyword?))
     (testing "coercion with unformer"
-      (is (= (pf "-- Spec failed --------------------
+      (is (= "-- Spec failed --------------------

   nil

 should satisfy

-  (pf.spec.alpha/conformer
+  (clojure.spec.alpha/conformer
    (fn
-    [%%]
+    [%]
     (if
-     (string? %%)
-     (keyword %%)
-     :pf.spec.alpha/invalid)))
+     (string? %)
+     (keyword %)
+     :clojure.spec.alpha/invalid)))

 -------------------------
 Detected 1 error
-")
+"
              (binding [s/*explain-out* (expound/custom-printer {:print-specs? false})]
                (s/explain-str :conformers-test/coerced-kw nil))))

-      (is (= (pf "-- Spec failed --------------------
+      (is (= "-- Spec failed --------------------

   [... ... ... 0]
                ^

 should satisfy

-  (pf.spec.alpha/conformer
+  (clojure.spec.alpha/conformer
    (fn
-    [%%]
+    [%]
     (if
-     (string? %%)
-     (keyword %%)
-     :pf.spec.alpha/invalid)))
+     (string? %)
+     (keyword %)
+     :clojure.spec.alpha/invalid)))

 -------------------------
 Detected 1 error
-")
+"
              (binding [s/*explain-out* (expound/custom-printer {:print-specs? false})]
                (s/explain-str (s/coll-of :conformers-test/coerced-kw) ["a" "b" "c" 0])))))

@@ -2034,7 +2017,7 @@
                                :conformers-test/person) [:Stan [:age 30 :name :Stan]])))))

     (testing "ambiguous value"
-      (is (= (pf "-- Spec failed --------------------
+      (is (= "-- Spec failed --------------------

   {[0 1] ..., [1 0] ...}
               ^^^^^
@@ -2045,14 +2028,13 @@

 should satisfy

-  %s
+  (fn
+   [%]
+   (< (-> % :x) (-> % :y)))

 -------------------------
 Detected 1 error
 "
-                 "(fn
-   [%]
-   (< (-> % :x) (-> % :y)))")
              (binding [s/*explain-out* (expound/custom-printer {:print-specs? false})]
                (s/explain-str (s/map-of :conformers-test/sorted-pair any?) {[0 1] [1 0]
                                                                             [1 0] [1 0]})))))))
@@ -2107,7 +2089,7 @@
 ;; FIXME - support fspec
 #_(deftest fspec-exception-test
   (testing "args that throw exception"
-    (is (= (pf "-- Exception ----------------------
+    (is (= "-- Exception ----------------------

   expound.alpha-test/my-div

@@ -2122,21 +2104,21 @@
 -- Relevant specs -------

 :fspec-test/div:
-  (pf.spec.alpha/fspec
+  (clojure.spec.alpha/fspec
    :args
-   (pf.spec.alpha/cat :x pf.core/int? :y pf.core/pos-int?)
+   (clojure.spec.alpha/cat :x clojure.core/int? :y clojure.core/pos-int?)
    :ret
-   pf.core/any?
+   clojure.core/any?
    :fn
    nil)

 -------------------------
-Detected 1 error\n")
+Detected 1 error\n"

            ;;
            (until-unsuccessful #(expound/expound-str :fspec-test/div my-div))))

-    (is (= (pf "-- Exception ----------------------
+    (is (= "-- Exception ----------------------

   [expound.alpha-test/my-div]
    ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -2152,16 +2134,16 @@
 -- Relevant specs -------

 :fspec-test/div:
-  (pf.spec.alpha/fspec
+  (clojure.spec.alpha/fspec
    :args
-   (pf.spec.alpha/cat :x pf.core/int? :y pf.core/pos-int?)
+   (clojure.spec.alpha/cat :x clojure.core/int? :y clojure.core/pos-int?)
    :ret
-   pf.core/any?
+   clojure.core/any?
    :fn
    nil)

 -------------------------
-Detected 1 error\n")
+Detected 1 error\n"
            (until-unsuccessful #(expound/expound-str (s/coll-of :fspec-test/div) [my-div]))))))

@@ -2176,7 +2158,7 @@
 ;; FIXME: support fspec
 #_(deftest fspec-ret-test
   (testing "invalid ret"
-    (is (= (pf "-- Function spec failed -----------
+    (is (= "-- Function spec failed -----------

   expound.alpha-test/my-plus

@@ -2189,10 +2171,10 @@
   pos-int?

 -------------------------
-Detected 1 error\n")
+Detected 1 error\n"
            (until-unsuccessful #(expound/expound-str :fspec-ret-test/plus my-plus {:print-specs? false}))))

-    (is (= (pf "-- Function spec failed -----------
+    (is (= "-- Function spec failed -----------

   [expound.alpha-test/my-plus]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -2206,12 +2188,12 @@
   pos-int?

 -------------------------
-Detected 1 error\n")
+Detected 1 error\n"
            (until-unsuccessful #(expound/expound-str (s/coll-of :fspec-ret-test/plus) [my-plus] {:print-specs? false}))))
     (s/def :fspec-ret-test/return-map (s/fspec
                                        :args (s/cat)
                                        :ret (s/keys :req-un [:fspec-ret-test/my-int])))
-    (is (= (pf "-- Function spec failed -----------
+    (is (= "-- Function spec failed -----------

   <anonymous function>

@@ -2227,7 +2209,7 @@

 -------------------------
 Detected 1 error
-")
+"
            (until-unsuccessful #(expound/expound-str :fspec-ret-test/return-map
                                                      (fn [] {})
                                                      {:print-specs? false}))))))
@@ -2386,7 +2368,7 @@

 (s/def :colorized-output/strings (s/coll-of string?))
 (deftest colorized-output
-  (is (= (pf "-- Spec failed --------------------
+  (is (= "-- Spec failed --------------------

   [... :a ...]
        ^^
@@ -2398,13 +2380,13 @@
 -- Relevant specs -------

 :colorized-output/strings:
-  (pf.spec.alpha/coll-of pf.core/string?)
+  (clojure.spec.alpha/coll-of clojure.core/string?)

 -------------------------
 Detected 1 error
-")
+"
          (expound/expound-str :colorized-output/strings ["" :a ""] {:theme :none})))
-  (is (= (pf "<NONE><NONE><CYAN>-- Spec failed --------------------<NONE>
+  (is (= "<NONE><NONE><CYAN>-- Spec failed --------------------<NONE>

   [... <RED>:a<NONE> ...]
   <MAGENTA>     ^^<NONE>
@@ -2416,11 +2398,11 @@
 <CYAN>-- Relevant specs -------<NONE>

 :colorized-output/strings:
-  (pf.spec.alpha/coll-of pf.core/string?)
+  (clojure.spec.alpha/coll-of clojure.core/string?)

 <CYAN>-------------------------<NONE>
 <CYAN>Detected<NONE> <CYAN>1<NONE> <CYAN>error<NONE>
-")
+"
          (readable-ansi (expound/expound-str :colorized-output/strings ["" :a ""] {:theme :figwheel-theme})))))

 (deftest clean-registry


fix spelling mistake

fix spelling mistake

--- src/overtone/sc/machinery/server/connection.clj
+++ src/overtone/sc/machinery/server/connection.clj
@@ -266,7 +266,7 @@
     (map str (concat port-arg arg-list))))

 (defn- sc-command
-  "Creates a sctring array representing the sc command to execute in an
+  "Creates a string array representing the sc command to execute in an
   external process (typically with #'external-booter)"
   [port opts]
   (into-array String (cons (or (config-get :sc-path) (find-sc-path)) (scsynth-arglist (merge-sc-args opts {:port port})))))


Change mount macro to a function for better composability

Only the convenience macro, run, will ensure a var-quoted handler.

--- modules/web/src/immutant/web.clj
+++ modules/web/src/immutant/web.clj
@@ -26,27 +26,21 @@
   (:import org.projectodd.wunderboss.WunderBoss))

 (defn server
-  "Create an HTTP server"
+  "Create an HTTP server or return existing one matching :name"
   [& {:as opts}]
   (WunderBoss/findOrCreateComponent "web"
     (stringify-keys
       (merge {:name "default" :host "localhost" :port 8080} opts))))

-(defmacro mount-handler
+(defn mount
   "Mount a Ring handler on a server"
   [server handler & {:as opts}]
-  (let [h (if (symbol? handler) `(var ~handler) handler)]
-    `(.registerHandler ~server
-       (undertow/create-http-handler ~h)
-       (stringify-keys (merge {:context-path "/"} ~opts)))))
-
-(defmacro run
-  "Creates a server, mounts the handler at root context and runs it"
-  [handler & opts]
-  `(mount-handler (server ~@opts) ~handler ~@opts))
+  (.registerHandler server
+    (undertow/create-http-handler handler)
+    (stringify-keys (merge {:context-path "/"} opts))))

 (defn unmount
-  "Unmount the handler at a given context path"
+  "Unmount handler at context path"
   ([] (unmount "/"))
   ([context-path] (unmount (server) context-path))
   ([server context-path]
@@ -57,3 +51,9 @@
   [server servlet & {:as opts}]
   (.registerServlet server servlet
     (stringify-keys (merge {:context-path "/"} opts))))
+
+(defmacro run
+  "Composes server and mount fns; ensures handler is var-quoted"
+  [handler & opts]
+  (let [h (if (symbol? handler) `(var ~handler) handler)]
+    `(mount-handler (server ~@opts) ~h ~@opts)))


improve logging

improve logging

--- src/babel/forest.cljc
+++ src/babel/forest.cljc
@@ -252,9 +252,7 @@

               return-val
               (filter (fn [result]
-                        (do
-                          (log/debug (str "LOOKING AT RESULT:  " result))
-                          (not (fail? result))))
+                        (not (fail? result)))
                       (map (fn [complement]
                              (let [debug (log/debug (str "adding complement to: ["
                                                          (get-in bolt [:rule]) " "


Test for the correct clojure version.

Test for the correct clojure version.

--- integration-tests/apps/no-clojure-jar/test/no_clojure_jar/tests.clj
+++ integration-tests/apps/no-clojure-jar/test/no_clojure_jar/tests.clj
@@ -19,4 +19,4 @@
   (:use clojure.test))

 (deftest bundled-clojure-version
-  (is (= "1.5.1" (clojure-version))))
+  (is (= "1.6.0" (clojure-version))))


Added default Kryo behavior to kryo-extend multimethod.

The current implementation doesn't necessarily allow `setRegistrationOptional`
to behave as expected (where unknown java classes are serialized using the FieldSerializer.)
This commit implements Kryo's default behavior as a separate function, `register-generic`,
and adds a default dispatch method to kryo-extend that calls `register-generic` if no custom
serialization made it.

--- src/carbonite/api.clj
+++ src/carbonite/api.clj
@@ -13,8 +13,19 @@
     (.register registry klass serializer))
   registry)

+(defn register-generic
+  "Default behavior of Kryo's handleUnregisteredClass method."
+  [klass ^Kryo registry]
+  (let [serializer (.newSerializer registry klass)]
+    (.register registry klass serializer true)))
+
 ;; first item *is* the class of the unregistered object type
 (defmulti kryo-extend (fn [klass registry] klass))
+
+;; kryo-extend defaults to standard behavior.
+(defmethod kryo-extend :default
+  [klass registry]
+  (register-generic klass registry))

 (defn new-registry
   "Create a new Kryo registry that supports unregistered classes and defers to the


Fix a problem with docstring ordering

Fix a problem with docstring ordering

--- src/catalog/vubis.clj
+++ src/catalog/vubis.clj
@@ -255,9 +255,10 @@
       trim-punctuation
       normalize-name))

-(defn get-format [s]
+(defn get-format
   "Find the given format for a string `s`. If the string doesn't
   correspond to any of BR, DVD, DY, ER, GD, LU, MN or TB return nil"
+   [s]
   (->> s
    (re-find #"^(?:BR|DVD|DY|ER|GD|LU|MN|TB)$")
    format-raw-to-format))


fix source so it works on macros

fix source so it works on macros

--- src/clj/cljs/repl.clj
+++ src/clj/cljs/repl.clj
@@ -936,10 +936,13 @@

   Example: (source-fn 'filter)"
   [env x]
-  (when-let [v (ana/resolve-var env x)]
+  (when-let [v (ana-api/resolve env x)]
     (when-let [filepath (:file v)]
-      (let [f (io/file filepath)]
-        (when (.exists f)
+      (let [f (io/file filepath)
+            f (if (.exists f)
+                f
+                (io/resource filepath))]
+        (when f
           (with-open [pbr (PushbackReader. (io/reader f))]
             (let [rdr (readers/source-logging-push-back-reader pbr)]
               (dotimes [_ (dec (:line v))] (readers/read-line rdr))


fixed web interface to work with new api

--- src/fxc/handler.clj
+++ src/fxc/handler.clj
@@ -1,4 +1,4 @@
-;; FXC - PIN Secret Sharingdigital  social currency toolkit
+;; FXC - Secret Sharing

 ;; part of Decentralized Citizen Engagement Technologies (D-CENT)
 ;; R&D funded by the European Commission (FP7/CAPS 610349)
@@ -26,107 +26,77 @@
             [compojure.route :as route]

             [hiccup.page :as page]
+
+            [fxc.core :refer :all]
+            [fxc.webpage :as web]
             [fxc.form_helpers :as fh]
-            [fxc.webpage :as web]
+
             [formidable.parse :as fp]
             [formidable.core :as fc]

-            [fxc.secretshare :as ssss]
-            [fxc.random :as rand]
-            [fxc.fxc :as fxc]
-            [fxc.marshalling :refer :all]
             [json-html.core :as present]
             [hiccup.page :as page]
             [ring.middleware.defaults :refer [wrap-defaults site-defaults]]))

-;; defaults
-(def settings
-  {:total (Integer. 5)
-   :quorum (Integer. 3)
-
-   :prime 'prime4096
-
-   :description "FXC v1 (Freecoin Secret Sharing)"
-
-   ;; versioning every secret
-   :protocol "FXC1"
-
-   :type "WEB"
-
-   ;; random number generator settings
-   :length 6
-   :entropy 3.1})
-

 (def generate-form-spec
   {:renderer :bootstrap3-stacked
-   :fields [{:name "PIN:"   :type :text}]
+   :fields [{:name "Secret:"   :type :text}]
    :validations [[:required [:field :value]]]
    :action "/generate"
    :method "post"})

 (def recovery-form-spec
   {:renderer :bootstrap3-stacked
-   :fields [{:name "1"  :type :integer}
-            {:name "2"  :type :text}
-            {:name "3"  :type :text}]
+   :fields [{:name "Share 1"  :type :integer}
+            {:name "Share 2"  :type :text}
+            {:name "Share 3"  :type :text}]
    :validations [[:required ["1" "2" "3"]]]
-
+
    :action "/recover"
    :method "post"})
-
-
-
-
-

 (defroutes app-routes

   (GET "/" []
       (web/render-page
-       {:section "Split PIN"
+       {:section "Split a Secret into Shares"
         :body [:div {:class "secrets row center"}
                [:div {:class "content input-form"}
                 (fc/render-form generate-form-spec)]]}))

   (POST "/g*" {params :params}
-    (let [pin    (biginteger (params "PIN:"))
-          shares (:shares (ssss/shamir-split settings pin))]
+    (let [pass   (params "Secret:")
+          shares (encode settings pass)]

       (web/render-page
-       {:section "Split PIN"
+       {:section "Split Secret"
         :body [:div {:class "secrets row center"}
                [:div {:class "password"}
-                "Your PIN:" [:div {:class "content"} pin]]
+                "Your Secret:" [:div {:class "content"} pass]]

                [:div {:class "slices"}
                 [:h3 (str "Split in " (:total settings)
                           " shared secrets, quorum "
                           (:quorum settings) ":")]
-                [:ul (map #(conj [:li {:class "content"}] %)
-                          (encode-shares shares))]]]})))
+                [:ul (map #(conj [:li {:class "content"}] %)
+                          shares)]]]})))

   (GET "/r*" []
-    (web/render-page {:section "Recover PIN"
+    (web/render-page {:section "Recover a Shared Secret"
                       :body [:div {:class "recovery row center"}
                          [:div {:class "content input-form"}
                           (fc/render-form recovery-form-spec)
                           ]]}))

   (POST "/r*" {params :params}
-    (web/render-page {:section "Recover PIN"
+    (web/render-page {:section "Recover Secret"
                       :body (let [para (fp/parse-params recovery-form-spec params)
-                              converted (decode-shares (vals para))]
-                          (present/edn->html
-                           {:0 (count converted)
-                            :header settings
-                            :shares converted
-                            :result (ssss/shamir-combine
-                                     (:header settings)
-                                     (:shares converted))
-                            }))}))
+                              converted (decode (vals para))]
+                          (present/edn->html converted))}))
+
   ;; TODO: detect cryptographical conversion error: returned is the first share

   (route/not-found "Not Found"))


Namespace rejuggle in grafter.rdf

Namespace rejuggle in grafter.rdf

--- src/grafter/rdf.clj
+++ src/grafter/rdf.clj
@@ -1,35 +1,34 @@
 (ns grafter.rdf
   "Functions and macros for creating RDF data.  Includes a small
   DSL for creating turtle-like templated forms."
-  (:use
-   [grafter.rdf.ontologies.rdf]
-   [grafter.rdf.ontologies.void]
-   [grafter.rdf.ontologies.dcterms]
-   [grafter.rdf.ontologies.vcard]
-   [grafter.rdf.ontologies.pmd]
-   [grafter.rdf.ontologies.qb]
-   [grafter.rdf.ontologies.os]
-   [grafter.rdf.ontologies.skos]
-   [grafter.rdf.ontologies.owl]
-   [grafter.rdf.ontologies.sdmx-measure]
-   [grafter.rdf.ontologies.sdmx-attribute]
-   [grafter.rdf.ontologies.sdmx-concept])
   (:require [clojure.java.io :as io]
             [grafter.tabular :as tab]
             [grafter.rdf.protocols :as pr]
             [grafter.rdf.sesame :as ses]
-            [potemkin.namespaces :refer [import-vars]])
+            [potemkin.namespaces :refer [import-vars]]
+            [grafter.rdf.ontologies.util :as ontutils]
+            [grafter.rdf.ontologies.rdf]
+            [grafter.rdf.ontologies.void]
+            [grafter.rdf.ontologies.dcterms]
+            [grafter.rdf.ontologies.vcard]
+            [grafter.rdf.ontologies.pmd]
+            [grafter.rdf.ontologies.qb]
+            [grafter.rdf.ontologies.os]
+            [grafter.rdf.ontologies.skos]
+            [grafter.rdf.ontologies.owl]
+            [grafter.rdf.ontologies.sdmx-measure]
+            [grafter.rdf.ontologies.sdmx-attribute]
+            [grafter.rdf.ontologies.sdmx-concept])
   (:import [grafter.rdf.protocols Triple Quad]
-           [grafter.rdf.sesame ISesameRDFConverter])
-  (:import [org.openrdf.model Statement Value Resource Literal URI BNode ValueFactory]
+           [grafter.rdf.sesame ISesameRDFConverter]
+           [org.openrdf.model Statement Value Resource Literal URI BNode ValueFactory]
            [org.openrdf.model.impl ValueFactoryImpl LiteralImpl]
            [org.openrdf.repository Repository]
            [org.openrdf.repository.sail SailRepository]
            [org.openrdf.sail.memory MemoryStore]
            [org.openrdf.sail.nativerdf NativeStore]
            [org.openrdf.query TupleQuery TupleQueryResult BindingSet QueryLanguage]
-           [org.openrdf.rio RDFFormat])
-  (:require [grafter.rdf.ontologies.util :as ontutils]))
+           [org.openrdf.rio RDFFormat]))

 (import-vars
  [grafter.rdf.sesame


Update -main doc string.

Update -main doc string.

--- src/incise/core.clj
+++ src/incise/core.clj
@@ -16,18 +16,18 @@
     (keyword method)
     (do
       (when-not (empty? method)
-      (warn (str \" method
-                 "\" is not a valid method (must be in "
-                 (s/join ", " valid-methods) "). Defaulting to serve.")))
+        (warn (str \" method
+                   "\" is not a valid method (must be in "
+                   (s/join ", " valid-methods) "). Defaulting to serve.")))
       :serve)))

 (defn- with-args*
   "A helper function to with-args macro which does all the work.

-   1.  Load in the config
-   2.  Parse arguments
-   3.  Merge into config
-   4.  Handle help or continue"
+  1.  Load in the config
+  2.  Parse arguments
+  3.  Merge into config
+  4.  Handle help or continue"
   [args body-fn]
   (conf/load)
   (let [[options cli-args banner]
@@ -50,7 +50,8 @@
   `(with-args* ~args (fn [~'args] ~@body)))

 (defn -main
-  "Start the development server and watcher."
+  "Based on the given args either deploy, compile or start the development
+  server."
   [& args]
   (with-args args
     (case (conf/get :method)


use with for nondestructive examples

use with for nondestructive examples

--- tutorial/building_queries.clj
+++ tutorial/building_queries.clj
@@ -6,47 +6,38 @@
 ;   the terms of this license.
 ;   You must not remove this notice, or any other, from this software.

-(require '[datomic.client.api :as d]
-         '[datomic.samples.repl :as repl])
-(import '(java.util UUID))
+(require '[datomic.client.api :as d])

-(def client-cfg (read-string (slurp "config.edn")))
-(def client (d/client client-cfg))
-(def db-name (str "scratch-" (UUID/randomUUID)))
-(d/create-database client {:db-name db-name})
-(def conn (d/connect client {:db-name db-name}))
-
-(repl/transact-all conn (repl/resource "day-of-datomic-cloud/social-news.edn"))
+(def client (d/client {:server-type :dev-local :system "datomic-samples"}))
+(def conn (d/connect client {:db-name "social-news"}))
+(def db (d/with-db conn))

 ;; some St*rts
-(d/transact conn {:tx-data [{:user/firstName "Stewart"
-                             :user/lastName "Brand"}
-                            {:user/firstName "John"
-                             :user/lastName "Stewart"}
-                            {:user/firstName "Stuart"
-                             :user/lastName "Smalley"}
-                            {:user/firstName "Stuart"
-                             :user/lastName "Halloway"}]})
-
-;; database point-in-time value
-(def db (d/db conn))
+(def db (:db-after (d/with db {:tx-data [{:user/firstName "Stewart"
+                                          :user/lastName "Brand"}
+                                         {:user/firstName "John"
+                                          :user/lastName "Stewart"}
+                                         {:user/firstName "Stuart"
+                                          :user/lastName "Smalley"}
+                                         {:user/firstName "Stuart"
+                                          :user/lastName "Halloway"}]})))

 ;; find all the Stewart first names
-(d/q '[:find ?e
+(d/q '[:find (pull ?e [*])
        :in $ ?name
        :where [?e :user/firstName ?name]]
      db
      "Stewart")

 ;; find all the Stewart or Stuart first names
-(d/q '[:find ?e
+(d/q '[:find (pull ?e [*])
        :in $ [?name ...]
        :where [?e :user/firstName ?name]]
      db
      ["Stewart" "Stuart"])

 ;; find all the Stewart/Stuart as either first name or last name
-(d/q '[:find ?e
+(d/q '[:find (pull ?e [*])
        :in $ [?name ...] [?attr ...]
        :where [?e ?attr ?name]]
      db
@@ -69,4 +60,3 @@
                        [?e :user/lastName ?lname]]}
       :args [db "Stuart" "Smalley"]})

-(d/delete-database client {:db-name db-name})


qualify some imported stuff

qualify some imported stuff

--- core.clj
+++ core.clj
@@ -1,11 +1,10 @@
 (ns tween.core
   (:import
-    [UnityEngine Application MonoBehaviour WaitForSeconds Time Mathf
+    [UnityEngine Mathf Application MonoBehaviour WaitForSeconds Time Mathf
      GameObject Color Vector4 Vector3 Vector2 Quaternion Debug]
     [System Object]
     [System.Collections IEnumerator]
     Wait MonoObj TimeLine
-
     ObjectPair SinglePair DoublePair Int16Pair Int32Pair Int64Pair QuaternionPair
     Vector4Pair Vector3Pair Vector2Pair ColorPair)
   (:require [clojure.walk :as walk]))
@@ -151,10 +150,10 @@
         (~'.StartCoroutine (mono-obj) ~tl))))

-(defmacro pow2 [a] `(Mathf/Pow ~a 2))
-(defmacro pow3 [a] `(Mathf/Pow ~a 3))
-(defmacro pow4 [a] `(Mathf/Pow ~a 4))
-(defmacro pow5 [a] `(Mathf/Pow ~a 5))
+(defmacro pow2 [a] `(UnityEngine.Mathf/Pow ~a 2))
+(defmacro pow3 [a] `(UnityEngine.Mathf/Pow ~a 3))
+(defmacro pow4 [a] `(UnityEngine.Mathf/Pow ~a 4))
+(defmacro pow5 [a] `(UnityEngine.Mathf/Pow ~a 5))

 (def quote-ease {
   :pow2   'pow2
@@ -251,13 +250,13 @@

 (deftag System.Object          {:pair ObjectPair     :lerp (fn [a b _] b)           :identity (System.Object.)})
-(deftag System.Single          {:pair SinglePair     :lerp Mathf/Lerp               :identity (float 0.0)})
-(deftag System.Double          {:pair DoublePair     :lerp Mathf/Lerp               :identity (double 0.0)})
+(deftag System.Single          {:pair SinglePair     :lerp UnityEngine.Mathf/Lerp   :identity (float 0.0)})
+(deftag System.Double          {:pair DoublePair     :lerp UnityEngine.Mathf/Lerp   :identity (double 0.0)})
 (deftag UnityEngine.Vector2    {:pair Vector2Pair    :lerp UnityEngine.Vector2/Lerp :identity (UnityEngine.Vector2.)})
 (deftag UnityEngine.Vector3    {:pair Vector3Pair    :lerp UnityEngine.Vector3/Lerp :identity (UnityEngine.Vector3.)})
 (deftag UnityEngine.Vector4    {:pair Vector4Pair    :lerp UnityEngine.Vector4/Lerp :identity (UnityEngine.Vector4.)})
 (deftag UnityEngine.Color      {:pair ColorPair      :lerp UnityEngine.Color/Lerp   :identity (UnityEngine.Color.)})
-(deftag UnityEngine.Quaternion {:pair QuaternionPair :lerp Quaternion/LerpUnclamped :identity (Quaternion.)})
+(deftag UnityEngine.Quaternion {:pair QuaternionPair :lerp UnityEngine.Quaternion/LerpUnclamped :identity (UnityEngine.Quaternion.)})

 (deftween [:position] [this]


fixup! fixup! add tests

fixup! fixup! add tests

--- src/expound/util.cljc
+++ src/expound/util.cljc
@@ -7,17 +7,12 @@
   #?(:clj (and (number? x) (Double/isNaN x))
      :cljs (and (number? x) (js/isNaN x))))

-;; some utils for spec walking
-
-(defn- accept-ident [x]
-  (when (qualified-ident? x)
-    x))
-
 (defn- parent-spec
   "Look up for the parent spec using the spec hierarchy."
   [k]
-  (or (accept-ident (s/get-spec k))
-      (some-> k s/get-spec s/form)))
+  (when-let [p (some-> k s/get-spec)]
+    (or (when (qualified-ident? p) p)
+        (s/form p))))

 (defn spec-vals
   "Returns all spec keys or pred "


Moved the config parts that belong to auth from the freecoin-lib

--- src/freecoin/core.clj
+++ src/freecoin/core.clj
@@ -53,6 +53,7 @@
             [freecoin.handlers.qrcode :as qrcode]
             [freecoin-lib.db.freecoin :as db]
             [just-auth.db.just-auth :as auth-db]
+            [just-auth.config :as auth-conf]
             [environ.core :as env]))

 (defn not-found [request]
@@ -177,9 +178,10 @@
   (if (:server app-state)
     app-state
     (if-let [db (:db app-state)]
-      (let [config-m           (config/create-config)
+      (let [config-m           (merge (config/create-config)
+                                      (auth-conf/create-config))
             stores-m           (merge (db/create-freecoin-stores db {})
-                                      (auth-db/create-auth-stores db {:ttl-password-recovery (config/ttl-password-recovery config-m)}))
+                                      (auth-db/create-auth-stores db {:ttl-password-recovery (auth-conf/ttl-password-recovery config-m)}))
             blockchain         (blockchain/new-mongo (select-keys stores-m [:transaction-store :wallet-store
                                                                             :confirmation-store :tag-store]))
             email-conf         (clojure.edn/read-string (slurp (:email-config config-m)))
@@ -223,12 +225,12 @@
   (swap! app-state connect-db)
   (assert (:db @app-state) "The DB is not set")
   (swap! lein-ring-handler
-         (fn [_] (let [config-m           (config/create-config)
+         (fn [_] (let [config-m           (merge (config/create-config)
+                                                 (auth-conf/create-config))
                        email-conf         (clojure.edn/read-string (slurp (:email-config config-m)))
                        db                 (:db @app-state)
-                       stores-m           (db/create-freecoin-stores
-                                           db
-                                           {:ttl-password-recovery (config/ttl-password-recovery config-m)})
+                       stores-m           (merge (db/create-freecoin-stores db {})
+                                                 (auth-db/create-auth-stores db {:ttl-password-recovery (auth-conf/ttl-password-recovery config-m)}))
                        blockchain         (blockchain/new-mongo (select-keys stores-m [:transaction-store :wallet-store
                                                                                :confirmation-store :tag-store]))
                        account-activator (just-auth.messaging/->AccountActivator email-conf (:account-store stores-m))


Augment update-munge to do old 0.4.X munging

--- src/grimoire/util.clj
+++ src/grimoire/util.clj
@@ -16,18 +16,21 @@
       ))

 (defn update-munge
-  "This function attempts to transform the legacy (Grimoire 0.2.X, 0.1.X)
-  munging of strings into the modern munging above. Note that update-munge is
-  _not_ and unmunge operation."
+  "This function attempts to transform the legacy munging of names
+  into the modern munging above. Note that update-munge is _not_ an
+  unmunge operation."
   [s]
   (-> s
-     (str/replace #"_?DASH_?" "-")
-     (str/replace #"_?BANG_?" "!")
-     (str/replace #"_?STAR_?" "*")
-     (str/replace #"_?EQ_?" "=")
-     (str/replace #"_?LT_?" "<")
-     (str/replace #"_?GT_?" ">")
-     url-encode))
+      (str/replace #"_?DASH_?"  "-")
+      (str/replace #"_?BANG_?"  "!")
+      (str/replace #"_?STAR_?"  "*")
+      (str/replace #"_?EQ_?"    "=")
+      (str/replace #"_?LT_?"    "<")
+      (str/replace #"_?GT_?"    ">")
+      (str/replace #"_?QMARK_?" "?")
+      (str/replace #"_?DOT_?"   ".")
+      (str/replace #"_?SLASH_?" "/")
+      url-encode))

 ;; FIXME: this should really be handled in data generation not in data use
 (defn normalize-version [x]


Unnecessary code snuck in in previous commit.

--- src/kademlia/core.clj
+++ src/kademlia/core.clj
@@ -3,8 +3,6 @@
             [taoensso.nippy :as nippy]
             [kademlia.util :as util])
   (:gen-class))
-
-(def do-nothing nil)

 (defn send!
   "Returns a deferred that will eval to true if we successfully sent the message otherwise false."


DM + RS #107 - Fix

DM + RS #107 - Fix

--- test/objective8/unit/workflows/sign_up_test.clj
+++ test/objective8/unit/workflows/sign_up_test.clj
@@ -10,12 +10,6 @@
         (authorised-redirect :user :some-url session-with-invitation)) => :authorised-response
         (provided
          (authorise (contains {:session (contains {:invitation :invitation-data})}) :user) => :authorised-response))
-
-(fact "only usernames containing alphanumeric characters, and between 1 and 16 characters long are valid"
-      (validate-username "1-a") => falsey
-      (validate-username "") => falsey
-      (validate-username "123456789abcdefgh") => falsey
-      (validate-username "val1d") => "val1d")

 (def USER_ID 1)
 (def the-user {:_id USER_ID})


fixed the build, only a typo | sg | #0

fixed the build, only a typo | sg | #0

--- src/clj/conference_rating/handler.clj
+++ src/clj/conference_rating/handler.clj
@@ -45,7 +45,7 @@
     (db/get-conferences-list db)))

 (defn add-conference [conference db]
-  (let [add-result (db/add-Fconference conference db)
+  (let [add-result (db/add-conference conference db)
         id         (:_id add-result)]
     (created (str "/api/conferences/" id) add-result)))


clean up

clean up

--- src/clj/conference_rating/handler.clj
+++ src/clj/conference_rating/handler.clj
@@ -60,12 +60,8 @@
    (GET "/api/conferences" [] (get-conferences db))
    (GET "/api/conferences/:id" [id] (get-conference id db))
    (GET "/api/conferences/:id/ratings" [id] (get-conference-ratings id db))
-   (POST "/api/conferences/:id/ratings" [id :as request] (do
-                                  (println "req " request)
-                                  (add-rating id (:body request) db)))
-   (POST "/api/conferences/" request (do
-                                         (println "req " request)
-                                         (add-conference (:body request) db)))
+   (POST "/api/conferences/:id/ratings" [id :as request] (add-rating id (:body request) db))
+   (POST "/api/conferences/" request (add-conference (:body request) db))
    (resources "/")
    (GET "/css/reagent-forms.css" [] (response (-> "reagent-forms.css"
                                                   clojure.java.io/resource


ignore :duration of #audio

ignore :duration of #audio

--- src/clj/iwaswhere_web/graph/query.clj
+++ src/clj/iwaswhere_web/graph/query.clj
@@ -12,6 +12,7 @@
             [clojure.pprint :as pp]
             [matthiasn.systems-toolbox.component :as st]))

+;; TODO: migrate existing audio entries to use a different keyword
 (defn summed-durations
   "Calculate time spent as tracked in custom fields."
   [entry]
@@ -19,7 +20,7 @@
         duration-secs (filter identity (map (fn [[k v]]
                                               (let [dur (:duration v)]
                                                 (if (= k "#audio")
-                                                  dur
+                                                  0
                                                   (* 60 (or dur 0)))))
                                             custom-fields))]
     (apply + duration-secs)))


tweaks

tweaks

--- src/cljs/omnext_routing_one/core.cljs
+++ src/cljs/omnext_routing_one/core.cljs
@@ -150,12 +150,9 @@
           (dom/div nil
           "something"
                )
-          #_(apply dom/ul nil
-                 (map (fn [ocean]
-                        (dom/li nil ocean)
-                        )
-                      )
-                 )
+          (dom/h1 nil
+                  (:hello (om/props this))
+                  )
           )
   )


made phone-template handle vectors as input properly

--- src/cljs/phonecat_re_frame/views.cljs
+++ src/cljs/phonecat_re_frame/views.cljs
@@ -87,10 +87,12 @@
     (map (fn [attribute]
            ^{:key (:name attribute)} [:div
                                       [:dt (:name attribute)]
-                                      [:dd (condp = (:value attribute)
-                                             true "\u2713"
-                                             false "\u2718"
-                                             (:value attribute))]])
+                                      [:dd (let [value (:value attribute)]
+                                             (condp #(%1 %2) value
+                                               true? "\u2713"
+                                               false? "\u2718"
+                                               vector? (clojure.string/join ", " value)
+                                               value))]])
          attributes-map)]])

 (defn thumbnails
@@ -153,7 +155,7 @@
 (defn size-and-weight
   [size-and-weight]
   [phone-info-template "Size And Weight" [{:name  "Dimensions"
-                                           :value (clojure.string/join ", " (:dimensions @size-and-weight))}
+                                           :value (:dimensions @size-and-weight)}
                                           {:name  "Weight"
                                            :value (:weight @size-and-weight)}]])

@@ -184,7 +186,7 @@
   [phone-info-template "Camera" [{:name  "Primary"
                                   :value (:primary @camera)}
                                  {:name  "Features"
-                                  :value (clojure.string/join ", " (:features @camera))}]])
+                                  :value (:features @camera)}]])

 (defn additional-features
   [additional-features]


Begin decomopsing path functionality.

Begin decomopsing path functionality.

--- src/pubhouse/core.clj
+++ src/pubhouse/core.clj
@@ -87,6 +87,10 @@
    (str (join "/" (cons root (drop 2 (fs/split (strip-extension path)))))
         ".html")))

+(defn content-path
+  [root-path]
+  (join "/" (concat (fs/split root-path) (list "content"))))
+
 (defn navigate-site-map
   [site-map page-record]
   (assoc (humane-site-map site-map)
@@ -110,10 +114,8 @@
                  content-root))

 (defn compile-site!
-  [root-dir build-root]
+  [root-path build-root]
   (binding [*site-map* (atom {})]
-    (let [content-root (clojure.java.io/as-file
-                        (join "/" (concat (fs/split root-dir)
-                                          (list "content"))))]
+    (let [content-root (content-path root-path)]
       (build-site-map! content-root)
       (compile-content! @*site-map* content-root build-root))))


Rename some functions to better reflect their purpose.

--- src/pubhouse/core.clj
+++ src/pubhouse/core.clj
@@ -27,14 +27,14 @@

 (defn page-record? [x] (and (coll? x) (contains? x :mod-time)))

-(defn build-file!
+(defn read-content-file!
   [file lines]
   [(mk-page-record file lines)
    (content-section lines)])

-(defn build-files!
+(defn read-content-directory!
   [root-dir]
-  (map-directory! build-file! content-file? root-dir))
+  (map-directory! read-content-file! content-file? root-dir))

 (defn add-page
   [site-map page-record]
@@ -48,7 +48,7 @@
           (let [root-part (first (fs/split root-dir))]
             (get (reduce #(add-page %1 (first %2))
                          {}
-                         (build-files! root-dir))
+                         (read-content-directory! root-dir))
                  (keyword root-part)))))

 (defn strip-extension
@@ -105,7 +105,7 @@
 (defn compile-content!
   [site-map content-root build-root]
   (do-directory! (comp (partial compile-file! site-map build-root)
-                       build-file!)
+                       read-content-file!)
                  content-file?
                  content-root))


1.3-ifying examples.korns-regression-p12

--- src/examples/korns_regression_p12.clj
+++ src/examples/korns_regression_p12.clj
@@ -3,8 +3,8 @@
 ;; Lee Spector, lspector@hampshire.edu, 2011

 (ns examples.korns-regression-p12
-  (:require [clojush] [clojure.contrib.math])
-  (:use [clojush] [clojure.contrib.math]))
+  (:use [clojush]
+	[clojure.math.numeric-tower]))

 (defn generate-data
   [rows] ;; korns uses 10000! But we won't :-)


send Connection: close header

send Connection: close header

--- src/vignette/http/routes.clj
+++ src/vignette/http/routes.clj
@@ -106,7 +106,8 @@
           (header "Varnish-Logs" "vignette")
           (header "X-Served-By" hostname)
           (header "X-Cache" "ORIGIN")
-          (header "X-Cache-Hits" "ORIGIN")))))
+          (header "X-Cache-Hits" "ORIGIN")
+          (header "Connection" "close")))))

 (defn route-params->image-type
   [route-params]


prevent colons for width dimension

prevent colons for width dimension

--- src/vignette/media_types.clj
+++ src/vignette/media_types.clj
@@ -86,7 +86,9 @@

 (defn width
   [data]
-  (let [width (:width data)
+  (let [width (if (keyword? (:width data))
+                (name (:width data))
+                (:width data))
         x-offset (:x-offset data)
         window-width (:window-width data)]
     (window-format width x-offset window-width)))


CMR-2291: Removed capture/reveal

CMR-2291: Removed capture/reveal

--- common-app-lib/src/cmr/common_app/api/routes.clj
+++ common-app-lib/src/cmr/common_app/api/routes.clj
@@ -148,7 +148,6 @@
   "Adds a request id header to every response to facillitate clientside debugging."
   [f]
   (fn [{context :request-context :as request}]
-    (cmr.common.dev.capture-reveal/capture-all)
     (if-let [request-id (cxt/context->request-id context)]
       (-> (f request)
           (assoc-in [:headers cxt/REQUEST_ID_HEADER] request-id))


Speed up validator (from, to)

Speed up validator (from, to)

--- src/whisper2cyanite/core.clj
+++ src/whisper2cyanite/core.clj
@@ -98,8 +98,9 @@
       Processor
       (process-metrics [this rollup period retention points path file series]
         (let [series (whisper/sort-series series)
-              from (first (first series))
-              to (first (last series))
+              times (map first series)
+              from (apply min times)
+              to (apply max times)
               error-reported? (atom false)
               mstore-series (mstore/fetch-series mstore tenant rollup period path
                                                  from to file)]


core: trampoline

core: trampoline

--- core/data/core.clj
+++ core/data/core.clj
@@ -2798,6 +2798,23 @@
     :added "1.0"}
   *e)

+(defn trampoline
+  "trampoline can be used to convert algorithms requiring mutual
+  recursion without stack consumption. Calls f with supplied args, if
+  any. If f returns a fn, calls that fn with no arguments, and
+  continues to repeat, until the return value is not a fn, then
+  returns that non-fn value. Note that if you want to return a fn as a
+  final value, you must wrap it in some data structure and unpack it
+  after trampoline returns."
+  {:added "1.0"}
+  ([f]
+   (let [ret (f)]
+     (if (fn? ret)
+       (recur ret)
+       ret)))
+  ([f & args]
+   (trampoline #(apply f args))))
+
 (defn empty?
   "Returns true if coll has no items - same as (not (seq coll)).
   Please use the idiom (seq x) rather than (not (empty? x))"


Remove Explicit Thread Factory

Remove Explicit Thread Factory

In case I have only one batch thread, one thread isn't sufficient. As I
have no idea if one thread more is sufficient, I skip using a custom
thread factory at all, hoping that a default is better.

--- src/lens/broker.clj
+++ src/lens/broker.clj
@@ -155,7 +155,7 @@
   Lifecycle
   (start [broker]
     (info (str "Start broker on queue " batch-queue))
-    (let [opts (cond-> {:executor (Executors/newFixedThreadPool num-batch-threads)}
+    (let [opts (cond-> {}
                  host (assoc :host host)
                  port (assoc :port port)
                  username (assoc :username username)


Restrict special-forms to top-level s-exprs

--- planck-cljs/src/planck/core.cljs
+++ planck-cljs/src/planck/core.cljs
@@ -86,10 +86,11 @@
 (defn ^:export get-completions [buffer]
   (let [namespace-candidates (map str
                                (keys (:cljs.analyzer/namespaces @planck.core/st)))
+        top-form? (re-find #"^\(\s*[^()]*$" buffer)
         all-candidates (set (concat namespace-candidates
                                     (completion-candidates-for-ns 'cljs.core false)
                                     (completion-candidates-for-ns @current-ns true)
-                                    (map str repl-specials)))]
+                                    (when top-form? (map str repl-specials))))]
     (let [buffer-match-suffix (re-find #"[a-zA-Z]*$" buffer)
           buffer-prefix (subs buffer 0 (- (count buffer) (count buffer-match-suffix)))]
       (clj->js (if (= "" buffer-match-suffix)


Added ManyValuedContexts to compile function in conexp

Signed-off-by: Daniel Borchmann <25857343a15bf1edafebc2912e82ecf775c585c1@mailbox.tu-dresden.de>

--- src/conexp.clj
+++ src/conexp.clj
@@ -5,6 +5,7 @@
   (compile 'conexp.fca.contexts)
   (compile 'conexp.fca.implications)
   (compile 'conexp.fca.lattices)
+  (compile 'conexp.fca.many-valued-contexts)
   (compile 'conexp.gui.repl))

 ; Use immigrate, so that all imports behave as if they were defined in here.


set resource for compojure

set resource for compojure

--- src/luar/server.clj
+++ src/luar/server.clj
@@ -1,34 +1,36 @@
 (ns luar.server
   (:use [org.httpkit.server :only [run-server]])
   (:require [ring.middleware.reload :as reload]
+            [ring.middleware.refresh :as refresh]
             [ring.util.response :as response]
-            [ring.middleware.refresh :as refresh]

             [compojure.core :refer [defroutes GET POST]]
             [compojure.route :as route]))

 (defroutes all-routes
   (GET "/" [] (response/file-response "index.html" {:root "resources/public"}))
-  (route/not-found "
Page not found.
"))
-
-;; (def server
-;;   (refresh/wrap-refresh all-routes))
+  (route/resources "/")
+  (route/not-found "
Page not found!
"))

 (defn in-dev? [& args] true)

+(def app
+  ;; (wrap-file all-routes "resources/public")
+  ;; (refresh/wrap-refresh all-routes)
+  (if (in-dev?)
+    (refresh/wrap-refresh
+     (reload/wrap-reload #'all-routes))
+    all-routes))
+
+(defonce server (atom nil))
+
+(defn stop-server []
+  (when-not (nil? @server)
+    (@server :timeout 100)
+    (reset! server nil)))
+
+(defn start-server [& port]
+  (reset! server (run-server #'app {:port 8080})))
+
 (defn -main [& args]
-  (let [handler
-        (if (in-dev? args)
-          (reload/wrap-reload #'all-routes)
-          all-routes)]
-
-    (run-server handler {:port 8080})))
-
-
-
-
-
-
-
-
-
+  (start-server))


futures based concurrent batching

futures based concurrent batching

--- src/luffer/core.clj
+++ src/luffer/core.clj
@@ -195,7 +195,7 @@
   "write bulk action line and source document line"
   [stream p]
   (do
-    (encode-stream {:index {:_index "plays.exp-1" :_type "play" :_id (:id p)}} stream)
+    (encode-stream {:index {:_id (:id p)}} stream)
     (.write stream "\n")
     (encode-stream p stream)
     (.write stream "\n")))
@@ -236,7 +236,7 @@

 (defn -main [& args]
   (let [batch-size 10000
-        concurrency 1
+        concurrency 8
         cnt (-> (exec-raw "SELECT COUNT(*) AS cnt FROM plays" :results) first :cnt)
         quoti (int (/ cnt concurrency))
         id-stop (+ quoti (- batch-size (mod quoti batch-size)))]
@@ -250,13 +250,13 @@
                   id-stop)]
       (when (< i concurrency)
         (println (format "new future [%,d, %,d)" start stop))
-        (select-in-batches (select* plays) start batch-size stop
-                           (fn [bat]
-                             (let [joined-bat (assoc bat :batch (join-plays (:batch bat)))]
-                               (swap! pc + (-> bat :batch count))
-                               (println (format "batched %,d plays. total=%,d" (-> bat :batch count) @pc))
-                               (write-batch-to-file "./tmp/batch-%d.json" joined-bat))))
-        (println (format "done with [%,d, %,d). total=%,d" start stop @pc))
+        (future (time (select-in-batches (select* plays) start batch-size stop
+                                         (fn [bat]
+                                           (let [joined-bat (assoc bat :batch (join-plays (:batch bat)))]
+                                             (swap! pc + (-> bat :batch count))
+                                             (println (format "batched %,d plays. total=%,d" (-> bat :batch count) @pc))
+                                             (write-batch-to-file "./tmp/batch-%d.json" joined-bat)))))
+                (println (format "done with [%,d, %,d). total=%,d" start stop @pc)))
         (recur (inc i) (+ start id-stop) (if (= (inc i) concurrency)
                                            nil
                                            (+ stop id-stop)))))))


placeholder: funciton arguments in Clojure

--- clojure/lazy_seq_again.clj
+++ clojure/lazy_seq_again.clj
@@ -8,14 +8,14 @@
   ([memory x y dx dy]
    (->SpiralMemory memory (->Square x y) (->Delta dx dy))))

-(defn adj-nn [x, y] (->Square      x  (inc y)))
-(defn adj-ne [x, y] (->Square (inc x) (inc y)))
-(defn adj-ee [x, y] (->Square (inc x)      y))
-(defn adj-se [x, y] (->Square (inc x) (dec y)))
-(defn adj-ss [x, y] (->Square      x  (dec y)))
-(defn adj-sw [x, y] (->Square (dec x) (dec y)))
-(defn adj-ww [x, y] (->Square (dec x)      y))
-(defn adj-nw [x, y] (->Square (dec x) (inc y)))
+(defn adj-nn [x y] (->Square      x  (inc y)))
+(defn adj-ne [x y] (->Square (inc x) (inc y)))
+(defn adj-ee [x y] (->Square (inc x)      y))
+(defn adj-se [x y] (->Square (inc x) (dec y)))
+(defn adj-ss [x y] (->Square      x  (dec y)))
+(defn adj-sw [x y] (->Square (dec x) (dec y)))
+(defn adj-ww [x y] (->Square (dec x)      y))
+(defn adj-nw [x y] (->Square (dec x) (inc y)))

 (defn adjacency
   [{{x :x y :y} :square


Fix indentation and doc-strings.

Fix indentation and doc-strings.

--- src/circleci/web/views/index.clj
+++ src/circleci/web/views/index.clj
@@ -1,10 +1,10 @@
 (ns circleci.web.views.index
   (:use noir.core
-       hiccup.core
-       hiccup.page-helpers
-       hiccup.form-helpers
-       circleci.web.views.common
-       ring.util.response)
+        hiccup.core
+        hiccup.page-helpers
+        hiccup.form-helpers
+        circleci.web.views.common
+        ring.util.response)
   (:use [circleci.db :only (with-conn)])
   (:use [ring.util.response :only (redirect)])
   (:require [circleci.model.beta-notify :as beta])
@@ -13,90 +13,91 @@

 (defpage [:post "/"] {:as request}
   (with-conn
-               (beta/insert {:email (:email request)
-                             :contact (= "true" (:contact request))
-                             :environment ""
-                             :features ""})
-               (cookies/put! :signed-up "1")
-               (redirect "/")))
+    (beta/insert {:email (:email request)
+                 :contact (= "true" (:contact request))
+                 :environment ""
+                 :features ""})
+    (cookies/put! :signed-up "1")
+    (redirect "/")))

 (declare signupform youre-done)

-(defn
-  ^{:doc "Take the provided div and center it vertically, by adding classes and
-          wrapping it's contents in more divs. It relies on additional.css
-          having .vcenter{1,2,3} defined."}
-  center-vertically [[tag & args]]
+(defn center-vertically
+  "Take the provided div and center it vertically, by adding classes and
+  wrapping it's contents in more divs. It relies on additional.css having
+  .vcenter{1,2,3} defined."
+  [[tag & args]]
     (let [[m & remaining] args
           property-map (into {:class "vcenter1"} (if (map? m) m {}))
           inner-tags (if (map? m) remaining args)]
-     [tag property-map [:div.vcenter2 (apply vector :div.vcenter3 inner-tags)]]))
+         [tag property-map [:div.vcenter2 (apply vector :div.vcenter3 inner-tags)]]))

 (defpage "/" []
   (layout
-   [:div#pitch_wrap
-    [:div#pitch
+    [:div#pitch_wrap
+      [:div#pitch

-     (center-vertically
-      [:div#left-panel [:h1#cititle "Continuous Integration" [:br] "made easy"]])
-     (center-vertically
-      [:div#right-panel (if (cookies/get :signed-up) (youre-done) (signupform))])
-     [:div.clear]]]
+        (center-vertically
+          [:div#left-panel [:h1#cititle "Continuous Integration" [:br] "made easy"]])
+        (center-vertically
+          [:div#right-panel (if (cookies/get :signed-up) (youre-done) (signupform))])
+        [:div.clear]]]

-   [:div#content_wrap
-    [:div#content
-     [:div#main_content_wide.left
-      [:div.box_medium.feature.separator_r
-       [:img {:src "img/icon_feature_03.png"
-              :width 60
-              :height 55}]
-       [:h3 "No more build breaks"]
-       [:p "Circle runs automated tests, builds artifacts, manages integration branches and deploys to production, with ease" ]]
-      [:div.box_medium.feature
-       [:img {:src "img/icon_feature_02.png"
-              :width 60
-              :height 55}]
-       [:h3 "Staged Deployments"]
-       [:p "Control when and how to deploy to automatically production, after the tests pass"]]
-      [:div.box_medium.feature.separator_r
-       [:img {:src "img/icon_feature_01.png"
-              :width 60
-              :height 55}]
-       [:h3 "Easy Github Integration"]
-       [:p "Automatically run the tests after every commit"]]
-      [:div.box_medium.feature
-       [:img {:src "img/icon_feature_04.png"
-              :width 60
-              :height 55}]
-       [:h3 "Parallel testing"]
-       [:p "Reduce test time by running the tests in parallel on multiple boxes"]]]]]))
+    [:div#content_wrap
+      [:div#content
+        [:div#main_content_wide.left
+          [:div.box_medium.feature.separator_r
+            [:img {:src "img/icon_feature_03.png"
+                   :width 60
+                   :height 55}]
+            [:h3 "No more build breaks"]
+            [:p "Circle runs automated tests, builds artifacts, manages integration branches "
+                "and deploys to production, with ease" ]]
+          [:div.box_medium.feature
+            [:img {:src "img/icon_feature_02.png"
+                   :width 60
+                   :height 55}]
+            [:h3 "Staged Deployments"]
+            [:p "Control when and how to deploy to automatically production, after the tests pass"]]
+          [:div.box_medium.feature.separator_r
+            [:img {:src "img/icon_feature_01.png"
+                   :width 60
+                   :height 55}]
+            [:h3 "Easy Github Integration"]
+            [:p "Automatically run the tests after every commit"]]
+          [:div.box_medium.feature
+            [:img {:src "img/icon_feature_04.png"
+                   :width 60
+                   :height 55}]
+            [:h3 "Parallel testing"]
+            [:p "Reduce test time by running the tests in parallel on multiple boxes"]]]]]))

 (defpartial signupform [& content]
-  [:div.move-right
-   [:div.blue-box
-    [:h2.takepart "Take part in the beta"]
-    [:p.whenready "We'll email you when we're ready."]
-    [:form {:action "/" :method "POST"}
-     [:fieldset#actualform
-      (unordered-list
-       [(list (text-field {:id "email"
-                           :type "text"
-                           :onfocus "if (this.value == 'Email address') { this.value=''};"
-                           :onblur "if (this.value == '') { this.value = 'Email address'};"}
-                           "email" "Email address"))
-        (list (check-box {:id "contact"
-                           :name "contact"
-                           :checked true} "contact")
-              [:div
-               [:div
-                (label {:id "contact-label"}
-                       "contact"
-                       "May we contact you to ask about your platform, stack, test suite, etc?")]])])]
-     [:fieldset
-      [:input.call_to_action {:type "submit"
-                              :value "Get Notified"}]]]]])
+   [:div.move-right
+     [:div.blue-box
+       [:h2.takepart "Take part in the beta"]
+         [:p.whenready "We'll email you when we're ready."]
+         [:form {:action "/" :method "POST"}
+           [:fieldset#actualform
+             (unordered-list
+               [(list (text-field {:id "email"
+                                   :type "text"
+                                   :onfocus "if (this.value == 'Email address') { this.value=''};"
+                                   :onblur "if (this.value == '') { this.value = 'Email address'};"}
+                                   "email" "Email address"))
+                (list (check-box {:id "contact"
+                                  :name "contact"
+                                  :checked true} "contact")
+                      [:div
+                        [:div
+                          (label {:id "contact-label"}
+                                 "contact"
+                                 "May we contact you to ask about your platform, stack, test suite, etc?")]])])]
+             [:fieldset
+               [:input.call_to_action {:type "submit"
+                                       :value "Get Notified"}]]]]])

@@ -110,6 +111,6 @@
 (defpartial youre-done [& content]
 ;  (delete-cookie :signed-up) ; For debugging
   [:div.move-right
-   [:h2.blue-box "Thanks!" [:br] "We'll be in touch soon!"]])
+    [:h2.blue-box "Thanks!" [:br] "We'll be in touch soon!"]])


that was dumb

that was dumb

--- src/metabase/db.clj
+++ src/metabase/db.clj
@@ -184,7 +184,7 @@

     (exists? User :id 100)"
   [entity & {:as kwargs}]
-  `(empty? (select ~entity
-                   (fields [:id])
-                   (where ~kwargs)
-                   (limit 1))))
+  `(not (empty? (select ~entity
+                        (fields [:id])
+                        (where ~kwargs)
+                        (limit 1)))))


did you know you can destructure like [entity & {:as kwargs}] <3

--- src/metabase/db.clj
+++ src/metabase/db.clj
@@ -24,7 +24,7 @@
                         :fields str/upper-case}}))

 (defn migrate
-  "Migrate the database :up or :down."
+  "Migrate the database `:up` or `:down.`"
   [direction]
   (let [conn (jdbc/get-connection {:subprotocol "h2"
                                    :subname db-file})]
@@ -56,8 +56,8 @@
    `(upd User 123 :is_active false)` -> updates user with id=123, setting is_active=false

    Returns true if update modified rows, false otherwise."
-  [entity entity-id & kwargs]
-  (let [kwargs (->> (apply assoc {} kwargs)
+  [entity entity-id & {:as kwargs}]
+  (let [kwargs (->> kwargs
                     (pre-update entity))]
     (-> (update entity (set-fields kwargs) (where {:id entity-id}))
         (> 0))))
@@ -68,8 +68,8 @@
 (defn del
   "Wrapper around `korma.core/delete` that makes it easier to delete a row given a single PK value.
    Returns a `204 (No Content)` response dictionary."
-  [entity & kwargs]
-  (delete entity (where (apply assoc {} kwargs)))
+  [entity & {:as kwargs}]
+  (delete entity (where kwargs))
   {:status 204
    :body nil})

@@ -118,9 +118,7 @@
     (sel :many Table :db_id 1)                    -> (select User (where {:id 1}))
     (sel :many Table :db_id 1 (order :name :ASC)) -> (select User (where {:id 1}) (order :name ASC))"
   [one-or-many entity & forms]
-  {:pre [(or (println "one-or-many:" one-or-many)
-             true)
-         (contains? #{:one :many} one-or-many)]}
+  {:pre [(contains? #{:one :many} one-or-many)]}
   `(->> (-sel-select ~entity ~@forms ~@(when (= one-or-many :one) `((limit 1))))
         (map (partial post-select (entity->korma ~entity)))
         ~(case one-or-many
@@ -171,9 +169,8 @@
    and automatically passes &rest KWARGS to `korma.core/values`.

    Returns newly created object by calling `sel`."
-  [entity & kwargs]
+  [entity & {:as kwargs}]
   (let [vals (->> kwargs
-                  (apply assoc {})
                   (pre-insert entity))]
     (let [{:keys [id]} (-> (insert entity (values vals))
                            (clojure.set/rename-keys {(keyword "scope_identity()") :id}))]
@@ -186,8 +183,8 @@
   "Easy way to see if something exists in the db.

     (exists? User :id 100)"
-  [entity & {:as forms}]
+  [entity & {:as kwargs}]
   `(empty? (select ~entity
                    (fields [:id])
-                   (where ~forms)
+                   (where ~kwargs)
                    (limit 1))))


Fix SQL queries for upstream API changes

--- src/clj/chili_dog_night/core.clj
+++ src/clj/chili_dog_night/core.clj
@@ -37,34 +37,34 @@
   ([] (query-media-ids db-spec))
   ([db-spec]
    (jdbc/query db-spec
-     (sql/select * :media)
-     :result-set-fn #(shuffle %))))
+               (sql/select * :media)
+               {:result-set-fn #(shuffle %)})))

 (defn query-media-by-rating []
   (jdbc/query db-spec
-    (sql/select * :media
-      (sql/order-by {:rating :desc}))))
+              (sql/select * :media
+                          (sql/order-by {:rating :desc}))))

 (defn update-rating [a b]
   (jdbc/with-db-transaction [trans-conn db-spec]
     (let [media-a (jdbc/query trans-conn
                               (sql/select * :media
-                                (sql/where {:id (:id a)}))
-                              :result-set-fn #(first %))
+                                          (sql/where {:id (:id a)}))
+                              {:result-set-fn #(first %)})
           media-b (jdbc/query trans-conn
                               (sql/select * :media
-                                (sql/where {:id (:id b)}))
-                              :result-set-fn #(first %))
+                                          (sql/where {:id (:id b)}))
+                              {:result-set-fn #(first %)})
           actual-score-a (if (:winner a) 1 0)
           actual-score-b (if (:winner b) 1 0)
           expected-score-a (elo-expected-score (:rating media-a) (:rating media-b))
           expected-score-b (elo-expected-score (:rating media-b) (:rating media-a))]
       (jdbc/update! trans-conn :media
-        {:rating (Integer. (str (m/round (+ (:rating media-a) (* 32 (- actual-score-a expected-score-a))))))}
-        (sql/where {:id (:id media-a)}))
+                    {:rating (Integer. (str (m/round (+ (:rating media-a) (* 32 (- actual-score-a expected-score-a))))))}
+                    (sql/where {:id (:id media-a)}))
       (jdbc/update! trans-conn :media
-        {:rating (Integer. (str (m/round (+ (:rating media-b) (* 32 (- actual-score-b expected-score-b))))))}
-        (sql/where {:id (:id media-b)})))))
+                    {:rating (Integer. (str (m/round (+ (:rating media-b) (* 32 (- actual-score-b expected-score-b))))))}
+                    (sql/where {:id (:id media-b)})))))

 (defn requires-admin [f req]
   (if-not (authenticated? req)


Okay. Merged for reals now.

Okay. Merged for reals now.

--- src/cljs/clj_mini_apps/pong.cljs
+++ src/cljs/clj_mini_apps/pong.cljs
@@ -78,8 +78,8 @@
 (defn on-collision [state]
   (let [ball-x (:x (:ball state))
         ball-y (:y (:ball state))
-        top-wall (+ 2 (+ 9 7.5))
-        btm-wall (- (- 490 7.5) 2)
+        top-wall (+ 2 (+ 9 (/ ball-size 2)))
+        btm-wall (- (- 490 (/ ball-size 2)) 2)
         not-dir #({+ -, - +} %)]
     (cond
       ;;check w/ top/btm walls
@@ -110,9 +110,9 @@
     (q/rect-mode :center))

   (q/rect ((state :player) :x)
-          ((state :player) :y) 20 100)
+          ((state :player) :y) paddle-width paddle-height)
   (q/rect ((state :computer) :x)
-          ((state :computer) :y) 20 100)
+          ((state :computer) :y) paddle-width paddle-height)
   (q/ellipse ((state :ball) :x)
              ((state :ball) :y) ball-size ball-size))


component extended regarding placement needs

#21

--- src/cljs/material/component.cljs
+++ src/cljs/material/component.cljs
@@ -425,6 +425,21 @@
       (svg
         {:hoverColor "#437f9d"
          :style      {:cursor "pointer"}
+         :onClick    #(add-item-fn)}
+        icon/add-small))]])
+
+(defn form-subsection-add
+  [label add-item-fn]
+  [:div.form-view-row
+   [:span.form-row-subsection.form-row-icon-section label]
+   [:div.form-row-icon-field
+    (mui
+      (svg
+        {:hoverColor "#437f9d"
+         :style      {:cursor    "pointer"
+                      :marginTop "2px"
+                      :width     "20px"
+                      :height    "20px"}
          :onClick    #(add-item-fn)}
         icon/add-small))]])

@@ -753,4 +768,11 @@
       {:key        "tbl"
        :selectable false}
       (form-info-table-header headers)
+      (form-info-table-body headers items render-item-fn render-items-key))))
+
+(defn form-info-table-headless [headers items render-item-fn render-items-key]
+  (mui
+    (table
+      {:key        "tbl"
+       :selectable false}
       (form-info-table-body headers items render-item-fn render-items-key))))


add clojure syntax table

add clojure syntax table

--- src/cljs_api_gen/clojure_api.clj
+++ src/cljs_api_gen/clojure_api.clj
@@ -93,6 +93,38 @@

   #{"#uuid" "#inst"})

+(def clj-syntax
+  {"\"" "StringReader"
+   ";"  "CommentReader"
+   "'"  "WrappingReader(QUOTE)"
+   "@"  "WrappingReader(DEREF)"
+   "^"  "MetaReader"
+   "`"  "SyntaxQuoteReader"
+   "~"  "UnquoteReader"
+   "("  "ListReader"
+   "["  "VectorReader"
+   "{"  "MapReader"
+   "\\" "CharacterReader"
+   "%"  "ArgReader"
+   "#"  "DispatchReader"
+
+   "#^"  "MetaReader"
+   "#'"  "VarReader"
+   "#\"" "RegexReader"
+   "#("  "FnReader"
+   "#{"  "SetReader"
+   "#="  "EvalReader"
+   "#!"  "CommentReader"
+   "#<"  "UnreadableReader"
+   "#_"  "DiscardReader"
+   "#?"  "ConditionalReader" ;; added 1.7 (which release?)
+
+   ":"        "matchSymbol" ;; (keywords matched w/ symbols)
+   "<symbol>" "matchSymbol"
+   "<number>" "matchNumber"
+   }
+  )
+
 ;;--------------------------------------------------------------------------------
 ;; ClojureScript -> Clojure name mapping
 ;;--------------------------------------------------------------------------------


Augment result map before printing result

Fixes an issue with the test var being printed as nil on failures.

--- src/com/palletops/multi_test.clj
+++ src/com/palletops/multi_test.clj
@@ -45,14 +45,17 @@
 ;;; # Reporters
 (def result (atom nil))

+(defn result-with-vars
+  [m]
+  (assoc m
+    :contexts (if (bound? #'test/*testing-contexts*)
+                test/*testing-contexts*)
+    :var (if (bound? #'test/*testing-vars*)
+           (first test/*testing-vars*))))
+
 (defn add-result!
   [m]
-  (swap! result conj
-         (assoc m
-           :contexts (if (bound? #'test/*testing-contexts*)
-                       test/*testing-contexts*)
-           :var (if (bound? #'test/*testing-vars*)
-                  (first test/*testing-vars*)))))
+  (swap! result conj m))

 ;;; ## Results Reporter
@@ -69,17 +72,19 @@

 (defmethod report :pass [m]
   (test/inc-report-counter :pass)
-  (add-result! m))
+  (add-result! (result-with-vars m)))

 (defmethod report :fail [m]
   (test/inc-report-counter :fail)
-  (print-fail m)
-  (add-result! m))
+  (let [m (result-with-vars m)]
+    (print-fail m)
+    (add-result! m)))

 (defmethod report :error [m]
   (test/inc-report-counter :error)
-  (print-error m)
-  (add-result! m))
+  (let [m (result-with-vars m)]
+    (print-error m)
+    (add-result! m)))

 (defmethod report :summary [m])

@@ -99,13 +104,13 @@
 (defmethod silent-report :default [m])

 (defmethod silent-report :pass [m]
-  (add-result! m))
+  (add-result! (result-with-vars m)))

 (defmethod silent-report :fail [m]
-  (add-result! m))
+  (add-result! (result-with-vars m)))

 (defmethod silent-report :error [m]
-  (add-result! m))
+  (add-result! (result-with-vars m)))

 (defmethod silent-report :summary [m])


Add proper error handling.

Add proper error handling.

--- src/potok/core.cljs
+++ src/potok/core.cljs
@@ -188,83 +188,89 @@
   ([{:keys [on-error state resolve]
      :or {on-error handle-error}
      :as params}]
-   (letfn [(process-error [error]
-             (let [res (on-error error)]
-               (if (rx/observable? res) res (rx/empty))))
-
-           (process-watch [input-sm output-sb state event]
-             (let [result (try
-                            (watch event state input-sm)
-                            (catch :default e
-                              (process-error e)))]
-
-               (cond
-                 (rx/observable? result)
-                 (->> result
-                      (rx/catch process-error)
-                      (rx/subs #(rx/push! output-sb %)))
-
-                 (promise? result)
-                 (->> (rx/from result)
-                      (rx/catch process-error)
-                      (rx/subs #(rx/push! output-sb %)))
-
-                 (nil? result)
-                 nil
-
-                 :else
-                 (js/console.warn "Event returned unexpected object from `watch` method (ignoring)."
-                                  (pr-str {:event event :event-type (type event)})))))
-
-           (handle-effect [input-sm state event]
-             (try
-               (effect event state input-sm)
-               (catch :default e
-                 (process-error e))))]
-
-     (let [input-sb  (rx/subject)
-
-           ;; This steps allow an optional layer of indirection:
-           ;; defining events in a multimethod style registry.
-           input-sm  (cond->> (rx/to-observable input-sb)
-                       (or (fn? resolve) (ifn? resolve))
-                       (rx/map #(if (event-ref? %)
-                                  (resolve (:type %) (:params %))
-                                  %)))
-           ;; A shared observable is used here for avoid repeating
-           ;; resolution process for each subscription.
-           input-sm  (rx/share input-sm)
-
-           state*    (atom state)]
-
-       ;; a sync state transformation subscription loop
-       (->> (rx/filter update? input-sm)
-            (rx/subs (fn [event]
-                       (try
-                         (swap! state* #(update event %))
-                         (catch :default e
-                           (process-error e))))))
-
-       ;; side effectful subscription for watch events
-       (->> (rx/filter watch? input-sm)
-            (rx/finalize #(prn "finalize watch?"))
-            (rx/subs #(process-watch input-sm input-sb @state* %)))
-
-       ;; side effectful subscription for effect events
-       (->> (rx/filter effect? input-sm)
-            (rx/subs #(handle-effect input-sm @state* %)))
-
-       (specify! state*
-         Store
-         (-push [_ event]
-           (rx/push! input-sb event))
-
-         (-input-stream [_]
-           input-sm)
-
-         rx/IDisposable
-         (-dispose [_]
-           (rx/end! input-sb)))))))
+   (let [input-sb (rx/subject)
+         failset  (js/WeakSet.)
+
+         process-error
+         (fn [error]
+           (let [res (on-error error)]
+             (if (rx/observable? res) res (rx/empty))))
+
+         process-watch
+         (fn [input-sm output-sb state event]
+           (let [result (try
+                          (watch event state input-sm)
+                          (catch :default e
+                            (.add ^js failset event)
+                            (process-error e)))]
+
+             (cond
+               (rx/observable? result)
+               (->> result
+                    (rx/catch process-error)
+                    (rx/subs #(rx/push! output-sb %)))
+
+               (promise? result)
+               (->> (rx/from result)
+                    (rx/catch process-error)
+                    (rx/subs #(rx/push! output-sb %)))
+
+               (nil? result)
+               nil
+
+               :else
+               (js/console.warn "Event returned unexpected object from `watch` method (ignoring)."
+                                (pr-str {:event event :event-type (type event)})))))
+
+         process-effect
+         (fn [input-sm state event]
+           (try
+             (effect event state input-sm)
+             (catch :default e
+               (process-error e))))
+
+         ;; This steps allow an optional layer of indirection:
+         ;; defining events in a multimethod style registry.
+         input-sm (cond->> (rx/to-observable input-sb)
+                    (or (fn? resolve) (ifn? resolve))
+                    (rx/map #(if (event-ref? %)
+                               (resolve (:type %) (:params %))
+                               %)))
+         ;; A shared observable is used here for avoid repeating
+         ;; resolution process for each subscription.
+         input-sm (rx/share input-sm)
+         state*   (atom state)]
+
+     ;; a sync state transformation subscription loop
+     (->> (rx/filter update? input-sm)
+          (rx/subs (fn [event]
+                     (try
+                       (swap! state* #(update event %))
+                       (catch :default e
+                         (.add failset event)
+                         (process-error e))))))
+
+     ;; side effectful subscription for watch events
+     (->> (rx/filter watch? input-sm)
+          (rx/filter (fn [e] (not ^boolean (.has ^js failset e))))
+          (rx/subs #(process-watch input-sm input-sb @state* %)))
+
+     ;; side effectful subscription for effect events
+     (->> (rx/filter effect? input-sm)
+          (rx/filter (fn [e] (not ^boolean (.has ^js failset e))))
+          (rx/subs #(process-effect input-sm @state* %)))
+
+     (specify! state*
+       Store
+       (-push [_ event]
+         (rx/push! input-sb event))
+
+       (-input-stream [_]
+         input-sm)
+
+       rx/IDisposable
+       (-dispose [_]
+         (rx/end! input-sb))))))

 (defn emit!
   "Emits an event or a collection of them into the default store.