Added 2 pooling layer tests related to negative inputs

--- test/clj/cortex/convolutional_layer_tests.clj
+++ test/clj/cortex/convolutional_layer_tests.clj
@@ -35,7 +35,8 @@
         input (b/array  (flatten (map #(repeat num-channels %)
                                               (range 1 (+ (* input-dim input-dim) 1)))))
         weights (b/array  (map #(repeat (* k-dim k-dim num-channels) %)
-                                       (range 1 (+ n-kernels 1))))
+                                       ;(range 1 (+ n-kernels 1))))
+                                       (take n-kernels (repeat -1))))
         bias (b/zero-array  [1 n-kernels])]
     (conv/->Convolutional weights bias conv-config)))

@@ -99,6 +100,46 @@
              (m/eseq input-gradient))))))

+(deftest pool-layer-negative-input
+  "Test the pooling layer output when input is negative"
+  (let [pool-layer (conv/->Pooling pool-layer-config)
+        input (b/array (range -8 8))
+        forward-pool-layer (core/forward pool-layer input)
+        output-gradient (b/array  [1 2 3 4])
+        backward-pool-layer (core/backward forward-pool-layer input output-gradient)
+        input-gradient (core/input-gradient backward-pool-layer)]
+    (is (= (map double [-5 -1 3 7])
+           (m/eseq (core/output forward-pool-layer))))
+    (is (= (map double (flatten (map #(vector 0 0 0 %) (range 1 5))))
+           (m/eseq input-gradient)))
+    (let [input (b/array  (range 8 -8 -1))
+          forward-pool-layer (core/forward backward-pool-layer input)
+          output-gradient (b/array  [1 2 3 4])
+          backward-pool-layer (core/backward forward-pool-layer input output-gradient)
+          input-gradient (core/input-gradient backward-pool-layer)]
+      (is (= (map double [8 4 0 -4])
+             (m/eseq (core/output forward-pool-layer))))
+      (is (= (map double (flatten (map #(vector % 0 0 0) (range 1 5))))
+             (m/eseq input-gradient))))))
+
+
+(deftest pool-layer-negative-weights
+  "Test the pooling layer output when input-size and pooling size are not exactly divisible
+which causes a partial window at the boundry"
+  (let [pool-layer (conv/->Pooling (conv/create-conv-layer-config 6 6 2 2 0 0 2 2 1 1))
+        input (b/array (repeat 36 -11))
+        forward-pool-layer (core/forward pool-layer input)]
+    (is (= (map double (into [] (repeat 9 -11)))
+           (m/eseq (core/output forward-pool-layer))))
+    (let [pool-layer (conv/->Pooling (conv/create-conv-layer-config 6 6 3 3 0 0 2 2 1 1))
+          forward-pool-layer (core/forward pool-layer input)]
+      (is (= (map double (into [] (repeat 9 -11)))
+           (m/eseq (core/output forward-pool-layer)))))
+    (let [pool-layer (conv/->Pooling (conv/create-conv-layer-config 6 6 3 3 0 0 2 2 1 1))
+          input (b/array (repeat 36 11))
+          forward-pool-layer (core/forward pool-layer input)]
+      (is (= (map double (into [] (repeat 9 11)))
+           (m/eseq (core/output forward-pool-layer)))))))

 (def conv-layer-pad-config (conv/create-conv-layer-config 3 3 2 2 0 0 1 1 1))


install event handler

install event handler

--- src/cljs/infinitelives/utils/events.cljs
+++ src/cljs/infinitelives/utils/events.cljs
@@ -116,3 +116,9 @@
   (.preventDefault ev)

   true)
+
+(defn install-key-handler!
+  "install the keyup and keydown event handlers"
+  []
+  (.addEventListener js/window "keydown" handle-keydown-event)
+  (.addEventListener js/window "keyup" handle-keyup-event))


experimental hammer.js stuff

experimental hammer.js stuff

--- src/cljs/infinitelives/utils/events.cljs
+++ src/cljs/infinitelives/utils/events.cljs
@@ -305,3 +305,19 @@

 (def get-gamepads (make-get-gamepads))

+;;
+;; touch wrapper (hammer.js)
+;;
+(comment
+  (defn touch-channel
+    [el]
+    (let [c (chan)]
+      (doto (js/Hammer. el)
+        (.on "pan" #(put! c [:pan ^js/Event %]))
+                                        ;(.on "tap" #(put! c [:tap ^js/Event %]))
+        (.on "doubletap" #(put! c [:doubletap %]))
+                                        ;(.on "pinch" #(put! c [:pinch %]))
+                                        ;(.on "rotate" #(put! c [:rotate %]))
+                                        ;(.on "swipe" #(put! c [:swipe %]))
+        )
+      c)))


handle both cases in the same way

handle both cases in the same way

--- src/cljs/just_married/home/handlers.cljs
+++ src/cljs/just_married/home/handlers.cljs
@@ -39,6 +39,7 @@
    :http-xhrio {:method          :post
                 :uri             "/api/rvsp"
                 :params          (assoc (:rvsp db) :coming value)
+                ;; could use EDN as well here potentially
                 :format          (ajax/json-request-format)
                 :response-format (ajax/json-response-format {:keywords? true})
                 :on-success      [:confirmation-sent]
@@ -48,16 +49,23 @@
  :send-notification
  rvsp)

+(defn handle
+  [response]
+  (when (= 201 (:status response))
+    (js/alert "Thanks for letting us know")))
+
+;;XXX: getting strangely cjls-ajax to report failure
+;;even if in fact it worked and it was a 201 response
 (reg-event-db
  :confirmation-sent
  (fn [db [_ response]]
-   (js/alert (:original-text response))
+   (handle response)
    db))

 (reg-event-db
  :confirmation-not-sent
  (fn [db [_ response]]
-   (js/alert "Could not submit")
+   (handle response)
    db))

 (reg-event-db


Refactorings

Refactorings

--- src/cljs/load_test_client/histogram.cljs
+++ src/cljs/load_test_client/histogram.cljs
@@ -17,25 +17,25 @@
       (.range #js [0 chart-width])))

 (defn render-bar [x-scale y-scale bar]
-  (dom/g #js {:transform (str "translate("
-                              (x-scale (.-x bar)) ","
-                              (y-scale (.-y bar)) ")")
-              :className "bar"}
+  (let [scaled-x (x-scale (.-x bar))
+        scaled-y (y-scale (.-y bar))
+        scaled-dx (x-scale (.-dx bar))]
+    (dom/g #js {:transform (str "translate(" scaled-x "," scaled-y ")")
+                :className "bar"}
+           (dom/rect #js {:width (dec scaled-dx)
+                          :height (- chart-height scaled-y)})
+           (dom/text #js {:dy "0.75em"
+                          :y 6
+                          :x (/ scaled-dx 2)
+                          :textAnchor "middle"}
+                     (when (pos? (.-y bar)) (.-y bar))))))

+(defn render-x-axis-path [x-scale]
+  (let [rng (.range x-scale)]
+    (dom/path #js {:className "domain"
+                   :d (str "M0" (aget rng 0) ",6V0H" (aget rng 1) "V6")})))

-         (dom/rect #js {:width (dec (x-scale (.-dx bar)))
-                        :height (- chart-height (y-scale (.-y bar)))})
-
-         (dom/text #js {:dy "0.75em"
-                        :y 6
-                        :x (/ (x-scale (.-dx bar)) 2)
-                        :textAnchor "middle"}
-                   (when (pos? (.-y bar)) (.-y bar)))))
-
-(defn render-x-axis-path []
-  (dom/path #js {:className "domain" :d (str "M0,6V0H" chart-width "V6")}))
-
-(defn render-x-axis-ticks [data x-scale]
+(defn render-x-axis-ticks [x-scale]
   (let [tick-arguments (array 10)
         ticks (if (.-ticks x-scale)
                 (.apply (.-ticks x-scale) x-scale tick-arguments)
@@ -61,7 +61,6 @@
             data ((-> (.. js/d3 -layout histogram)
                       (.bins (.ticks x-scale 20)))
                   (apply array response-times))
-
             y-scale (get-y-scale data)]

         (dom/div #js {:className "chart response-time-histogram"}
@@ -69,6 +68,6 @@
                                :height (+ chart-height top bottom)}
                           (apply dom/g #js {:transform (str "translate(" left "," top ")")}
                                  (dom/g #js {:className "x axis" :transform (str "translate(0," chart-height ")")}
-                                        (render-x-axis-path)
-                                        (render-x-axis-ticks data x-scale))
+                                        (render-x-axis-path x-scale)
+                                        (render-x-axis-ticks x-scale))
                                  (map #(render-bar x-scale y-scale %) data))))))))


Remove home link from navbar as the site name already fills that purpose

--- src/cljs/my_money/components/navbar.cljs
+++ src/cljs/my_money/components/navbar.cljs
@@ -5,13 +5,6 @@
             [my-money.views.login :as login]
             [my-money.views.registration :as registration]
             [my-money.routes :as routes]))
-
-(defn nav-link [uri title page collapsed?]
-  [:li.nav-item
-   {:class (when (= page (session/get :page)) "active")}
-   [:a.nav-link
-    {:href uri
-     :on-click #(reset! collapsed? true)} title]])

 (defn user-menu [e!]
   [:ul.flex.pl-0.mb-0.list-none.ml-auto
@@ -36,7 +29,6 @@
      [:div.collapse.navbar-collapse
       (when-not @collapsed? {:class "show"})
       [:ul.flex.pl-0.mb-0.list-none
-       [nav-link "#/" "Home" :home collapsed?]
        (when (session/get :identity)
          [:<>
           [:button.btn.btn-outline-info.fa.fa-cog.fa-inverse.ml-1 {:on-click #(routes/navigate! :config)}]


Let you know what % of your functions are tested

--- src/cake/tasks/coverage.clj
+++ src/cake/tasks/coverage.clj
@@ -39,19 +39,28 @@
 (defn used-symbols [file]
   (filter symbol? (flatten (read-all (java.io.PushbackReader. (reader file))))))

-(defn un-tested-symbols []
-  (let [targets (testable-symbols (testable-namespaces))
-        tested (set (mapcat used-symbols (clj-test-files)))
-        untested (remove (comp tested symbol name) targets)]
+(defn un-tested-symbols [testables]
+  (let [tested (set (mapcat used-symbols (clj-test-files)))
+        untested (remove (comp tested symbol name) testables)]
     (into {} (for [[ns syms] (group-by namespace untested)]
                [ns (map name syms)]))))

 (deftask coverage
-  (when-let [needed-additions (not-empty (un-tested-symbols))]
-    (print "The following functions appear to be untested:")
-    (let [width (apply max (map #(.length (key %)) needed-additions))
-          fmt (str "%n  %" width "s:")]
-      (doseq [[ns syms] needed-additions]
-        (print (format fmt ns))
-        (doseq [s syms] (print (str " " s))))
-      (.flush *out*)))) ;; since we're not getting println's auto-flush
+  (let [testables (testable-symbols (testable-namespaces))
+        needed-additions (not-empty (un-tested-symbols testables))
+        untested-count (apply + (map (comp count val) needed-additions))
+        tested-ratio (- 1 (/ untested-count (count testables)))
+        [fmt ratio] (cond
+                     (= 1 tested-ratio)    ["Great!"         1]
+                     (<= 1/2 tested-ratio) ["Almost done..." tested-ratio]
+                     (zero? tested-ratio)  ["Get to work!"   0]
+                     :else                 ["Keep it up!"    (- 1 tested-ratio)])
+        fmt (str "%n%n%2.0f%% of public functions are tested! " fmt)]
+    (when needed-additions
+      (print "The following functions appear to be untested:")
+      (let [width (apply max (map #(.length (key %)) needed-additions))
+            fmt (str "%n  %" width "s:")]
+        (doseq [[ns syms] needed-additions]
+          (print (format fmt ns))
+          (doseq [s syms] (print (str " " s))))))
+    (println (format fmt (* 100.0 ratio)))))


Refactored like/ilike to use a helper function to convert sql pattern into a regex string

--- src/cfpb/qu/query/where.clj
+++ src/cfpb/qu/query/where.clj
@@ -65,26 +65,30 @@

 (declare mongo-eval-not)

+(defn sql-pattern-to-regex-str
+  "Converts a SQL search string, such as 'foo%', onto a regular expression string"
+  [value]
+  (str "^"
+    (str/replace value
+      #"[%_]|[^%_]+"
+      (fn [match]
+        (case match
+          "%" ".*"
+          "_" "."
+          (Pattern/quote match))))
+    "$"))
+
 (defn like-to-regex
   "Converts a SQL LIKE value into a regular expression."
   [like]
-  (re-pattern
-    (str "^"
-         (str/replace like
-                      #"[%_]|[^%_]+"
-                      (fn [match]
-                        (case match
-                          "%" ".*"
-                          "_" "."
-                          (Pattern/quote match))))
-         "$")))
+  (re-pattern (sql-pattern-to-regex-str like)))

 (defn ilike-to-regex
   "Converts a SQL ILIKE value into a regular expression."
   [ilike]
   (re-pattern
     (str "(?i)"
-      (.pattern (like-to-regex ilike)))))
+      (sql-pattern-to-regex-str ilike))))

 (defn mongo-eval


thread prev-seg through all the encode loops

--- src/clj/cljs/source_map.clj
+++ src/clj/cljs/source_map.clj
@@ -76,11 +76,8 @@
              (recur (inc gline) (next lines) (assoc relseg 0 0) result))
            result)))))

-;; TODO: the lastseg needs to be passed into encode-cols - everything
-;; but :gcol is relative
-
-(defn encode-cols [vs source-idx line col names->idx name-idx]
-  (loop [vs (seq vs) lastseg nil cols-segs []]
+(defn encode-cols [vs prev-seg source-idx line col names->idx name-idx]
+  (loop [vs (seq vs) prev-seg prev-seg cols-segs []]
     (if vs
       (let [v (first vs)
             seg [(:gcol v) source-idx line col]
@@ -93,40 +90,43 @@
                                 cidx))]
                     (conj seg idx))
                   seg)
-            relseg (if lastseg
-                      (into [] (map - seg lastseg))
+            relseg (if prev-seg
+                      (into [] (map - seg prev-seg))
                       seg)]
         (recur (next vs)
           (if (and (= (count seg) 4)
-                   (= (count lastseg) 5))
-            (conj seg (peek lastseg))
+                   (= (count prev-seg) 5))
+            (conj seg (peek prev-seg))
             seg)
           (conj cols-segs (base64-vlq/encode relseg))))
-      cols-segs)))
+      {:col-segs cols-segs
+       :prev-seg prev-seg})))

-(defn encode-source [lines segs source-idx names->idx name-idx]
-  (loop [lines (seq lines) segs segs]
+(defn encode-source [lines segs prev-seg source-idx names->idx name-idx]
+  (loop [lines (seq lines) segs segs prev-seg prev-seg]
     (if lines
       (let [[line cols] (first lines)
-            segs
-            (loop [cols (seq cols) segs segs]
+            {:keys [segs prev-seg]}
+            (loop [cols (seq cols) segs segs prev-seg prev-seg]
               (if cols
                 (let [[col vs] (first cols)
-                      col-segs (encode-cols vs source-idx line col names->idx name-idx)]
-                  (recur (next cols) (conj segs col-segs)))
-                segs))]
-        (recur (next lines) segs))
-      segs)))
+                      {:keys [col-segs prev-seg]}
+                      (encode-cols vs prev-seg source-idx line col names->idx name-idx)]
+                  (recur (next cols) (conj segs col-segs) prev-seg))
+                {:segs segs :prev-seg prev-seg}))]
+        (recur (next lines) segs prev-seg))
+      {:segs segs :prev-seg prev-seg})))

 (defn encode [m opts]
   (let [names->idx (atom {})
         name-idx   (atom 0)
-        segs (loop [sources (seq m) source-idx 0 segs []]
-               (if sources
-                 (let [[source lines] (first sources)
-                       segs (encode-source lines segs source-idx names->idx name-idx)]
-                   (recur (next sources) (inc source-idx) segs))
-                 segs))]
+        {:keys [segs]}
+        (loop [sources (seq m) prev-seg nil source-idx 0 segs []]
+          (if sources
+            (let [[source lines] (first sources)
+                  segs (encode-source lines segs prev-seg source-idx names->idx name-idx)]
+              (recur (next sources) prev-seg (inc source-idx) segs))
+            segs))]
     (with-out-str
       (json/pprint
        {"version" 3


added documentation for new functions.

added documentation for new functions.

--- src/clj/forma/date_time.clj
+++ src/clj/forma/date_time.clj
@@ -107,10 +107,10 @@
 (def eights (partial delta-periods julian 8))

 (defn periodize
-  "Converts the supplied integers into a reference time interval at
-the supplied temporal resolution. Input can be any number of pieces of
-a date, from greatest to least significance. See clj-time's date-time
-function for more information."
+  "Converts the supplied `org.joda.time.DateTime` object into a
+reference time interval at the supplied temporal
+resolution. `DateTime` objects can be created with `clj-time`'s
+`date-time` function."
   [temporal-res date]
   (let [period-func (case temporal-res
                           "32" months
@@ -119,8 +119,10 @@
     (period-func (time/epoch) date)))

 (defn datetime->period
-  "Converts a datestring, formatted as `YYYY-MM-DD`, into an integer
-  time period at the supplied temporal resolution."
+  "Converts a formatted datestring, into an integer time period at the
+  supplied temporal resolution. The default format is
+  `:year-month-day`, or `YYYY-MM-DD`; additional datestrings can by
+  viewed with `(clj-time.format/show-formatters)`."
   ([res datestring]
      (datetime->period res datestring :year-month-day))
   ([res datestring format]


fix: avoid StackOverflowError while reading a VCF with many lines of meta

With current implementation, many lines of meta (say 4k lines of contig definition) causes StackOverflowError like below.

```
 :cause nil
 :via
 [{:type java.lang.StackOverflowError
   :message nil
   :at [clojure.lang.PersistentHashMap$BitmapIndexedNode ensureEditable "PersistentHashMap.java" 812]}]
 :trace
 [[clojure.lang.PersistentHashMap$BitmapIndexedNode ensureEditable "PersistentHashMap.java" 812]
  [clojure.lang.PersistentHashMap$BitmapIndexedNode assoc "PersistentHashMap.java" 894]
  [clojure.lang.PersistentHashMap$TransientHashMap doAssoc "PersistentHashMap.java" 327]
  [clojure.lang.ATransientMap assoc "ATransientMap.java" 64]
  [clojure.lang.PersistentHashMap create "PersistentHashMap.java" 78]
  [clojure.core$hash_map invokeStatic "core.clj" 389]
  [clojure.core$hash_map doInvoke "core.clj" 381]
  [clojure.lang.RestFn applyTo "RestFn.java" 137]
  [clojure.core$apply invokeStatic "core.clj" 667]
  [clojure.core$apply invoke "core.clj" 662]
  [cljam.io.vcf.reader$parse_data_line invokeStatic "reader.clj" 173]
  [cljam.io.vcf.reader$parse_data_line invoke "reader.clj" 154]
  [cljam.io.vcf.reader$read_data_lines invokeStatic "reader.clj" 181]
  [cljam.io.vcf.reader$read_data_lines invoke "reader.clj" 175]
  [cljam.io.vcf.reader$read_data_lines invokeStatic "reader.clj" 183]

;; continues recursive call's stack trace
```

I fixed the problem explicitly call `recur` to utlize tail call optimization.

--- src/cljam/io/vcf/reader.clj
+++ src/cljam/io/vcf/reader.clj
@@ -180,7 +180,7 @@
     (if-not (or (meta-line? line) (header-line? line))
       (cons (parse-data-line line kws)
             (lazy-seq (read-data-lines rdr header kws)))
-      (read-data-lines rdr header kws))))
+      (recur rdr header kws))))

 (defn read-variants
   ([rdr]


Fix OS to image icon map

Fix OS to image icon map

--- src/cljs/app/templates.cljs
+++ src/cljs/app/templates.cljs
@@ -9,7 +9,7 @@
 (def icon-files
   {"Windows" "images/windows.svg"
    "Linux" "images/linux.svg"
-   "Mac OS X" "images/apple.svg"
+   "macOS" "images/apple.svg"
    "Other" ""
    "Installer" "images/monitor.svg"
    "Portable" "images/archive.svg"


Overkill for drawing rectangles it seems to me

--- src/cljs/kindness/game.cljs
+++ src/cljs/kindness/game.cljs
@@ -302,9 +302,7 @@
         surface (:surface @game-state)]
     ;;(println "name:" (:name e) "x,y:" [x y] "width, height:" [width height] "color:" color)
     (set! (.-fillStyle surface) color)
-    (.fillRect surface x y width height)
-    (set! (.-lineWidth surface) 0)
-    (.strokeRect surface x y width height)))
+    (.fillRect surface x y width height)))
 (defmethod draw :background [e]
   (let [renderable (utils/find-component :renderable e)
         color (:color renderable)


Game logic, continued

Game logic, continued

--- src/cljs/triboard/core.cljs
+++ src/cljs/triboard/core.cljs
@@ -84,6 +84,15 @@
       (take-while is-cell-owned?)) ;; TODO - Use partition ?
     (range-coord [x y] [dx dy])))

+(defn convertible-cells
+  [board [x y] [dx dy] player]
+  (let [cells (range-cells board [(+ x dx) (+ y dy)] [dx dy])
+        [head tail :as cell-groups] (partition-by identity cells)]
+    (cond
+      (<= (count cell-groups) 1) []
+      (= player (first tail)) (vec head)
+      :else [])))
+
 ;; -----------------------------------------

 (defonce app-state (atom (new-game)))


Optimization of game engine

Optimization of game engine

--- src/cljs/triboard/core.cljs
+++ src/cljs/triboard/core.cljs
@@ -57,30 +57,35 @@
 ;; IDENTIFY CONVERTIBLE CELLS
 ;; -----------------------------------------

-(defn range-coord
-  "Give all the coordinate in the provided direction"
-  [[xi yi] [dx dy]]
-  (loop [x xi, y yi, res []]
-    (if (or (neg? x) (neg? y) (> x board-width) (> y board-height))
-      res
-      (recur (+ x dx) (+ y dy) (conj res [x y])))
-    ))
-
-(defn ^boolean is-cell-owned?
+(defn ^boolean not_in-board?
+  [x y]
+  (or (neg? x) (neg? y) (> x board-width) (> y board-height)))
+
+(defn ^boolean is-cell-empty?
   "Indicates whether a cell is owned by any player"
   [cell]
-  (and (not= cell :empty) (not= cell :wall)))
+  (or (= cell :empty) (= cell :wall)))
+
+(defn range-coord
+  "Give all the pairs [cell coordinate] in the provided direction"
+  [board [xi yi] [dx dy]]
+  (loop [x xi, y yi, res []]
+    (if (or (not_in-board? x y) (is-cell-empty? (get-in board [x y])))
+      res
+      (recur
+        (+ x dx)
+        (+ y dy)
+        (conj res [(get-in board [x y]) [x y]])))
+    ))

 (defn range-cells ;; TODO - Use the concept of sentinel for the walls?
   "Give all the cells in the provided direction - until you reach an empty / blocked / wall cell"
   [board pos dir]
   (eduction
     (comp
-      (map (juxt #(get-in board %) identity))
-      (take-while #(-> % first is-cell-owned?))
       (partition-by first)
       (map (juxt #(-> % first first) #(mapv second %))))
-    (range-coord pos dir)))
+    (range-coord board pos dir)))

 (defn available-cells-by-dir
   "Indicates the convertible cells for the provided player - when clicking at [x y]


Add basic looping methods.

Add basic looping methods.

--- src/clojurecraft/events.clj
+++ src/clojurecraft/events.clj
@@ -10,12 +10,16 @@
   (dosync (alter (:event-handlers bot) dissoc event-type)))

+(defn- handle-action-group [bot action-group]
+  (println action-group)
+  (let [queue-action #(.put (:actionqueue bot) %)
+        queue-action-group #(dorun (map queue-action %))]
+    (queue-action-group action-group)))
+
 (defn- fire-handler [bot event-type & args]
   (let [action-groups (map #(apply (deref %) (into [bot] args))
-                           (event-type @(:event-handlers bot)))
-        queue-action #(.put (:actionqueue bot) %)
-        queue-action-group #(dorun (map queue-action %))]
-    (dorun (map queue-action-group action-groups))))
+                           (event-type @(:event-handlers bot)))]
+    (dorun (map handle-action-group (cycle [bot]) action-groups))))

 (defn fire-chat [bot message]
@@ -24,3 +28,11 @@
 (defn fire-dead [bot]
   (fire-handler bot :dead))

+
+(defn- run-loop [bot function sleep-ms]
+  (while (nil? (:exit @(:connection bot)))
+    (handle-action-group bot (function bot))
+    (Thread/sleep sleep-ms)))
+
+(defn add-loop [bot function sleep-ms]
+  (.start (Thread. #(run-loop bot function sleep-ms))))


Fix bad Last-Modified header :unamused: #1230

--- src/metabase/routes.clj
+++ src/metabase/routes.clj
@@ -6,21 +6,17 @@
             [ring.util.response :as resp]
             [stencil.core :as stencil]
             [metabase.api.routes :as api]
-            [metabase.models.setting :as setting]))
+            [metabase.models.setting :as setting]
+            [metabase.util :as u]))

 (defn- index [_]
-  (if ((resolve 'metabase.core/initialized?))
-    (-> (io/resource "frontend_client/index.html")
-        slurp
-        (stencil/render-string {:bootstrap_json (json/generate-string (setting/public-settings))})
-        resp/response
-        (resp/content-type "text/html")
-        (resp/header "Last-Modified" "{now} GMT"))
-    (-> (io/resource "frontend_client/init.html")
-        slurp
-        resp/response
-        (resp/content-type "text/html")
-        (resp/header "Last-Modified" "{now} GMT"))))
+  (-> (if (@(resolve 'metabase.core/initialized?))
+        (stencil/render-string (slurp (io/resource "frontend_client/index.html"))
+                               {:bootstrap_json (json/generate-string (setting/public-settings))})
+        (slurp (io/resource "frontend_client/init.html")))
+      resp/response
+      (resp/content-type "text/html")
+      (resp/header "Last-Modified" (u/format-date :rfc822))))

 ;; Redirect naughty users who try to visit a page other than setup if setup is not yet complete
 (defroutes routes


proper desactivation of card on rez and forfeit

--- src/node/game/core.cljs
+++ src/node/game/core.cljs
@@ -32,7 +32,7 @@
     (swap! state update-in [side (first r)] #(+ % (last r)))))

 (defn desactivate [state side card]
-  (let [c (dissoc card :counter :advance-counter :current-strength :abilities)
+  (let [c (dissoc card :counter :advance-counter :current-strength :abilities :rezzed)
         cdef (card-def card)]
     (when-let [leave-effect (:leave-play (card-def card))]
       (leave-effect state side card nil))
@@ -556,8 +556,7 @@

 (defn derez [state side {:keys [card]}]
   (system-msg state side (str "derez " (:title card)))
-  (update! state side (dissoc card :rezzed))
-  (desactivate state side card))
+  (update! state side (desactivate state side card)))

 (defn advance [state side {:keys [card]}]
   (when (pay state side :click 1 :credit 1)
@@ -566,8 +565,7 @@

 (defn forfeit [state side {:keys [card]}]
   (system-msg state side (str "forfeits " (:title card)))
-  (desactivate state side card)
-  (move state side card :rfg)
+  (move state side (desactivate state side card) :rfg)
   (gain state side :agenda-point (- (:agendapoints card))))

 (defn move-card [state side {:keys [card server]}]


Remove unused require.

Remove unused require.

--- src/onyx/plugin/seq.clj
+++ src/onyx/plugin/seq.clj
@@ -1,6 +1,5 @@
 (ns onyx.plugin.seq
-  (:require [clojure.core.async :refer [poll! timeout chan alts!! >!! close!]]
-            [clojure.core.async.impl.protocols]
+  (:require [clojure.core.async.impl.protocols]
             [clojure.set :refer [join]]
             [onyx.plugin.protocols :as p]
             [taoensso.timbre :refer [fatal info debug] :as timbre]))


Fixed requires.

Fixed requires.

--- dev-resources/src/dragon/dev.clj
+++ dev-resources/src/dragon/dev.clj
@@ -12,9 +12,9 @@
             [clojure.walk :refer [macroexpand-all]]
             [clojusc.twig :as logger]
             [dragon.cli :as cli]
+            [dragon.content.rfc5322 :as rfc5322]
             [dragon.generator :as generator]
             [dragon.main :as main]
-            [dragon.post.rfc5322 :as rfc5322]
             [dragon.util :as util]
             [dragon.web :as web]
             [dragon.web.content :as content]
@@ -22,11 +22,9 @@
             [selmer.parser :as selmer]
             [taoensso.timbre :as log]
             [trifl.core :refer [->int]]
-            [trifl.java :as java]))
+            [trifl.java :refer [show-methods]]))

 (logger/set-level! '[dragon clojang] :debug)
-
-(def show-methods #'java/show-methods)

 ;;; Aliases


Record user name too

Record user name too

--- src/layzee/use_cases/realtime_sample.clj
+++ src/layzee/use_cases/realtime_sample.clj
@@ -1,15 +1,17 @@
 (ns layzee.use-cases.realtime-sample
   (:require [layzee.adapters.journal :as journal]))

+(defn- clean[text] (.replace text "\n" ""))
+
 (defn- console[tweet]
-  (let [text (get tweet "text") created-at (get tweet "created_at")]
+  (let [text (clean (get tweet "text")) created-at (get tweet "created_at")]
     (when (not (nil? text))
       (println (format "[%s] -- %s" created-at text)))))

 (defn- record[tweet]
-  (let [text (get tweet "text") created-at (get tweet "created_at")]
+  (let [text (clean (get tweet "text")) created-at (get tweet "created_at") screen-name (get-in tweet ["user" "screen_name"])]
     (when (not (nil? text))
-      (journal/record (format "[%s] -- %s" created-at text)))))
+      (journal/record (format "[%s] -- @%s -- %s" created-at screen-name text)))))

 (defn- view[tweet]
   (console tweet)


handle chessground move callback to insert move

--- src/main/cljs/chessdojo/views/board.cljs
+++ src/main/cljs/chessdojo/views/board.cljs
@@ -4,7 +4,8 @@
     [chessdojo.state :as cst]
     [chessdojo.fen :as cf]
     [chessdojo.rules :as cr]
-    [clojure.zip :as zip]))
+    [clojure.zip :as zip]
+    [chessdojo.game :as cg]))

 (enable-console-print!)

@@ -12,12 +13,20 @@
   (let [position (:position (zip/node game))
         valid-moves (cr/valid-moves position)
         from-to (map #(select-keys % [:from :to]) valid-moves)
-        grouped-by-from (group-by :from from-to)
-        ]
-    (reduce-kv #(assoc %1 (cr/to-sqr %2) (map cr/to-sqr (map :to %3))) {} grouped-by-from)
+        grouped-by-from (group-by :from from-to)]
+    (reduce-kv #(assoc %1 (cr/to-sqr %2) (map cr/to-sqr (map :to %3))) {} grouped-by-from)))

-    )
-  )
+(defn insert-move [from to meta]
+  (do
+    (println (str "insert move: " from " " to " " (js->clj meta)))
+    (let [buffer @cst/main-buffer
+          game (:game buffer)
+          move-coords {:from (cr/to-idx (keyword from)) :to (cr/to-idx (keyword to))}
+          new-game (cg/insert-move game move-coords)]
+      (swap! cst/main-buffer assoc :game new-game))))
+
+;(defn ^:export set-comment [comment]
+;  (reset! current-game (cg/set-comment @current-game comment)))

 (defn create-chessground-options []
   (let [buffer @cst/main-buffer
@@ -28,6 +37,9 @@
                    :free       false
                    :dests      (move-destinations game)
                    :show-dests true
+                   :events     {
+                                :after insert-move
+                                }
                    }
      }
     )


gallery and photo components added

gallery and photo components added

--- src/photosure/core.cljs
+++ src/photosure/core.cljs
@@ -2,20 +2,24 @@
   (:require [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true]))

-(def app-state (atom {:list ["Lion" "Zebra"]}))
+(def app-state (atom {:list ["I", "LOVE", "YOU"]}))

-
-(defn gallery [state owner]
+(defn photo [title owner]
   (reify
     om/IRender
     (render [this]
-      (dom/div #js {:id "backdrop"}
-               (dom/div nil "Beginning")
-               (dom/div nil "Middle")
-               (dom/div nil "End")))))
+      (dom/div nil title))))
+
+(defn gallery [titles owner]
+  (reify
+    om/IRender
+    (render [this]
+      (apply dom/div
+             nil
+             (om/build-all photo (:list titles))))))

-(defn run [app]
+(defn run [app app-state]
   (om/root app app-state {:target (. js/document (getElementById "app"))}))

-(run gallery)
+(run gallery app-state)


added mumsnet guest post

added mumsnet guest post

--- src/prais2/content.cljc
+++ src/prais2/content.cljc
@@ -1159,6 +1159,8 @@
                                 [:a (core/href "https://www.rcsed.ac.uk/news-public-affairs/news/2016/june/understanding-children-s-heart-surgery-outcomes" :target "_blank") "Royal College of Surgeons of Edinburgh:"] " “Understanding Children’s Heart Surgery Outcomes”"]
                                [:li
                                 [:a (core/href "http://www.insight.mrc.ac.uk/2016/07/29/beyond-open-making-data-accessible/" :target "_blank") "Insight: Medical Research Council"] " “Beyond open: making your data accessible”"]
+                               [:li
+                                [:a (core/href "http://www.mumsnet.com/Talk/guest_posts/2699023-Guest-post-I-hope-weve-helped-others-preparing-for-their-childs-heart-surgery" :target "_blank") "Mumsnet guest post:"] " “I hope we've helped others preparing for their child's heart surgery”"]
                                ]
                               ]
                }]}


default histogram buckets are in seconds

--- src/prometheus/core.clj
+++ src/prometheus/core.clj
@@ -15,9 +15,9 @@
 (defn- make-request-histogram [app-name registry]
   (-> (Histogram/build)
       (.namespace app-name)
-      (.name "http_request_durations_milliseconds")
+      (.name "http_request_latency_seconds")
       (.labelNames (into-array String ["method" "status" "path"]))
-      (.help "A histogram of the response latency for HTTP requests (in milliseconds).")
+      (.help "A histogram of the response latency for HTTP requests in seconds.")
       (.register registry)))

 (defn- record-request-metric [counter histogram request-method response-status request-time response-path]
@@ -27,7 +27,7 @@
     (-> (.labels counter labels)
         (.inc))
     (-> (.labels histogram labels)
-        (.observe (double request-time)))))
+        (.observe request-time))))

 (defn instrument-handler [handler ^String app-name ^CollectorRegistry registry]
   "Ring middleware to record request metrics"
@@ -38,9 +38,9 @@
             start-time (System/currentTimeMillis)
             response (handler request)
             finish-time (System/currentTimeMillis)
-            request-time (- finish-time start-time)
             response-status (get response :status 404)
-            response-path (get (meta response) :path "unspecified")]
+            response-path (get (meta response) :path "unspecified")
+            request-time (/ (double (- finish-time start-time)) 1000.0)]
         (record-request-metric counter histogram request-method response-status request-time response-path)
         response))))


