precondition to check type of PushbackReader

Since clojure.tools.namespace.parse/read-ns-decl silently ignores any
exception thrown by `read`, it is helpful to check the type of the
reader. Otherwise, attempting to call `read-ns-decl` on an object of
the wrong type, or nil, would return nil without any explanation.

--- src/main/clojure/clojure/tools/namespace/parse.clj
+++ src/main/clojure/clojure/tools/namespace/parse.clj
@@ -30,6 +30,7 @@
   (controlled by *read-eval*), and as such should be used only with
   trusted sources."
   [rdr]
+  {:pre [(instance? java.io.PushbackReader rdr)]}
   (try
    (loop []
      (let [form (doto (read rdr) str)]  ; str forces errors, see TNS-1


Render 'insufficient input' case in a more easy-to-grasp manner

--- src/pinpointer/formatter.cljc
+++ src/pinpointer/formatter.cljc
@@ -178,7 +178,12 @@

         (let [next-frame (second (:trace printer))]
           (and next-frame (= (:reason next-frame) "Insufficient input")))
-        (highlight (visit/visit (:base-printer printer) x))
+        (let [printer (:base-printer printer)
+              x (if (seq? x) (concat x ['...]) (conj x '...))]
+          (render-coll frame printer x
+            (fn [i v]
+              (cond-> (visit/visit printer v)
+                (= i (dec (count x))) highlight))))

         (empty? steps)
         (render-next printer x)


Improve read-deps-edn fn

Improve read-deps-edn fn

--- prod.clj
+++ prod.clj
@@ -1,4 +1,5 @@
 (require
+  '[clojure.string :as str]
   '[leiningen.core.project :as p :refer [defproject]]
   '[leiningen.clean :refer [clean]]
   '[leiningen.install :refer [install]]
@@ -15,14 +16,25 @@
                   vals
                   (mapcat :extra-deps)
                   (into deps)
+                  (map (fn parse-coord [coord]
+                         (let [[artifact info] coord
+                               s (str artifact)]
+                           (if-let [i (str/index-of s "$")]
+                             [(symbol (subs s 0 i))
+                              (assoc info :classifier (subs s (inc i)))]
+                             coord))))
                   (reduce
                     (fn [deps [artifact info]]
                       (if-let [version (:mvn/version info)]
                         (conj deps
                           (transduce cat conj [artifact version]
-                            (select-keys info [:scope :exclusions])))
+                            (select-keys info [:exclusions :classifier])))
                         deps))
-                    []))]
+                    []))
+        paths (->> (select-keys aliases aliases-to-include)
+                   vals
+                   (mapcat :extra-paths)
+                   (into paths))]
     {:dependencies deps
      :source-paths []
      :resource-paths paths}))


fix: regression test

fix: regression test

--- src/test/clojure/pdok/featured/regression_test.clj
+++ src/test/clojure/pdok/featured/regression_test.clj
@@ -123,12 +123,12 @@
     (doseq [row-id rows-to-delete]
       (swap! extracts dissoc row-id))))