Add curve-point, curve-tangent to curve/curve.cljx example.

--- src/quil_cljs_examples/curves/curve.cljs
+++ src/quil_cljs_examples/curves/curve.cljs
@@ -5,12 +5,19 @@

 (defn draw []
 	(q/background 255)
-	(q/stroke 255 102 0)
-	(q/curve 5 26 5 26 73 23 73 61)
+	(q/no-fill)
 	(q/stroke 0)
 	(q/curve 5 26 73 24 73 61 15 65)
-	(q/stroke 255 102 0)
-	(q/curve 73 24 73 61 15 65 15 65))
+	(doseq [i (range 6)]
+		(let [t (/ i 6.0)
+			  x  (q/curve-point 5 73 73 15 t)
+			  y  (q/curve-point 26 24 61 65 t)
+			  tx (q/curve-tangent 5 73 73 15 t)
+			  ty (q/curve-tangent 26 24 61 65 t)
+			  a  (- (q/atan2 ty tx) q/HALF_PI)
+			  x2 (+ x (* 8 (q/cos a)))
+			  y2 (+ y (* 8 (q/sin a)))]
+			  (q/line x y x2 y2))))

 (defsketch curve


Correct argument order error in fluid density

--- src/test_utils/fracture_diagnostics.cljc
+++ src/test_utils/fracture_diagnostics.cljc
@@ -608,7 +608,7 @@
   ([]
    (typical-density :liquid))
   ([density-unit]
-   (typical-density :liquid density-unit)))
+   (typical-density density-unit :liquid)))

 (defn typical-total-pump-energy
   ([]


Improve generichash_test with doseq

Improve generichash_test with doseq

Thanks, Leon Grapenthin!

--- test/caesium/crypto/generichash_test.clj
+++ test/caesium/crypto/generichash_test.clj
@@ -29,6 +29,7 @@
          :personal (.getBytes "fedcba9876543210")]
         (unhexify "9479874d504f0447d43d72a969c989c34032172276ac50077e0027277c3c8d867bee9ee314c8506e4e4a9b3030b989d3eb7b4c1826c8e0d56e6aa71b1d4cf388")))
   (testing "blake2b defaults are accurate"
-    (let [results (map #(apply blake2b %) blake2b-empty-args-variations)
-          empty-string-digest? (partial array-eq empty-string-digest)]
-      (is (every? empty-string-digest? results)))))
+    (doseq [args blake2b-empty-args-variations]
+      (is (array-eq (apply blake2b args)
+                    empty-string-digest)
+          (str "args: " args)))))


Check a bunch of consts

Check a bunch of consts

--- test/caesium/crypto/generichash_test.clj
+++ test/caesium/crypto/generichash_test.clj
@@ -4,15 +4,35 @@
    [caesium.util :refer [unhexify array-eq]]
    [clojure.test :refer :all]
    [caesium.vectors :as v]
-   [caesium.util :as u]))
+   [caesium.util :as u]
+   [caesium.crypto.hash :as h]))
+
+(deftest const-tests
+  (are [const expected] (= expected const)
+    32 g/bytes
+    16 g/bytes-min
+    64 g/bytes-max
+
+    32 g/keybytes
+    16 g/keybytes-min
+    64 g/keybytes-max
+
+    32 g/blake2b-bytes
+    16 g/blake2b-bytes-min
+    64 g/blake2b-bytes-max
+
+    32 g/blake2b-keybytes
+    16 g/blake2b-keybytes-min
+    64 g/blake2b-keybytes-max
+
+    16 g/blake2b-saltbytes
+    16 g/blake2b-personalbytes))

 (def blake2b-vector
   (comp v/hex-resource (partial str "vectors/generichash/blake2b/")))

 (deftest generichash-kat-test
-  (are [args expected] (and
-                        (array-eq (apply g/hash args) expected)
-                        (array-eq (apply g/blake2b args) expected))
+  (are [args expected] (array-eq (apply g/hash args) expected)
     [(byte-array [])]
     (blake2b-vector "digest-empty-string")


fix url prefix in sample pipeline

fix url prefix in sample pipeline

--- test/lambdacd_cctray/sample_pipeline.clj
+++ test/lambdacd_cctray/sample_pipeline.clj
@@ -53,7 +53,7 @@
   (let [home-dir (if (not (empty? args)) (first args) (util/create-temp-dir))
         config { :home-dir home-dir }
         pipeline (lambdacd/assemble-pipeline pipeline-structure config)
-        cctray-pipeline-handler (cctray/cctray-handler-for pipeline-structure (:state pipeline) "http://localhost:8080/pipeline")]
+        cctray-pipeline-handler (cctray/cctray-handler-for pipeline-structure (:state pipeline) "http://localhost:8081/pipeline")]
     (runners/start-one-run-after-another pipeline)
     (ring-server/serve (mk-routes (ui/ui-for pipeline) cctray-pipeline-handler)
                                   {:open-browser? true


Add an explanation to the day 4 solution approach.

I want to try remember to do this, reading last year's solutions some of them
are hard to follow now that the thought process is not freshly in my mind.

--- clojure/src/advent2017/day4.clj
+++ clojure/src/advent2017/day4.clj
@@ -1,4 +1,10 @@
 (ns advent2017.day4
+  "Part 1 is simply finding duplicate words, we can compare the length of the
+  original list of words with the length of a set of the original list, if there
+  are any duplicates the lengths will be unequal.
+
+  Part 2 requires checking anagrams. For two words to be anagrams all we need to
+  do is compare letter frequencies."
   (:require [advent2017.core :refer [->words]]))


Avoid consistency column-title-error until specification

--- backend/src/akvo/lumen/lib/transformation/engine.clj
+++ backend/src/akvo/lumen/lib/transformation/engine.clj
@@ -538,6 +538,6 @@
        :transformations  (w/keywordize-keys (vec applied-txs))})))

 (defn column-title-error? [column-title columns]
-  (when (not-empty (filter #(= column-title (get % "title")) columns))
-    #_{:success? false
+  #_(when (not-empty (filter #(= column-title (get % "title")) columns))
+    {:success? false
      :message  (format "In this dataset there's already a column with this name: %s. Please choose another non existing name" column-title)}))


debug cleanup

debug cleanup

--- src/skylark/cleanup.clj
+++ src/skylark/cleanup.clj
@@ -45,7 +45,7 @@
           ;; (1) if you recurse into suite before you process, you miss the nonlocal and global elimination
           ;; (2) if you recurse into suite after you process, you pay quadratic instead of linear cost
           ;; and miss the elimination of empty suites.
-          (:suite) (let [r (flatten () s)]
+          (:suite) (let [r (flatten () x)]
                      (cond (empty? r) (v :None)
                            (empty? (rest r)) (first r)
                            :else (w :suite (reverse r))))


fix problem saving snapshot

fix problem saving snapshot

--- src/wb_es/bulk/core.clj
+++ src/wb_es/bulk/core.clj
@@ -11,7 +11,7 @@
             [wb-es.datomic.db :refer [datomic-conn]]
             [wb-es.env :refer [es-base-url release-id]]
             [wb-es.mappings.core :refer [create-index]]
-            [wb-es.snapshot.core :refer [save-snapshot get-next-snapshot-id]]))
+            [wb-es.snapshot.core :refer [connect-snapshot-repository save-snapshot get-next-snapshot-id]]))

 (defn format-bulk
   "returns a new line delimited JSON based on
@@ -336,10 +336,11 @@
           (close! scheduler))
         )