-(defn- test-timeline->extract [collection n-extracts]
+(defn- test-timeline->extract [n-extracts]
   (let [extracts (atom {})]
     (with-bindings
       {#'e/*process-insert-extract* (partial inserted-features extracts)
        #'e/*process-delete-extract* (partial deleted-versions extracts)}
-      (e/fill-extract "regression-set" collection nil))
+      (e/fill-extract "regression-set" nil))
     (is (= n-extracts (count @extracts)))))

 (defn- query-geoserver [table]
@@ -145,7 +145,7 @@
   (test-timeline "col-2" "id-b" {:timeline-current {:n 1}
                                  :timeline {:n 0}
                                  :timeline-changelog {:n-new 1}})
-  (test-timeline->extract "col-2" 1)
+  (test-timeline->extract 1)
   (test-geoserver "col-2" 1))

 (defregressiontest new-change-feature "col-2_id-b_new-change" stats
@@ -155,7 +155,7 @@
   (test-timeline "col-2" "id-b" {:timeline-current {:n 1}
                                  :timeline {:n 1}
                                  :timeline-changelog {:n-new 1 :n-change 1}})
-  (test-timeline->extract "col-2" 2)
+  (test-timeline->extract 2)
   (test-geoserver "col-2" 1))

 (defregressiontest new-change-close-feature "col-2_id-b_new-change-close" stats
@@ -165,7 +165,7 @@
   (test-timeline "col-2" "id-b" {:timeline-current {:n 1}
                                  :timeline {:n 1}
                                  :timeline-changelog {:n-new 1 :n-change 1 :n-close 1}})
-  (test-timeline->extract "col-2" 2)
+  (test-timeline->extract 2)
   (test-geoserver "col-2" 0))

 (defregressiontest new-change-close_with_attributes-feature "col-2_id-b_new-change-close_with_attributes" stats
@@ -175,7 +175,7 @@
   (test-timeline "col-2" "id-b" {:timeline-current {:n 1}
                                  :timeline {:n 2}
                                  :timeline-changelog {:n-new 1 :n-change 2 :n-close 1}})
-  (test-timeline->extract "col-2" 3)
+  (test-timeline->extract 3)
   (test-geoserver "col-2" 0))

 (defregressiontest new-change-change-delete-feature "col-1_id-a_new-change-change-delete" stats
@@ -185,7 +185,7 @@
   (test-timeline "col-1" "id-a" {:timeline-current {:n 0}
                                  :timeline {:n 0}
                                  :timeline-changelog {:n-new 1 :n-change 2 :n-delete 3}})
-  (test-timeline->extract "col-1" 0)
+  (test-timeline->extract 0)
   (test-geoserver "col-1" 0))

 (defregressiontest new-change-change-delete-new-change-feature "col-1_id-a_new-change-change-delete-new-change" stats
@@ -195,5 +195,5 @@
   (test-timeline "col-1" "id-a" {:timeline-current {:n 1}
                                  :timeline {:n 1}
                                  :timeline-changelog {:n-new 2 :n-change 3 :n-delete 3}})
-  (test-timeline->extract "col-1" 2)
+  (test-timeline->extract 2)
   (test-geoserver "col-1" 1))


Start segregating handshake test w/ mem pool

On the crazy theory that maybe the client is releasing the buffer after
the server starts parsing it.

So far, I don't see any obvious functional difference.

--- test/com/frereth/common/curve/interaction_test.clj
+++ test/com/frereth/common/curve/interaction_test.clj
@@ -141,21 +141,25 @@

 (defn retrieve-hello
   "This is really a server-side method"
-  [client-chan hello]
-  (println "Pulled HELLO from client")
+  [mem-pool client-chan hello]
+  (log/info "Pulled HELLO from client")
   (let [n (.readableBytes hello)]
     (println "Have" n "bytes to write to " client-chan)
     (if (= 224 n)
-      (strm/try-put! (:chan client-chan)
-                     {:message (Unpooled/wrappedBuffer hello)
-                      :host "test-client"
-                      :port 65536}
-                     500
-                     ::timed-out)
+      (let [copy (.directBuffer mem-pool n)]
+        (.readBytes hello copy)
+        (.release hello)
+        (strm/try-put! (:chan client-chan)
+                       {:message copy
+                        :host "test-client"
+                        :port 65536}
+                       500
+                       ::timed-out))
       (throw (RuntimeException. "Bad Hello")))))

 (defn wrote-hello
   [client-chan success]
+  (log/info "Wrote HELLO to server")
   (is success "Failed to write hello to server")
   (is (not= success ::timed-out "Timed out waiting for server to read HELLO"))
   ;; This is timing out both here and in the server side.
@@ -200,23 +204,24 @@

 (defn wrote-cookie
   [clnt-> success]
+  (log/info "Wrote cookie packet to Client")
   (is (and success
            (not (keyword? success))))
   (if (not= success ::timeout)
     (do
-      (println "Server Cookie sent to client. Waiting for Initiate packet in response")
+      (log/info "Server Cookie sent to client. Waiting for Initiate packet in response")
       (strm/try-take! clnt-> ::drained 500 ::timeout))))

 (defn vouch->server
-  [->server vouch]
+  [mem-pool ->server vouch]
   ;; I don't have any real failure indication available
   ;; if something goes wrong with/on the server trying
   ;; to cope with this incoming vouch.
   ;; I almost need an error stream for dealing with exceptions.
-  (println "Got Initiate packet from client: "
-           vouch
-           " for forwarding along to "
-           ->server)
+  (log/info "Got Initiate packet from client: "
+            vouch
+            " for forwarding along to "
+            ->server)
   (is (not (keyword? vouch)))
   ;; There's something inside out going on.
   ;; We just forwarded the from the server to the
@@ -226,12 +231,15 @@
   ;; back to the Server.
   (if-not (or (= vouch ::drained)
               (= vouch ::timeout))
-    (strm/try-put! (:chan ->server)
-                   {:message vouch
-                    :host "tester-client"
-                    :port 65536}
-                   500
-                   ::timeout)
+    (let [copy (.directBuffer mem-pool (.readableBytes vouch))]
+      (.readBytes vouch copy)
+      (.release vouch)
+      (strm/try-put! (:chan ->server)
+                     {:message copy
+                      :host "tester-client"
+                      :port 65536}
+                     500
+                     ::timeout))
     (throw (ex-info "Retrieving Vouch from client failed"
                     {:failure vouch}))))

@@ -399,7 +407,6 @@
   ;; Shouldn't be trying to re-use buffers produced at client side on the server.
   ;; And vice-versa.
   ;; That's just adding needless complexity
-  (throw (RuntimeException. "Start by isolating the ByteBuf"))
   (let [options (build-hand-shake-options)
         ;; Note that the channel names in here seem backward.
         ;; Remember that they're really a mirror image:
@@ -431,18 +438,23 @@
                 ;; Q: Is there anything interesting about the deferred that it
                 ;; currently returns?
                 (let [eventually-started (clnt/start! client)
-                      clnt->srvr (::clnt/chan->server @client)]
+                      clnt->srvr (::clnt/chan->server @client)
+                      ;; Start with one that prefers direct buffers, even though it doesn't
+                      ;; make a lot of sense for this test.
+                      ;; I'm as certain as I can be (without actual metrics) that's the most
+                      ;; realistic picture I'll get of the way it needs to really work
+                      mem-pool (io.netty.buffer.PooledByteBufAllocator. true)]
                   (assert (= chan->server clnt->srvr)
                           (str "Client channels don't match.\n"
                                "Expected:" chan->server
                                "\nHave:" clnt->srvr))
                   (assert chan->server)
-                  (let [write-hello (partial retrieve-hello chan<-client)
+                  (let [write-hello (partial retrieve-hello mem-pool chan<-client)
                         build-cookie (partial wrote-hello chan->client)
                         write-cookie (partial forward-cookie chan<-server)
                         ;; This pulls the Initiate packet from the client
                         get-cookie (partial wrote-cookie chan->server)
-                        write-vouch (partial vouch->server chan<-client)
+                        write-vouch (partial vouch->server mem-pool chan<-client)
                         get-server-response (partial wrote-vouch chan->client)
                         write-server-response (partial finalize chan<-server)
                         _ (println "interaction-test: Starting the stream "


[#1077] More descriptive docstring for add-tenant script

--- backend/src/akvo/lumen/admin/add_tenant.clj
+++ backend/src/akvo/lumen/admin/add_tenant.clj
@@ -1,8 +1,8 @@
 (ns akvo.lumen.admin.add-tenant
   "The following env vars are assumed to be present:
   ENCRYPTION_KEY, KC_URL, KC_SECRET, PG_HOST, PG_DATABASE, PG_USER, PG_PASSWORD
-  ENCRYPTION_KEY is a key specific for the environment used for encrypting
-  the db_uri.
+  ENCRYPTION_KEY is a key specific for the Kubernetes environment used for
+  encrypting the db_uri.
   The PG_* env vars can be found in the ElephantSQL console for the appropriate
   instance. KC_URL is the url to keycloak (without trailing /auth).
   KC_SECRET is the client secret found in the Keycloak admin at


Improve windowing crash test to duplicate data as well as well as produce multiple segments per root segment


harder benchmark for with-temp-files

harder benchmark for with-temp-files

--- benchmarks/matross/tasks/temp_file_benchmark.clj
+++ benchmarks/matross/tasks/temp_file_benchmark.clj
@@ -20,4 +20,4 @@

 (defcase temp-file-benchmarks :with-temp-files-macro
   [conn _]
-  (with-temp-files conn [a]))
+  (with-temp-files conn [a b c d]))


Don't try to fetch zero rows.

Don't try to fetch zero rows.

--- src/cavm/h2.clj
+++ src/cavm/h2.clj
@@ -1211,7 +1211,10 @@
         fields (into {} (fetch-field-ids dataset-id
                                          (into (collect-fields where) select)))
         cache (atom {})
-        fetch (fn [rows field] (fetch-rows cache rows (fields field)))]
+        fetch (fn [rows field]
+                (if (not-empty rows)
+                  (fetch-rows cache rows (fields field))
+                  {}))]
   (evaluate (apply sorted-set (range N)) {:fetch fetch
                                           :fetch-indexed (partial fetch-indexed fields)
                                           :indexed? (partial has-index? fields)} exp)))


fix conf

fix conf

--- src/ccm_clj.clj
+++ src/ccm_clj.clj
@@ -29,11 +29,13 @@
     r))

 (defn- conf-as-map [conf-file]
+  ;todo this pretty suss
   ;Python config parsers do not guess datatypes of values in configuration files, always storing them internally as string,
   ;BUT we'll keyword cos we can't help ourselves."
   (apply array-map (mapcat
                      (fn [line]
-                       (let [[k v] (str/split line #":" 2)]
+                       (let [k (subs line 0 (inc (.indexOf line ":")))
+                             v (subs line (inc (.indexOf line ":")))]      ;todo comments multi-lines
                          (letfn [(realize [i]
                                           (let [i (str/trim i)]
                                                 (cond


added simple html5 wrapper

added simple html5 wrapper

The new "layout" is used for the replyform resource which only returns a replyform wrapped by <html><body>.


Reformat src/deps.cljs

Reformat src/deps.cljs

--- src/deps.cljs
+++ src/deps.cljs
@@ -1,3 +1,3 @@
-{:npm-deps {"react-flip-move" "3.0.3"
-            "highlight.js" "9.15.8"
+{:npm-deps {"react-flip-move"    "3.0.3"
+            "highlight.js"       "9.15.8"
             "react-highlight.js" "1.0.7"}}


Showing the number of URLs to give people an idea of the work involved

--- src/ui/relevance/display.cljs
+++ src/ui/relevance/display.cljs
@@ -244,9 +244,11 @@
   (let [url-times  (subscribe [:data :url-times])
         site-times (subscribe [:data :site-times])
         url-values (reaction (filter-tabs (vals @url-times)))
-        to-list    (reaction (sort-by #(* -1 (:time %)) @url-values))]
+        to-list    (reaction (sort-by #(* -1 (:time %)) @url-values))
+        total      (reaction (count @to-list))]
     (fn []
       [:div {:class "row"}
+       [:p "Total: " @total " URLs."]
        [:div {:class "card"}
         [:div {:class "content table-responsive table-full-width"}
          [:table {:class "table table-striped table-hover"}
@@ -264,9 +266,11 @@
 (defn div-sitetimes []
   (let [site-times (subscribe [:data :site-times])
         sites      (reaction (vals @site-times))
-        to-list    (reaction (sort-by #(* -1 (:time %)) @sites))]
+        to-list    (reaction (sort-by #(* -1 (:time %)) @sites))
+        total      (reaction (count @to-list))]
     (fn []
       [:div {:class "row"}
+       [:p "Total: " @total " domains."]
        [:div {:class "card"}
         [:div {:class "content table-responsive table-full-width"}
          [:table {:class "table table-striped table-hover"}


Add 10% chance of forming a coral root.

Add 10% chance of forming a coral root.

--- src/videotest/coral/coral.clj
+++ src/videotest/coral/coral.clj
@@ -48,8 +48,14 @@
 (defn bumping-coral? []
   )

+(def BOTTOM-ATTACH-PCT 0.1)
+
 (defn is-attaching? [num-rows cell-w x y]
-  (is-bottom? num-rows (y->row cell-w y)))
+  (cond
+   (is-bottom? num-rows (y->row cell-w y))
+   (> BOTTOM-ATTACH-PCT (rand))
+
+   :default false))

 (defn remove-seeds [all-seeds seeds]
   (remove (set seeds) all-seeds))


Sort of getting somewhere on Clojure part 3

--- palindrome.clj
+++ palindrome.clj
@@ -1,18 +1,22 @@
 (def orig (first *command-line-args*))
+(def input (seq (char-array (first *command-line-args*))))
+(defn palindrome? [s] (= s (reverse s)))
+(def occurrences-map (frequencies input))
+(def evens-map (filter (fn [[_, v]] (even? v)) occurrences-map))
+(def odds-map (filter (fn [[_, v]] (odd? v)) occurrences-map))

-(def input (seq (char-array (first *command-line-args*))))
+(defn string-from-map [k, v] (apply str (take (quot v 2) (repeat k))))

-(defn palindrome? [s] (= s (reverse s)))
+(defn get-single [k, _] k)

-(def occurrences-map (frequencies input))
-
-(def evens-map (filter (fn [[_, v]] (even? v)) occurrences-map))
-
-(def odds-map (filter (fn [[_, v]] (odd? v)) occurrences-map))
+; build full string with (apply str 1 2 3)
+; iterate through pairs with (doseq [[k, v] map-name] ())
+; final print = (printf "A palindromic form of %s is %s%n" orig (build-string s-evens s-odds single))

 (if (palindrome? input)
   (printf "%s is a palindrome%n" orig)
   (if (> (count (keys odds-map)) 1)
     (printf "%s cannot be made into a palindrome%n" orig)
-    (println "dingo"))
+    (printf "A palindromic form of %s is %s%n" orig orig)
+  )
 )


indentation

indentation

--- src/yeller/clojure/client.clj
+++ src/yeller/clojure/client.clj
@@ -214,5 +214,5 @@
      (.report client
               exception
               ^java.util.Map (stringify-keys (add-ex-data
-                                exception
-                                (:custom-data extra {})))))))
+                                               exception
+                                               (:custom-data extra {})))))))


added thickness function

added thickness function

--- model.clj
+++ model.clj
@@ -0,0 +1,10 @@
+(defn thickness-function
+  "Take the thickness and returns the function of thickess around the camber line"
+  [thickness x]
+  (let [a-0 0.2969
+        a-1 -0.126
+        a-2 -0.3516
+        a-3 0.2843
+        a-4 -0.1036]
+        (* (/ thickness 0.2)
+           (+ (* a-0 (^ x 0.5)) (* a-1 x) (* a-2 (^ x 2)) (* a-3 (^ x 3)) (* a-4 (^ x 4))))))


lein-release plugin: bumped version from 0.3.3 to 0.3.4-SNAPSHOT for next development cycle

--- backend/project.clj
+++ backend/project.clj
@@ -1,4 +1,4 @@
-(defproject lambdaui "0.3.3"
+(defproject lambdaui "0.3.4-SNAPSHOT"
   :description "LambdaCD-Plugin that provides a modern UI for your pipeline."
   :url "https://github.com/sroidl/lambda-ui"
   :license {:name "Apache License 2.0"


Updated dependency on lein-ccw-deps

Updated dependency on lein-ccw-deps

--- ccw.core/project.clj
+++ ccw.core/project.clj
@@ -9,4 +9,4 @@
                  [org.clojure/core.incubator "0.1.0"]
                  [com.cemerick/drawbridge "0.0.6"]]
   :source-paths []
-  :plugins [[ccw/lein-ccw-deps "0.1.0-SNAPSHOT"]])+  :plugins [[ccw/lein-ccw-deps "0.1.0"]])


Add test for parsing ip(x) = 10.0.0.1

Add test for parsing ip(x) = 10.0.0.1

--- test/desdemona/query_test.clj
+++ test/desdemona/query_test.clj
@@ -17,6 +17,13 @@
                  [:identifier "b"]]]
          (#'q/infix-parser "a = b"))
       "equality between identifiers")
+  (is (= [:expr [:eq
+                 [:fn-call
+                  [:identifier "ip"]
+                  [:identifier "x"]]
+                 [:ipv4-address "10" "0" "0" "1"]]]
+         (#'q/infix-parser "ip(x) = 10.0.0.1"))
+      "equality between fn call and IP address literal"))

 (deftest infix->dsl-tests
   (is (= '(= (:ip x) "10.0.0.1")


Tests for metadata

Tests for metadata

--- test/grafter/tabular_test.clj
+++ test/grafter/tabular_test.clj
@@ -735,14 +735,14 @@
     (testing "graph-fn"
       (testing "destructuring"
         (are [name column-names binding-form body]
-          (testing name
-            (let [ds (make-dataset test-data
-                                   column-names)
-                  f (graph-fn [binding-form]
-                              body)]
-
-              (is (= first-quad
-                     (first (f ds))))))
+             (testing name
+               (let [ds (make-dataset test-data
+                                      column-names)
+                     f (graph-fn [binding-form]
+                                 body)]
+
+                 (is (= first-quad
+                        (first (f ds))))))

           "by :keys"
           [:a :b :c :d] {:keys [a b c d]}
@@ -779,16 +779,13 @@
                                           [a
                                            [b c]]))
               ds (make-dataset [["http://one/" "http://two/" "http://three/"]])
-              quad-meta (meta (first (my-graphfn ds)))]
-
-
-          (is (= {:grafter.tabular/row {"a" "http://one/" "b" "http://two/" "c" "http://three/"}}
-                 quad-meta)
-              "Adds the row that yielded each Quad as metadata")
-
-          (is (= {"a" "http://one/" "b" "http://two/" "c" "http://three/"}
-                 (:grafter.tabular/row quad-meta))
-              "Adds the row that yielded each Quad as metadata"))))))
+              quad-meta (meta (first (my-graphfn ds)))] (is (= {:grafter.tabular/row {"a" "http://one/" "b" "http://two/" "c" "http://three/"}}
+                                                               quad-meta)
+                                                            "Adds the row that yielded each Quad as metadata")
+
+             (is (= {"a" "http://one/" "b" "http://two/" "c" "http://three/"}
+                    (:grafter.tabular/row quad-meta))
+                 "Adds the row that yielded each Quad as metadata"))))))

 (deftest rename-test
   (let [ds (test-dataset 1 2)]


New aleph version correctly sets Host header

--- test/icecap/e2e/http_test.clj
+++ test/icecap/e2e/http_test.clj
@@ -72,7 +72,7 @@
               :server-name "localhost"
               :server-port 8378
               :uri "/test/example"
-              :headers {"host" "localhost"
+              :headers {"host" "localhost:8378"
                         "content-length" "0"}
               :keep-alive? true
               :query-string nil


Use HornetQ utils API.

Use HornetQ utils API.

--- test/onyx/plugin/sql_test.clj
+++ test/onyx/plugin/sql_test.clj
@@ -2,43 +2,13 @@
   (:require [clojure.data.fressian :as fressian]
             [clojure.java.jdbc :as jdbc]
             [midje.sweet :refer :all]
+            [onyx.queue.hornetq-utils :as hq-util]
             [onyx.plugin.sql]
             [onyx.api])
   (:import [org.hornetq.api.core.client HornetQClient]
            [org.hornetq.api.core TransportConfiguration HornetQQueueExistsException]
            [org.hornetq.core.remoting.impl.netty NettyConnectorFactory]
            [com.mchange.v2.c3p0 ComboPooledDataSource]))
-
-(defn create-queue [session queue-name]
-  (try
-    (.createQueue session queue-name queue-name true)
-    (catch Exception e)))
-
-(defn consume-queue! [config queue-name echo]
-  (let [tc (TransportConfiguration. (.getName NettyConnectorFactory) config)
-        locator (HornetQClient/createServerLocatorWithoutHA (into-array [tc]))
-        session-factory (.createSessionFactory locator)
-        session (.createTransactedSession session-factory)]
-
-    (create-queue session queue-name)
-
-    (let [consumer (.createConsumer session queue-name)
-          results (atom [])]
-      (.start session)
-      (while (not= (last @results) :done)
-        (when (zero? (mod (count @results) echo))
-          (prn (format "[HQ Util] Read %s segments" (count @results))))
-        (let [message (.receive consumer)]
-          (when message
-            (.acknowledge message)
-            (swap! results conj (fressian/read (.toByteBuffer (.getBodyBuffer message)))))))
-
-      (prn "[HQ Util] Done reading")
-      (.commit session)
-      (.close consumer)
-      (.close session)
-
-      @results)))

 (defn capitalize [{:keys [rows] :as segment}]
   (map (fn [{:keys [name] :as row}] (assoc row :name (clojure.string/upper-case name))) rows))
@@ -165,7 +135,7 @@

 (onyx.api/submit-job conn {:catalog catalog :workflow workflow})

-(def results (consume-queue! hq-config out-queue 1))
+(def results (hq-util/consume-queue! hq-config out-queue 1))

 (doseq [v-peer v-peers]
   (try


fixing namespace

fixing namespace

--- resources/leiningen/new/closp/clj/components/components.clj
+++ resources/leiningen/new/closp/clj/components/components.clj
@@ -3,11 +3,11 @@
     [com.stuartsierra.component :as component]
     (system.components
       [repl-server :refer [new-repl-server]])
-    [foo.bar.components.server :refer [new-web-server]]
-    [foo.bar.components.handler :refer [new-handler]]
-    [foo.bar.components.config :as c]
-    [foo.bar.components.db :refer [new-db]]
-    [foo.bar.components.locale :as l]))
+    [{{ns}}.components.server :refer [new-web-server]]
+    [{{ns}}.components.handler :refer [new-handler]]
+    [{{ns}}.components.config :as c]
+    [{{ns}}.components.db :refer [new-db]]
+    [{{ns}}.components.locale :as l]))

 (defn dev-system []


better safer solution to reading result of ns form that returns js

--- sidecar/src/figwheel_sidecar/components/figwheel_server.clj
+++ sidecar/src/figwheel_sidecar/components/figwheel_server.clj
@@ -39,13 +39,11 @@

 (defn read-msg [data]
   (try
-    (let [msg
-          (binding [*read-eval* false
-                    *default-data-reader-fn* (fn [tag res] res)]
-            (read-string data))]
+    (let [msg (edn/read-string {:readers {'js identity 'object identity}} data)]
       (if (and (map? msg) (:figwheel-event msg)) msg {}))
     (catch Exception e
       (println "Figwheel: message from client couldn't be read!")
+      (println (Throwable->map e))
       {})))

 (defn validate-file-selected-msg [{:keys [file-name file-line file-column] :as msg}]


removed a do

removed a do

--- src/cljs/org/broadinstitute/firecloud_ui/page/method_config_importer.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/method_config_importer.cljs
@@ -52,11 +52,10 @@
                       {:endpoint (endpoints/delete-agora-entity
                                    type namespace name snapshotId)
                        :on-done (fn [{:keys [success? status-text]}]
-                                  (do
                                     (swap! state dissoc :blocking? :blocking-text)
                                     (if success?
                                       ((:on-delete props))
-                                      (js/alert (str "Error ! Message : " status-text)))))}))))))}]])
+                                      (js/alert (str "Error ! Message : " status-text))))}))))))}]])
      [comps/EntityDetails {:entity entity}]
      [:div {:style {:fontSize "120%" :margin "1.5em 0 0.5em 0"}} "Save as:"]
      (map


including comment about op quote stuff

including comment about op quote stuff

--- src/main/cljc/clojure_club/x121_universal_computation_engine/wmatson.cljc
+++ src/main/cljc/clojure_club/x121_universal_computation_engine/wmatson.cljc
@@ -1,5 +1,6 @@
 (ns main.cljc.clojure-club.x121-universal-computation-engine.wmatson)

+;;http://stackoverflow.com/a/19113820
 (def fix-op-quote-maddness {'+ + '/ / '- - '* *})

 (defn node-evaluator [var-map]


(MAINT) Whitespace changes

(MAINT) Whitespace changes

--- test/integration/puppetlabs/services/jruby/jruby_puppet_internal_test.clj
+++ test/integration/puppetlabs/services/jruby/jruby_puppet_internal_test.clj
@@ -26,35 +26,35 @@
     (is (thrown? ExceptionInfo
                  (jruby-internal/get-compile-mode :foo)))))