-
-      (let [repository-name "s3_repository"
-            snapshot-id (get-next-snapshot-id repository-name release-id)]
-        (save-snapshot index-id repository-name snapshot-id))
+      (let [repository-name "s3_repository"]
+        (do
+          (connect-snapshot-repository repository-name)
+          (let [snapshot-id (get-next-snapshot-id repository-name release-id)]
+            (save-snapshot index-id repository-name snapshot-id))))
       )))


Add gamepad debugging function.

Add gamepad debugging function.

--- dev/playasophy/wonderdome/input/gamepad_harness.clj
+++ dev/playasophy/wonderdome/input/gamepad_harness.clj
@@ -42,3 +42,13 @@
   (when system
     (alter-var-root #'system component/stop))
   :stop)
+
+
+(defn read-gamepad!
+  [device]
+  (let [buffer (byte-array 16)
+        len (.readTimeout device buffer 100)]
+    (when (pos? len)
+      (->> (take len buffer)
+           (map (partial format "%02X"))
+           (apply println)))))


Very messy implementation of springy hinges.

--- ClojureScript/hello.cljs
+++ ClojureScript/hello.cljs
@@ -14,22 +14,22 @@
         ))

 (def my-code-url "https://github.com/pauldoo/scratch/blob/master/ClojureScript/hello.cljs")
-(def tick-step (/ 1 200))
-(def render-step (/ 1 30))
-(def gravity-strength 500)
-(def ground-strength 200)
+(def tick-step (/ 1 100))
+(def render-step (/ 1 25))
+(def gravity-strength 300)
+(def ground-strength 100)
 (def initial-game-state {
     :nodes {
         :t {
+            :pos [50 100]
+            :vel [0 0]
+        }
+        :u {
+            :pos [250 200]
+            :vel [0 0]
+        }
+        :v {
             :pos [150 100]
-            :vel [0 0]
-        }
-        :u {
-            :pos [350 200]
-            :vel [0 0]
-        }
-        :v {
-            :pos [250 100]
             :vel [0 0]
         }
     }
@@ -40,19 +40,29 @@
             :rest-length 224.0
             :strength 2000
         }
-        {
-            :node-a :u
-            :node-b :v
-            :rest-length 141.0
-            :strength 2000
-        }
+        ;{
+        ;    :node-a :u
+        ;    :node-b :v
+        ;    :rest-length 141.0
+        ;    :strength 2000
+        ;}
         {
             :node-a :t
             :node-b :v
             :rest-length 100.0
             :strength 2000
         }
-    ] })
+    ]
+    :hinges [
+        {
+            :node-a :u
+            :node-b :t
+            :node-c :v
+            :rest-angle (/ Math/PI 2)
+            :strength 100000
+        }
+    ]
+    })

 (defn print-to-log [v]
     (.log js/console v))
@@ -63,6 +73,13 @@
 (def magnitude-squared (comp (partial apply +) (partial map #(* % %))))
 (def magnitude (comp Math/sqrt magnitude-squared))
 (def normalize (comp (partial apply vec*) (juxt identity (comp (partial / 1.0) magnitude))))
+(defn dot-product [v w] (apply + (map * v w)))
+(defn clamp [v lower upper] (Math/min (Math/max v lower) upper))
+(defn angle [v w] (Math/acos (clamp
+    (dot-product (normalize v) (normalize w))
+    -1.0 1.0 )))
+(defn rot-cw [[x y]] [y (- x)])
+(defn rot-ccw [[x y]] [(- y) x])

 (defn calculate-force [node-a node-b rest-length strength]
     (let [a-b (vec- node-a node-b)
@@ -84,6 +101,31 @@
                         node-b-id (vec- (get forces node-b-id [0 0]) force))
                     r)))))

+(defn calculate-hinge-force [a b c rest-angle strength]
+    (let [
+        b-to-a (vec- a b)
+        b-to-c (vec- c b)
+        pressure (* (- rest-angle (angle b-to-a b-to-c)) strength)
+        result [
+            (vec* (rot-ccw b-to-a) (/ pressure (magnitude-squared b-to-a)))
+            (vec* (rot-cw b-to-c) (/ pressure (magnitude-squared b-to-c)))
+        ]]
+            result))
+
+(defn calculate-hinge-forces [nodes hinges]
+    (loop [forces {} hinges hinges]
+        (if (empty? hinges) forces
+            (let [
+                [h & r] hinges
+                {:keys [node-a node-b node-c rest-angle strength]} h
+                [force-a force-c] (calculate-hinge-force (:pos (nodes node-a)) (:pos (nodes node-b)) (:pos (nodes node-c)) rest-angle strength)]
+                    (recur
+                        (assoc forces
+                            node-a (vec+ (get forces node-a [0 0]) force-a)
+                            node-b (vec+ (get forces node-b [0 0]) (vec* (vec+ force-a force-c) -1.0))
+                            node-c (vec+ (get forces node-c [0 0]) force-c))
+                        r)))))
+
 (defn calculate-gravity-forces [nodes]
     (zipmap (keys nodes) (repeat [0 (- gravity-strength)])))

@@ -94,9 +136,10 @@
                 (vec* [(- xv) (+ (Math/max 0 (- yv)) (- y))] ground-strength)
                 [0 0])) (vals nodes))))

-(defn calculate-all-node-forces [nodes springs]
+(defn calculate-all-node-forces [{:keys [nodes springs hinges]}]
     (merge-with vec+
         (calculate-spring-forces nodes springs)
+        (calculate-hinge-forces nodes hinges)
         (calculate-gravity-forces nodes)
         (calculate-ground-forces nodes)))

@@ -139,7 +182,7 @@
             (update-node-positions
                 (update-node-velocities
                     (:nodes state)
-                    (calculate-all-node-forces (:nodes state) (:springs state))
+                    (calculate-all-node-forces state)
                     tick-step)
                 tick-step)))


ensure all namespaces are compiled

ensure all namespaces are compiled

--- dev-resources/insn/test.clj
+++ dev-resources/insn/test.clj
@@ -2,7 +2,9 @@
   (:require [clojure.test :as test]
             [clojure.java.io :as io]
             [insn.core :as insn]
-            insn.clojure)
+            insn.core-test
+            insn.clojure-test
+            insn.util-test)
   (:gen-class))

 (defmethod test/report :begin-test-ns [m])
@@ -13,20 +15,14 @@
     (throw (ex-info "tests failed" m))))

 (defn -main []
-  (let [nses (->> (.getResources (.getClassLoader (class -main)) "insn")
-                  enumeration-seq
-                  (filter #(.endsWith (.getPath %) "/test/insn"))
-                  (mapcat #(-> % .openStream io/reader line-seq))
-                  (keep #(second (re-find #"^(.+)_test\.clj$" %)))
-                  (map #(symbol (str "insn." % "-test"))))
-        clj (apply str ((juxt :major (constantly \.) :minor) *clojure-version*))
+  (let [clj (apply str ((juxt :major (constantly \.) :minor) *clojure-version*))
         asm (if (= clojure.asm.Type (get (ns-imports 'insn.core) 'Type))
               "clojure.asm"
               "objectweb.asm")
         aot (try (Class/forName "insn.test") "aot compiled"
                  (catch ClassNotFoundException _ "interpreted"))
+        nses (filter #(re-find #"^insn\..+-test$" (str (ns-name %))) (all-ns))
         versions [1.5 1.6 1.7]]
-    (dorun (map require nses))
     (test/with-test-out
       (print "Testing bytecode versions"
              (str (first versions) \- (last versions))


Add created times to photos and albums

Add created times to photos and albums

--- src/ansel/db.clj
+++ src/ansel/db.clj
@@ -57,12 +57,14 @@
 ;; Photo management -----------------------------------------------------------

 (defn add-photo-to-db [photo]
-  (swap! images assoc (keyword (:filename photo)) photo)
-  (info "photo added"))
+  (let [photo (assoc photo :created (now))]
+    (swap! images assoc (keyword (:filename photo)) photo)
+    (info "photo added")))

 (defn add-album-to-db [album]
-  (swap! albums assoc (keyword (:slug album)) album)
-  (info "album added"))
+  (let [album (assoc album :created (now))]
+    (swap! albums assoc (keyword (:slug album)) album)
+    (info "album added")))

 (defn get-uploads-path []
   (or (:upload-path @config) "uploads/"))
@@ -101,12 +103,14 @@
   (get @comments photo))

 (defn val-map
-  "Given a map where every val is a coll, map f over each coll,
-  preserving the map's structure"
+  "Given a map where every val is a coll or a map, map f over each
+  coll/map, preserving the map's structure"
   [f m]
   (into {} (map
              (fn [[k v]]
-               [k (vec (map f v))])
+               [k (if (map? v)
+                    (f v)
+                    (vec (map f v)))])
              m)))

 (defn map-time->string [m]
@@ -129,8 +133,8 @@
                default-db)]
     (dosync
       (ref-set users    (:users data))
-      (reset! images    (:images data))
-      (reset! albums    (:albums data))
+      (reset! images    (timify-strings (:images data)))
+      (reset! albums    (timify-strings (:albums data)))
       (reset! likes     (:likes data))
       (reset! config    (:config data))
       (reset! comments  (timify-strings (:comments data)))


use "suis" rather than "être" so that test passes; add related TODO comment

--- test/babel/test/fr.cljc
+++ test/babel/test/fr.cljc
@@ -93,7 +93,10 @@
         (filter #(not (fail? %))
                 (map (fn [rule]
                        (unify rule
-                               {:head (last (get lex "être"))}))
+                              ;; TODO: instead of using "suis", use
+                              ;; (francais.morphology/lookup-in)
+                              ;; with {:agr {:person :1st :number :sing}}.
+                              {:head (last (get lex "suis"))}))
                      (:grammar (small))))]
     (is (not (empty? result)))
     (is (= (get-in (first result) [:rule]) "vp-aux"))))


add parsing to speed-test

add parsing to speed-test

--- test/babel/test/fr.cljc
+++ test/babel/test/fr.cljc
@@ -675,7 +675,14 @@
     (is (= times
            (count (take times
                         (repeatedly
-                         #(time (println (fo (generate spec :model model)))))))))))
+                         #(time (do
+                                  (println (fo (generate spec :model (medium))))
+                                  (println (string/join ","
+                                                        (map (:morph-ps (medium))
+                                                             (parse (fo (generate spec :model (medium)))
+                                                                    :model (medium)
+                                                                    :parse-with-truncate false)))))))))))))
+
 (deftest speed-test-1
   ;; these should all take relatively the same time, but
   ;; for now, the more general the spec, the longer it takes to generate.


keyword keyword sufficient for days of week and months after first arg

--- test/java_time_test.clj
+++ test/java_time_test.clj
@@ -512,10 +512,10 @@
     (let [thursday (j/day-of-week :thursday)
           saturday (j/day-of-week :saturday)
           sunday (j/day-of-week :sunday)]
-      (is (j/after? saturday thursday))
-      (is (not (j/after? thursday saturday)))
-      (is (j/before? saturday sunday))
-      (is (not (j/before? sunday saturday)))
+      (is (j/after? saturday :thursday))
+      (is (not (j/after? thursday :saturday)))
+      (is (j/before? saturday :sunday))
+      (is (not (j/before? sunday :saturday)))
       (is (j/not-after? saturday saturday))
       (is (j/not-after? saturday sunday))
       (is (not (j/not-after? sunday saturday)))
@@ -526,10 +526,10 @@
     (let [january (j/month :january)
           february (j/month :february)
           march (j/month :march)]
-      (is (j/after? february january))
-      (is (not (j/after? january february)))
-      (is (j/before? february march))
-      (is (not (j/before? march february)))
+      (is (j/after? february :january))
+      (is (not (j/after? january :february)))
+      (is (j/before? february :march))
+      (is (not (j/before? march :february)))
       (is (j/not-after? january january))
       (is (j/not-after? february march))
       (is (not (j/not-after? march february)))


Move new-mutable-vector

Move new-mutable-vector

This function appears to be unused except in the commented-out Mikera
optimiser. Moving it down there increases clarity.

--- cortex/src/cortex/optimise.cljc
+++ cortex/src/cortex/optimise.cljc
@@ -12,9 +12,6 @@
           (set! *warn-on-reflection* true)
           (set! *unchecked-math* true)))

-(defn new-mutable-vector
-  [size]
-  (m/mutable (m/array :vectorz (repeat size 0))))

 ;; ==============================================
 ;; Adam
@@ -152,6 +149,10 @@
 ;; Mikera optimiser
 ;; TODO: complete conversion of algorithm

+(defn new-mutable-vector
+  [size]
+  (m/mutable (m/array :vectorz (repeat size 0))))
+
 ;;(def ^:const MIKERA-DEFAULT-LEARN-RATE 0.01)
 ;;(def ^:const MIKERA-DEFAULT-DECAY 0.95)
 ;;


Only use buf-id from buf, not takes.

Only use buf-id from buf, not takes.

--- src/ago/core.cljs
+++ src/ago/core.cljs
@@ -279,7 +279,7 @@
       (when-not (nil? value)
         (protocols/put! c value (fn-handler active? (fn [] nil))))
       (protocols/close! c))
-    (ago-dereg-state-machine ago-world (.-buf-id (.-takes c)))
+    (ago-dereg-state-machine ago-world (.-buf-id (.-buf c)))
     c))

 ; --------------------------------------------------------


Update 'org.clojure/tools.namespace' version to 0.3.0

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -202,7 +202,7 @@
               copy-meta))))

 (def ^:private ^:deps content-deps
-  '[[org.clojure/tools.namespace "0.3.0-alpha4"]])
+  '[[org.clojure/tools.namespace "0.3.0"]])

 (defn content-task
   "Wrapper for input parsing tasks. Calls the return from `render-form-fn` on
@@ -338,7 +338,7 @@
      (filter-meta-by-ext fileset options))))

 (def ^:private ^:deps images-resize-deps
-  '[[org.clojure/tools.namespace "0.3.0-alpha4"]
+  '[[org.clojure/tools.namespace "0.3.0"]
     [image-resizer "0.1.10"]])

 (def ^:private +images-resize-defaults+
@@ -371,7 +371,7 @@
       :tmp tmp})))

 (def ^:private ^:deps yaml-metadata-deps
-  '[[org.clojure/tools.namespace "0.3.0-alpha4"]
+  '[[org.clojure/tools.namespace "0.3.0"]
     [circleci/clj-yaml "0.6.0"]])

 (def ^:private +yaml-metadata-defaults+
@@ -399,7 +399,7 @@
       :pod pod})))

 (def ^:private ^:deps markdown-deps
-  '[[org.clojure/tools.namespace "0.3.0-alpha4"]
+  '[[org.clojure/tools.namespace "0.3.0"]
     [com.vladsch.flexmark/flexmark "0.40.16"]
     [com.vladsch.flexmark/flexmark-profile-pegdown "0.40.16"]])

@@ -505,7 +505,7 @@
                    :cmd-opts cmd-opts))))

 (def ^:private ^:deps asciidoctor-deps
-  '[[org.clojure/tools.namespace "0.3.0-alpha4"]
+  '[[org.clojure/tools.namespace "0.3.0"]
     [org.asciidoctor/asciidoctorj "2.0.0"]])

 (def ^:private +asciidoctor-defaults+
@@ -554,7 +554,7 @@
                         :meta       meta))))

 (def ^:private ^:deps highlight-deps
-  '[[org.clojure/tools.namespace "0.3.0-alpha4"]
+  '[[org.clojure/tools.namespace "0.3.0"]
     [enlive "1.1.6"]
     [clygments "1.0.0"]])

@@ -624,7 +624,7 @@
         (pm/set-meta fileset updated-metas)))))

 (def ^:private ^:deps word-count-deps
-  '[[org.clojure/tools.namespace "0.3.0-alpha4"]
+  '[[org.clojure/tools.namespace "0.3.0"]
     [org.apache.lucene/lucene-analyzers-common "8.1.0"]])

 (def ^:private +word-count-defaults+
@@ -804,7 +804,7 @@
         (commit fileset tmp)))))

 (def ^:private ^:deps render-deps
-  '[[org.clojure/tools.namespace "0.3.0-alpha4"]])
+  '[[org.clojure/tools.namespace "0.3.0"]])

 (def render-pod (delay (create-pod' render-deps)))

@@ -1177,7 +1177,7 @@
       paths)))

 (def ^:private ^:deps atom-deps
-  '[[org.clojure/tools.namespace "0.3.0-alpha4"]
+  '[[org.clojure/tools.namespace "0.3.0"]
     [org.clojure/data.xml "0.2.0-alpha6"]
     [clj-time "0.15.1"]])


minors

minors

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -158,7 +158,7 @@
                                    (or (:filepath file)
                                        (str (:filename file) ".html")))]
             (perun/create-file tmp page-filepath html)))
-        (u/info (str "Render all pages\n"))
+        (u/info "Render all pages\n")
         (commit fileset tmp)))))

 (def ^:private +collection-defaults+


Remove redundant logging message

Remove redundant logging message

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -693,7 +693,6 @@
                                                              slurp))))
                new-path    (perun/create-filepath out-dir path)
                new-entry   (assoc entry :out-dir out-dir)]
-           (perun/report-info task-name (str "rendered " task-name " " path))
            (assoc result new-path {:meta    global-meta
                                    :entry   new-entry
                                    :entries (vec sorted)})))


Fix transfer-state bug on mouse mixin.

Fix transfer-state bug on mouse mixin.

--- frontend/uxbox/ui/workspace/base.cljs
+++ frontend/uxbox/ui/workspace/base.cljs
@@ -85,19 +85,27 @@
                   y (.-clientY event)]
               (rx/push! mouse-bus [(- x offset-x)
                                    (- y offset-y)])))]
-    (->> (events/listen js/document EventType.MOUSEMOVE on-mousemove)
-         (assoc own ::eventkey))))
+    (let [key (events/listen js/document EventType.MOUSEMOVE on-mousemove)]
+      (js/console.log "mouse-mixin-did-mount" key)
+      (assoc own ::eventkey key))))

 (defn- mouse-mixin-will-unmount
   [own]
-  (println "mouse-mixin-will-unmount")
   (let [key (::eventkey own)]
+    (js/console.log "mouse-mixin-will-unmount" key)
     (events/unlistenByKey key)
     (dissoc own ::eventkey)))

+(defn- mouse-mixin-transfer-state
+  [old-own own]
+  (let [key (::eventkey old-own)]
+    (js/console.log "mouse-mixin-transfer-state" key)
+    (assoc own ::eventkey key)))
+
 (def ^:static mouse-mixin
   {:did-mount mouse-mixin-did-mount
-   :will-unmount mouse-mixin-will-unmount})
+   :will-unmount mouse-mixin-will-unmount
+   :transfer-state mouse-mixin-transfer-state})

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Constants


Add non-logged 'ping' route.

Add non-logged 'ping' route.

--- src/cavm/core.clj
+++ src/cavm/core.clj
@@ -30,6 +30,7 @@
   (:require [taoensso.timbre :as timbre])
   (:require [less.awful.ssl :as ssl])
   (:require [ring.util.response :as response])
+  (:require [ring.util.request :refer [path-info]])
   (:require hiccup.page)
   (:import cavm.XenaImport cavm.Splash)
   (:import org.slf4j.LoggerFactory
@@ -182,6 +183,14 @@
       {:status 503
        :headers {}
        :body "Database booting"})))