-  (deftest ^:integration settings-plumbed-into-jruby-container
-    (testing "setting plumbed into jruby container for"
-      (let [pool (JRubyPool. 1)
-            config (jruby-testutils/jruby-puppet-config
-                     {:http-client-connect-timeout-milliseconds 2
-                      :http-client-idle-timeout-milliseconds 5
-                      :http-client-cipher-suites ["TLS_RSA_WITH_AES_256_CBC_SHA256"
-                                                  "TLS_RSA_WITH_AES_256_CBC_SHA"]
-                      :http-client-ssl-protocols ["TLSv1" "TLSv1.2"]
-                      :compile-mode :jit})
-            instance (jruby-internal/create-pool-instance! pool 0 config #() nil)
-            container (:scripting-container instance)]
-        (= RubyInstanceConfig$CompileMode/JIT
-           (.getCompileMode container))
-        (try
-          (let [settings (into {} (.runScriptlet container
-                                    "java.util.HashMap.new
-                                       (Puppet::Server::HttpClient.settings)"))]
-            (testing "http_connect_timeout_milliseconds"
-              (is (= 2 (settings "http_connect_timeout_milliseconds"))))
-            (testing "http_idle_timeout_milliseconds"
-              (is (= 5 (settings "http_idle_timeout_milliseconds"))))
-            (testing "cipher_suites"
-              (is (= ["TLS_RSA_WITH_AES_256_CBC_SHA256"
-                      "TLS_RSA_WITH_AES_256_CBC_SHA"]
-                    (into [] (settings "cipher_suites")))))
-            (testing "ssl_protocols"
-              (is (= ["TLSv1" "TLSv1.2"]
-                    (into [] (settings "ssl_protocols"))))))
-          (finally
-            (.terminate (:jruby-puppet instance))
-            (.terminate container))))))
+(deftest ^:integration settings-plumbed-into-jruby-container
+  (testing "setting plumbed into jruby container for"
+    (let [pool (JRubyPool. 1)
+          config (jruby-testutils/jruby-puppet-config
+                  {:http-client-connect-timeout-milliseconds 2
+                   :http-client-idle-timeout-milliseconds 5
+                   :http-client-cipher-suites ["TLS_RSA_WITH_AES_256_CBC_SHA256"
+                                               "TLS_RSA_WITH_AES_256_CBC_SHA"]
+                   :http-client-ssl-protocols ["TLSv1" "TLSv1.2"]
+                   :compile-mode :jit})
+          instance (jruby-internal/create-pool-instance! pool 0 config #() nil)
+          container (:scripting-container instance)]
+      (= RubyInstanceConfig$CompileMode/JIT
+         (.getCompileMode container))
+      (try
+        (let [settings (into {} (.runScriptlet container
+                                               "java.util.HashMap.new
+                                                  (Puppet::Server::HttpClient.settings)"))]
+          (testing "http_connect_timeout_milliseconds"
+            (is (= 2 (settings "http_connect_timeout_milliseconds"))))
+          (testing "http_idle_timeout_milliseconds"
+            (is (= 5 (settings "http_idle_timeout_milliseconds"))))
+          (testing "cipher_suites"
+            (is (= ["TLS_RSA_WITH_AES_256_CBC_SHA256"
+                    "TLS_RSA_WITH_AES_256_CBC_SHA"]
+                   (into [] (settings "cipher_suites")))))
+          (testing "ssl_protocols"
+            (is (= ["TLSv1" "TLSv1.2"]
+                   (into [] (settings "ssl_protocols"))))))
+        (finally
+          (.terminate (:jruby-puppet instance))
+          (.terminate container))))))


Actually, SOME is a bad idea.

Actually, SOME is a bad idea.

--- test/structural_typing/use/condensed_type_descriptions/f_ALL_variants.clj
+++ test/structural_typing/use/condensed_type_descriptions/f_ALL_variants.clj
@@ -75,24 +75,4 @@
     (check-for-explanations :X {:a [3 {:b 1}]}) => (just (err:only [3 {:b 1}]))
     (check-for-explanations :X {:a []}) => (just (err:only []))
     (check-for-explanations :X {:a 3}) => (just (err:notpath [:a ONLY :b] {:a 3}))))
-
-
-(future-fact "SOME"
-  (fact "describing the whole path"
-    (type! :X {[SOME] even?})
-    (built-like :X [2]) => [2]
-    (built-like :X [1 2]) => [1 2]
-    (check-for-explanations :X [1]) => (just (err:shouldbe [SOME] "even?" [1]))
-    (check-for-explanations :X []) => (just (err:shouldbe [SOME] "even?" []))
-    (check-for-explanations :X 3) => (just (err:notpath [SOME] 3)))
-
-  (fact "as part of a path"
-    (type! :X {[:a SOME] {:b even?}})
-    (built-like :X {:a [{:b 2}]}) => {:a [{:b 2}]}
-    (built-like :X {:a [{:b 1} {:b 2}]}) => {:a [{:b 1} {:b 2}]}
-    (check-for-explanations :X {:a [{:b 1}]}) => (just (err:shouldbe [:a SOME] "even?" [{:b 1}]))
-    (check-for-explanations :X {:a []}) => (just (err:shouldbe [:a SOME] "even?" []))
-    (check-for-explanations :X {:a 3}) => (just (err:notpath [:a SOME] 3))))
-
-
 (start-over!)


That's not a place you can put a docstring

--- test/desdemona/cli_test.clj
+++ test/desdemona/cli_test.clj
@@ -41,7 +41,6 @@
   ["Unknown option: \"--xyzzy\""])

 (deftest aeron-main-tests
-  "Tests for the aeron-media-driver main."
   (testing "--help displays usage"
     (let [[result stdout] (with-fake-launcher-side-effects
                             (aeron/-main "--help"))]


Use a good message in test-deftest-fx.

Use a good message in test-deftest-fx.

--- test/fixturex/core_test.clj
+++ test/fixturex/core_test.clj
@@ -17,7 +17,7 @@

 (deftest-fx test-deftest-fx [bind-dvar-to-var]
   (is (= *dvar* :var))
-  (testing-fx "" [(bind-dvar-fixturer :testing)]
+  (testing-fx "binding a var with testing-fx" [(bind-dvar-fixturer :testing)]
     (is (= *dvar* :testing))))

 (deftest non-fixtured-test (is (= *dvar* :testing-again)))


Fix Clojure profiles

Fix Clojure profiles

--- clojure/profiles.clj
+++ clojure/profiles.clj
@@ -1,29 +1,26 @@
-;; See: https://github.com/kumarshantanu/lein-localrepo
-{:user {:plugins [;; Try new api quickly using the repl
-                  [lein-try "0.4.3"]
-                  ;;[lein-localrepo "0.5.4"]
+{:user
+  {:plugins [;;Try new api quickly using the repl
+             ;;[lein-try "0.4.3"]

-                  ;; Convert pom.xml to project.clj
-                  ;; Note: from https://github.com/thickey/lein-nevam
-                  [lein-nevam "0.1.2"]
+             ;;=> https://github.com/kumarshantanu/lein-localrepo
+             ;;[lein-localrepo "0.5.4"]

-                  ;; A Leiningen plugin for a superior development environment
-                  ;; See: [Introduction Blog Post](https://blog.venanti.us/ultra/)
-                  ;; https://github.com/venantius/ultra
-                  ;;[venantius/ultra "0.5.2"]
+             ;;Convert pom.xml to project.clj
+             ;;[lein-nevam "0.1.2"]

-                  ;; Pretty-print a representation of the project map
-                  [lein-pprint "1.2.0"]
+             ;;A Leiningen plugin for a superior development environment
+             ;;[Introduction Blog Post](https://blog.venanti.us/ultra/)
+             ;;=> https://github.com/venantius/ultra
+             ;;[venantius/ultra "0.5.2"]

-                  ;; For quick typing
-                  [com.palletops/lein-shorthand "0.4.0"]]
+             ;;=> Pretty-print a representation of the project map
+             [lein-pprint "1.2.0"]

-        ;; See: https://github.com/pallet/alembic
-        :shorthand {. [alembic.still/distill alembic.still/lein]}
+             ;;=> https://github.com/pallet/alembic
+             [com.palletops/lein-shorthand "0.4.0"]]
+   :shorthand {. [alembic.still/distill alembic.still/lein]}
+   :dependencies [[alembic "0.3.2"]
+                  [pjstadig/humane-test-output "0.8.3"]]

-        ;; Experimental
-        :dependencies [[pjstadig/humane-test-output "0.8.3"]
-                       ;; See: https://github.com/pallet/alembic
-                       [alembic "0.3.2"]]
-        :injections [(require 'pjstadig.humane-test-output)
-                     (pjstadig.humane-test-output/activate!)]}}
+   :injections [(require 'pjstadig.humane-test-output)
+                (pjstadig.humane-test-output/activate!)]}}


fix wrong project URL on `/add-projects`

- was showing /github/... instead of /gh/...


Remove debug statement.

Remove debug statement.

--- src/afterglow/web/routes/show_control.clj
+++ src/afterglow/web/routes/show_control.clj
@@ -225,7 +225,7 @@
   (flatten
        (for [effect current]
          (for [v (:variables (:cue effect))]
-           (let [value (cues/get-cue-variable (:cue effect) (timbre/spy :info v) :show show :when-id (:id effect))]
+           (let [value (cues/get-cue-variable (:cue effect) v :show show :when-id (:id effect))]
              (when value
                {:effect (:key effect)
                 :id (:id effect)


Added attrs-nil test

Added attrs-nil test

--- test/hiccup.clj
+++ test/hiccup.clj
@@ -88,3 +88,7 @@
 (deftest attrs-bool-false
   (is (= (html [:input {:type "checkbox" :checked false}])
          "<input type=\"checkbox\" />")))
+
+(deftest attrs-nil
+  (is (= (html [:span {:class nil} "foo"])
+         "foo")))


long tests

long tests


better multiline handling

better multiline handling

Currently the repl gets stuck in multiline mode if an error like "unmatched delimiter" occurs.

--- src/cljs/cljs_repl_web/replumb_proxy.cljs
+++ src/cljs/cljs_repl_web/replumb_proxy.cljs
@@ -33,7 +33,7 @@
     false
     (catch :default e
       (log/warn "multiline? caught @{e}")
-      true)))
+      (= "EOF" (subs (.-message e) 0 3)))))

 (defn eval-opts
   [verbose src-path]


rewrite all-cells for the abstract case

rewrite all-cells for the abstract case

--- src/cljs/infinitelives/utils/spatial.cljs
+++ src/cljs/infinitelives/utils/spatial.cljs
@@ -75,20 +75,20 @@
           (remove-from-hash-with-hash entity-key old-pos old-hash)
           (add-to-hash-with-hash entity-key new-pos new-hash)))))

-;; TODO: rewrite this in some amazing functional inspiration
-;; to solve n-cords where n is integers >= 1
-(defn all-cells [[x1 y1 z1] [x2 y2 z2]]
-  (if (and (nil? z1) (nil? z2))
-    ;; 2-coord
-    (for [x (range x1 (inc x2))
-          y (range y1 (inc y2))]
-      [x y])
-
-    ;; 3-corrd
-    (for [x (range x1 (inc x2))
-          y (range y1 (inc y2))
-          z (range z1 (inc z2))]
-      [x y z])))
+(defn all-cells [low high]
+  (loop [acc '()
+         [l & lrest] low
+         [h & hrest] high]
+    (if (and l h)
+      (if (seq acc)
+        (recur (for [p acc
+                     q (range l (inc h))]
+                 (conj p q))
+               lrest hrest)
+        (recur (for [p (range l (inc h))]
+                 (vector p))
+               lrest hrest))
+      acc)))

 (defn query-cells [{:keys [hash divider] :as spatial} start-cell end-cell]
   (apply merge (for [cell (all-cells start-cell end-cell)] (hash cell))))


import button description

import button description

--- src/cljs/salava/extra/hpass/ui/block.cljs
+++ src/cljs/salava/extra/hpass/ui/block.cljs
@@ -201,7 +201,7 @@
 (defn ^:export accept-terms-string []
   "I have read and i agree to the privacy policy")

-(defn ^:export import-badge-text [lang]
+(defn ^:export importbadgetext [lang]
   [:small {:key "import"} [:i (case lang
                                 "en" "Import badges from other platforms, and add them to your myHPass profile"
                                 "Import badges from other platforms, and add them to your myHPass profile"


Fix profile images can only be images

Fix profile images can only be images

--- src/cljs/salava/user/ui/edit_profile.cljs
+++ src/cljs/salava/user/ui/edit_profile.cljs
@@ -33,7 +33,7 @@
                     (.append "file" file (.-name file)))]
     (m/modal! (file/upload-modal nil (t :file/Uploadingfile) (t :file/Uploadinprogress)))
     (ajax/POST
-      (path-for "/obpv1/file/upload")
+      (path-for "/obpv1/file/upload_image")
       {:body    form-data
        :handler (fn [{:keys [status message reason data]} response]
                   (when (= status "success")


Make tmp dir settable.

Make tmp dir settable.

--- src/cavm/h2.clj
+++ src/cavm/h2.clj
@@ -16,6 +16,11 @@
   (:require [cavm.db :refer [XenaDb]])
   (:gen-class))

+
+(def ^:dynamic *tmp-dir* (System/getProperty "java.io.tmpdir"))
+
+(defn set-tmp-dir! [dir]
+  (alter-var-root #'*tmp-dir* (constantly dir)))

 ; Coerce this sql fn name to a keyword so we can reference it.
 (def KEY-ID (keyword "SCOPE_IDENTITY()"))
@@ -761,7 +766,7 @@
          (clear-by-exp exp)
          (load-related-sources
            experiment_sources :experiments_id exp files)
-         (table-writer "/dev/shm" ; XXX use db dir? root dir? tmp dir?
+         (table-writer *tmp-dir*
                        (partial load-exp-matrix exp matrix-fn)))))))

 ; XXX factor out common parts with merge, above?


TITANIC does not need to do iteration with candidates

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

--- src/conexp/contrib/algorithms/titanic.clj
+++ src/conexp/contrib/algorithms/titanic.clj
@@ -99,43 +99,40 @@
             minimum    (partial minimum weight-order max-weight)]

     (loop [key-set    #{#{}},
-           candidates (set-of #{m} [m base-set]),
            keys       [#{}]]
-      (set! set-weight (into set-weight (weigh candidates)))
-      (doseq [X key-set]
-        (set-val! closure X (titanic-closure X base-set keys)))
-      (let [next-key-set (set-of X [X candidates,
-                                    :when (not= (subset-weight X)
-                                                (get set-weight X))])]
-        (if-not (empty? next-key-set)
-          (recur next-key-set
-                 (titanic-generate base-set next-key-set)
-                 (map first
-                      (sort (fn [[_ a] [_ b]]
-                              (weight-order a b))
-                            (map #(vector % (get set-weight %))
-                                 (concat next-key-set keys)))))
-          (distinct (vals closure)))))))
+      (let [candidates (titanic-generate base-set key-set)]
+        (set! set-weight (into set-weight (weigh candidates)))
+        (doseq [X key-set]
+          (set-val! closure X (titanic-closure X base-set keys)))
+        (let [next-key-set (set-of X [X candidates,
+                                      :when (not= (subset-weight X)
+                                                  (get set-weight X))])]
+          (if-not (empty? next-key-set)
+            (recur next-key-set
+                   (map first
+                        (sort (fn [[_ a] [_ b]]
+                                (weight-order a b))
+                              (map #(vector % (get set-weight %))
+                                   (concat next-key-set keys)))))
+            (distinct (vals closure))))))))

 (defn titanic-keys
   "Nearly the same as titanic, but returns the key sets only."
   [base-set weigh max-weight weight-order]
-  (binding [closure    {},
-            set-weight (weigh [#{}]),
+  (binding [set-weight (weigh [#{}]),
             minimum    (partial minimum weight-order max-weight)]

     (loop [key-set    #{#{}},
-           candidates (set-of #{m} [m base-set]),
            keys       [#{}]]
-      (set! set-weight (into set-weight (weigh candidates)))
-      (let [next-key-set (set-of X [X candidates,
-                                    :when (not= (subset-weight X)
-                                                (get set-weight X))])]
-        (if-not (empty? next-key-set)
-          (recur next-key-set
-                 (titanic-generate base-set next-key-set)
-                 (concat next-key-set keys))
-          keys)))))
+      (let [candidates (titanic-generate base-set key-set)]
+        (set! set-weight (into set-weight (weigh candidates)))
+        (let [next-key-set (set-of X [X candidates,
+                                      :when (not= (subset-weight X)
+                                                  (get set-weight X))])]
+          (if-not (empty? next-key-set)
+            (recur next-key-set
+                   (concat next-key-set keys))
+            keys))))))

 ;;;


TODO list of matchers to implement

TODO list of matchers to implement

--- src/chartem.clj
+++ src/chartem.clj
@@ -13,6 +13,28 @@
 ;;
 ;;  a match is a map with pass? and message, message will be a string
 ;;  if pass? if false
+;;
+;;  TODO: matchers list
+;; -- ** Matchers on seqs
+;; , is-empty
+;; , has-size
+;; , every-item
+;; , include?
+;; -- ** Matchers on numbers
+;; , <
+;; , <=
+;; , >
+;; , >=
+;; -- ** Matchers on nil
+;; , nil?
+;; -- ** Matcher combinators
+;; , is-not
+;; , any-of
+;; , on
+;; , and-also
+;; -- ** Utility functions for writing your own matchers
+;; , matcher-on
+;; , match-list

 (defn =
   "matches based on equality of the value given


Solving 5.8 and 5.9

Solving 5.8 and 5.9

--- src/fpinscala/strictness_and_laziness.clj
+++ src/fpinscala/strictness_and_laziness.clj
@@ -152,3 +152,28 @@
 ;all conceptually the same with exception that I simply translated flat-map by accident :)
 ;furthermore I have had incorrect order due to argument swapping
 ;-----------------------------------------------------------------------
+
+;5.8
+;mine
+(defn constant
+  "Returns inifinite stream of given value"
+  [x]
+  (stream-cons x (lazy-seq (constant x))))
+;fpins
+;I am not really sure if this is good variant and if it
+;really reassembles fpins solution, anyway it is done through Clojure's core functions.
+;And I am not really sure how to reassemble fpins as Clojure doesn't provide lazy vals/args
+(defn constant-fpins
+  [x]
+  (repeat x))
+;-----------------------------------------------------------------------
+
+;5.9
+;mine
+(defn from
+  "Returns range of integers starting from n"
+  [n]
+  (stream-cons n (lazy-seq (from (inc n)))))
+;fpins
+;conceptually - the same
+


Relaxing temporal time spec (#80)

Relaxing temporal time spec (#80)

--- src/kixi/datastore/metadatastore/time.clj
+++ src/kixi/datastore/metadatastore/time.clj
@@ -2,8 +2,8 @@
   (:require  [clojure.spec :as s]
              [kixi.datastore.schemastore.conformers :as sc]))

-(s/def ::from sc/timestamp)
-(s/def ::to sc/timestamp)
+(s/def ::from (s/nilable sc/timestamp))
+(s/def ::to (s/nilable sc/timestamp))

 (s/def ::temporal-coverage
-  (s/keys :req [::from ::to]))
+  (s/keys :opt [::from ::to]))


Renamed assoc!! and dissoc!! as they're pure

--- src/onyx/messaging/aeron/peer_manager.clj
+++ src/onyx/messaging/aeron/peer_manager.clj
@@ -4,17 +4,17 @@

 (defprotocol PeerManager
   (clone [this])
-  (assoc!! [this k v])
-  (dissoc!! [this k])
+  (add [this k v])
+  (remove [this k])
   (peer-channels [this k]))

 (deftype VPeerManager [^Int2ObjectHashMap m]
   PeerManager
-  (assoc!! [this k v]
+  (add [this k v]
     (let [vp ^VPeerManager (clone this)]
       (.put (.m vp) (int k) v)
       vp))
-  (dissoc!! [this k]
+  (remove [this k]
     (let [vp ^VPeerManager (clone this)]
       (.remove (.m vp) (int k))
       vp))


Test for unmount, init and destroy

Test for unmount, init and destroy

--- modules/web/test/immutant/web_test.clj
+++ modules/web/test/immutant/web_test.clj
@@ -2,7 +2,8 @@
   (:require [clojure.test :refer :all]
             [immutant.web :refer :all]
             [testing.web  :refer [get-body hello handler]]
-            [testing.hello.service :as pedestal]))
+            [testing.hello.service :as pedestal])
+  (import clojure.lang.ExceptionInfo))

 (def url "http://localhost:8080/")

@@ -27,3 +28,22 @@
 (deftest mount-pedestal-service
   (mount-servlet (server) pedestal/servlet)
   (is (= "Hello World!" (get-body url))))
+
+(deftest unmount-yields-404
+  (run hello)
+  (is (= "hello" (get-body url)))
+  (unmount)
+  (let [result (is (thrown? ExceptionInfo (get-body url)))]
+    (is (= 404 (-> result ex-data :object :status)))))
+
+(deftest mount-should-call-init
+  (let [p (promise)]
+    (run hello :init #(deliver p 'init))
+    (is (= 'init @p))))
+
+(deftest unmount-should-call-destroy
+  (let [p (promise)]
+    (run hello :destroy #(deliver p 'destroy))
+    (is (not (realized? p)))
+    (unmount)
+    (is (= 'destroy @p))))


Let unwords work on non-collections

Let unwords work on non-collections

Fix devth/yetibot#526

--- src/yetibot/core/commands/collections.clj
+++ src/yetibot/core/commands/collections.clj
@@ -162,8 +162,10 @@
 ; unwords
 (defn unwords
   "unwords <list> # join <list> with a single space"
-  [{opts :opts}]
-  (s/join " " (ensure-items-collection opts)))
+  [{args :args opts :opts}]
+  (if (nil? opts)
+    args ; no collection, return the value as-is
+    (s/join " " (ensure-items-collection opts))))

 (cmd-hook ["unwords" #"^unwords$"]
           _ unwords)


Redirect j.u.l to slf4j in dev

Redirect j.u.l to slf4j in dev

This pushes j.u.l logs through the normal logback system.

--- lib.app.dev/src/dev_extras.clj
+++ lib.app.dev/src/dev_extras.clj
@@ -6,7 +6,12 @@
    [edge.system.meta :as system.meta]
    [integrant.repl]
    [integrant.repl.state]
-   io.aviso.ansi))
+   io.aviso.ansi)
+  (:import
+    [org.slf4j.bridge SLF4JBridgeHandler]))
+
+(SLF4JBridgeHandler/removeHandlersForRootLogger)
+(SLF4JBridgeHandler/install)

 (defmacro ^:private proxy-ns
   [ns & vars]


counter-devcards: fix comments

counter-devcards: fix comments

--- examples/counter-devcards/src/app/core.cljs
+++ examples/counter-devcards/src/app/core.cljs
@@ -39,7 +39,8 @@
                              ; Setup bidirectional sync with data atom.
                              (carry-atom-sync/add data-atom)))
           [_ app-view] (carry-reagent/connect app counter/view-model counter/view)]
-      ((:dispatch-signal app) :on-start)                    ; Start the app.
+      ; Start the app.
+      ((:dispatch-signal app) :on-start)

       ; Render app view.
       [-div-with-unmount-callback
@@ -48,7 +49,7 @@
        ; Stop the app on umount/hot-reload.
        #((:dispatch-signal app) :on-stop)]))

-  ; Create devcards atom with initial model value.
+  ; Create data atom with initial model value.
   (atom (:initial-model counter/spec))

   ; Card options.


CMR-1589: Fixed broken test.

CMR-1589: Fixed broken test.

--- metadata-db-app/int_test/cmr/metadata_db/int_test/concepts/delete_test.clj
+++ metadata-db-app/int_test/cmr/metadata_db/int_test/concepts/delete_test.clj
@@ -31,7 +31,8 @@
       (is (= (dissoc (assoc saved-coll1
                             :deleted true
                             :metadata ""
-                            :revision-id revision-id)
+                            :revision-id revision-id
+                            :user-id nil)
                      :revision-date)
              (dissoc deleted-coll1 :revision-date)))


Making the step starting points more visible

--- src-cljs/frontend/components/build_timings.cljs
+++ src-cljs/frontend/components/build_timings.cljs
@@ -124,9 +124,10 @@
         (.attr "class" "container-step-start-line")
         (.attr "x1"    step-start-position)
         (.attr "x2"    step-start-position)
-        (.attr "y1"    container-position)
+        (.attr "y1"    #(- (container-position %) 1))
         (.attr "y2"    #(+ (container-position %)
-                           container-bar-height)))))
+                           container-bar-height
+                           1)))))

 (defn draw-steps! [x-scale chart steps]
   (let [steps-group (-> chart


Pulling out common helper functions.

Pulling out common helper functions.

--- src-cljs/frontend/components/build_timings.cljs
+++ src-cljs/frontend/components/build_timings.cljs
@@ -6,7 +6,9 @@
 (def timings-width 800)
 (def bar-height 20)
 (def bar-gap 10)
+(def container-bar-height (- bar-height bar-gap))

+;;; Helpers
 (defn create-x-scale [start-time stop-time]
   (let [start-time (js/Date. start-time)
         stop-time  (js/Date. stop-time)]
@@ -19,35 +21,41 @@
       (.append "svg")
       (.attr "width" timings-width)))

+(defn container-position [step]
+  (* bar-height (inc (aget step "index"))))
+
+(defn scaled-time [x-scale step time-key]
+  (x-scale (js/Date. (aget step time-key))))
+
+;;; Elements of the visualization
 (defn draw-containers! [x-scale step]
-  (let [step-length      #(- (x-scale (js/Date. (aget % "end_time")))
-                             (x-scale (js/Date. (aget % "start_time"))))
-        container-pos    #(* bar-height (inc (aget % "index")))
-        container-height #(- bar-height bar-gap)
+  (let [step-length      #(- (scaled-time x-scale % "end_time")
+                             (scaled-time x-scale % "start_time"))
         step-start-pos   #(x-scale (js/Date. (aget % "start_time")))]
     (-> step
         (.selectAll "rect")
           (.data #(aget % "actions"))
         (.enter)
           (.append "rect")
-          (.attr "class" "container-step")
-          (.attr "width" step-length)
-          (.attr "height" container-height)
-          (.attr "y" container-pos)
-          (.attr "x" step-start-pos))))
+          (.attr "class"  "container-step")
+          (.attr "width"  step-length)
+          (.attr "height" container-bar-height)
+          (.attr "y"      container-position)
+          (.attr "x"      step-start-pos))))

 (defn draw-step-start-line! [x-scale step]
+  (let [step-start-position #(scaled-time x-scale % "start_time")]
   (-> step
       (.selectAll "line")
         (.data #(aget % "actions"))
       (.enter)
         (.append "line")
         (.attr "class" "container-step-start-line")
-        (.attr "x1" #(x-scale (js/Date. (aget % "start_time"))))
-        (.attr "x2" #(x-scale (js/Date. (aget % "start_time"))))
-        (.attr "y1" #(* bar-height (inc (aget % "index"))))
-        (.attr "y2" #(+ (* bar-height (inc (aget % "index")))
-                        (- bar-height bar-gap)))))
+        (.attr "x1"    step-start-position)
+        (.attr "x2"    step-start-position)
+        (.attr "y1"    container-position)
+        (.attr "y2"    #(+ (container-position %)
+                           container-bar-height)))))

 (defn draw-steps! [x-scale chart steps]
   (let [step (-> chart
@@ -64,6 +72,7 @@
     (println "Running " parallel "x with " (count steps) "steps.")
     (draw-steps! x-scale chart steps)))

+;;;; Main component
 (defn build-timings [build owner]
   (reify
     om/IDidMount


[scamp] refactor "receive-msg :new-subscription"

...to pull out "handle-new-subscription" for reuse in "receive-msg :initial-contact".

--- modules/scamp/src/scamp/core.clj
+++ modules/scamp/src/scamp/core.clj
@@ -422,8 +422,30 @@
      ;; TODO: How does the convergence change if these messages are interleaved or randomized?
      (util/concatv u-messages d-messages)]))

-;; TODO: figure out the discussion of initial weights on left column of p5
-;; TODO: create rebalancing message type and messages and tests
+(s/defn handle-new-subscription :- CommUpdateSchema
+  [{:as cluster-config :keys [logging connection-redundancy]}
+   {:as node :keys [downstream]} :- NetworkedNodeSchema
+   self-id :- NodeContactAddressSchema
+   subscription :- SubscriptionSchema]
+  (let [node (update node :upstream maybe-neighbor self-id subscription)
+        new-messages (if (empty? downstream)
+                       ;; There is no 'downstream. No messages are needed, because the
+                       ;; 'subscription node will already have 'node in its
+                       ;; :downstream.
+                       []
+
+                       ;; Forward subscription to :downstream.
+                       (let [downstream (node-neighbors->contact-addresses downstream)
+                             downstream+ (reduce (fn [x _] (conj x (rand-nth* downstream)))
+                                                 downstream
+                                                 (range connection-redundancy))]
+                         (mapv
+                          (fn [node-contact-address]
+                            (msg->envelope node-contact-address
+                                           :forwarded-subscription
+                                           subscription))
+                          downstream+)))]
+    [node new-messages]))

 (s/defmethod receive-msg :new-subscription :- CommUpdateSchema
   #_"Add 'subscription to :upstream.
@@ -446,26 +468,7 @@
   (let [self-id (networked-node->node-contact-address node)]
     (when (= self-id subscription)
       (throw (ex-info (str "Got own new subscription: " subscription) {:node node})))
-
-    (let [node (update node :upstream maybe-neighbor self-id subscription)
-          new-messages (if (empty? downstream)
-                         ;; There is no 'downstream. No messages are needed, because the
-                         ;; 'subscription node will already have 'node in its
-                         ;; :downstream.
-                         []
-
-                         ;; Forward subscription to :downstream.
-                         (let [downstream (node-neighbors->contact-addresses downstream)
-                               downstream+ (reduce (fn [x _] (conj x (rand-nth* downstream)))
-                                                   downstream
-                                                   (range connection-redundancy))]
-                           (mapv
-                            (fn [node-contact-address]
-                              (msg->envelope node-contact-address
-                                             :forwarded-subscription
-                                             subscription))
-                            downstream+)))]
-      [node new-messages])))
+    (handle-new-subscription cluster-config node self-id subscription)))

 (s/defn do-probability :- s/Bool
   "'rand is inclusive of 0 and exclusive of 1, so our test should not have '=."


Add options to driver

Add options to driver

--- src/angelic/search/implicit/fah_astar_eval2.clj
+++ src/angelic/search/implicit/fah_astar_eval2.clj
@@ -23,6 +23,20 @@
 ;;  excluded-child-set went away, since we're now eager about pushing new outputs
 ;;   output-constraints went away since we have refine-input.

+;; Timing breakdown on DM 4-3 is:
+;; 10% extract-leaf-seq
+;; 20% lfss-empty?
+;; 20% optimistic-set-and-reward
+;; 25% make-atomic-subproblem (immediate refs+)
+;; 30% summary-changed
+
+;; Actually just about 1/3 in apply-opt, counting primitives, 10% in immediate-refs
+;; (almost half in primitives -- close enough).
+
+;; For nav-switch, becomes 80% summary-changed!
+;; Of this, 25% is =summary, unclear where rest is....
+;; 20% of total time is extracting parents from node
+

 ;; TODO: find cleaner overall architecture.  Right now, names
 ;;   don't really do anything, and there's too much worrying about types, etc.
@@ -34,13 +48,13 @@
 ;;;;; Features
 ;; TODO: pessimistic

-;;;;; Summaries and solving
+;;;;; Summaries and solving (if only 30% of time, who cares!)
 ;; TODO: pseudo-solve
 ;; TODO: smarter summary updates (i.e., pass child)
 ;; TODO: halfway eager prop -- eager about cost, not contents.

 ;;;;; SP caching
-;; TODO: tail (i.e., pair) caching?
+;; TODO: tail (i.e., pair) caching? -- Only help for >2 len refs...
 ;; TODO: cache refine-inputs?
 ;; TODO: cache children of output-collector?

@@ -48,7 +62,8 @@
 ;; TODO: garbage collect dead stuff
 ;; TODO: improve top-down propagation of bounds
 ;; TODO: better subusmption.
-;; TODO: add options to search alg.
+
+;; --> TODO: add options to search alg.

 ;; TODO: why doesn't subsumption help (at all?)
 ;; Note: subsumption edges don't help AT ALL, under seemingly any settings
@@ -62,11 +77,8 @@

 (def *no-identical-nonterminal-outputs* true)
 (def *decompose-cache*       true) ;; nil for none, or bind to hashmap
-(def *state-abstraction*     :eager #_ :deliberate) ;; Or lazy or nil.
-
-(assert (contains? #{nil :eager :deliberate} *state-abstraction*))
-(when *state-abstraction* (assert *decompose-cache*))
-(when *decompose-cache* (assert *no-identical-nonterminal-outputs*))
+(def *state-abstraction*     :eager ) ;; Or lazy or nil.
+

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;       Utilities      ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -502,9 +514,16 @@
     (dotimes [_ 2] (evaluate! root-stub))
     (get-stub-output! root-stub)))

-(defn implicit-fah-a*-eval2 [henv]
-  (binding [summaries/*cache-method* :eager
-            *decompose-cache* (when *decompose-cache* (HashMap.))]
+(defn implicit-fah-a*-eval2 [henv & {gather :gather d :d s :s c :cache
+                                     :or {gather true s :eager d true c :eager}}]
+  (assert (contains? #{nil false :eager :deliberate} s))
+  (when s (assert d))
+  (when d (assert gather))
+  (assert (contains? #{:lazy :eager} c))
+  (binding [*no-identical-nonterminal-outputs* gather
+            *decompose-cache* (when d (HashMap.))
+            *state-abstraction* s
+            summaries/*cache-method* c]
     (summaries/solve
      (tree-summarizer (apply get-root-subproblem (fs/make-init-pair henv)))
      #(evaluate! (last (filter can-evaluate? %)))


quite untar

quite untar

--- src/com/narkisr/celestial/puppet_standalone.clj
+++ src/com/narkisr/celestial/puppet_standalone.clj
@@ -27,7 +27,7 @@

 (defn extract [server module]
-  (execute server "cd /tmp" (<< "tar -xvzf ~(:name module).tar.gz")))
+  (execute server "cd /tmp" (<< "tar -xzf ~(:name module).tar.gz")))

 (defn cleanup [server module]
   (execute server "cd /tmp" (<< "rm -rf ~(:name module)*")))


pprint conf-map

pprint conf-map

--- elephantdb-server/src/clj/elephantdb/ui/handler.clj
+++ elephantdb-server/src/clj/elephantdb/ui/handler.clj
@@ -66,10 +66,9 @@
             [:div
              [:p "Configuration"]
              [:pre
-              "{\n"
-              (for [[k v] conf-map]
-                (str k " " v "\n"))
-              "}"]
+              (let [sw (java.io.StringWriter.)]
+                (clojure.pprint/pprint conf-map sw)
+                (str sw))]
              ]))

 (defn node [conf-map id]


add command-exists

add command-exists

--- user.clj
+++ user.clj
@@ -1,7 +1,8 @@
 (ns user
-  (:require table.core)
-  (:require [clojure.pprint])
-  (:require [clojure.string :as string]))
+  (:require clojure.pprint
+            table.core
+            clojure.java.io
+            [clojure.string :as string]))

 ; =======
 ; Utilities: general purpose fns to be used mostly inside other fns
@@ -9,6 +10,12 @@
 (defn sym-to-var [sym]
   "Converts a symbol to var"
   ((ns-interns ((meta (resolve sym)) :ns)) sym))
+
+(defn command-exists? [cmd]
+  "Determines if command exists in $PATH"
+  (some
+    #(-> (str % "/" cmd) clojure.java.io/file .isFile)
+    (-> (System/getenv "PATH") (clojure.string/split #":"))))

 ; TODO: only display vars local to a namespace
 (defn ns-dynamic-vars


Update ns-tracker to 0.3.1

Update ns-tracker to 0.3.1

--- ring-devel/project.clj
+++ ring-devel/project.clj
@@ -8,7 +8,7 @@
                  [ring/ring-core "1.6.0-beta7"]
                  [hiccup "1.0.5"]
                  [clj-stacktrace "0.2.8"]
-                 [ns-tracker "0.3.0"]]
+                 [ns-tracker "0.3.1"]]
   :profiles
   {:1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]}
    :1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]}


Updated ns-tracker to fix another reload bug

--- ring-devel/project.clj
+++ ring-devel/project.clj
@@ -4,4 +4,4 @@
   :dependencies [[ring/ring-core "1.1.5"]
                  [hiccup "1.0.0"]
                  [clj-stacktrace "0.2.4"]
-                 [ns-tracker "0.1.2"]])
+                 [ns-tracker "0.2.0"]])


improve mda-piano ugen docstring

improve mda-piano ugen docstring

--- src/overtone/sc/machinery/ugen/metadata/mda.clj
+++ src/overtone/sc/machinery/ugen/metadata/mda.clj
@@ -23,5 +23,9 @@
            {:name "sustain", :default 0.1 :doc "If positive, act as if the piano's sustain pedal is pressed."}],
     :rates #{:ar}
     :num-outs 2
-    :doc "Piano ugen"}
-   ])
+    :summary "Synthesised piano"
+    :doc "A piano synthesiser (originally a VST plugin by Paul Kellett,
+          ported to SC by Dan Stowell). This UGen is not polyphonic (but
+          can be retriggered to play notes in sequence). Note: This UGen
+          is stereo - it returns two channels, with a stereo 'wideness'
+          effect controlled by the stereo argument."}])


Reword docstrings

Reword docstrings

--- src/vip/data_processor/db/translations/util.clj
+++ src/vip/data_processor/db/translations/util.clj
@@ -152,7 +152,10 @@
              #(assoc % :results_id import-id))
        rows))

-(defn transformer [row-fn ltree-fn]
+(defn transformer
+  "Translate a set of rows from `row-fn` using `ltree-fn`, then load
+  that into the database. `row-fn` should be a function of import-id."
+  [row-fn ltree-fn]
   (fn [{:keys [ltree-index import-id] :as ctx}]
     (let [idx-fn (index-generator ltree-index)
           ltree-rows (mapcat (partial ltree-fn idx-fn)
@@ -165,10 +168,9 @@
         ctx))))

 (defn transformer-with-conn
-  "Generates a transformation function that operates on a single
-  database connection? If `row-fn` is the sort of thing that requires a
-  connection, we'll need to setup a binding context and thread this
-  value to subsequent calls. "
+  "Like `transformer`, but with a database connection passed to `row-fn`.
+  Useful when `row-fn` needs a single connection, e.g., when using a
+  database cursor."
   [row-fn ltree-fn]
   (fn [{:keys [ltree-index import-id] :as ctx}]
     (jdbc/with-db-connection [conn (postgres/db-spec)]


added docstring to <> macro

added docstring to <> macro

--- storm-multicore/src/clj/backtype/storm/util.clj
+++ storm-multicore/src/clj/backtype/storm/util.clj
@@ -970,6 +970,7 @@

 (defmacro -<>
+  "Allows recursive map definitions. See mk-worker for example."
   ([x] x)
   ([x form] (if (seq? form)
               (with-meta


Better update code documentation

Better update code documentation

--- clojure/src/app/core.clj
+++ clojure/src/app/core.clj
@@ -16,6 +16,11 @@
 (defn sleep-for [n]
   (Thread/sleep n))

+;;; Example of using Agents and the Clojure STM to simulate a bank account use case
+;;;
+;;; Two threads of execution are spawned: (1) deposits, (2) via withdrawls via futures.
+;;; Each logical thread of execution sleeps for a short random internal and updates the
+;;; bank account balance via the 'send' function
 (defn example []

   ;; start with a bank account of balance zero
@@ -32,6 +37,7 @@
         (sleep-for (rand 500))
         (send bank-account withdraw 5)))

+    ;; futures are not guaranteed to execute immediately, thus the explicit wait
     (sleep-for 5000)

     ;; print output


added collision detection functions

added collision detection functions

--- src/agario3d/game.clj
+++ src/agario3d/game.clj
@@ -105,6 +105,33 @@
   [game :- s/Any t :- s/Keyword]
   (filter (fn [[k v]] (= t (:t v))) game))

+(defn eat [eater eatee]
+  (let [mass (+ (:m eater) (:m eatee))]
+    (assoc eater :m mass :r (mass->radius mass))))
+
+(defn get-collisions [game]
+  (let [players (things-of-type @game :player)
+        bots (things-of-type @game :bot)
+        agents (concat players bots)
+        food (things-of-type @game :food)
+        both (concat agents food)]
+    (for [a agents
+          b both
+          :when (and (not= a b) (contains? a b))]
+      [a b])))
+
+(defn handle-collisions! [game]
+  (let [collisions (get-collisions game)]
+    (swap! game
+           (fn [g]
+             (reduce
+               (fn [g [eater eatee]]
+                 (prn "nom nom nom")
+                 (-> g
+                     (dissoc ,, (:id eatee))
+                     (assoc ,, (:id eater) (eat eater eatee)))) g collisions)))
+    game))
+
 (defn create-new-game
   "Seed the game with food, viruses and bots"
   []


pascal-triangle-row implement

pascal-triangle-row implement


(PDB-4656) command-retry-handler: remove vestigial process message

--- test/puppetlabs/puppetdb/command_test.clj
+++ test/puppetlabs/puppetdb/command_test.clj
@@ -256,38 +256,37 @@

 (deftest command-retry-handler
   (with-redefs [quick-retry-count 0]
-    (let [process-message (fn [_] (throw (RuntimeException. "retry me")))]
-      (testing "logs for each L2 failure up to the max"
-        (doseq [i (range 0 maximum-allowable-retries)
-                :let [log-output (atom [])]]
-          (binding [*logger-factory* (atom-logger log-output)]
-            (with-message-handler {:keys [handle-message dlo delay-pool q]}
-              (is (= 0 (task-count delay-pool)))
-              (handle-message (-> q
-                                  (queue/store-command (failed-catalog-req 10 "cats" {:certname "cats"}))
-                                  (add-fake-attempts i)))
-              (is (= 1 (task-count delay-pool)))
-              (is (= 0 (count (fs/list-dir (:path dlo)))))
-              (is (= (get-in @log-output [0 1]) :error))
-              (is (str/includes? (get-in @log-output [0 3]) "cats"))
-              (is (instance? Exception (get-in @log-output [0 2])))
-              (is (str/includes? (last (first @log-output))
-                                 "Retrying after attempt"))))))
-
-      (testing "a failed message after the max is discarded"
-        (let [log-output (atom [])]
-          (binding [*logger-factory* (atom-logger log-output)]
-            (with-message-handler {:keys [handle-message dlo delay-pool q]}
-              (handle-message (-> q
-                                  (queue/store-command (failed-catalog-req 10 "cats" {:certname "cats"}))
-                                  (add-fake-attempts maximum-allowable-retries)))
-              (is (= 0 (task-count delay-pool)))
-              (is (= 2 (count (fs/list-dir (:path dlo)))))
-              (is (= (get-in @log-output [0 1]) :error))
-              (is (instance? Exception (get-in @log-output [0 2])))
-              (is (str/includes? (last (first @log-output))
-                                 "Exceeded max"))
-              (is (str/includes? (get-in @log-output [0 3]) "cats")))))))))
+    (testing "logs for each L2 failure up to the max"
+      (doseq [i (range 0 maximum-allowable-retries)
+              :let [log-output (atom [])]]
+        (binding [*logger-factory* (atom-logger log-output)]
+          (with-message-handler {:keys [handle-message dlo delay-pool q]}
+            (is (= 0 (task-count delay-pool)))
+            (handle-message (-> q
+                                (queue/store-command (failed-catalog-req 10 "cats" {:certname "cats"}))
+                                (add-fake-attempts i)))
+            (is (= 1 (task-count delay-pool)))
+            (is (= 0 (count (fs/list-dir (:path dlo)))))
+            (is (= (get-in @log-output [0 1]) :error))
+            (is (str/includes? (get-in @log-output [0 3]) "cats"))
+            (is (instance? Exception (get-in @log-output [0 2])))
+            (is (str/includes? (last (first @log-output))
+                               "Retrying after attempt"))))))
+
+    (testing "a failed message after the max is discarded"
+      (let [log-output (atom [])]
+        (binding [*logger-factory* (atom-logger log-output)]
+          (with-message-handler {:keys [handle-message dlo delay-pool q]}
+            (handle-message (-> q
+                                (queue/store-command (failed-catalog-req 10 "cats" {:certname "cats"}))
+                                (add-fake-attempts maximum-allowable-retries)))
+            (is (= 0 (task-count delay-pool)))
+            (is (= 2 (count (fs/list-dir (:path dlo)))))
+            (is (= (get-in @log-output [0 1]) :error))
+            (is (instance? Exception (get-in @log-output [0 2])))
+            (is (str/includes? (last (first @log-output))
+                               "Exceeded max"))
+            (is (str/includes? (get-in @log-output [0 3]) "cats"))))))))

 (deftest message-acknowledgement
   (testing "happy path, message acknowledgement when no failures occured"


Simple optimisations for .seek

Simple optimisations for .seek

--- src/aurora/btree.cljs
+++ src/aurora/btree.cljs
@@ -36,16 +36,16 @@
         (when-not (nil? children)
           (.into (aget children (alength keys)) result)))
   (seek [this key ix]
-        (loop [lo (max ix 0)
+        (loop [lo (if (> ix 0) ix 0)
                hi (- (alength keys) 1)]
           (if (< hi lo)
             lo
             (let [mid (+ lo (js/Math.floor (/ (- hi lo) 2)))
                   mid-key (aget keys mid)]
-              (cond
-               (> mid-key key) (recur lo (- mid 1))
-               (< mid-key key) (recur (+ mid 1) hi)
-               :else mid)))))
+              (if (> mid-key key) (recur lo (- mid 1))
+                (if (< mid-key key)
+                  (recur (+ mid 1) hi)
+                  mid))))))
   (assoc! [this key val max-keys]
           (set! lower (min lower key))
           (set! upper (max upper key))
@@ -218,6 +218,18 @@
     (.valid! tree)
     tree)

+  (let [tree (tree 1)]
+    (dotimes [i 1000]
+      (.assoc! tree i (* 2 i)))
+    (.valid! tree)
+    (= (map #(.apply vector nil %) tree) (for [i (range 1000)] [i (* 2 i)])))
+
+  (let [tree (tree 2)]
+    (dotimes [i 1000]
+      (.assoc! tree i (* 2 i)))
+    (.valid! tree)
+    (= (map #(.apply vector nil %) tree) (for [i (range 1000)] [i (* 2 i)])))
+
   (let [tree (tree 3)]
     (dotimes [i 1000]
       (.assoc! tree i (* 2 i)))


fix tests for the removal of the wrapper

Signed-off-by: Chris Granger <5654cde260ae99bc4d30054171b8bcd902efd19a@gmail.com>

--- src/aurora/btree.cljs
+++ src/aurora/btree.cljs
@@ -838,8 +838,16 @@
   (let [tree (apply-to-tree (tree min-keys key-len) actions)
         iterator-results (apply-to-iterator (iterator tree) movements)

-        iterator-a (js/aurora.join.magic-iterator tree)
-        iterator-b (js/aurora.join.magic-iterator tree )
+        iterator-a (js/aurora.join.magic-iterator tree (let [arr (array)]
+                                                         (dotimes [x key-len]
+                                                           (.push arr x))
+                                                         arr
+                                                         ))
+        iterator-b (js/aurora.join.magic-iterator tree (let [arr (array)]
+                                                         (dotimes [x key-len]
+                                                           (.push arr x))
+                                                         arr
+                                                         ))
         join-itr (js/aurora.join.join-iterator #js [iterator-a iterator-b])
         join-results (apply-to-iterator join-itr movements)]
     (= (map vec iterator-results) (map vec join-results))))


adding total-depth

adding total-depth

--- src/babel/forest.cljc
+++ src/babel/forest.cljc
@@ -52,33 +52,33 @@
                 index
                 morph))))

-(defn generate-all [spec grammar lexicon index morph]
+(defn generate-all [spec grammar lexicon index morph & [total-depth]]
   (filter #(not (fail? %))
-          (do
+          (let [total-depth (if total-depth total-depth 0)]
             (log/debug (str "generate-all: cat: " (get-in spec [:synsem :cat])))
             (if (= :adjective (get-in spec [:synsem :cat]) )
               (exception (str "got here; spec=" (strip-refs spec))))
             (let [add-complements-to-bolts
                   (fn [bolts path]
                     (mapcat #(if (not (= :none (get-in % path :none)))
-                               (add-complement % path :top grammar lexicon index morph 0)
+                               (add-complement % path :top grammar lexicon index morph 0 (+ total-depth (count path)))
                                [%])
                             bolts))]
               (-> (lightning-bolt (lazy-shuffle grammar)
                                   lexicon
-                                  spec 0 index morph)
+                                  spec 0 index morph total-depth)
                   ;; TODO: allow more than a fixed maximum depth of generation (here, 4 levels from top of tree).
-                  (add-complements-to-bolts [:head :head :head :comp])
+                  (add-complements-to-bolts [:head :head :head :comp] )
                   (add-complements-to-bolts [:head :head :comp])
                   (add-complements-to-bolts [:head :comp])
                   (add-complements-to-bolts [:comp]))))))

-(defn lightning-bolt [grammar lexicon spec depth index morph]
+(defn lightning-bolt [grammar lexicon spec depth index morph total-depth]
   "Returns a lazy-sequence of all possible trees given a spec, where
 there is only one child for each parent, and that single child is the
 head of its parent. generate (above) 'decorates' each returned lightning bolt
 of this function with complements."
-  (log/debug (str "lightning-bolt(depth=" depth "): sem:" (strip-refs (get-in spec [:synsem :sem]))))
+  (log/debug (str "lightning-bolt(depth=" depth ", total-depth=" total-depth "): sem:" (strip-refs (get-in spec [:synsem :sem]))))
   (if (not (= :none (get-in spec [:synsem :sem :synsem] :none)))
     (exception (str "SHOULD NOT GET HERE.")))
   (let [maxdepth 3 ;; maximum depth of a lightning bolt: H1 -> H2 -> H3 where H3 must be a lexeme, not a phrase.
@@ -101,17 +101,16 @@
                       (if (nil? (get-in parent [:head] nil))
                         (exception "get-in(parent,:head) was nil before looking for phrasal heads."))
                       (over/overh parent (lightning-bolt grammar lexicon (get-in parent [:head])
-                                                         (+ 1 depth) index morph)
+                                                         (+ 1 depth) index morph (+ 1 total-depth))
                                   morph))
                     parents))]
       (if (lexemes-before-phrases depth)
         (lazy-cat lexical phrasal)
         (lazy-cat phrasal lexical)))))

-(defn add-complement [bolt path spec grammar lexicon cache morph depth]
+(defn add-complement [bolt path spec grammar lexicon cache morph depth total-depth]
   (let [input-spec spec
         from-bolt bolt ;; so we can show what (add-complement) did to the input bolt, for logging.
-        depth (if depth depth 0)
         spec (unifyc spec (get-in bolt path))]
     (let [immediate-parent (get-in bolt (butlast path))
           start-time (current-time)
@@ -133,19 +132,27 @@
           shuffled-candidate-lexical-complements (lazy-shuffle filtered-lexical-complements)]
       (filter (fn [complement]
                 (if (fail? complement)
-                  true
                   (do
-                    (log/debug (str "add-complement(depth=" depth ",path=" path ",bolt=(" (show-bolt bolt path morph) ")=>"
+                    (log/debug (str "add-complement(depth=" depth ",total-depth=" total-depth
+                                    ",path=" path ",bolt=(" (show-bolt bolt path morph) ") FAILED:"
+                                    "'" (morph complement) "'"))
+
+                    true)
+                  (do
+                    (log/debug (str "add-complement(depth=" depth ",total-depth=" total-depth
+                                    ",path=" path ",bolt=(" (show-bolt bolt path morph) ")=>"
                                     "'" (morph complement) "'"))
                     false)))
               (map (fn [complement]
                      (unify (copy bolt)
                             (path-to-map path
                                          (copy complement))))
-                   (let [debug (log/debug (str "add-complement(depth=" depth ",path=" path ",bolt=(" (show-bolt bolt path morph)
+                   (let [debug (log/debug (str "add-complement(depth=" depth ",total-depth=" total-depth
+                                               ",path=" path ",bolt=(" (show-bolt bolt path morph)
                                                "): calling generate-all(" (strip-refs spec) ");"
                                                "input-spec: " input-spec))
-                         phrasal-complements (generate-all spec grammar lexicon cache morph)]
+                         phrasal-complements (if (< 10 total-depth)
+                                               (generate-all spec grammar lexicon cache morph (+ depth total-depth)))]
                      (if (lexemes-before-phrases depth)
                        (lazy-cat shuffled-candidate-lexical-complements phrasal-complements)
                        (lazy-cat phrasal-complements shuffled-candidate-lexical-complements))))))))


streamlines test

streamlines test

--- test/vip/data_processor/pipeline_test.clj
+++ test/vip/data_processor/pipeline_test.clj
@@ -59,7 +59,7 @@

 (deftest process-test
   (testing "Builds the context and executes the pipeline"
-    (let [intial-input {:input 0 :check-stop-flag-fn #(identity %)}
+    (let [intial-input {:input 0 :check-stop-flag-fn identity}
           pipeline [incrementor incrementor incrementor]
           result (process pipeline intial-input)]
       (is (= 3 (:input result)))


Fix env setting of test size

Fix env setting of test size

--- test/kixi/unit/schemastore/schemastore_test.clj
+++ test/kixi/unit/schemastore/schemastore_test.clj
@@ -55,7 +55,7 @@
                :str  string?)
          {[:str] #()}))

-(def sample-size (env :generative-testing-size 100))
+(def sample-size (Integer/valueOf (env :generative-testing-size "100")))

 (defn double-str?
   [^String s]


staging fuckup missed a line

staging fuckup missed a line

--- src/bløggr/posts.clj
+++ src/bløggr/posts.clj
@@ -8,6 +8,7 @@
 (def lead-length 500)
 (def twitter-card-length 190)

+(defn- twitter-card-template
   "Create twitter cards in document head"
   [{header :header description :twitter-lead}]
   (let [img (:image header)


Fixed fapply implementation for sequence-monad.

--- src/cats/builtin.cljc
+++ src/cats/builtin.cljc
@@ -77,14 +77,20 @@

     (-fapply [_ self av]
       (loop [[f & fs :as fcoll] self
-             [v & vs :as vcoll] av
-             ys '()]
-        (if (or (empty? fcoll)
-                (empty? vcoll))
-          (reverse ys)
+             results []]
+        (if (empty? fcoll)
+          (loop [[x & xs :as coll] results
+                 result '()]
+            (if (empty? coll)
+              (reverse result)
+              (recur xs
+                     (into result x))))
           (recur fs
-                 vs
-                 (cons (f v) ys)))))
+                 (conj results (loop [[v & vs :as vcoll] av
+                                      r '()]
+                                 (if (empty? vcoll)
+                                   (reverse r)
+                                   (recur vs (cons (f v) r)))))))))

     p/Monad
     (-mreturn [_ v]


cleaning stats exception message

cleaning stats exception message

--- src/chazel/chazel.clj
+++ src/chazel/chazel.clj
@@ -110,7 +110,7 @@
              [(str m) (parse-string @f true)])
            (into {} $))
      (catch Throwable t
-       (warn "could not submit instance task via instance [" instance "]: " (.getMessage t))))))
+       (warn "could not submit a \"collecting stats\" task via hazelcast instance [" instance "]: " (.getMessage t))))))

 ;; adds a string kv pair to the local member of this hazelcast instance
 (defn add-member-attr [instance k v]


added fully qualified names to access protocol function properties.

For example in ICounted was generating:

cljs.core._count = function(a) {
  return cljs.core.truth_(cljs.core.truth_(a) ? a.cljs$core$ICounted$_count : a) ? a.cljs$core$ICounted$_count(a) : function() {
    var b = _count[goog.typeOf.call(null, a)]; /* not qualified */
    if(cljs.core.truth_(b)) {
      return b
    }else {
      if(b = _count._, cljs.core.truth_(b)) { /* not qualified */
        return b
      }else {
        throw cljs.core.missing_protocol.call(null, "ICounted.-count", a);
      }
    }
  }().call(null, a)
};

but now generates

cljs.core._count = function(a) {
  return cljs.core.truth_(cljs.core.truth_(a) ? a.cljs$core$ICounted$_count : a) ? a.cljs$core$ICounted$_count(a) : function() {
    var b = cljs.core._count[goog.typeOf.call(null, a)]; /* fully qualified */
    if(cljs.core.truth_(b)) {
      return b
    }else {
      if(b = cljs.core._count._, cljs.core.truth_(b)) { /* fully qualified */
        return b
      }else {
        throw cljs.core.missing_protocol.call(null, "ICounted.-count", a);
      }
    }
  }().call(null, a)
};

--- src/clj/cljs/core.clj
+++ src/clj/cljs/core.clj
@@ -223,15 +223,17 @@

 (defmacro defprotocol [psym & doc+methods]
   (let [p (:name (cljs.compiler/resolve-var (dissoc &env :locals) psym))
+        ns-name (-> &env :ns :name)
+        fqn (fn [n] (symbol (str ns-name "." n)))
         prefix (protocol-prefix p)
         methods (if (string? (first doc+methods)) (next doc+methods) doc+methods)
         expand-sig (fn [fname slot sig]
                      `(~sig
                        (if (and ~(first sig) (. ~(first sig) ~slot))
                          (. ~(first sig) ~slot ~@sig)
-                         ((or
-                           (aget ~fname (goog.typeOf ~(first sig)))
-                           (aget ~fname "_")
+                         ((or
+                           (aget ~(fqn fname) (goog.typeOf ~(first sig)))
+                           (aget ~(fqn fname) "_")
                            (throw (missing-protocol
                                     ~(str psym "." fname) ~(first sig))))
                           ~@sig))))


Small clean up

Small clean up

--- src/clj_nsca/core.clj
+++ src/clj_nsca/core.clj
@@ -3,5 +3,13 @@

 (defn nagios-settings
   "Create Nagios Settings"
-  ([host port] (.create (doto (new NagiosSettingsBuilder) (.withNagiosHost host) (.withPort port))))
-  ([host port password] (.create (doto (new NagiosSettingsBuilder) (.withNagiosHost host) (.withPort port) (.withPassword password)))))
+  ([host port] (-> (NagiosSettingsBuilder.)
+                            (.withNagiosHost host)
+                            (.withPort port)
+                            (.create)))
+
+  ([host port password] (-> (NagiosSettingsBuilder.)
+                            (.withNagiosHost host)
+                            (.withPort port)
+                            (.withPassword password)
+                            (.create))))


add title tooltip for settings icon link in aside

--- frontend/components/aside.cljs
+++ frontend/components/aside.cljs
@@ -96,7 +96,8 @@
                        :title (project-model/project-name project)}
              (project-model/project-name project)]
             (when-not collapse-branches?
-             [:a.project-settings-icon {:href (routes/v1-project-settings {:org org :repo repo})}
+             [:a.project-settings-icon {:href (routes/v1-project-settings {:org org :repo repo})
+                                        :title (str "Settings for " org "/" repo)}
               (common/ico :settings-light)])
             (when-let [latest-master-build (last (project-model/master-builds project))]
               (sidebar-build latest-master-build {:org org :repo repo :branch (name (:default_branch project)) :latest? true}))]]


Keep dialogs alive when orientation changes

--- android/src/clojure/net/nightweb/dialogs.clj
+++ android/src/clojure/net/nightweb/dialogs.clj
@@ -16,12 +16,47 @@
         [nightweb.db :only [max-length-large]]
         [nightweb.constants :only [is-me?]]))

-(defn set-orientation-frozen
-  [context should-freeze?]
-  (let [pref (if should-freeze?
-               android.content.pm.ActivityInfo/SCREEN_ORIENTATION_NOSENSOR
-               android.content.pm.ActivityInfo/SCREEN_ORIENTATION_SENSOR)]
-    (.setRequestedOrientation context pref)))
+(defn create-dialog
+  [context message view buttons]
+  (let [builder (android.app.AlertDialog$Builder. context)]
+    (when-let [positive-name (get buttons :positive-name)]
+      (.setPositiveButton builder positive-name nil))
+    (when-let [neutral-name (get buttons :neutral-name)]
+      (.setNeutralButton builder neutral-name nil))
+    (when-let [negative-name (get buttons :negative-name)]
+      (.setNegativeButton builder negative-name nil))
+    (.setMessage builder message)
+    (.setView builder view)
+    (let [dialog (.create builder)
+          positive-type android.app.AlertDialog/BUTTON_POSITIVE
+          neutral-type android.app.AlertDialog/BUTTON_NEUTRAL
+          negative-type android.app.AlertDialog/BUTTON_NEGATIVE
+          btn-action (fn [dialog button func]
+                       (proxy [android.view.View$OnClickListener] []
+                         (onClick [v]
+                           (when (func context view button)
+                             (.dismiss dialog)))))]
+      (.setOnShowListener
+        dialog
+        (proxy [android.content.DialogInterface$OnShowListener] []
+          (onShow [d]
+            (when-let [positive-btn (.getButton d positive-type)]
+              (.setOnClickListener
+                positive-btn (btn-action d
+                                         positive-btn
+                                         (get buttons :positive-func))))
+            (when-let [neutral-btn (.getButton d neutral-type)]
+              (.setOnClickListener
+                neutral-btn (btn-action d
+                                        neutral-btn
+                                        (get buttons :neutral-func))))
+            (when-let [negative-btn (.getButton d negative-type)]
+              (.setOnClickListener
+                negative-btn (btn-action d
+                                         negative-btn
+                                         (get buttons :negative-func)))))))
+      (.setCanceledOnTouchOutside dialog false)
+      dialog)))

 (defn show-dialog
   ([context title message]
@@ -33,52 +68,22 @@
        (.setCanceledOnTouchOutside dialog false)
        (.show dialog))))
   ([context message view buttons]
-   (let [builder (android.app.AlertDialog$Builder. context)]
-     (set-orientation-frozen context true)
-     (when-let [positive-name (get buttons :positive-name)]
-       (.setPositiveButton builder positive-name nil))
-     (when-let [neutral-name (get buttons :neutral-name)]
-       (.setNeutralButton builder neutral-name nil))
-     (when-let [negative-name (get buttons :negative-name)]
-       (.setNegativeButton builder negative-name nil))
-     (.setMessage builder message)
-     (.setView builder view)
-     (let [dialog (.create builder)
-           positive-type android.app.AlertDialog/BUTTON_POSITIVE
-           neutral-type android.app.AlertDialog/BUTTON_NEUTRAL
-           negative-type android.app.AlertDialog/BUTTON_NEGATIVE
-           btn-action (fn [dialog button func]
-                        (proxy [android.view.View$OnClickListener] []
-                          (onClick [v]
-                            (set-orientation-frozen context false)
-                            (when (func context view button)
-                              (.dismiss dialog)))))]
-       (.setOnShowListener
-         dialog
-         (proxy [android.content.DialogInterface$OnShowListener] []
-           (onShow [d]
-             (when-let [positive-btn (.getButton d positive-type)]
-               (.setOnClickListener
-                 positive-btn (btn-action d
-                                          positive-btn
-                                          (get buttons :positive-func))))
-             (when-let [neutral-btn (.getButton d neutral-type)]
-               (.setOnClickListener
-                 neutral-btn (btn-action d
-                                         neutral-btn
-                                         (get buttons :neutral-func))))
-             (when-let [negative-btn (.getButton d negative-type)]
-               (.setOnClickListener
-                 negative-btn (btn-action d
-                                          negative-btn
-                                          (get buttons :negative-func)))))))
-       (.setOnCancelListener
-         dialog
-         (proxy [android.content.DialogInterface$OnCancelListener] []
-           (onCancel [d]
-             (set-orientation-frozen context false))))
-       (.setCanceledOnTouchOutside dialog false)
-       (.show dialog)))))
+   (let [dialog-fragment (proxy [android.app.DialogFragment] []
+                           (onCreate [bundle]
+                             (proxy-super onCreate bundle)
+                             (.setRetainInstance this true))
+                           (onDetach []
+                             (proxy-super onDetach)
+                             (.removeView (.getParent view) view))
+                           (onDestroyView []
+                             (when (and (.getDialog this)
+                                        (.getRetainInstance this))
+                               (.setDismissMessage (.getDialog this) nil))
+                             (proxy-super onDestroyView))
+                           (onCreateDialog [bundle]
+                             (proxy-super onCreateDialog bundle)
+                             (create-dialog context message view buttons)))]
+     (.show dialog-fragment (.getFragmentManager context) "dialog"))))

 (defn show-pending-user-dialog
   [context]


Fixed broken Jetty test

Fixed broken Jetty test

--- ring-jetty-adapter/test/ring/adapter/jetty_test.clj
+++ ring-jetty-adapter/test/ring/adapter/jetty_test.clj
@@ -16,5 +16,5 @@
         (is (= (:status response) 200))
         (is (.startsWith (get-in response [:headers "content-type"])
                          "text/plain"))
-        (is (= (:body response) "Hello World\n")))
+        (is (= (:body response) "Hello World")))
       (finally (.stop server)))))


Add (commented out) ND4J snapshots.

Add (commented out) ND4J snapshots.

--- examples/benchmarks/project.clj
+++ examples/benchmarks/project.clj
@@ -17,8 +17,10 @@
                  #_[org.nd4j/nd4j-cuda-9.1 "1.0.0-beta"]
                  [org.nd4j/nd4j-native-platform "1.0.0-beta"]]

+  ;;:repositories [["snapshots" {:url "https://oss.sonatype.org/content/repositories/snapshots"}]]
   :jvm-opts ^:replace ["-Dserver -Dclojure.compiler.direct-linking=true"
-                       "-XX:MaxDirectMemorySize=16g" "-XX:+UseLargePages"]
+                       "-XX:MaxDirectMemorySize=16g" "-XX:+UseLargePages"
+                       #_"-Dorg.bytedeco.javacpp.openblas.load=mkl_rt"]

   :global-vars {*warn-on-reflection* true
                 *assert* false


in anagram_test, a "BANANA" is not a "banana"

I noticed several time that people's solution to this problem don't
include this fact. I think it should.
It also makes the problem more interesting: how to best organize
the code, to avoid using the lower-case function  everywhere in the
code, while keeping it readable.

--- anagram/anagram_test.clj
+++ anagram/anagram_test.clj
@@ -27,4 +27,7 @@
 (deftest word-is-not-own-anagram
   (is (= [] (anagram/anagrams-for "banana" ["banana"]))))

+(deftest capital-word-is-not-own-anagram
+  (is (= [] (anagram/anagrams-for "BANANA" ["banana"]))))
+
 (run-tests)


Adapt plugin to use karma-install

Adapt plugin to use karma-install

--- plugin/src/leiningen/doo.clj
+++ plugin/src/leiningen/doo.clj
@@ -135,24 +135,26 @@
           (doseq [js-env# ~js-envs]
             (doo.core/assert-compiler-opts js-env# compiler#))
           (if (= "auto" ~watch-mode)
-            (do
-              #_(when (some doo.karma/env? ~js-envs)
-                (doo.core/install! (set (filter doo.karma/env? ~js-env))
-                                   ~compiler# ~doo-opts))
+            (let [karma-envs# (vec (filter doo.karma/env? ~js-envs))
+                  non-karma-envs# (vec (remove doo.karma/env? ~js-envs))]
+              (when-not (empty? karma-envs#)
+                (doo.core/install! karma-envs# compiler# ~doo-opts))
               (cljs.build.api/watch
                 (apply cljs.build.api/inputs ~source-paths)
                 (assoc compiler#
                   :watch-fn
                   (fn []
-                    (doseq [js-env# (remove doo.karma/env? ~js-envs)]
-                      (doo.core/print-env js-env#)
-                      (doo.core/run-script js-env# compiler# ~doo-opts))))))
+                    (doseq [js-env# non-karma-envs#]
+                      (doo.core/print-envs js-env#)
+                      (doo.core/run-script js-env# compiler# ~doo-opts))
+                    (apply doo.core/print-envs karma-envs#)
+                    (doo.core/karma-run! ~doo-opts)))))
             (do
               (cljs.build.api/build
                 (apply cljs.build.api/inputs ~source-paths) compiler#)
               (let [ok# (->> ~js-envs
                           (map (fn [e#]
-                                 (doo.core/print-env e#)
+                                 (doo.core/print-envs e#)
                                  (doo.core/run-script e# compiler# ~doo-opts)))
                           (every? (comp zero? :exit)))]
                 (System/exit (if ok# 0 1))))))))))


CMR-3552: Addressed more PR comments

CMR-3552: Addressed more PR comments

--- ingest-app/src/cmr/ingest/services/humanizer_alias_cache.clj
+++ ingest-app/src/cmr/ingest/services/humanizer_alias_cache.clj
@@ -36,7 +36,7 @@
                             ;; case in humanizers.json where there are multiple :replacement_value
                             ;; that only differ in upper-lower cases.
                             (->> (map #(select-keys % [:replacement_value :source_value]) v1)
-                                 (map #(update-in % [:replacement_value] str/upper-case))))]
+                                 (map #(update % :replacement_value str/upper-case))))]
                       [k2 (map :source_value v2)]))])))

 (defn refresh-cache
@@ -139,8 +139,7 @@
         plats (get collection plat-key)
         updated-plats (map #(update-element-with-subelement-aliases
                               % instr-key instr-name-key instr-alias-map) plats)]
-    (-> collection
-        (assoc plat-key updated-plats))))
+    (assoc collection plat-key updated-plats)))

 (defn update-collection-with-aliases
   "Returns the collection with humanizer aliases added."