+
+(defn wrap-ping [handler]
+  (fn [request]
+    (if (= (path-info request) "/ping/")
+      {:status 200
+       :headers {}
+       :body "pong"}
+      (handler request))))

 ; XXX add ring jsonp?
 (defn- get-app [docroot db loader port userauth allow-hosts]
@@ -199,6 +208,7 @@
       (wrap-params)
       (wrap-multipart-params {:store (byte-array-store)})
       (wrap-stacktrace-web)
+      (wrap-ping)
       (wrap-db-loading db)
       (attr-middleware :db db)
       (wrap-access-control allow-hosts)


Use the with-open macro in planck.core

Use the with-open macro in planck.core

--- planck-cljs/src/planck/core.cljs
+++ planck-cljs/src/planck/core.cljs
@@ -1,6 +1,6 @@
 (ns planck.core
   (:require-macros
-    [planck.core])
+    [planck.core :refer [with-open]])
   (:require
     [cljs.spec :as s]
     [planck.repl :as repl])
@@ -231,17 +231,14 @@
   "Opens a reader on f and reads all its contents, returning a string.
   See planck.io/reader for a complete list of supported arguments."
   [f & opts]
-  (let [r (apply *reader-fn* f opts)
-        sb (StringBuffer.)]
-    (try
+  (with-open [r (apply *reader-fn* f opts)]
+    (let [sb (StringBuffer.)]
       (loop [s (-read r)]
         (if (nil? s)
           (.toString sb)
           (do
             (.append sb s)
-            (recur (-read r)))))
-      (finally
-        (-close r)))))
+            (recur (-read r))))))))

 (s/fdef slurp
   :args (s/cat :f :planck.io/coercible-file? :opts (s/* any?))
@@ -251,11 +248,8 @@
   "Opposite of slurp.  Opens f with writer, writes content, then
   closes f. Options passed to planck.io/writer."
   [f content & opts]
-  (let [w (apply *writer-fn* f opts)]
-    (try
-      (-write w (str content))
-      (finally
-        (-close w)))))
+  (with-open [w (apply *writer-fn* f opts)]
+    (-write w (str content))))

 (s/fdef spit
   :args (s/cat :f :planck.io/coercible-file? :content any? :opts (s/* any?)))


Remove unnecessary *load-fn* override

Remove unnecessary *load-fn* override

--- planck-cljs/src/planck/core.cljs
+++ planck-cljs/src/planck/core.cljs
@@ -137,7 +137,6 @@
   (cljs/require
     {:*compiler*     st
      :*load-fn*      load
-     :*eval-fn*      cljs/js-eval}
     sym
     reload
     {:macros-ns  macros-ns?


CMR-3239 - Added potemkin dependency.

CMR-3239 - Added potemkin dependency.

--- ingest-app/project.clj
+++ ingest-app/project.clj
@@ -11,6 +11,7 @@
                  [nasa-cmr/cmr-message-queue-lib "0.1.0-SNAPSHOT"]
                  [nasa-cmr/cmr-common-app-lib "0.1.0-SNAPSHOT"]
                  [compojure "1.5.1"]
+                 [potemkin "0.4.3"]
                  [ring/ring-core "1.5.0"]
                  [ring/ring-json "0.4.0"]
                  [clj-http "2.0.0"]


add missing method

add missing method

--- src/miq/core.clj
+++ src/miq/core.clj
@@ -1,5 +1,5 @@
 ; Trello Analytics
-
+; a helpful website to see json http://www.jsoneditoronline.org
 (ns json.core
   (:require [clojure.data.json :as json])
   )
@@ -7,6 +7,7 @@

 (use '(incanter core charts stats ))
+

 ; define some constants for column ids
 (def in-progress-column-id "53067ded5264b32b0bf1dbfa")
@@ -20,7 +21,7 @@
   (json/read-str (slurp file-path) :key-fn keyword)
   )

-; get resource path
+; get resource path, some environments set up the working directory differently
 (defn resource-path []
   (let [current-directory (System/getProperty "user.dir")]
     (if (.contains current-directory "/src") (str current-directory "/../../resources") (str current-directory "/resources"))
@@ -58,44 +59,13 @@

-;
-(defn column-name-to-column-id [json-map column-name]
-  (loop [in-data (:lists json-map)]
-    (if (empty? in-data) nil
-      (if (= column-name (:name (first in-data))) (:id (first in-data))
-        (recur (rest in-data))
-
-        )
-      )
-    )
-  )

+; bunch of filters to find appropriate cards

-; Is this card in a column-id
-(defn card-in-column? [card column-id]
-  (= (:idList card) column-id)
+(defn is-card-movement? [c]
+  (and (is-update-card? c) (has-data-5? c) (has-list-before-after c) (not= (list-before-id c) (list-after-id  c)))
   )
-
-; How many cards are in a named column
-(defn arity-of-column [json-map column-name]
-  (loop [cards (:cards json-map)
-         column-id (column-name-to-column-id json-map column-name)
-         accum 0]
-    (if (empty? cards) accum
-      (recur
-       (rest cards)
-        column-id
-       (if (card-in-column? (first cards) column-id)
-         (inc accum)
-         accum)
-
-       )
-      )
-    )
-  )
-
-

 (defn card-movement [json-map]
   (filter is-card-movement? (:actions json-map))
@@ -134,25 +104,6 @@

 (defn is-owner [c o]
   )
-;http://www.jsoneditoronline.org
-(defn make-blip [time delta]
-  (conj [] (- time delta) time (+ time delta) ))
-
-
-(defn blipper [xs]
-  (loop
-    [css xs
-         result []]
-    (if (empty? css) result
-      (recur (rest css) (conj result (make-blip (first css) 1))))
-    )
-  )
-
-(defn get-bucket [min max delta value]
-  (/ (- value min) delta)
-  )
-
-

 (defn is-rework? [movement-c]
@@ -174,10 +125,10 @@

 (def file-path (str (resource-path) "/cd.json"))
 (def json-map (file-to-map file-path))
+
+
 (def movements (card-movement json-map))
-(count movements)
 (def reworks  (filter is-rework? movements))
-(count reworks)
 (def interruptions  (filter is-interruption? movements))

@@ -185,10 +136,18 @@

 (def interruptions-on-week (map week-of-year-from-trello interruptions))
-(view (histogram interruptions-on-week :nbins 20 :y-label "interruptions" :x-label "week number" :title "interrupions by week") )
+(view (histogram interruptions-on-week :nbins 20 :y-label "interruptions" :x-label "week number" :title "interruptions by week") )

 (def rework-on-week (map week-of-year-from-trello reworks))
 (view (histogram rework-on-week :nbins 20 :y-label "reworks" :x-label "week number" :title "reworks by week") )
+
+(def movements-on-week (map week-of-year-from-trello movements))
+(view (histogram movements-on-week :nbins 20 :y-label "Movements" :x-label "week number" :title "movements by week") )
+; some testing...
+
+(def interruptions-by-person (group-by (fn[c] (:fullName (:memberCreator c)) ) interruptions))
+(count  interruptions-by-person)
+(def taylor-movements (filter (fn[c] (= (:fullName (:memberCreator c)) "taylor")) movements))

@@ -203,48 +162,3 @@

-
-
-(def interruptions-by-person (group-by (fn[c] (:fullName (:memberCreator c)) ) interruptions))
-(count  interruptions-by-person)
-
-
-
-(def taylor-movements (filter (fn[c] (= (:fullName (:memberCreator c)) "taylor")) movements))
-
-
-(def dates (reverse(map (fn[c] (to-millis (:date c))) taylor-movements)))
-
-
-(def y (flatten(repeat  (count dates) '(0 1 0))))
- (comment
- (view (time-series-plot blipped-date y
-                          :title "Taylor's Rejected bug fixes"
-                          :x-label "Time"
-                          :y-label "Rejections"))
- )
-
-
-(- (last dates) (first dates))
-
-(defn bucketize [seq-of-times bucket-size]
-  (reduce (fn [m data]
-                (let [min (last seq-of-times)
-                      max (first seq-of-times)
-                      bucket (get-bucket min max  bucket-size data)]
-
-                  (update-in m [:buckets bucket] (fnil inc 0))))
-              {}
-              seq-of-times)
-  )
-
-
-
-
-
-
-
-
-
-
-


improved store init code

improved store init code

--- src/ctia/init.clj
+++ src/ctia/init.clj
@@ -103,23 +103,23 @@
     (let [store-impls (or (-> (get-in @p/properties [:ctia :store store-key])
                               (clojure.string/split #",")) [])
           store-impl-keys (map keyword store-impls)
-          store-properties
-          (reduce merge {}
-                  (map (fn [impl] {impl {:properties (merge (get-in @p/properties [:ctia :store impl :default] {})
-                                                           (get-in @p/properties [:ctia :store impl store-key] {}))
+          store-properties (map (fn [impl]
+                                  {:properties (merge (get-in @p/properties [:ctia :store impl :default] {})
+                                                      (get-in @p/properties [:ctia :store impl store-key] {}))

-                                        :builder (get-in store-factories [:builder impl]
-                                                         (fn default-builder [f p] (f)))
+                                   :builder (get-in store-factories [:builder impl]
+                                                    (fn default-builder [f p] (f)))

-                                        :factory (get-in store-factories [store-key impl]
-                                                         #(throw (ex-info (format "Could not configure %s store" impl)
-                                                                          {:store-key store-key
-                                                                           :store-type (keyword %)})))}}) store-impl-keys))]
-      (doseq [[store-impl store-params] store-properties]
-        (when-not (= store-impl :none)
-          (swap! store/stores update store-key #(conj % ((:builder store-params)
-                                                         (:factory store-params)
-                                                         (:properties store-params)))))))))
+                                   :factory (get-in store-factories [store-key impl]
+                                                    #(throw (ex-info (format "Could not configure %s store" impl)
+                                                                     {:store-key store-key
+                                                                      :store-type (keyword %)})))}) store-impl-keys)
+
+          store-instances (doall (map (fn [{:keys [builder factory properties]}]
+                                        (builder factory properties)) store-properties))]
+
+      (swap! store/stores assoc store-key store-instances))))
+
 (defn start-ctia!
   "Does the heavy lifting for ctia.main (ie entry point that isn't a class)"
   [& {:keys [join? silent?]}]


cosmetics

cosmetics

--- src/nml/core.clj
+++ src/nml/core.clj
@@ -3,18 +3,50 @@
   (:require [instaparse.core   :as insta ])
   (:gen-class))

-(declare nmlname nmlstr)
+(declare nk nkv nmlget nmlname nmlset nmlstr)

 (def debug false)

 (def parse (insta/parser (clojure.java.io/resource "grammar")))

+(defn exe [tree commands]
+  (if (empty? commands)
+    tree
+    (let [cmd (first  commands)
+          arg (second commands)
+          rst (drop 2 commands)]
+      (case cmd
+        "--get" (let [[nml key    ] (nk  arg)] (exe (nmlget tree nml key)     rst))
+        "--set" (let [[nml key val] (nkv arg)] (exe (nmlset tree nml key val) rst))))))
+
 (defn fail [& msg]
   (if msg (println (apply str msg)))
   (System/exit 1))

+(defn nk [x]
+  (string/split x #":" 2))
+
+(defn nkv [x]
+  (let [[nmlkey val] (string/split x #"=" 2)]
+    (concat (nk nmlkey) (list val))))
+
+(defn nmlget [tree nml key]
+  (let [stmt     (last (filter #(= (nmlname %) nml) (rest tree)))
+        nvsubseq (last (filter #(= (nmlname %) key) (rest (last stmt))))
+        values   (last nvsubseq)
+        value    (if (nil? values) "" (nmlstr values))]
+    (println (str nml ":" key "=" value))
+    tree))
+
 (defn nmlname [x]
   (nmlstr (second x)))
+
+(defn nmlset [tree nml key val & sub]
+  (let [child (if sub :nvsubseq :stmt)
+        match (if sub key nml)
+        vnew  (if sub (fn [tree] (parse val :start :values)) #(nmlset % nml key val true))
+        f     (fn [k v] [child k (if (= (nmlstr k) match) (vnew v) v)])]
+    (insta/transform {child f} tree)))

 (defn nmlstr [x]
   (let [k (first x)
@@ -63,41 +95,9 @@
                  :ws       ""
                  :wsopt    ""))))

-(defn nmlget [tree nml key]
-  (let [stmt     (last (filter #(= (nmlname %) nml) (rest tree)))
-        nvsubseq (last (filter #(= (nmlname %) key) (rest (last stmt))))
-        values   (last nvsubseq)
-        value    (if (nil? values) "" (nmlstr values))]
-    (println (str nml ":" key "=" value))
-    tree))
-
-(defn nmlset [tree nml key val & sub]
-  (let [child (if sub :nvsubseq :stmt)
-        match (if sub key nml)
-        vnew  (if sub (fn [tree] (parse val :start :values)) #(nmlset % nml key val true))
-        f     (fn [k v] [child k (if (= (nmlstr k) match) (vnew v) v)])]
-    (insta/transform {child f} tree)))
-
 (defn nmltree [fname]
   (try (parse (slurp fname))
        (catch Exception e (fail "Could not open namelist file '" fname "'"))))
-
-(defn nk [x]
-  (string/split x #":" 2))
-
-(defn nkv [x]
-  (let [[nmlkey val] (string/split x #"=" 2)]
-    (concat (nk nmlkey) (list val))))
-
-(defn exe [tree commands]
-  (if (empty? commands)
-    tree
-    (let [cmd (first commands)
-          arg (second commands)
-          rst (drop 2 commands)]
-      (case cmd
-        "--get" (let [[nml key    ] (nk  arg)] (exe (nmlget tree nml key)     rst))
-        "--set" (let [[nml key val] (nkv arg)] (exe (nmlset tree nml key val) rst))))))

 (defn -main [& args]
   (alter-var-root #'*read-eval* (constantly false))


Shutdown peer resources on failure, bail if unclean shutdown.

--- src/onyx/api.clj
+++ src/onyx/api.clj
@@ -116,7 +116,11 @@
                                    (catch Exception e
                                      (warn e)
                                      :stopped))
-                                 (throw (ex-info "Peer failed" {})))))
+                                 (try (component/stop live)
+                                      nil
+                                      (catch Exception e
+                                        (warn e)
+                                        :stopped)))))
                            (catch Exception e
                              (warn e)
                              (warn "Virtual peer failed, backing off and rebooting...")


Add collapsible row to poketable entry

Add collapsible row to poketable entry

--- frontend/src/cruncher/views.cljs
+++ frontend/src/cruncher/views.cljs
@@ -66,6 +66,15 @@

 ;;;; Poketable
+(defui PokeTableEntryDetails
+  Object
+  (render [this]
+    (let [pokemon (om/props this)]
+      (dom/tr #js {:id              (str "poketable-row-details-" (:id pokemon))
+                   :className       "collapse"}
+              (dom/td #js {:colSpan 12} "ahoi")))))
+(def poketable-entry-details (om/factory PokeTableEntryDetails {}))
+
 (defui PokeTableEntry
   Object
   (render [this]
@@ -75,7 +84,11 @@
                    :data-favorite   (:favorite pokemon)
                    :data-id         (:id pokemon)
                    :data-iv-perfect (:individual_percentage pokemon)
-                   :data-cp         (:cp pokemon)}
+                   :data-cp         (:cp pokemon)
+                   :data-toggle   "collapse"
+                   :data-target   (str "#poketable-row-details-" (:id pokemon))
+                   :aria-expanded "false"
+                   :aria-controls "collapseExample"}
               (dom/td nil
                       (dom/div #js {:className "checkbox"})
                       (dom/label nil
@@ -117,7 +130,11 @@
                                            (vlib/sortable-table-header :individual_defense "IV Defense")
                                            (vlib/sortable-table-header :individual_stamina "IV Stamina")
                                            (vlib/sortable-table-header :candy "Candy")))
-                        (apply dom/tbody nil
+                        (dom/tbody nil
+                                   (interleave
+                                     (map #(poketable-entry (lib/merge-react-key %)) (lib/inventory-pokemon))
+                                     (map #(poketable-entry-details (lib/merge-react-key %)) (lib/inventory-pokemon))))
+                        #_(apply dom/tbody nil
                                (map #(poketable-entry (lib/merge-react-key %)) (lib/inventory-pokemon))))
              #_(let [jquery (js* "$")]
                  (.stickyTableHeaders (jquery "#poketable"))))))


Respect existing arglists metadata in rum/def* macros

Here is a example about this

https://github.com/aJchemist/rum-mdl/blob/master/src/rum/mdl.cljc#L184

--- src/rum/core.clj
+++ src/rum/core.clj
@@ -37,7 +37,8 @@
         arglists  (if (= render-ctor 'rum.core/render->mixin)
                     (map (fn [[arglist & _body]] arglist) bodies)
                     (map (fn [[[_ & arglist] & _body]] (vec arglist)) bodies))]
-    `(def ~(with-meta name `{:arglists '~arglists}) ~(or doc "")
+    `(def ~(vary-meta name update :arglists #(or % `(quote ~arglists)))
+       ~(or doc "")
        (let [render-mixin# (~render-ctor (fn ~@render-fn))
              class#        (rum.core/build-class (concat [render-mixin#] ~mixins) ~(str name))
              ctor#         (fn [& args#]


Added a triple to type the id

Added a triple to type the id

--- kabob-build/src/main/resources/edu/ucdenver/ccp/kabob/build/rules/bio_to_ice/step_b/ontology_id_denotes_concept_gen.clj
+++ kabob-build/src/main/resources/edu/ucdenver/ccp/kabob/build/rules/bio_to_ice/step_b/ontology_id_denotes_concept_gen.clj
@@ -3,7 +3,8 @@
 ;; ------------------------------------------------------------------------
 ;; create id denotes concept triple for every ontology concept
 `{:name "ontology-id-denotes-concept-gen"
-  :head ((?/id obo/IAO_0000219 ?/sc)) ; denotes
+  :head ((?/id obo/IAO_0000219 ?/sc) ; denotes
+         (?/id rdf/type ccp/IAO_EXT_0000088)) ; ontology concept identifier
   :sparql-string "prefix ccp: <http://ccp.ucdenver.edu/obo/ext/>
                   prefix obo: <http://purl.obolibrary.org/obo/>
                   select ?sc {


Add a header to the CSV we spit out.

Add a header to the CSV we spit out.

--- src/frmr/dstt.clj
+++ src/frmr/dstt.clj
@@ -209,6 +209,7 @@
                                                parsed-handler)]
           (if csv
             (with-open [csv-writer (io/writer csv)]
+              (.write csv-writer (str "Load test: " url " Requests: " requests " Seconds: " seconds))
               (let [raw-results (get load-test-results "RawResults")
                     lines (map #(join "," %) raw-results)
                     content (join "\n" lines)]


Euler two for Clojure. Several fibonacci implementations.

--- clojure-functional/src/test/clojure/no/knowit/clojure_functional/euler_one/problem_one.clj
+++ clojure-functional/src/test/clojure/no/knowit/clojure_functional/euler_one/problem_one.clj
@@ -39,4 +39,60 @@
   (is (= (euler-one-sum-beneath-eager 10) 23))
   (is (= (euler-one-sum-beneath-eager 1000) 233168)))

+
+(def fib
+  (fn [num]
+    (if (< num 2) num
+      (+ (fib (- num 1))
+        (fib (- num 2))))))
+
+(def fib-mem
+  (memoize (fn [num]
+             (if (< num 2) num
+               (+ (fib-mem (- num 1))
+                 (fib-mem (- num 2)))))))
+
+(defn fib-tail [num]
+  (loop [num num, b 1N a 0N]
+    (if (< num 1) a
+      (recur (- num 1) (+ a b) b))))
+
+(defn fib-lazy []
+  ((fn f [a b]
+     (cons a
+       (lazy-seq
+         (f b (+ a b)))))
+    0N 1N))
+
+(defn fib-range [f]
+  (map f (range)))
+
+(defn even-nums [coll]
+  (filter even? coll))
+
+(defn contents-less-than [limit coll]
+  (take-while #(> limit %) coll))
+
+
+(defn in-side-out [limit f]
+  (apply +
+    (contents-less-than limit
+      (even-nums (f)))))
+
+
+(defn composed [limit f]
+  ((comp #(apply + %)
+     #(contents-less-than limit %) even-nums f)))
+
+
+(defn arrowed [limit f]
+  (->> (f) even-nums (contents-less-than limit) (apply +)))
+
+
+(deftest euler-two-fibonacci-sum
+  (is (= (in-side-out 40 #(fib-range fib)) 44))
+  (is (= (in-side-out 4000000 #(fib-range fib-mem)) 4613732))
+  (is (= (in-side-out 4000000 #(fib-range fib-tail)) 4613732))
+  (is (= (in-side-out 4000000 fib-lazy) 4613732)))
+
 (run-tests)


:bug: Fix copy action

:bug: Fix copy action

--- frontend/src/uxbox/main/data/workspace.cljs
+++ frontend/src/uxbox/main/data/workspace.cljs
@@ -234,6 +234,7 @@
                 :created-at (dt/now)
                 :items selected}
           clipboard (-> (:clipboard state)
+                        empty
                         (conj item))]
       (assoc state :clipboard
              (if (> (count clipboard) 5)


[WM] fix weird core.async behavior w/ pedestal

Before this change, I was seeing a ClassNotFoundException when it was compiling kehaar.wire-up. Removing pedestal made it go away, but so did removing the try-catch from kehaar.core/go-handler.

I *think* the much-newer version of tools.analyzer.jvm that pedestal brings in (versus the one core.async depends on) was to blame. Hopefully this won't break when core.async updates to a newer version...

--- resources/leiningen/new/kraken_http_api/project.clj
+++ resources/leiningen/new/kraken_http_api/project.clj
@@ -10,6 +10,12 @@
                  [prismatic/schema "0.4.3"]
                  [ch.qos.logback/logback-classic "1.1.3"]

+                 ;; core.async has to come before pedestal or kehaar.wire-up will
+                 ;; not compile. Something to do with the try-catch in
+                 ;; kehaar.core/go-handler.
+                 [org.clojure/core.async "0.1.346.0-17112a-alpha"]
+                 [democracyworks/kehaar "0.5.0"]
+
                  [io.pedestal/pedestal.service "0.4.0"]
                  [io.pedestal/pedestal.service-tools "0.4.0"]
                  [democracyworks/pedestal-toolbox "0.6.1"]
@@ -19,9 +25,7 @@
                  ;; https://github.com/pedestal/pedestal/issues/33
                  [org.immutant/web "2.0.2"]
                  [io.pedestal/pedestal.immutant "0.4.0"]
-                 [org.immutant/core "2.0.2"]
-
-                 [democracyworks/kehaar "0.5.0"]]
+                 [org.immutant/core "2.0.2"]]
   :plugins [[lein-immutant "2.0.0"]]
   :main ^:skip-aot {{name}}.server
   :target-path "target/%s"


Add .toString method for xml elements

Add .toString method for xml elements

--- src/main/clojure/clojure/data/xml/node.clj
+++ src/main/clojure/clojure/data/xml/node.clj
@@ -8,11 +8,22 @@

 (ns clojure.data.xml.node
   "Data types for xml nodes: Element, CData and Comment"
-  {:author "Herwig Hochleitner"})
+  {:author "Herwig Hochleitner"}
+  (:require [clojure.data.xml.name :refer [to-qname]]))

 ;; Parsed data format
 ;; Represents a node of an XML tree
-(defrecord Element [tag attrs content])
+(defrecord Element [tag attrs content]
+  Object
+  (toString [_]
+    (let [qname (to-qname tag)]
+      (apply str (concat ["<" qname]
+                         (mapcat (fn [[n a]]
+                                   [" " (to-qname n) "=" (pr-str a)])
+                                 attrs)
+                         (if (seq content)
+                           (concat [">"] content ["<" qname ">"])
+                           ["/>"]))))))
 (defrecord CData [content])
 (defrecord Comment [content])


CMR-1354: Fixing issue in getting score sort order.

--- search-app/src/cmr/search/data/query_to_elastic.clj
+++ search-app/src/cmr/search/data/query_to_elastic.clj
@@ -40,7 +40,7 @@
   relevancy to sort. If true, use the temporal overlap script in elastic. This config allows
   temporal overlap calculations to be turned off if needed for performance."
   {:type Boolean
-   :default true})
+   :default false})

 (defn- doc-values-field-name
   "Returns the doc-values field-name for the given field."
@@ -277,15 +277,16 @@
   (let [use-keyword-sort? (keywords-extractor/contains-keyword-condition? query)
         use-temporal-sort? (and (temporal-range-extractor/contains-temporal-ranges? query)
                                 (sort-use-temporal-relevancy))]
-    (concat
-     (when use-keyword-sort?
-       [{:_score {:order :desc}}])
-     (when use-temporal-sort?
-       [{:_script (temporal-to-elastic/temporal-overlap-sort-script query)}])
-     ;; We only include this if one of the others is present
-     (when (and (or use-temporal-sort? use-keyword-sort?)
-                (sort-use-relevancy-score))
-       [{:usage-relevancy-score {:order :desc :missing 0}}]))))
+    (seq
+     (concat
+      (when use-keyword-sort?
+        [{:_score {:order :desc}}])
+      (when use-temporal-sort?
+        [{:_script (temporal-to-elastic/temporal-overlap-sort-script query)}])
+      ;; We only include this if one of the others is present
+      (when (and (or use-temporal-sort? use-keyword-sort?)
+                 (sort-use-relevancy-score))
+        [{:usage-relevancy-score {:order :desc :missing 0}}])))))

 (defn- temporal-sort-order
   "If there are temporal ranges in the query and temporal relevancy sorting is turned on,


Ensure OSC sending debug args get printed by forcing lazy seqs into a vector

--- src/overtone/sc/machinery/server/comms.clj
+++ src/overtone/sc/machinery/server/comms.clj
@@ -41,7 +41,7 @@
   (server-snd \"/foo\" 1 2.0 \"eggs\")"
   [path & args]
   (let [args (massage-numerical-args args)]
-    (log/debug (str "Sending: " path ", args: " (doall args)))
+    (log/debug (str "Sending: " path ", args: " (into [] args)))
     (when @osc-debug*
       (println "Sending: " path args))
     (apply validated-snd @server-osc-peer* path args)))


Bass restored

Bass restored

--- src/overtunes/songs/canone_alla_quarta.clj
+++ src/overtunes/songs/canone_alla_quarta.clj
@@ -44,6 +44,11 @@
           (merge-with concat call response development)]
     (=> line #(update-in % [:time] sums) #(map vector (:time %) (:pitch %)))))

+(def bassline
+  (map vector
+       (sums (mapcat repeat [21 12] [1 1/4]))
+       (concat (mapcat (partial repeat 3) (concat (run 0 -3) (run -5 -3))) (run 12 0))))
+
 (defn play# [notes]
   (let [play-at# #(at (% 0) (piano# (% 1)))]
     (->> notes (map play-at#) dorun)))
@@ -56,9 +61,10 @@
         mirror (transform-y -)
         transpose #(transform-y (add %))
         leader #(=> % (after 1/2) (in g-major) (tempo (bpm 120)) from-now)
-        follower #(=> % mirror (transpose -3) (after 3) leader)]
+        follower #(=> % mirror (transpose -3) (after 3) leader)
+        bass (=> bassline (transpose -7) (in g-major) (tempo (bpm 120)) from-now)]
     (=> melody leader play#)
     (=> melody follower play#)
-    ))
+    (=> bass play#)))

 (canone-alla-quarta#)


(CTH-65) Implement threaded dispatch queue

This commit uses threaded map to deliver messages to their endpoints
after they have been processed by the inventory service.

--- src/puppetlabs/cthun/connection_states.clj
+++ src/puppetlabs/cthun/connection_states.clj
@@ -81,9 +81,11 @@

 (defn deliver-from-accept-queue
   [message]
-  (doseq [message (messages-to-destinations message)]
-    (log/info "delivering message from accept queue to mesh" message)
-    ((:deliver-to-client @mesh) (first (:endpoints message)) message)))
+  (log/info "Delivering")
+  (doall (pmap (fn [message]
+                 (log/info "delivering message from accept queue to mesh" message)
+                 ((:deliver-to-client @mesh) (first (:endpoints message)) message))
+               (messages-to-destinations message))))

 (defn use-this-mesh
   "Specify which mesh to use"


Move epoch ahead of protocol

Move epoch ahead of protocol

--- src/tick/core.clj
+++ src/tick/core.clj
@@ -26,6 +26,9 @@
     (LocalDate/now *clock*)
     (LocalDate/now)))

+(defn epoch []
+  (java.time.Instant/EPOCH))
+
 (defprotocol ITimeAt
   (on [_ _] "Set time be ON a date")
   (at [_ _] "Set date to be AT a time")  )
@@ -35,9 +38,6 @@

 (defn noon [^LocalDate date]
   (at date (LocalTime/NOON)))
-
-(defn epoch []
-  (java.time.Instant/EPOCH))

 (s/def ::instant #(instance? Instant %))


MMT-1851: only render NASA logo for NASA collections

* only render NASA logo in collection overview section for NASA data centers
* MMT-1881 - change tab to Citation Information

--- collection-renderer-lib/project.clj
+++ collection-renderer-lib/project.clj
@@ -14,7 +14,7 @@
    the hardcoded commit id during dev integration with cmr_metadata_preview project.
    The hardcoded commit id should be updated when MMT releases a new version of the gem."
   (or (System/getenv "CMR_METADATA_PREVIEW_COMMIT")
-      "92d2906dc67"))
+      "d81ad5ef55c"))

 (def gem-install-path
   "The directory within this library where Ruby gems are installed."


Do not sort sequences.

Do not sort sequences.

--- src/devtools/cljs/kamituel/s-tlbx-chrome/utils.cljs
+++ src/devtools/cljs/kamituel/s-tlbx-chrome/utils.cljs
@@ -83,7 +83,7 @@
                        (handle-coll v idx))]

         (seq? data)
-        [:div.seq (for [[idx v] (map-indexed (fn [idx v] [idx v]) (sort data))]
+        [:div.seq (for [[idx v] (map-indexed (fn [idx v] [idx v]) data)]
                     ^{:key (hash (conj current-path idx))}
                     (handle-coll v idx))]


forgotten require

forgotten require

--- src/xvsy/core.clj
+++ src/xvsy/core.clj
@@ -1,5 +1,7 @@
 (ns xvsy.core
-  (:require [clojure.tools.logging :as log])
+  (:require [clojure.tools.logging :as log]
+            [clojure.data.json]
+            [ring.util.codec])
   (:require (xvsy  [geom :as geom]
                    [ggsql :as ggsql]
                    [scale :as scale]


Processing source map

Processing source map

--- src/zg/server.clj
+++ src/zg/server.clj
@@ -183,29 +183,37 @@
                              (db-interface/read-words-for-pattern word :blacklist))]
         (finish-processing request search-results nil nil title emender-page :blacklist)))

+(defn sources->map
+    [sources]
+    (into '{}
+        (for [source sources] [(:id source) (:source source)])))
+
 (defn process-all-words
     "Read all words from the selected dictionary and display them to user on generated page."
     [request title emender-page mode]
     (perform-operation request mode)
     (let [search-results (db-interface/read-all-words mode)
-          sources        (db-interface/read-sources)]
-        (finish-processing request search-results sources nil title emender-page mode)))
+          sources        (db-interface/read-sources)
+          sources-map    (sources->map sources)]
+        (finish-processing request search-results sources-map nil title emender-page mode)))

 (defn process-deleted-words
     "Read all deleted words from the selected dictionary and display them to user on generated page."
     [request title emender-page mode]
     (perform-operation request mode)
     (let [search-results (db-interface/read-deleted-words mode)
-          sources        (db-interface/read-sources)]
-        (finish-processing request search-results sources nil title emender-page mode)))
+          sources        (db-interface/read-sources)
+          sources-map    (sources->map sources)]
+        (finish-processing request search-results sources-map nil title emender-page mode)))

 (defn process-active-words
     "Read all nondeleted words from the selected dictionary and display them to user on generated page."
     [request title emender-page mode]
     (perform-operation request mode)
     (let [search-results (db-interface/read-active-words mode)
-          sources        (db-interface/read-sources)]
-        (finish-processing request search-results sources nil title emender-page mode)))
+          sources        (db-interface/read-sources)
+          sources-map    (sources->map sources)]
+        (finish-processing request search-results sources-map nil title emender-page mode)))

 (defn read-changes-statistic
     []
@@ -364,6 +372,7 @@
             "/all-words-in-whitelist"     (process-all-words     request title emender-page :whitelist)
             "/all-words-in-blacklist"     (process-all-words     request title emender-page :blacklist)
             "/all-words-in-atomic-typos"  (process-all-words     request title emender-page :atomic-typos)
+            "/all-words-in-glossary"      (process-all-words     request title emender-page :glossary)
             "/active-words-in-whitelist"  (process-active-words  request title emender-page :whitelist)
             "/active-words-in-blacklist"  (process-active-words  request title emender-page :blacklist)
             "/active-words-in-atomic-typos"  (process-active-words     request title emender-page :atomic-typos)


Use bytes= instead of array-eq

Use bytes= instead of array-eq

--- test/caesium/magicnonce/secretbox_test.clj
+++ test/caesium/magicnonce/secretbox_test.clj
@@ -13,16 +13,16 @@
         two (byte-array [0 1 0])
         out (byte-array [0 0 0])]
     (is (identical? (#'ms/xor! out one two) out))
-    (is (u/array-eq (byte-array [1 1 1]) out)))
+    (is (bb/bytes= (byte-array [1 1 1]) out)))
   (let [one (byte-array [1 0 1])
         two (byte-array [0 1 0])]
     (is (identical? (#'ms/xor-inplace! one two) one))
-    (is (u/array-eq (byte-array [1 1 1]) one))))
+    (is (bb/bytes= (byte-array [1 1 1]) one))))

 (deftest random-nonce!-test
   (let [a (#'ms/random-nonce!)
         b (#'ms/random-nonce!)]
-    (is (not (u/array-eq a b)))
+    (is (not (bb/bytes= a b)))
     (is (= s/noncebytes (bb/buflen a) (bb/buflen b)))))

 (defn is-valid-magicnonce-ctext?
@@ -37,7 +37,7 @@
        out
        (bb/->indirect-byte-buf st/secret-key)
        (bb/->indirect-byte-buf ctext))
-      (is (u/array-eq st/ptext out)))
+      (is (bb/bytes= st/ptext out)))

     (let [out (bb/alloc ptextlen)
           forgery (bb/->indirect-byte-buf (r/randombytes (bb/buflen out)))]
@@ -48,7 +48,7 @@
             (bb/->indirect-byte-buf st/secret-key)
             forgery))))

-    (is (u/array-eq st/ptext (ms/decrypt st/secret-key ctext)))
+    (is (bb/bytes= st/ptext (ms/decrypt st/secret-key ctext)))

     (let [forgery (r/randombytes (bb/buflen ctext))]
       (is (thrown-with-msg?
@@ -60,7 +60,7 @@
        out
        (bb/->indirect-byte-buf ctext)
        (bb/->indirect-byte-buf st/secret-key))
-      (is (u/array-eq st/ptext out)))
+      (is (bb/bytes= st/ptext out)))

     (let [out (bb/alloc ptextlen)
           forgery (bb/->indirect-byte-buf (r/randombytes (bb/buflen out)))]
@@ -71,7 +71,7 @@
             forgery
             (bb/->indirect-byte-buf st/secret-key)))))

-    (is (u/array-eq st/ptext (ms/open ctext st/secret-key)))
+    (is (bb/bytes= st/ptext (ms/open ctext st/secret-key)))

     (let [forgery (r/randombytes (bb/buflen ctext))]
       (is (thrown-with-msg?
@@ -101,7 +101,7 @@
          xord-ctexts (byte-array shortest)]
      (apply #'ms/xor! xord-ptexts ptexts)
      (apply #'ms/xor! xord-ctexts ctexts)
-     (u/array-eq xord-ptexts xord-ctexts))))
+     (bb/bytes= xord-ptexts xord-ctexts))))

 (deftest secretbox-pfx-test
   (let [nonce (byte-array (range s/noncebytes))
@@ -118,13 +118,13 @@

   (let [c1 (ms/secretbox-rnd st/ptext st/secret-key)
         c2 (ms/secretbox-rnd st/ptext st/secret-key)]
-    (is (not (u/array-eq c1 c2)))
+    (is (not (bb/bytes= c1 c2)))
     (is (not= (take s/noncebytes c1) (take s/noncebytes c2))))

   (with-redefs [ms/random-nonce! constant-nonce]
     (let [c1 (ms/secretbox-rnd st/ptext st/secret-key)
           c2 (ms/secretbox-rnd st/ptext st/secret-key)]
-      (is (u/array-eq c1 c2))
+      (is (bb/bytes= c1 c2))
       (is (= (range s/noncebytes) (take s/noncebytes c1) (take s/noncebytes c2))))))

 (deftest synthetic-nonce-test
@@ -140,9 +140,9 @@
            (bb/buflen (sn m2 k1))
            (bb/buflen (sn m1 k2))
            (bb/buflen (sn m2 k2))))
-    (is (u/array-eq (sn m1 k1) (sn m1 k1)))
-    (is (not (u/array-eq (sn m1 k1) (sn m2 k1))))
-    (is (not (u/array-eq (sn m1 k1) (sn m1 k2))))))
+    (is (bb/bytes= (sn m1 k1) (sn m1 k1)))
+    (is (not (bb/bytes= (sn m1 k1) (sn m2 k1))))
+    (is (not (bb/bytes= (sn m1 k1) (sn m1 k2))))))

 (deftest secretbox-det-test
   (let [ctext (ms/secretbox-det st/ptext st/secret-key)]
@@ -153,7 +153,7 @@

   (let [c1 (ms/secretbox-det st/ptext st/secret-key)
         c2 (ms/secretbox-det st/ptext st/secret-key)]
-    (is (u/array-eq c1 c2))))
+    (is (bb/bytes= c1 c2))))

 (deftest secretbox-nmr-with-implicit-rnd-nonce-test
   (let [ctext (ms/secretbox-nmr st/ptext st/secret-key)]
@@ -167,7 +167,7 @@
           c2 (ms/secretbox-nmr st/ptext st/secret-key)
           alt-ptext (.getBytes "yellow submarine")
           c3 (ms/secretbox-nmr alt-ptext st/secret-key)]
-      (is (u/array-eq c1 c2))
+      (is (bb/bytes= c1 c2))
       (let [n1 (take s/noncebytes c1)
             n2 (take s/noncebytes c2)
             n3 (take s/noncebytes c3)]