Add test for testing jline by writing to its input stream.

--- test/cli4clj/test/cli.clj
+++ test/cli4clj/test/cli.clj
@@ -13,7 +13,8 @@
   (:use clojure.test
         cli4clj.cli
         clj-assorted-utils.util)
-  (:import (java.util ArrayList)))
+  (:import (java.io ByteArrayInputStream)
+           (java.util ArrayList)))

 (deftest simple-options-merging-test
   (let [user-options {:cmds {:foo {:fn 123}}}
@@ -206,3 +207,11 @@
                                      :b {:fn (fn [summand1 summand2] (+ summand1 summand2))}}}))))]
     (is (= (expected-string ["2" "5"] out)))))

+(deftest simple-jline-input-stream-mock-test
+  (let [in-string "a 1\nb 2 3\nq\n"
+        out (binding [*jline-input-stream* (ByteArrayInputStream. (.getBytes in-string))]
+              (with-out-str
+                (start-cli {:cmds {:a {:fn (fn [arg] (inc arg))}
+                                   :b {:fn (fn [summand1 summand2] (+ summand1 summand2))}}})))]
+    (is (= (expected-string ["2" "5"] out)))))
+


Fixed bug in nested-tags test

Fixed bug in nested-tags test


added test for custom safe filter

added test for custom safe filter

--- test/selmer/core_test.clj
+++ test/selmer/core_test.clj
@@ -1,5 +1,5 @@
 (ns selmer.core-test
-  (:use clojure.test selmer.parser selmer.template-parser selmer.tags selmer.util)
+  (:use clojure.test selmer.filters selmer.parser selmer.template-parser selmer.tags selmer.util)
   (:import java.io.File))

 (def path (str "test/templates" File/separator))
@@ -443,3 +443,13 @@
   (set-resource-path! nil)
   (is nil? @custom-resource-path)
   )
+
+(deftest safe-filter
+  (add-filter! :foo  (fn [x] [:safe (.toUpperCase x)]))
+  (is
+    (= "
I'M SAFE
"
+       (render "{{x|foo}}" {:x "
I'm safe
"})))
+  (add-filter! :bar #(.toUpperCase %))
+  (is
+    (= "<DIV>I'M NOT SAFE</DIV>"
+      (render "{{x|bar}}" {:x "
I'm not safe
"}))))


Make test data match schema in type of coll

New version of data-spec makes vectors in spec only match vectors in
data (previously it could be any `coll?`).

--- test/braid/test/server/notify_rules_test.clj
+++ test/braid/test/server/notify_rules_test.clj
@@ -67,8 +67,8 @@
                     :user-id (sender :id)
                     :content ""
                     :created-at (java.util.Date.)
-                    :mentioned-user-ids ()
-                    :mentioned-tag-ids ()})]
+                    :mentioned-user-ids []
+                    :mentioned-tag-ids []})]

     (is (rules/notify? (db/uuid) [[:any :any]] (msg)) ":any :any always gets notified")
     (let [new-msg (msg)]


Add subtype for unexpected call.

Add subtype for unexpected call.

--- src/midje/semi_sweet.clj
+++ src/midje/semi_sweet.clj
@@ -74,7 +74,7 @@
   (let [found (find-matching-call faked-function args expectations)]
     (if-not found
 	    (do
-	      (report {:type :fail
+	      (report {:type :fail :subtype :unexpected-call
 		      :message (str "The form being tested near "
 				    (position-string *file-position-of-call-under-test*)
 				    " made an unexpected call.")


Fix typo.

Fix typo.

--- web/test-integration/immutant/web/integ_test.clj
+++ web/test-integration/immutant/web/integ_test.clj
@@ -676,7 +676,7 @@
                :on-close (fn [_ reason]
                            (deliver @client-state :closed)))))]
     (replace-handler handler)
-    (let [:keys [body status] (get-response (cdef-url))]
+    (let [{:keys [body status]} (get-response (cdef-url))]
       (is (= 200 status))
       (is (= [0 1 2 3] (read-string body))))
     (is (= :closed (read-string (get-body (str (cdef-url) "state")))))))


Omit message section when email note is blank.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -97,8 +97,7 @@
           (spacer 30)
           [:th {:class "expander"}]]]]])

-(defn- content
-  [snapshot]
+(defn- content [snapshot]
   [:td
     (spacer 60 "header")
     (logo-name snapshot)
@@ -113,26 +112,30 @@
               (map #(topic (snapshot (keyword %))) (:sections snapshot))
               (repeat (spacer 25 "header"))))]]]])

-(defn- body
-  [snapshot]
+(defn- message [snapshot]
+  [:table
+    [:tbody
+      [:tr
+        (spacer 55 "note")
+        (note snapshot)
+        (spacer 16 "note")
+        (attribution snapshot)
+        (spacer 57 "note")]]])
+
+(defn- body [snapshot]
   [:body
     [:table {:class "body"}
       [:tbody
         [:tr
           [:td {:class "center", :align "center", :valign "top"}
             [:center
-              (spacer 55 "note")
-              (note snapshot)
-              (spacer 16 "note")
-              (attribution snapshot)
-              (spacer 57 "note")
+              (when-not (s/blank? (:note snapshot)) (message snapshot))
               [:table {:class "container"}
                 [:tbody
                   [:tr
                     (content snapshot)]]]]]]]]])

-(defn- head
-  [snapshot]
+(defn- head [snapshot]
   [:html {:xmlns "http://www.w3.org/1999/xhtml"}
     [:head
       [:meta {:http-equiv "Content-Type", :content "text/html; charset=utf-8"}]
@@ -145,8 +148,7 @@
       [:link {:href "http://fonts.googleapis.com/css?family=Open+Sans", :rel "stylesheet", :type "text/css"}]
       (body snapshot)]])

-(defn html
-  [snapshot]
+(defn html [snapshot]
   (str
     "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"
     (h/html (head (keywordize-keys snapshot)))))
@@ -195,4 +197,8 @@
   (def snapshot (json/decode (slurp "./resources/snapshots/open.json")))
   (spit "./resources/hiccup.html" (content/html (assoc snapshot :note note)))

+  (def note "")
+  (def snapshot (json/decode (slurp "./resources/snapshots/open.json")))
+  (spit "./resources/hiccup.html" (content/html (assoc snapshot :note note)))
+
   )


core: memoize

core: memoize

--- core/data/core.clj
+++ core/data/core.clj
@@ -2890,20 +2890,20 @@
        ~@body
        (recur))))

-; (defn memoize
-;   "Returns a memoized version of a referentially transparent function. The
-;   memoized version of the function keeps a cache of the mapping from arguments
-;   to results and, when calls with the same arguments are repeated often, has
-;   higher performance at the expense of higher memory use."
-;   {:added "1.0"}
-;   [f]
-;   (let [mem (atom {})]
-;     (fn [& args]
-;       (if-let [e (find @mem args)]
-;         (val e)
-;         (let [ret (apply f args)]
-;           (swap! mem assoc args ret)
-;           ret)))))
+(defn memoize
+  "Returns a memoized version of a referentially transparent function. The
+  memoized version of the function keeps a cache of the mapping from arguments
+  to results and, when calls with the same arguments are repeated often, has
+  higher performance at the expense of higher memory use."
+  {:added "1.0"}
+  [f]
+  (let [mem (atom {})]
+    (fn [& args]
+      (if-let [e (find @mem args)]
+        (val e)
+        (let [ret (apply f args)]
+          (swap! mem assoc args ret)
+          ret)))))

 (defn empty?
   "Returns true if coll has no items - same as (not (seq coll)).


fixing boot bug

fixing boot bug

--- src/overtone/core/sc.clj
+++ src/overtone/core/sc.clj
@@ -359,7 +359,7 @@

 (defn internal-booter [port]
   (reset! running?* true)
-  (log/debug "booting internal audio server...")
+  (log/info "booting internal audio server listening on port: " port)
   (let [opts (byref sc-jna-startoptions)]
     (set! (. opts udp-port-num) port)
     (set! (. opts tcp-port-num) port)
@@ -374,6 +374,7 @@
 (defn boot-internal
   ([] (boot-internal (+ (rand-int 50000) 2000)))
   ([port]
+   (log/info "boot-internal: " port)
    (if (not @running?*)
      (let [sc-thread (Thread. #(internal-booter port))]
        (.setDaemon sc-thread true)
@@ -414,8 +415,7 @@
   specific port."
   ([port]
    (if (not @running?*)
-     (let [port (if (nil? port) (+ (rand-int 50000) 2000) port)
-           cmd (into-array String (concat [(SC-PATHS (@config* :os)) "-u" (str port)] (SC-ARGS (@config* :os))))
+     (let [cmd (into-array String (concat [(SC-PATHS (@config* :os)) "-u" (str port)] (SC-ARGS (@config* :os))))
            sc-thread (Thread. #(external-booter cmd))]
        (.setDaemon sc-thread true)
        (log/debug "Booting SuperCollider server (scsynth)...")
@@ -428,9 +428,10 @@
   "Boot either the internal or external audio server."
   ([] (boot (get @config* :server :internal) SERVER-HOST SERVER-PORT))
   ([which & [host port]]
-   (cond
-     (= :internal which) (boot-internal port)
-     (= :external which) (boot-external host port))))
+   (let [port (if (nil? port) (+ (rand-int 50000) 2000) port)]
+     (cond
+       (= :internal which) (boot-internal port)
+       (= :external which) (boot-external host port)))))

 (defn quit
   "Quit the SuperCollider synth process."


Teach inactive-node-modification-error to respond to *non-active-node-modification-exceptions* set to vals :silent, :warning or :exception only.

--- src/overtone/sc/node.clj
+++ src/overtone/sc/node.clj
@@ -11,13 +11,21 @@
             [overtone.config.log :as log]
             [overtone.at-at :as at-at]))

-(defonce ^{:dynamic true} *non-active-node-modification-exceptions* true)
-
-(defn inactive-node-modification-error [err-msg]
+(defonce ^{:dynamic true} *non-active-node-modification-exceptions* :exception)
+
+(defn inactive-node-modification-error
+  "The default error behaviour triggered when a user attempts to either
+  control or kill an inactive node."
+  [err-msg]
   (condp = *non-active-node-modification-exceptions*
-    :silent nil ;;do nothing
-    false   (println "Warning - " err-msg)
-    (throw (Exception. err-msg))))
+    :silent    nil ;;do nothing
+    :warning   (println "Warning - " err-msg)
+    :exception (Exception. err-msg)
+    (throw
+     (IllegalArgumentException.
+      (str "Unexpected value for *non-active-node-modification-exceptions*: "
+           *non-active-node-modification-exceptions*
+           "Expected one of :silent, :warning, :exception.")))))

 (defonce ^{:private true}
   _PROTOCOLS_


[FLINK-11651][tests] Upgrade jepsen dependency to 0.1.11

--- flink-jepsen/project.clj
+++ flink-jepsen/project.clj
@@ -22,7 +22,7 @@
   :dependencies [[org.clojure/clojure "1.9.0"],
                  [cheshire "5.8.0"]
                  [clj-http "3.8.0"]
-                 [jepsen "0.1.10"],
+                 [jepsen "0.1.11"],
                  [jepsen.zookeeper "0.1.0"]
                  [org.clojure/data.xml "0.0.8"]
                  [zookeeper-clj "0.9.4" :exclusions [org.slf4j/slf4j-log4j12]]]


upload to mongo, catch polling exceptions

--- src/polismath/poller.clj
+++ src/polismath/poller.clj
@@ -1,16 +1,22 @@
 (ns polismath.poller
   (:use clojure.pprint
+        clojure.core.matrix.impl.ndarray
         polismath.conversation
         polismath.named-matrix
         polismath.utils
         polismath.pca)
   (:require [korma.db :as kdb]
             [korma.core :as ko]
+            [cheshire.core :refer :all]
+            [cheshire.generate :refer [add-encoder encode-seq remove-encoder]]
             [clojure.java.jdbc :as sql]
             [monger.core :as mg]
-            [monger.collection :as mg.col]
+            [monger.collection :as mgcol]
             [environ.core :as env]))

+;(use 'alex-and-georges.debug-repl)
+
+(println "launching poller " (System/currentTimeMillis))

 (defn heroku-db-spec [db-uri]
   (let [[_ user password host port db] (re-matches #"postgres://(?:(.+):(.*)@)?([^:]+)(?::(\d+))?/(.+)" db-uri)
@@ -24,11 +30,6 @@
     (kdb/postgres settings)))

-(defn mongo-db [mongo-url]
-  (let [params  {}
-        con     (mg/connect params)]
-    (mg/get-db con "polismath")))
-

 (defn split-by-conv [votes]
   (reduce
@@ -38,50 +39,87 @@
                (conj (get conv-map conv-id []) vote))))
     {} votes))

-(defn post-results [db-spec zid last-timestamp results-json]
-  (kdb/with-db db-spec
-    (ko/update "math_results_dev01"
-      (ko/set-fields {
-        :data results-json
-        :last_timestamp last-timestamp })
-      (ko/where {
-        :zid [= zid]
-        :last_timestamp [< last-timestamp] }))))

-(defn post-results-raw [db-spec zid last-timestamp results-json]
-  (kdb/with-db db-spec
-    (ko/exec-raw [
-      "UPDATE math_results_dev01 SET data = ?, last_timestamp = ? WHERE zid = ? RETURNING zid"
-      [results-json last-timestamp zid]
-      :results])))
+(defn mongo-connect! [mongo-url]
+  (monger.core/connect-via-uri! mongo-url))
+
+(defn mongo-upsert-results [zid timestamp new-results ]
+  (monger.collection/update "polismath_test1248124"
+    {
+      :zid zid
+      ; "$gt" 92839182312
+    }
+    {
+      "zid" zid
+      "lastVoteTimestamp" timestamp
+      "data" new-results
+    }
+    :multi false
+    :upsert true))

-(defn post-results-insert [db-spec zid last-timestamp results-json]
-  (kdb/with-db db-spec
-    (ko/insert "math_results_dev01"
-      (ko/values {
-        :data results-json
-        :last_timestamp last-timestamp
-        :zid zid}))))
+; (defn post-results [db-spec zid last-timestamp results-json]
+;   (kdb/with-db db-spec
+;     (ko/update "math_results_dev01"
+;       (ko/set-fields {
+;         :data results-json
+;         :last_timestamp last-timestamp })
+;       (ko/where {
+;         :zid [= zid]
+;         :last_timestamp [< last-timestamp] }))))

-(defn upsert-results [db-spec zid last-timestamp results-json]
-  (try
-    (post-results-insert db-spec 1001 0 results-json)
-    (catch Exception e
-      (post-results db-spec 1001 1 results-json))))
+; (defn post-results-raw [db-spec zid last-timestamp results-json]
+;   (kdb/with-db db-spec
+;     (ko/exec-raw [
+;       "UPDATE math_results_dev01 SET data = ?, last_timestamp = ? WHERE zid = ? RETURNING zid"
+;       [results-json last-timestamp zid]
+;       :results])))
+
+
+; (defn post-results-insert [db-spec zid last-timestamp results-json]
+;   (kdb/with-db db-spec
+;     (ko/insert "math_results_dev01"
+;       (ko/values {
+;         :data results-json
+;         :last_timestamp last-timestamp
+;         :zid zid}))))
+
+; (defn upsert-results [db-spec zid last-timestamp results-json]
+;   (try
+;     (post-results-insert db-spec 1001 0 results-json)
+;     (catch Exception e
+;       (post-results db-spec 1001 1 results-json))))

 (defn poll [db-spec last-timestamp]
-  (kdb/with-db db-spec
-    (ko/select "votes"
-      (ko/where {:created [> last-timestamp]})
-      (ko/order :created :asc))))
+  (try
+    (kdb/with-db db-spec
+      (ko/select "votes"
+        (ko/where {:created [> last-timestamp]})
+        (ko/order :created :asc)))
+    (catch Exception e (do
+        (println (str "polling failed " (.getMessage e)))
+        []))))
+
+
+
+(add-encoder mikera.vectorz.Vector
+             (fn [v jsonGenerator]
+               (encode-seq (into-array v) jsonGenerator)))
+
+; CAREFUL - make sure we don't lose dimensions of the N-Dimensional array.
+(add-encoder clojure.core.matrix.impl.ndarray.NDArray
+             (fn [v jsonGenerator]
+               (encode-seq (into-array v) jsonGenerator)))
+
+
+

 (defn -main []
   (let [poll-interval 1000
         pg-spec         (heroku-db-spec (env/env :database-url))
-        mg-db           (mongo-db (env/env :mongo-url))
+        mg-db           (mongo-connect! (env/env :mongo-url))
         last-timestamp  (atom 0)
         conversations   (atom {})]
     (endlessly poll-interval
@@ -89,20 +127,29 @@
             new-votes (poll pg-spec @last-timestamp)
             split-votes (split-by-conv new-votes)]
         (doseq [[zid votes] split-votes]
-          (swap! conversations
-            (fn [convs]
-              (assoc convs zid
-                  (try
-                    (small-conv-update {:conv (or (convs zid)
-                                            {:rating-mat (named-matrix)})
-                                    :votes votes
-                                    :opts {}})
-                      (catch Exception e (println "exception when processing zid: " zid))))))
-
-          ;(upsert-results pg-spec 1001 1 "foo")
-          (println "zid: " zid)
-          (println "time: " (System/currentTimeMillis))
-          (println "\n\n")
-          (println (@conversations zid))
+          (let [lastVoteTimestamp (:created (last votes))]
+            (swap! conversations
+              (fn [convs]
+                (assoc convs zid
+                    (try
+                      (small-conv-update {:conv (or (convs zid)
+                                              {:rating-mat (named-matrix)})
+                                      :votes votes
+                                      :opts {}})
+                        (catch Exception e (println "exception when processing zid: " zid))))))
+
+            ;(upsert-results pg-spec 1001 1 "foo")
+            (println "zid: " zid)
+            (println "time: " (System/currentTimeMillis))
+            (println "\n\n")
+            (println (generate-string (prep-for-uploading (@conversations zid))))
+            ; (debug-repl)
+            (println
+              (mongo-upsert-results
+                zid
+                lastVoteTimestamp
+                (generate-string
+                  (prep-for-uploading
+                    (@conversations zid)))))
         (swap! last-timestamp (fn [_] (:created (last new-votes))))
-      )))))
+      ))))))


More work

More work

--- src/posthere/storage.clj
+++ src/posthere/storage.clj
@@ -40,8 +40,11 @@
     false))

 (defn request-with-slurped-body [request]
+  ; (println (:body request))
+  ; (println (slurp (:body request)))
+  ; (println (read (:body request)))
   (if (contains? request :body)
-    (assoc request :body (slurp (request :body)))
+    (assoc request :body (slurp (:body request)))
     request))

 ;; Public
@@ -49,21 +52,21 @@
 (defn save-request
   "Store the request made to a UUID in Redis for up to 24h."
   [url-uuid request]
-  (def clean_request (dissoc request :async-channel))
-
-  (println clean_request)

   (let [url-key (url-key-for url-uuid)
         request-uuid (uuid) ;; new UUID for this request
         request-entry (request-entry-for request-uuid)
-        request-key (request-key-for request-uuid)]
+        request-key (request-key-for request-uuid)
+        clean-request (request-with-slurped-body (dissoc request :async-channel :websocket?))]
+
+    (println clean-request)

     ;; Save the POST request to the list for this URL UUID
     (wcar*
       (car/multi) ;; transaction
         (car/lpush url-key request-entry) ;; push the request onto the list
         (car/expire url-key day) ;; renew the list expiration
-        (car/set request-key (request-with-slurped-body clean_request)) ;; store the request
+        (car/set request-key clean-request) ;; store the request
         (car/expire request-key day) ;; expire the request
       (car/exec)) ;; execute transaction


fixing partial

fixing partial

--- src/proxmox/provider.clj
+++ src/proxmox/provider.clj
@@ -106,7 +106,7 @@
               (check-task node (prox-post (str "/nodes/" node "/openvz") ct*))
               (enable-features this)
               (when (p/system-exists? id)
-                (p/partial-system id {:proxmox (select-keys ct* [:vmid :ip_address])}))
+                (p/partial-system id {:proxmox {:vmid vmid} :machine {:ip ip_address} }))
               (catch [:status 500] e
                 (release-ip (ct* :ip_address))
                 (warn "Container already exists" e)))))
@@ -196,3 +196,5 @@
       :ct  (let [[ct ex] (translate spec)]
              (->Container node ct ex)))))

+
+


Improved Welcome

Improved Welcome

--- src/re_demo/welcome.cljs
+++ src/re_demo/welcome.cljs
@@ -6,32 +6,35 @@
 (defn welecome
   []
   [v-box
-   :size     "auto"
-   ;:width    "600px"
-   :children [
-              [p
+   :children [[p
                "Re-com is a library of ClojureScript UI components, built on top of "
                [hyperlink-href
                 :label "Reagent"
                 :href "https://github.com/reagent-project/reagent"
                 :target "_blank"]
                "."]
-              [p "It contains the sort of layout and controls you'd need to build a desktop-class app."]
-
-
-              ]])
+              [p "It contains the sort of layout and controls you'd need to build a desktop-class app."]]])

 (defn this-app
   []
   [v-box
-   :children [[title :level :level2 :label "This app"]
-              ;[gap :size "5px"]
-              [p "The demo app serves as:"
-               [:ul
-                [:li "a visual showcase of the components"]
-                [:li "example code for using the components"]
-                [:li "documentation for the components (parameters etc.)"]
-                [:li "something of a test harness"]]]]])
+   :children [
+              [title :level :level2 :label "This app"]
+
+              [h-box
+               :gap "100px"
+               :children [[v-box
+                           :children [[p "The demo app serves as:"
+                                       [:ul
+                                        [:li "a visual showcase of the components"]
+                                        [:li "documentation for the components (parameters etc.)"]
+                                        [:li "shows, via its own code, how to use the components"]
+                                        [:li "something of a test harness"]]]]]
+                          [v-box
+                           :style {:font-size "13px" :color "#aaa"}
+                           :children [[p {:style {:width "250px"}} [:br] [:br] [:br] "Most pages in this app have
+                           hyperlinks near the title which take you
+                           directly to the associated source code in github."]]]]]]])

 (defn named-params
@@ -39,39 +42,43 @@
   [v-box
    :children [
               [title :level :level2 :label "Named Parameters"]
+              [p  "re-com components take " [:span.bold "named parameters"] ", rather than " [:span.bold "positional parameters"] "."]

-              [p  "re-com components take " [:span.bold "named parameters"] ", rather than " [:span.bold "positional parameters"] "."]
-              [p "So, use of a re-com component like " [:span.bold "checkbox"] ", looks like this:"]
-              [:pre
-               {:style {:width "450px"}}
-               "[checkbox
+              [h-box
+               :gap "100px"
+               :children [[v-box
+                          :children [[p "When you use a re-com component, like " [:span.bold "checkbox"] ", it looks like this:"]
+                                     [:pre
+                                      {:style {:width "450px"}}
+                                      "[checkbox
   :label     \"Show Status Icon?\"
   :model     status-icon?      ; a ratom
   :on-change (fn [new-val] (reset! status-icon? new-val))]"]
-              [p "Notice how each parameter has a short, leading keyword name."]
-              [p "Using positional parameters (no naming), is more concise while using named parameters is more explicit.
-              Both approaches have their merits - a situation which invariably leads to highly contested
-              Religious Wars. "]
-              [p "We've gone with named parameters in the API because:"
-               [:ol
-                [:li "the code seems easier to read (despite being longer)"]
-                [:li "as a result the code seems more understandable - something we value above all other considerations."]
-                [:li "optionality - not all parameters have to be supplied, defaults can be introduced"]
-                [:li "API flexibility - new parameters are easily added"]]]
-              [p "Read further analysis "
-               [hyperlink-href
-                :label "here"
-                :href "https://clojurefun.wordpress.com/2012/08/13/keyword-arguments-in-clojure/"
-                :target "_blank"] "."]
+                                     [p "Each parameter has a leading keyword name."]
+                                     [p "Now, our sausage fingers sometimes type onmouseover instead of on-mouse-over,
+                                     or centre rather than center, and sometimes we pass in a string where  there should be keyword."]
+                                     [p "re-com tries to catch these kinds of mistakes by validating all parameter names and values."]
+                                     [p "But there is overhead in this checking which you'd like to avoid in production. So, to remove it,
+                                      be sure to
+                                     include the following in your project.clj for your productuion builds:"]
+                                     [:pre
+                                      {:style {:width "450px"}}
+                                      ":closure-defines {:goog.DEBUG false}"]]]
+                          [v-box
+                           :style {:font-size "13px" :color "#aaa"}
+                           :children [[p {:style {:width "250px"}} "We use named parameters because:"
+                                        [:ol
+                                         [:li "the code seems more easily read and understood (although longer)"]
+                                         [:li "optionality - not all parameters need be supplied and defaults can be introduced"]
+                                         [:li "API flexibility - easy to add new parameters"]]]
+                                       [p {:style {:width "250px"}} "Read further analysis "
+                                        [hyperlink-href
+                                         :label "here"
+                                         :href "https://clojurefun.wordpress.com/2012/08/13/keyword-arguments-in-clojure/"
+                                         :target "_blank"] "."]]]
+                          ]]
               ]])

-
-(defn param-validation
-  []
-  [v-box
-   :children [
-              [title :level :level2 :label "Named Parameters"]
-              ]])

 (defn panel2
@@ -85,10 +92,8 @@
               [this-app]
               [gap :size "30px"]
               [line]
-
-              [h-box
-               :gap      "100px"
-               :children [[named-params]]]]])
+              [named-params]
+              [gap :size "40px"]]])


Add step* impl for s/nilable and s/tuple

--- src/spectrace/trace.cljc
+++ src/spectrace/trace.cljc
@@ -71,6 +71,21 @@
 (defmethod step* `s/or [state succ fail]
   (step-by-key state succ fail))

+(defmethod step* `s/nilable [{:keys [spec] :as state} succ fail]
+  (with-cont succ fail
+    (-> state
+        (assoc :spec (get-in spec [:args :pred]))
+        (update :path rest))))
+
+(defmethod step* `s/tuple [{:keys [spec path val] :as state} succ fail]
+  (with-cont succ fail
+    (let [[segment & path] path]
+      (-> state
+          (assoc :spec (nth (:args spec) segment)
+                 :path path
+                 :val (nth val segment))
+          (update :in rest)))))
+
 (defmethod step* `s/cat [state succ fail]
   (step-by-key state succ fail :val-fn nth))


Remove Rotary external dependencies: -?>> -> some->>, use local Functor (fmap) implementation

--- src/taoensso/faraday.clj
+++ src/taoensso/faraday.clj
@@ -5,7 +5,7 @@
   (:require [clojure.string         :as str]
             [taoensso.timbre        :as timbre]
             [taoensso.nippy         :as nippy]
-            [taoensso.faraday.utils :as utils])
+            [taoensso.faraday.utils :as utils :refer (fmap)])
   (:import  [com.amazonaws.services.dynamodb.model
              AttributeValue
              BatchGetItemRequest
@@ -79,9 +79,9 @@
   "Get the value of an AttributeValue object."
   [attr-value]
   (or (.getS attr-value)
-      (-?>> (.getN attr-value)  to-long)
-      (-?>> (.getNS attr-value) (map to-long) (into #{}))
-      (-?>> (.getSS attr-value) (into #{}))))
+      (some->> (.getN attr-value)  to-long)
+      (some->> (.getNS attr-value) (map to-long) (into #{}))
+      (some->> (.getSS attr-value) (into #{}))))

 (defn- key-schema-element
   "Create a KeySchemaElement object."
@@ -184,9 +184,9 @@
   BatchResponse
   (as-map [result]
     {:consumed-capacity-units (.getConsumedCapacityUnits result)
-     :items (-?>> (.getItems result)
-                  (into [])
-                  (fmap #(fmap get-value (into {} %))))})
+     :items (some->> (.getItems result)
+                     (into [])
+                     (fmap #(fmap get-value (into {} %))))})
   KeysAndAttributes
   (as-map [result]
     (merge


Improved repo abstraction for proper encode and send query-string.

--- src/uxbox/repo/core.cljs
+++ src/uxbox/repo/core.cljs
@@ -7,13 +7,15 @@
 (ns uxbox.repo.core
   "A main interface for access to remote resources."
   (:refer-clojure :exclude [do])
-  (:require [httpurr.client.xhr :as http]
+  (:require [clojure.walk :as walk]
+            [httpurr.client.xhr :as http]
             [httpurr.status :as http.status]
             [hodgepodge.core :refer (local-storage)]
             [promesa.core :as p :include-macros true]
             [beicon.core :as rx]
             [uxbox.transit :as t]
-            [uxbox.state :as ust]))
+            [uxbox.state :as ust])
+  (:import [goog.Uri QueryData]))

 (goog-define url "http://127.0.0.1:5050/api")

@@ -49,19 +51,28 @@
 (def ^:private ^:const +headers+
   {"content-type" "application/transit+json"})

-(defn auth-headers
+(defn- auth-headers
   []
   (when-let [auth (:auth @ust/state)]
     {"authorization" (str "Token " (:token auth "no-token"))}))

+(defn- encode-query
+  [params]
+  (let [data (QueryData.)]
+    (.extend data (clj->js params))
+    (.toString data)))
+
 (defn- send!
-  [{:keys [body headers auth method] :or {auth true} :as request}]
+  [{:keys [body headers auth method query url] :or {auth true} :as request}]
   (let [headers (merge {}
                        (when body +headers+)
                        headers
                        (when auth (auth-headers)))
-        request (merge (assoc request :headers headers)
-                       (when body {:body (t/encode body)}))]
+        request {:method method
+                 :url url
+                 :headers headers
+                 :query-string (when query (encode-query query))
+                 :body (when body (t/encode body))}]
     (->> (http/send! request)
          (rx/from-promise)
          (rx/map conditional-decode)


User name + user stats in HTML heading

User name + user stats in HTML heading

--- src/zg/html_renderer.clj
+++ src/zg/html_renderer.clj
@@ -34,9 +34,19 @@
             [:div {:class "input-group-btn"}
                 (form/submit-button {:class "btn btn-default"} "Search")]]))

+(defn render-name-field
+    "Renders box for typing user name on the top side of HTML page."
+    [user-name]
+    (form/form-to {:class "navbar-form navbar-left" :role "search"} [:get "/" ]
+        [:div {:class "input-group"}
+            ;[:span {:class "input-group-addon"} "Name"]
+            (form/text-field {:size "10" :class "form-control" :placeholder "User name"} "user-name" (str user-name))
+            [:div {:class "input-group-btn"}
+                (form/submit-button {:class "btn btn-default"} "Remember me")]]))
+
 (defn render-navigation-bar-section
     "Renders whole navigation bar."
-    [word]
+    [word user-name]
     [:nav {:class "navbar navbar-inverse navbar-fixed-top" :role "navigation"}
         [:div {:class "container-fluid"}
             [:div {:class "row"}
@@ -59,18 +69,26 @@
                         [:a {:href "/deleted-words" :class "navbar-brand"} "Deleted words"]
                     ] ; ./navbar-header
                 ] ; col ends
+                [:div {:class "col-md-3"}
+                    (render-name-field user-name)
+                ]
+                [:div {:class "col-md-1"}
+                    [:div {:class "navbar-header"}
+                        [:a {:href "/users" :class "navbar-brand"} "Users"]
+                    ] ; ./navbar-header
+                ] ; col ends
             ] ; row ends
         ] ; /.container-fluid
 ]); </nav>

 (defn render-error-page
     "Render error page with a 'back' button."
-    [word message]
+    [word user-name message]
     (page/xhtml
         (render-html-header "")
         [:body
             [:div {:class "container"}
-                (render-navigation-bar-section word)
+                (render-navigation-bar-section word user-name)
                 [:div {:class "col-md-10"}
                     [:h2 "Sorry, error occured in zg"]
                     [:p message]
@@ -83,12 +101,12 @@
     ))

 (defn render-front-page
-    [word search-results]
+    [word user-name search-results]
     (page/xhtml
         (render-html-header word)
         [:body
             [:div {:class "container"}
-                (render-navigation-bar-section word)
+                (render-navigation-bar-section word user-name)

                 (form/form-to [:post "/add-words"]
                         [:div {:class "label label-primary"} "New words"]


update ns comment

update ns comment


fix link strength boost

fix link strength boost

--- src/node/game/core.cljs
+++ src/node/game/core.cljs
@@ -255,7 +255,7 @@
         choice (if (= (:choices prompt) :credit)
                  (min choice (get-in @state [side :credit])) choice)]
     (when (= (:choices prompt) :credit)
-      (pay state :corp card :credit choice))
+      (pay state side card :credit choice))
     (swap! state update-in [side :prompt] rest)
     ((:effect prompt) (or choice card))
     (when-let [run (:run @state)]


use a empty version of the map passed to select-in

we want to preserve om cursors

--- src-cljs/frontend/utils/seq.cljs
+++ src-cljs/frontend/utils/seq.cljs
@@ -11,7 +11,7 @@
   "Returns a map containing only those entries in map whose keypath is in keypaths
    (select-in {:a {:b 1 :c 2}} [[:a :b]]) => {:a {:b 1}} "
   [map keypathseq]
-  (loop [ret {} keypaths (seq keypathseq)]
+  (loop [ret (empty map) keypaths (seq keypathseq)]
     (if keypaths
       (let [entry (get-in map (first keypaths) sentinel)]
         (recur


Update clojars-deployer to use latest leiningen.

We were relying on a pomegranate snapshot that no longer existed.

--- support/clojars-deployer/project.clj
+++ support/clojars-deployer/project.clj
@@ -1,15 +1,15 @@
 ;; Copyright 2008-2014 Red Hat, Inc, and individual contributors.
-;;
+;;
 ;; This is free software; you can redistribute it and/or modify it
 ;; under the terms of the GNU Lesser General Public License as
 ;; published by the Free Software Foundation; either version 2.1 of
 ;; the License, or (at your option) any later version.
-;;
+;;
 ;; This software is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 ;; Lesser General Public License for more details.
-;;
+;;
 ;; You should have received a copy of the GNU Lesser General Public
 ;; License along with this software; if not, write to the Free
 ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
@@ -21,6 +21,5 @@
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
   :dependencies [[org.clojure/clojure "1.5.1"]
-                 [leiningen "2.1.1"]
-                 [com.cemerick/pomegranate "0.2.1-SNAPSHOT"]]
+                 [leiningen "2.3.4"]]
   :main clojars-deployer.main)


Simplify structure-digit string encoding

...in test.check generator


Fix logging statement.

Fix logging statement.

--- src/kixi/hecuba/data/measurements.clj
+++ src/kixi/hecuba/data/measurements.clj
@@ -36,7 +36,7 @@
   "WARNING: This will delete data in 1 month chunks based on the dates
   passed in."
   [sensor_id start-date end-date session]
-  (log/infof "Deleting Measurements for % from %s to %s" sensor_id type start-date end-date)
+  (log/infof "Deleting Measurements for %s from %s to %s" sensor_id start-date end-date)
   (s/validate SensorId sensor_id)
   (let [months (time/range->months start-date end-date)
         years  (time/range->years start-date end-date)


Turn off kill for time being

Turn off kill for time being

--- src/angelic/search/summaries.clj
+++ src/angelic/search/summaries.clj
@@ -96,7 +96,7 @@

 (def *subsumption* true)

-(def *kill* true) ;; Remove dead children of OR-nodes.  Doesn't seem to really help or hurt...
+(def *kill* false #_ true) ;; Remove dead children of OR-nodes.  Doesn't seem to really help or hurt...

 (defn update-bound! [n bound-atom b]
   (when (and *subsumption* (< b @bound-atom))


put add-plot and add-line statements within functions, so that compiling won't display map windows.

--- src/clj/forma/presentation/ndvi_filter.clj
+++ src/clj/forma/presentation/ndvi_filter.clj
@@ -64,7 +64,9 @@
 ;; Add the points indicating bad (read: unreliable) values on the
 ;; original NDVI time-series.

-(c/add-points plot1 forma-range kill-vals :series-label "Unreliable Values")
+(defn add-unreliable
+  []
+  (c/add-points plot1 forma-range kill-vals :series-label "Unreliable Values"))

 ;; Create a new plot with the HP-filter to be updated by the slider,
 ;; based on the interpolated NDVI values.
@@ -80,16 +82,18 @@
 ;; Add a plot of the interpolated NDVI values to serve as the
 ;; background to the updating slider.

-(c/add-lines plot2 forma-range (fix-time-series #{1} reli ndvi) :series-label "Conditioned NDVI")
+(defn add-conditioned-ndvi []
+  (c/add-lines plot2 forma-range (fix-time-series #{1} reli ndvi) :series-label "Conditioned NDVI"))

 ;; Add the slider to the original time-series plot, defined in the
 ;; first definition of plot2

-(let [x forma-range]
-  (c/slider #(i/set-data plot2
-                         [x (hp-filter (fix-time-series #{1} reli ndvi) %)])
-            (map (partial round-places 2) (range 0 1000 1))
-            "lambda"))
+(defn add-ndvi-slider []
+  (let [x forma-range]
+    (c/slider #(i/set-data plot2
+                           [x (hp-filter (fix-time-series #{1} reli ndvi) %)])
+              (map (partial round-places 2) (range 0 1000 1))
+              "lambda")))

 ;; Add the original kill plots, just in case we want to show the
 ;; original scale. Note that we can just turn this feature on and off.
@@ -114,6 +118,8 @@
 ;; Add the points indicating bad (read: unreliable) values on the
 ;; original NDVI time-series.

-(c/add-points plot3 forma-range kill-vals :series-label "UNRELIABLE VALUES")
+(defn add-unreliable-views []
+  (c/add-points plot3 forma-range kill-vals :series-label "UNRELIABLE VALUES"))

-(doto (c/add-lines plot3 forma-range (hp-filter (fix-time-series #{1} reli ndvi)  2) :series-label "FILTER"))
+(defn add-filter []
+  (doto (c/add-lines plot3 forma-range (hp-filter (fix-time-series #{1} reli ndvi)  2) :series-label "FILTER")))


cleanup inbound mapper

cleanup inbound mapper

--- src/clj/swarmpit/docker/mapper/inbound.clj
+++ src/clj/swarmpit/docker/mapper/inbound.clj
@@ -1,7 +1,6 @@
 (ns swarmpit.docker.mapper.inbound
   "Map docker domain to swarmpit domain"
-  (:require [clojure.string :as str]
-            [clojure.tools.logging :as log]))
+  (:require [clojure.string :as str]))

 (defn- as-megabytes
   [bytes]


correct check

correct check

--- src/cljs/infinitelives/pixi/pixelfont.cljs
+++ src/cljs/infinitelives/pixi/pixelfont.cljs
@@ -206,7 +206,7 @@
         ))))

 (defn layout-text [font-key text x y right line-spacing justify charset]
-  (assert (#{:justified :ragged} justify) "justify needs to be set correctly")
+  (assert (#{:justify :ragged} justify) "justify needs to be set correctly")
   (let [font (get-font font-key)
         height (:height font)
         word-extents (vec (word-beginnings-ends text))


default get-texture to :nearest

default get-texture to :nearest

--- src/cljs/infinitelives/pixi/resources.cljs
+++ src/cljs/infinitelives/pixi/resources.cljs
@@ -79,8 +79,11 @@
     (.addChild stage s)
     s))

-(defn get-texture [key scale]
-  (scale (get @!texture-store key)))
+(defn get-texture
+  ([key scale]
+   (scale (get @!texture-store key)))
+  ([key]
+   (get-texture key :nearest)))

 ;; setup a pixi texture cache keyed by the tail of its filename
 (defn- register!


Add execute!.

Add execute!.

--- src/fhofherr/clj_db_util/jdbc_template.clj
+++ src/fhofherr/clj_db_util/jdbc_template.clj
@@ -36,6 +36,10 @@
   [db sql-str & {:as options}]
   (execute-sql-str jdbc/query db sql-str options))

+(tx/deftx execute!
+  [db sql-str & {:as options}]
+  (execute-sql-str jdbc/execute! db sql-str options))
+
 (tx/deftx load-statement
   "Load a statement from a resource file using the database's dialect."
   [db stmt-path]


Made sidebar (+) button more visible

Made sidebar (+) button more visible

--- src/braid/ui/styles/sidebar.cljs
+++ src/braid/ui/styles/sidebar.cljs
@@ -49,7 +49,7 @@
       :position "relative"}]

     [:&.plus
-     {:background "#333"
+     {:background "#999"
       :color "#222"
       :font-family "fontawesome"}

@@ -57,6 +57,6 @@
       (mixins/fontawesome \uf067)]

      [:&:hover
-      {:background "#555"}]]
+      {:background "#CCC"}]]

     badge]])


profiles.clj: check in stale version

profiles.clj: check in stale version

--- profiles.clj
+++ profiles.clj
@@ -1,12 +1,2 @@
-{:user { ;; :java-cmd "drip"
-        :plugins [[cider/cider-nrepl "0.11.0-SNAPSHOT"]
-                  [lein-ancient "0.6.8"]
-                  [lein-auto "0.1.2"]
-                  [lein-exec "0.3.5"]
-                  [lein-kibit "0.1.2"]
-                  [lein-bikeshed "0.2.0"]
-                  [jonase/eastwood "0.2.3"]
-                  [org.clojure/tools.nrepl "0.2.12"]
-                  [lein-typed "0.3.5"]
-                  [refactor-nrepl "2.0.0-SNAPSHOT"]]}
- :cuttle {:plugins [[lein-pprint "1.1.1"]]}}
+{:user {:plugins [[lein-auto "0.1.3"]]
+        :certificates ["clojars.pem"]}}


Kube node provider POC

Kube node provider POC

--- src/clj/shale/node_providers.clj
+++ src/clj/shale/node_providers.clj
@@ -71,9 +71,38 @@
   (can-add-node [this] false)
   (can-remove-node [this] false))

+(defn selenium-url
+  [pod port-name]
+  (let [port (->> pod
+                  :spec
+                  :containers
+                  (mapcat :ports)
+                  (filter (fn [p]
+                            (-> p :name (= port-name))))
+                  first)
+        _ (assert port)
+        port-num (:containerPort port)]
+    (str "http://" (-> pod :status :podIP) ":" port-num)))

+(deftype KubeNodeProvider [api-url label port-name namespace]
+  ;;; Uses pods with the given label. Label is a map containing a single key & value. port-name is the name of the container port to connect on
+  INodeProvider
+  (get-nodes [this]
+    (assert (map? label))
+    (assert (= 1 (count label)))
+    (let [label-key (-> label first key)
+          label-value (-> label first val)]
+      (->> (kube/list-pods api-url)
+           :items
+           (filter (fn [pod]
+                     (-> pod :metadata :labels (get label-key) (= label-value))))
+           (map (fn [pod]
+                  (selenium-url pod port-name))))))
+  (add-node [this url]
+    (throw (ex-info "Adding nodes is not yet implemented."
+                    {:user-visible true :status 500})))

-    (remove-node [this url])
+  (remove-node [this url])

-    (can-add-node [this] false)
-    (can-remove-node [this] false))
+  (can-add-node [this] false)
+  (can-remove-node [this] false))


fix error omitting empty attributes

fix error omitting empty attributes

--- src/clj_money/import/gnucash.clj
+++ src/clj_money/import/gnucash.clj
@@ -41,9 +41,9 @@
                        identity)
         raw-value ($x:text? xpath node)
         value (when raw-value (transform-fn raw-value))]
-    (if value
-      (assoc result attribute value)
-      result)))
+    (if (nil? value)
+      result
+      (assoc result attribute value))))

 (defn- node->model
   [node attributes]


add summary to budget report

add summary to budget report

--- src/clj_money/models/reports.clj
+++ src/clj_money/models/reports.clj
@@ -196,26 +196,52 @@
        :actual-per-period  (/ actual period-count)})))

 (defn- process-budget-group
-  [storage budget as-of [account-type items]]
-  (let [period-count (+ 1 (budgets/period-containing budget as-of))
-        records (->> items
+  [storage budget period-count as-of [account-type items]]
+  (let [records (->> items
                      (map #(->budget-report-record storage budget period-count as-of %))
                      (sort-by :difference))]
     (conj records
           (budget-group-header period-count account-type records))))
+
+(defn- append-summary
+  [period-count records]
+  (let [income (->> records
+                    (filter #(= "Income" (:caption %)))
+                    first)
+        expense (->> records
+                     (filter #(= "Expense" (:caption %)))
+                     first)
+        budget (->> [income expense]
+                    (map #(:budget %))
+                    (apply -))
+        actual (->> [income expense]
+                    (map #(:actual %))
+                    (apply -))
+        difference (- actual budget)]
+    (with-precision 10
+      (concat records [{:caption "Net"
+                        :style :summary
+                        :budget budget
+                        :actual actual
+                        :difference difference
+                        :percent-difference (when (not= 0M budget)
+                                              (/ difference budget))
+                        :actual-per-period (/ actual period-count)}]))))

 (defn budget
   "Returns a budget report"
   [storage-spec budget-id as-of]
   (with-storage [s storage-spec]
     (let [budget (budgets/find-by-id s budget-id)
+          period-count (+ 1 (budgets/period-containing budget as-of))
           items (->> (accounts/select-by-entity-id s
                                                    (:entity-id budget)
                                                    {:types #{:income :expense}})
                      (group-by :type)
                      (sort-by  #(.indexOf [:income :expense] (first %)))
-                     (mapcat #(process-budget-group s budget as-of %))
-                     (remove #(= 0M (:actual %) (:budget %))))]
+                     (mapcat #(process-budget-group s budget period-count as-of %))
+                     (remove #(= 0M (:actual %) (:budget %)))
+                     (append-summary period-count))]
       (-> budget
           (assoc :items items)
           (rename-keys {:name :title})


Fix calculation of my-courses total credits

--- src/cljs/kulive/subscribers.cljs
+++ src/cljs/kulive/subscribers.cljs
@@ -96,9 +96,9 @@
        courses (re-frame/subscribe [:courses])]
    (fn [_]
      (reaction
-      (let [courses (into {} @courses)]
-        (reduce + (mapv #(js/parseInt (nth % 2))
-                        @my-courses)))))))
+      (reduce + (mapv #(js/parseInt (first (get-in (val %) [:en :credit-hours])))
+                      ;; select @my-courses maps from @courses
+                      (select-keys (into {} @courses) @my-courses)))))))

 (re-frame/register-sub
  :my-schedule


Fix broken ClojureScript compatibility.

Fix broken ClojureScript compatibility.

--- src/clojure/clj_chess/board.cljc
+++ src/clojure/clj_chess/board.cljc
@@ -364,30 +364,32 @@
                 (checking-pieces board))})

-(defn perft
-  "perft function for testing move generator, see
+#?(:clj
+   (defn perft
+     "perft function for testing move generator, see
   https://chessprogramming.wikispaces.com/Perft"
-  [board depth & [no-pmap]]
-  (cond (= depth 0) 1
-        (= depth 1) (count (moves board))
-        :else (reduce + ((if no-pmap map pmap)
-                          (fn [m] (perft (do-move board m) (- depth 1) true))
-                          (moves board)))))
-
-(defn divide
-  "divide function for testing move generator, see
+     [board depth & [no-pmap]]
+     (cond (= depth 0) 1
+           (= depth 1) (count (moves board))
+           :else (reduce + ((if no-pmap map pmap)
+                            (fn [m] (perft (do-move board m) (- depth 1) true))
+                            (moves board))))))
+
+#?(:clj
+   (defn divide
+     "divide function for testing move generator, see
   https://chessprogramming.wikispaces.com/Perft"
-  [board depth]
-  (reduce
-    (fn [acc next]
-      (conj acc
-            (conj next (if (empty? acc)
-                         (nth next 1)
-                         (+ (nth (last acc) 2) (nth next 1))))))
-    []
-    (sort
-      #(compare (first %1) (first %2))
-      (pmap (fn [m]
-              [(move-to-uci m)
-               (perft (do-move board m) (- depth 1) true)])
-            (moves board)))))+     [board depth]
+     (reduce
+      (fn [acc next]
+        (conj acc
+              (conj next (if (empty? acc)
+                           (nth next 1)
+                           (+ (nth (last acc) 2) (nth next 1))))))
+      []
+      (sort
+       #(compare (first %1) (first %2))
+       (pmap (fn [m]
+               [(move-to-uci m)
+                (perft (do-move board m) (- depth 1) true)])
+             (moves board))))))


Remove neko.application namespace

Remove neko.application namespace

--- src/clojure/neko/application.clj
+++ src/clojure/neko/application.clj
@@ -1,19 +0,0 @@
-(ns neko.application
-  "Contains tools to create and manipulate Application instances. This
-  namespace is deprecated and exists only for backward compatibility
-  purposes."
-  (:require neko.init)
-  (:import android.app.Application
-           android.content.Context))
-
-(defmacro defapplication
-  [& args]
-  (throw (Exception. "defapplication is deprecated, please define
-  Application class from Java. Default `:on-create` moved to
-  `init-application`.")))
-
-(defn init-application
-  "DEPRECATED: Performs necessary preparations for Neko and REPL
-  development. You should call `neko.init/init` instead."
-  [context]
-  (neko.init/init context))


Refactor map reader

Refactor map reader

--- src/com/wsscode/pathom/core.cljc
+++ src/com/wsscode/pathom/core.cljc
@@ -84,7 +84,7 @@
       (parser env query))))

 (defn continue-seq [{::keys [entity-key] :as env} coll]
-  (mapv #(continue (assoc env entity-key %)) coll))
+  (into (empty coll) (map #(continue (assoc env entity-key %))) coll))

 (defn ast-key-id [ast]
   (let [key (some-> ast :key)]
@@ -124,7 +124,7 @@
   (let [entity (entity env)]
     (if-let [[_ v] (find entity (:key ast))]
       (if (sequential? v)
-        (into (empty v) (map #(continue (assoc env entity-key %))) v)
+        (continue-seq env v)
         (if (and (map? v) query)
           (continue (assoc env entity-key v))
           v))


Index functions.

Index functions.

--- src/afterglow/fixtures/chauvet.clj
+++ src/afterglow/fixtures/chauvet.clj
@@ -1,7 +1,8 @@
 (ns afterglow.fixtures.chauvet
   "Models for fixtures provided by [Chauvet Lighting](http://www.chauvetlighting.com)."
   {:doc/format :markdown}
-  (:require [afterglow.channels :as chan]))
+  (:require [afterglow.channels :as chan]
+            [afterglow.fixtures :refer [index-functions]]))

 ;; TODO: functions for rotational tranformatons

@@ -12,7 +13,7 @@
   ([]
    (slimpar-hex3-irc :12-channel))
   ([mode & {:keys [mix-amber mix-uv] :or {mix-amber true mix-uv true}}]
-   (assoc (case mode
+   (let [base (case mode
             ;; TODO: missing channels once we have definition support for them
             :12-channel {:channels [(chan/dimmer 1) (chan/color 2 :red) (chan/color 3 :green) (chan/color 4 :blue)
                                     (chan/color 5 :amber :hue (when mix-amber 45)) (chan/color 6 :white)
@@ -22,6 +23,7 @@
                                    (chan/color 7 :uv :label "UV" :hue (when mix-uv 270))]}
             :6-channel {:channels [(chan/color 1 :red) (chan/color 2 :green) (chan/color 3 :blue)
                                    (chan/color 4 :amber :hue (when mix-amber 45)) (chan/color 5 :white)
-                                   (chan/color 6 :uv :label "UV" :hue (when mix-uv 270))]})
-          :name "Chauvet SlimPAR Hex 3 IRC"
-          :mode mode)))
+                                   (chan/color 6 :uv :label "UV" :hue (when mix-uv 270))]})]
+     (assoc (index-functions base)
+            :name "Chauvet SlimPAR Hex 3 IRC"
+            :mode mode))))


Added :type detection.

Added :type detection.


preserve arrows when pasting

preserve arrows when pasting

--- src-cljs/frontend/controllers/controls.cljs
+++ src-cljs/frontend/controllers/controls.cljs
@@ -1225,6 +1225,7 @@
 (defmethod control-event :layers-pasted
   [browser-state message {:keys [layers height width min-x min-y canvas-size] :as layer-data} state]
   (let [{:keys [entity-ids state]} (frontend.db/get-entity-ids state (count layers))
+        eid-map (zipmap (map :db/id layers) entity-ids)
         doc-id (:document/id state)
         camera (:camera state)
         zoom (:zf camera)
@@ -1237,17 +1238,19 @@
         [move-x move-y] (cameras/screen->point camera new-x new-y)
         [snap-move-x snap-move-y] (cameras/snap-to-grid (:camera state) move-x move-y)]
     (-> state
-      (assoc-in [:clipboard :layers] (mapv (fn [l eid]
+      (assoc-in [:clipboard :layers] (mapv (fn [l]
                                              (-> l
                                                (assoc :layer/ancestor (:db/id l)
-                                                      :db/id eid
+                                                      :db/id (get eid-map (:db/id l))
                                                       :layer/document doc-id
                                                       :points (when (:layer/path l) (parse-points-from-path (:layer/path l))))
+                                               (utils/update-when-in [:layer/points-to] (fn [dests]
+                                                                                (set (map #(update-in % [:db/id] eid-map) dests))))
                                                (#(move-layer % %
                                                              {:snap-x snap-move-x :snap-y snap-move-y
                                                               :move-x move-x :move-y move-y :snap-paths? true}))
                                                (dissoc :layer/current-x :layer/current-y :points)))
-                                           layers entity-ids))
+                                           layers))
       (assoc-in [:selected-eids :selected-eids] (set entity-ids)))))

 (defmethod post-control-event! :layers-pasted


Modify copy impl to work with new parsers format.

Returns a delay which returns a sequential collection of created files.

--- src/incise/parsers/impl/copy.clj
+++ src/incise/parsers/impl/copy.clj
@@ -4,12 +4,16 @@
             [clojure.java.io :refer [file copy]]
             [incise.config :as conf]))

-(defn parse [input-file]
+(defn parse
+  "An incise parser which simply copies a file based on its relative path to the
+  input directory."
+  [input-file]
   (let [{:keys [in-dir out-dir]} (conf/get)
         input-filename (remove-prefix-from-path in-dir input-file)
         output-file (file out-dir input-filename)]
-    (.mkdirs (.getParentFile output-file))
-    (copy input-file output-file)
-    output-file))
+    (delay
+      (.mkdirs (.getParentFile output-file))
+      (copy input-file output-file)
+      [output-file])))

 (pc/register [:copy :cname] parse)


add new rules to cover 'day after tomorrow' without the article in EN

--- resources/duckling/rules/en.cycles.clj
+++ resources/duckling/rules/en.cycles.clj
@@ -76,7 +76,7 @@

   "<cycle> before <time>"
   [(dim :cycle) #"(?i)before" (dim :time)]
-  (cycle-nth-after (:grain %1) -1 %3)
+  (cycle-nth-after (:grain %1) -1 %3git)

   "last n <cycle>"
   [#"(?i)last|past" (integer 1 9999) (dim :cycle)]


Run each clojure version under its own jboss.

This should speed up the build, since it reduces the accretion of
class leaks.

--- integration-tests/src/test/clojure/immutant/integs.clj
+++ integration-tests/src/test/clojure/immutant/integs.clj
@@ -75,15 +75,15 @@
       (throw (Exception. (str "Failed to resolve clojure " version))))))

 (defn for-each-version
-  "Runs the integ apps under each clojure version"
-  [namespaces]
+  "Invokes the given fn with the integ apps set to use each clojure version."
+  [f]
   (doseq [version clojure-versions]
     (try
       (set-version version)
       (println "\n>>>>" (str \[ (.toString (java.util.Date.)) \])
                "Running integs with clojure" version )
       (binding [*current-clojure-version* version]
-        (time (apply run-tests namespaces)))
+        (time (f)))
       (println "\n<<<<" (str \[ (.toString (java.util.Date.)) \])
                "Finished integs with clojure"
                version "\n")
@@ -111,6 +111,8 @@
                 report (fn [x] (report-orig x)
                          (swap! results conj (:type x)))]
         (println "\n>>>> Testing against" clojure-versions "\n")
-        (with-jboss #(for-each-version namespaces)))
+        (for-each-version
+         #(with-jboss
+            (partial apply run-tests namespaces))))
       (shutdown-agents)
       (System/exit (if (empty? (filter #{:fail :error} @results)) 0 -1)))))


rename output fill

rename output fill

--- src/atom_finder/questions/superfluous_parens.clj
+++ src/atom_finder/questions/superfluous_parens.clj
@@ -134,8 +134,8 @@

 (defn main-superfluous-parens
   []
-  (let [edn-file "tmp/all-parens_2018-10-30_01_exclude-template-misparses.edn"
-        csv-file "src/analysis/data/all-parens_2018-10-30_01_exclude-template-misparses.csv"
+  (let [edn-file "tmp/all-parens_2018-10-30_02_multi-op-expr.edn"
+        csv-file "src/analysis/data/all-parens_2018-10-30_02_multi-op-expr.csv"
         ]
     (find-all-parens-in-project edn-file)
     (summarize-all-parens edn-file csv-file)


Memoize funcs in problem61.clj

Memoize funcs in problem61.clj

This solution needs work.

--- euler_clojure/src/euler/problem61.clj
+++ euler_clojure/src/euler/problem61.clj
@@ -35,13 +35,12 @@
 (defn heptagonal [n] (/ (* n (- (* 5 n) 3)) 2))
 (defn octagonal  [n] (* n (- (* 3 n) 2)))

-(defn- check-cyclic
+(def cyclic?
   "Are these four-digit numbers cyclic?"
-  [x y]
-  (= (subvec (vec (str (int x))) 2 4)
-     (subvec (vec (str (int y))) 0 2)))
-
-(def cyclic? (memoize check-cyclic))
+  (memoize
+   (fn [x y]
+     (= (subvec (vec (str (int x))) 2 4)
+        (subvec (vec (str (int y))) 0 2)))))

 (defn all-cyclic?
   "Is the set of digits cyclic, including the last number with the first?"
@@ -50,15 +49,17 @@
                                [(nth node i)
                                 (nth node (mod (inc i) (count node)))])))

-(defn fourdigit? [n] (= 4 (count (str (int n)))))
+(defn fourdigit? [n]
+  (= 4 (count (str (int n)))))

-(defn fourdigit-polys
+(def fourdigit-polys
   "Given a function representing a polygonal type, return all four-digit
   members of that type."
-  [func]
-  (let [dw (drop-while (complement fourdigit?)
-                       (map func (iterate inc 0)))]
-    (take-while fourdigit? dw)))
+  (memoize
+   (fn [func]
+     (let [dw (drop-while (complement fourdigit?)
+                          (map func (iterate inc 0)))]
+       (take-while fourdigit? dw)))))

 (defn problem61 []
   ;; For every way to order the polygonal types, perform depth-first search.


Update dependencies.

Update dependencies.

--- metlog-vault/project.clj
+++ metlog-vault/project.clj
@@ -4,21 +4,21 @@
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}

-  :dependencies [[org.clojure/clojure "1.8.0"]
-                 [org.clojure/clojurescript "1.9.93"]
-                 [clj-time "0.14.4"]
+  :dependencies [[org.clojure/clojure "1.10.0"]
+                 [org.clojure/clojurescript "1.10.520"]
+                 [clj-time "0.15.1"]
                  [com.mschaef/sql-file "0.4.0"]
-                 [ring/ring-jetty-adapter "1.5.0"]
+                 [ring/ring-jetty-adapter "1.7.1"]
                  [slester/ring-browser-caching "0.1.1"]
-                 [com.cognitect/transit-clj "0.8.285"]
-                 [compojure "1.5.1"
+                 [com.cognitect/transit-clj "0.8.313"]
+                 [compojure "1.6.1"
                   :exclusions [commons-codec]]
                  [hiccup "1.0.5"]

-                 [org.clojure/core.async "0.2.385"]
-                 [cljs-ajax "0.5.8"]
-                 [reagent "0.5.1"]
-                 [com.andrewmcveigh/cljs-time "0.4.0"]
+                 [org.clojure/core.async "0.4.490"]
+                 [cljs-ajax "0.8.0"]
+                 [reagent "0.8.1"]
+                 [com.andrewmcveigh/cljs-time "0.5.2"]

                  [metlog-common "0.1.0-SNAPSHOT"]]

@@ -54,12 +54,12 @@
              :server-logfile "log/figwheel.log"}

   :profiles {:dev
-             {:dependencies [[figwheel "0.5.4-7"]
-                             [figwheel-sidecar "0.5.4-7"]
-                             [com.cemerick/piggieback "0.2.1"]
-                             [org.clojure/tools.nrepl "0.2.12"]]
+             {:dependencies [[figwheel "0.5.18"]
+                             [figwheel-sidecar "0.5.18"]
+                             [com.cemerick/piggieback "0.2.2"]
+                             [org.clojure/tools.nrepl "0.2.13"]]
               :jvm-opts ["--add-modules" "java.xml.bind"]
-              :plugins [[lein-figwheel "0.5.4-7"]]
+              :plugins [[lein-figwheel "0.5.18"]]

               :cljsbuild {:builds
                           {:test


CMR-6164 simplifies and comments test.

CMR-6164 simplifies and comments test.

--- system-int-test/test/cmr/system_int_test/ingest/subscription_ingest_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/subscription_ingest_test.clj
@@ -286,16 +286,8 @@
   (testing "Tests subscriber-id filtering in subscription email processing job"
     (system/only-with-real-database
      (let [user1-group-id (echo-util/get-or-create-group (system/context) "group1")
-           admin-group1 (echo-util/get-or-create-group (system/context) "admin-group1")
+           ;; User 1 is in group1
            user1-token (echo-util/login (system/context) "user1" [user1-group-id])
-           _ (echo-util/ungrant (system/context)
-                                (-> (access-control/search-for-acls (system/context)
-                                                                    {:provider "PROV1"
-                                                                     :target "INGEST_MANAGEMENT_ACL"}
-                                                                    {:token "mock-echo-system-token"})
-                                    :items
-                                    first
-                                    :concept_id))
            _ (echo-util/ungrant (system/context)
                                 (-> (access-control/search-for-acls (system/context)
                                                                     {:provider "PROV1"
@@ -306,32 +298,8 @@
                                     :concept_id))
            _ (echo-util/ungrant (system/context)
                                 (-> (access-control/search-for-acls (system/context)
-                                                                    {:provider "PROV1"
-                                                                     :target "SUBSCRIPTION_MANAGEMENT"}
-                                                                    {:token "mock-echo-system-token"})
-                                    :items
-                                    first
-                                    :concept_id))
-           _ (echo-util/ungrant (system/context)
-                                (-> (access-control/search-for-acls (system/context)
-                                                                    {:provider "PROV2"
-                                                                     :target "INGEST_MANAGEMENT_ACL"}
-                                                                    {:token "mock-echo-system-token"})
-                                    :items
-                                    first
-                                    :concept_id))
-           _ (echo-util/ungrant (system/context)
-                                (-> (access-control/search-for-acls (system/context)
                                                                     {:provider "PROV2"
                                                                      :identity-type "catalog_item"}
-                                                                    {:token "mock-echo-system-token"})
-                                    :items
-                                    first
-                                    :concept_id))
-           _ (echo-util/ungrant (system/context)
-                                (-> (access-control/search-for-acls (system/context)
-                                                                    {:provider "PROV2"
-                                                                     :target "SUBSCRIPTION_MANAGEMENT"}
                                                                     {:token "mock-echo-system-token"})
                                     :items
                                     first
@@ -356,30 +324,7 @@
                                :granule_applicable true
                                :granule_identifier {:access_value {:include_undefined_value true
                                                                    :min_value 100 :max_value 200}}})
-           _ (echo-util/grant (system/context)
-                              [{:group_id admin-group1
-                                :permissions [:read :update]}]
-                              :provider_identity
-                              {:provider_id "PROV1"
-                               :target "SUBSCRIPTION_MANAGEMENT"})
-           _ (echo-util/grant (system/context)
-                              [{:group_id admin-group1
-                                :permissions [:read :update]}]
-                              :provider_identity
-                              {:provider_id "PROV1"
-                               :target "INGEST_MANAGEMENT_ACL"})
-           _ (echo-util/grant (system/context)
-                              [{:group_id admin-group1
-                                :permissions [:read :update]}]
-                              :provider_identity
-                              {:provider_id "PROV2"
-                               :target "SUBSCRIPTION_MANAGEMENT"})
-           _ (echo-util/grant (system/context)
-                              [{:group_id admin-group1
-                                :permissions [:read :update]}]
-                              :provider_identity
-                              {:provider_id "PROV2"
-                               :target "INGEST_MANAGEMENT_ACL"})
+           ;; Setup collections
            coll1 (data-core/ingest-umm-spec-collection "PROV1"
                                                        (data-umm-c/collection {:ShortName "coll1"
                                                                                :EntryTitle "entry-title1"})
@@ -389,6 +334,7 @@
                                                                                :EntryTitle "entry-title2"})
                                                        {:token "mock-echo-system-token"})
            _ (index/wait-until-indexed)
+           ;; Setup subscriptions for each collection, for user1
            _ (subscription-util/ingest-subscription (subscription-util/make-subscription-concept
                                                      {:Name "test_sub_prov1"
                                                       :SubscriberId "user1"
@@ -405,6 +351,8 @@
                                                       :Query " "})
                                                     {:token "mock-echo-system-token"})
            _ (index/wait-until-indexed)
+           ;; Setup granules, gran1 and gran3 with acl matched access-value
+           ;; gran 2 does not match, and should not be readable by user1
            gran1 (data-core/ingest "PROV1"
                                    (data-granule/granule-with-umm-spec-collection coll1
                                                                                (:concept-id coll1)
@@ -424,7 +372,7 @@
                                                                                :access-value 133})
                                    {:token "mock-echo-system-token"})
            _ (index/wait-until-indexed)
-           expected [(:concept-id gran1) (:concept-id gran3)]
+           expected [(:concept-id gran1 (:concept-id gran3))]
            actual (->> (process-subscriptions)
                        (map #(nth % 1))
                        flatten


Add FC Sr Clojure Engineer listing

Add FC Sr Clojure Engineer listing

--- src/clj/clojuredocs/pages/jobs.clj
+++ src/clj/clojuredocs/pages/jobs.clj
@@ -169,6 +169,71 @@
 We all have unlimited vacation. We work hard, but at a sustainable pace.

 You must be eligible to work in the United States and willing to work in Adzerk's Durham, NC office."}
+           {:job-title "Sr. Clojure Engineer"
+            :job-type "Permanent"
+            :job-location "San Francisco, CA"
+            :job-apply-href "https://www.fundingcircle.com/us/about/careers/"
+            :id "fc2"
+            :short-id "fc2"
+            :remote-ok? false
+            :posted-at (util/now)
+            :company-name "Funding Circle"
+            :company-url "https://www.fundingcircle.com/us/about/"
+            :company-image-url "/img/funding-circle-box-logo.png"
+            :company-description "Funding Circle is the world’s leading marketplace exclusively focused on small businesses — more than $2.5bn has been lent to 20,000 businesses in the UK, USA, Germany, Spain and the Netherlands. Today, businesses can borrow directly from a wide range of investors, including more than 55,000 people, the UK Government, local councils, a university and a number of financial organizations."
+            :job-description "Funding Circle brings together small businesses and investors in a way that is truly revolutionary. We're here to foster an environment where small business can thrive. Our online platform provides a marketplace where investors receive better returns and small businesses find lower rates. The driving force behind our product is our engineering team; we are building elegant, sustainable, and scalable infrastructure on a global scale, and we want you to be a part of it!
+
+Our mission: to build a better financial world.
+
+# Prospectus
+
+Would you describe yourself as a creative and ambitious engineer who’s always ready to take on the next cutting edge technology? If your answer is yes, you’re going to fit right in with our global team. We’re looking for an experienced and enthusiastic Clojure Engineer who will bring elegance and simplicity to the forefront of our distributed systems. We are a group of passionate engineers whose bread and butter is learning new technologies and fostering a collaborative and inclusive environment - we’re looking for partners in crime who feel the same.
+
+
+# Bird’s eye view of the role
+
+* Be an automator: we are continually reevaluating our stack to improve efficiency throughout the pipeline. We practice continuous integration and have a container-based deployment workflow.
+* Be a builder: you’ll build and expand our highly-available architecture to handle over $2 billion in loans originated through our pipeline.
+* Be a collector: you’ll help build scalable infrastructure to collect data for real time analytics and risk modeling.
+* Be a collaborator: you’ll be expected to forge deep bonds with your business counterparts to truly understand the needs of our Borrowers and Investors. We work in an Agile environment including pair programming and daily stand-ups.
+* Be a teacher: be generous with your time and expertise to teach stakeholders and our fellow engineers how to answer their own questions with tools you build.
+
+
+# Our ideal teammate has
+
+* at least 2 years of professional experience working with Clojure (or really strong personal projects using Clojure).
+* 5+ years of overall software engineering experience in any language (Ruby, Python, Java, etc).
+* an interest in Functional Programming languages.
+* comfortable in a Unix/Linux environment.
+
+
+# Brownie points for
+
+* Github or other open source code we can check out.
+* distributed systems experience.
+* experience with microservices and/or event-driven architecture.
+* operating at scale with low-latency systems.
+* familiarity with Docker, Mesos, and/or experience with distributed database systems, such as Cassandra.
+
+
+# Why Join Us?
+
+Happy employees are productive employees, that’s why we offer a hearty benefits package. From learning and development and commuter stipends, to a competitive salary, equity, and health benefits, we’ve got you covered! That being said, have you heard about what we're doing?! Our mission is what really motivates us to come to work each day:
+
+* We're supporting small business, the engine of economic growth.
+* We're helping facilitate higher yields for investors and lower interest rates for borrowers.
+* We can fund loans extremely quickly, all online!
+* We have a clear competitive advantage globally in areas like domain expertise and regulatory processes.
+
+To learn more about our work environment, culture, and perks, visit:
+
+* https://www.fundingcircle.com/us/careers
+* https://www.themuse.com/companies/fundingcircle
+
+
+*Pursuant to the San Francisco Fair Chance Ordinance, we will consider for employment qualified applicants with arrest and conviction records.*
+
+*Funding Circle provides equal employment opportunity to all individuals regardless of their race, age, creed, color, religion, national origin or ancestry, sex, gender, disability, veteran status, genetic information, sexual orientation, gender identity or expression, pregnancy, or any other characteristic protected by state, federal, or local law.*"}
            {:job-title "Backend Developer"
             :job-type "Permanent"
             :job-location "Charlottesville, VA"


Remove the rest of the clygments code.

Remove the rest of the clygments code.

--- src/clj/qualityclj/routes/home.clj
+++ src/clj/qualityclj/routes/home.clj
@@ -1,7 +1,6 @@
 (ns qualityclj.routes.home
   (:require [qualityclj.views.layout :as layout]
             [clojure.java.io :as io]
-            [clygments.core :refer [highlight]]
             [compojure.core :refer :all]))

 #_(defn read-kibit-report-from-file
@@ -27,19 +26,11 @@
                     :reporter (partial write-kibit-report-to-file
                                        (io/resource output-file))))

-(defn clygmatize [source-file]
-  (highlight (slurp (io/resource source-file)) :clojure :html))
-
 (defn home []
   (layout/common
    [:div#jumbo]
    [:div.container-fluid
-    [:h2 "Sample"]]
-   [:div#file-header.container-fluid]
-   [:div.container-fluid
-    [:div.row
-     [:div#source.col-xs-8 (clygmatize "analyze/prob5.clj")]
-     [:div#notes.col-xs-4]]]))
+    [:h2 "Sample"]]))

 (defn about []
   (layout/common


add futures :)

add futures :)

--- src/clojure_images_server/save.clj
+++ src/clojure_images_server/save.clj
@@ -10,19 +10,19 @@
   (get (:params (mp/multipart-params-request req)) "imageFiles"))

 (defn- save-file [rs file]
-  (let [rename? (:rename rs)
-        tempfile (:tempfile file)
-        original-name (:filename file)
-        dot (string/last-index-of original-name ".")
-        ext (subs original-name dot)
-        name (if rename?
-               (str (digest/md5 tempfile) ext)
-               (:filename file))
-        savepath (str (:savepath rs) "/" name)
-        fullpath (str (:fullpath rs) "/" name)]
-    (do (when-not (.exists (as-file savepath))
-          (copy tempfile (java.io.File. savepath)))
-      fullpath)))
+   (let  [rename? (:rename rs)
+            tempfile (:tempfile file)
+          original-name (:filename file)
+          dot (string/last-index-of original-name ".")
+          ext (subs original-name dot)
+          name (if rename?
+                 (str (digest/md5 tempfile) ext)
+                 (:filename file))
+          savepath (str (:savepath rs) "/" name)
+          fullpath (str (:fullpath rs) "/" name)]
+     (do (when-not (.exists (as-file savepath))
+           (copy tempfile (java.io.File. savepath)))
+       fullpath)))

 (defn- save-files [rs files]
@@ -30,7 +30,7 @@
     (if (map? files)
         (list (save-file files))
         (if (:multiple rs)
-          (map save-file files)
+          (pmap #(deref (future (save-file %))) files)
           (list (save-file (get files 0)))))))

 (defn handler [req rs]


core: distinct?

core: distinct?

--- core/data/core.clj
+++ core/data/core.clj
@@ -2763,6 +2763,22 @@
   {:added "1.0"}
   [coll] (when (seq coll) coll))

+(defn distinct?
+  "Returns true if no two of the arguments are ="
+  {:tag Bool
+  :added "1.0"}
+  ([x] true)
+  ([x y] (not (= x y)))
+  ([x y & more]
+   (if (not= x y)
+     (loop [s #{x y} [x & etc :as xs] more]
+       (if xs
+         (if (contains? s x)
+           false
+           (recur (conj s x) etc))
+         true))
+     false)))
+
 (defn get-in
   "Returns the value in a nested associative structure,
   where ks is a sequence of keys. Returns nil if the key


tests fault

tests fault

--- test/morpheus/tests/chained_list.clj
+++ test/morpheus/tests/chained_list.clj
@@ -29,6 +29,6 @@
         (fact "Create edges that can fit in two list"
               (apply link-group! v1 :rel (repeat (* 2 max-list-items) v2)))
         (fact "Check Degree - duo"
-              (degree (reload-vertex v1) :direction :*outbounds*) => (* 2 max-list-items))
+              (degree (reload-vertex v1) :direction :*outbounds*) => (* 3 max-list-items))
         (fact "Check list link - duo"
               )))))


improve sample test

improve sample test

--- test/flambo/api_test.clj
+++ test/flambo/api_test.clj
@@ -159,9 +159,12 @@
       "sample returns a fraction of the RDD, with/without replacement,
         using a given random number generator seed"
       (-> (f/parallelize c [0 1 2 3 4 5 6 7 8 9])
-          (f/sample false 0.2 666)
-          f/collect
-          vec) => [1])
+          (f/sample false 0.3 666)
+          f/collect
+          vec) => (-> (f/parallelize c [0 1 2 3 4 5 6 7 8 9])
+                      (f/sample false 0.3 666)
+                      f/collect
+                      vec))

      (fact
       "combine-by-key returns an RDD by combining the elements for each key using a custom


CMR-387: Merged.

CMR-387: Merged.

--- src/cmr/search/services/query_execution.clj
+++ src/cmr/search/services/query_execution.clj
@@ -121,6 +121,7 @@
                 processed-query
                 (acl-service/add-acl-conditions-to-query context processed-query))
         elastic-results (idx/execute-query context processed-query)
+
         query-results (rc/elastic-results->query-results context query elastic-results)]
     (post-process-query-result-features context query elastic-results query-results)))


Fix bug in page number.

Fix bug in page number.

--- src/kixi/hecuba/api/entities.clj
+++ src/kixi/hecuba/api/entities.clj
@@ -111,8 +111,8 @@
 (defn filter-entities
   ([params role store]
      (let [query-string   (or (:q params) "*")
-           page-number    (or (:page params) 0)
            page-size      (or (:size params) default-page-size)
+           page-number    (*  (or (:page params) 0) page-size)
            results        (search/search-entities query-string page-number page-size (:search-session store))
            total_hits     (esr/total-hits results)
            file-bucket    (-> store :s3 :file-bucket)
@@ -122,8 +122,8 @@
                    :entities   parsed-results}}))
   ([params allowed-programmes allowed-projects role store]
      (let [query-string   (or (:q params) "*")
-           page-number    (or (:page params) 0)
            page-size      (or (:size params) default-page-size)
+           page-number    (*  (or (:page params) 0) page-size)
            shoulds        (should-terms allowed-programmes allowed-projects)
            filter-terms   (search-filter nil shoulds nil)
            results        (search/search-entities query-string filter-terms page-number page-size (:search-session store))
@@ -135,8 +135,8 @@
                    :entities   parsed-results}}))
   ([project_id params allowed-programmes allowed-projects role store]
      (let [query-string   (or (:q params) "*")
-           page-number    (or (:page params) 0)
            page-size      (or (:size params) default-page-size)
+           page-number    (*  (or (:page params) 0) page-size)
            shoulds        (should-terms allowed-programmes allowed-projects)
            must           (must-term :project_id project_id)
            filter-terms   (search-filter must shoulds nil)


fixes https://github.com/status-im/status-react/issues/993

--- src/status_im/new_group/handlers.cljs
+++ src/status_im/new_group/handlers.cljs
@@ -81,7 +81,8 @@

 (defn show-chat!
   [{:keys [new-chat]} _]
-  (dispatch [:navigation-replace :chat (:chat-id new-chat)]))
+  (dispatch [:navigate-to-clean :chat-list])
+  (dispatch [:navigate-to :chat (:chat-id new-chat)]))

 (defn start-listen-group!
   [{:keys [new-chat web3 current-public-key]}]


Make use of tree-seq when forcing the evaluation of the DOM tree

--- src/main/clojure/cascade/dom.clj
+++ src/main/clojure/cascade/dom.clj
@@ -188,7 +188,7 @@
 (defn element?
   "Returns true if the dom node is type :element."
   [node]
-  (= :element (node :type)))
+  (= :element (:type node)))

 (defn dom-zipper
   [root-node]
@@ -266,11 +266,7 @@
 (defn force-dom
   "Forces lazy evaluation of all DOM nodes."
   [dom-nodes]
-  (loop [queue dom-nodes]
-    (when-not (empty? queue)
-      (let [cursor (first queue)
-            remaining (rest queue)]
-        (if (map? cursor)
-          ; Recursive depth-first
-          (recur (concat (cursor :value) remaining))
-          (recur remaining))))))
+  (doseq [top dom-nodes
+          node (tree-seq element? :value  top)])
+  nil)
+


Only wrap function bodies in let bindings if there are any props

--- src/main/workflo/macros/view.clj
+++ src/main/workflo/macros/view.clj
@@ -117,7 +117,7 @@
     inject-fn-args))

 (defn normalize-fn-name
-  "Normalize the function name of of. This removes the leading .
+  "Normalize the function name of f. This removes the leading .
    from the names of raw functions."
   [[name args & body :as f]]
   (let [name (symbol (cond-> (str name) (raw-fn? f) (subs 1)))]
@@ -131,20 +131,29 @@
   [[name args & body :as f] props computed]
   (let [scope (fn-scope f)]
     (if (not= scope :static)
-      (let [prop-keys       (p/map-keys props)
-            computed-keys   (p/map-keys computed)
-            this-index      (.indexOf args 'this)
-            props-index     (.indexOf args 'props)
-            actual-props    (if (>= props-index 0)
-                              (args props-index)
-                              (if (not= scope :static)
-                                `(~'om/props ~(args this-index))
-                                nil))
-            actual-computed `(~'om/get-computed ~actual-props)]
-        `(~name ~args
-          (~'let [{:keys [~@prop-keys]} ~actual-props
-                  {:keys [~@computed-keys]} ~actual-computed]
-           ~@body)))
+      (let [prop-keys         (p/map-keys props)
+            computed-keys     (p/map-keys computed)
+            this-index        (.indexOf args 'this)
+            props-index       (.indexOf args 'props)
+            actual-props      (if (>= props-index 0)
+                                (args props-index)
+                                (if (not= scope :static)
+                                  `(~'om/props ~(args this-index))
+                                  nil))
+            actual-computed   `(~'om/get-computed ~actual-props)
+            prop-bindings     (when-not (empty? prop-keys)
+                                `[{:keys [~@prop-keys]}
+                                  ~actual-props])
+            computed-bindings (when-not (empty? computed-keys)
+                                `[{:keys [~@computed-keys]}
+                                  ~actual-computed])]
+        (if (or prop-bindings computed-bindings)
+          `(~name ~args
+            (~'let [~@prop-bindings
+                    ~@computed-bindings]
+             ~@body))
+          `(~name ~args
+             ~@body)))
       f)))

 (defn anonymous-fn


include a :card-create event in our view logging because realistically the user is always looking at the card they are creating.

--- src/metabase/events/view_log.clj
+++ src/metabase/events/view_log.clj
@@ -8,7 +8,8 @@

 (def view-counts-topics
   "The `Set` of event topics which we subscribe to for view counting."
-  #{:card-read
+  #{:card-create
+    :card-read
     :dashboard-read})

 (def ^:private view-counts-channel


wrap the sample app in session/params

wrap the sample app in session/params

--- examples/yeller/ring_example_app.clj
+++ examples/yeller/ring_example_app.clj
@@ -1,10 +1,14 @@
 (ns yeller.ring-example-app
   (:require [ring.adapter.jetty9 :as jetty]
+            [ring.middleware.params :as params]
+            [ring.middleware.session :as session]
             [yeller-clojure-client.ring :as yeller]))

 (defn -main [& args]
   (jetty/run-jetty
-    (yeller/wrap-ring
-      (fn [& args] (assert false "error"))
-      {:token "YOUR API KEY HERE"})
+    (params/wrap-params
+      (session/wrap-session
+        (yeller/wrap-ring
+          (fn [& args] (assert false "error"))
+          {:token "YOUR API KEY GOES HERE"})))
     {:port 4001}))


preprocess-multipart updates for more accurate drop metrics.

--- src/ais/resilient_decoder.clj
+++ src/ais/resilient_decoder.clj
@@ -97,9 +97,8 @@
 ;; Core
 ;;---

-; filter nils
 (defn- consume [n in-ch]
-  (filter valid-syntax? (take-while ais-util/not-nil? (repeatedly n #(async/<!! in-ch)))))
+  (take-while ais-util/not-nil? (repeatedly n #(async/<!! in-ch))))

 (defn- group-key [line]
   (if-let  [prefix (ais-ex/parse "g" line)]
@@ -198,9 +197,10 @@

 (defn- preprocess-multipart [line include-types unpaired-frags in-ch out-ch]
   (let [remaining (consume (- (m_fc line) 1) in-ch)
-        groups (group-fragments (conj remaining line))]
+        groups (group-fragments (conj (filter valid-syntax? remaining) line))]
     {:drop (concat (-forward (map vector (groups :single)) include-types out-ch)
-                   (-forward-multipart include-types unpaired-frags groups out-ch))}))
+                   (-forward-multipart include-types unpaired-frags groups out-ch)
+                   (filter (complement valid-syntax?) remaining))}))

 (defn- log-metrics [dropped invalid]
   (logging/info (format "count.invalid.total=%d" invalid))


Don't need repl for "boot dev"

Don't need repl for "boot dev"

--- build.boot
+++ build.boot
@@ -163,7 +163,6 @@
    (fix)
    (make-solver)
    (environ :env {:http-port "3000"})
-   (repl)
    (figwheel)
    (run-figwheel)
    (sift


releasing 0.1.12

releasing 0.1.12

--- build.boot
+++ build.boot
@@ -1,4 +1,4 @@
-(def +version+ "0.1.12-SNAPSHOT")
+(def +version+ "0.1.12")

 (set-env!
   :source-paths #{"src"}


Upgrade dependencies

Upgrade dependencies

--- build.boot
+++ build.boot
@@ -14,11 +14,11 @@
                  [java-jdbc/dsl "0.1.3"]
                  [buddy/buddy-auth "1.1.0"]
                  [org.postgresql/postgresql "9.4.1208"]
-                 [org.omcljs/om "1.0.0-alpha28"]
+                 [org.omcljs/om "1.0.0-alpha41"]
                  [org.clojure/clojure "1.9.0-alpha10"]
                  [org.clojure/clojurescript "1.9.198"]
                  [org.clojure/core.async "0.2.385"]
-                 [org.clojure/java.jdbc "0.6.2-alpha1"]
+                 [org.clojure/java.jdbc "0.6.2-alpha2"]
                  [org.clojure/math.numeric-tower "0.0.4"]])

 (require


Use the production system in production mode

--- build.boot
+++ build.boot
@@ -82,7 +82,7 @@
   []
   (comp (build-production)
         (run :main-namespace "server.core"
-             :arguments [#'development-system])
+             :arguments [#'production-system])
         (wait)))

 (deftask uberjar


boot deploy task refactor

boot deploy task refactor

--- build.boot
+++ build.boot
@@ -256,10 +256,15 @@
         (sift :move {#"docs" "../docs"})
         (target)))

-(deftask deploy
-  "Installs the artifact into the local maven repo and pushes to clojars."
+(deftask local-deploy
+  "Installs the artifact into the local maven repository."
   []
   (comp (pom)
         (jar)
-        (install)
+        (install)))
+
+(deftask deploy
+  "Installs the artifact into the local maven repository and pushes to clojars."
+  []
+  (comp (local-deploy)
         (push)))


Version 0.1.0

Version 0.1.0

--- build.boot
+++ build.boot
@@ -1,5 +1,5 @@
 (def project 'tulos/manifail)
-(def version "0.1.0-SNAPSHOT")
+(def version "0.1.0")

 (set-env! :resource-paths #{"src/clj"}
           :source-paths   #{"test" "src/java"}


also allow :trusted-hosts in user-config

--- src/main/shadow/cljs/devtools/server/web/api.clj
+++ src/main/shadow/cljs/devtools/server/web/api.clj
@@ -305,13 +305,15 @@

 (defn api-tool [{:keys [relay transit-read transit-str] :as req}]
   ;; FIXME: negotiate encoding somehow? could just as well use edn
+  (?> req ::api-tool)
   (let [remote-addr (get-in req [:ring-request :remote-addr])
         trusted-hosts
         (set/union
-          (set (get-in req [:config :trusted-hosts]))
           #{"127.0.0.1"
             "0:0:0:0:0:0:0:1"
-            "localhost"})]
+            "localhost"}
+          (set (get-in req [:config :trusted-hosts]))
+          (set (get-in req [:config :user-config :trusted-hosts])))]

     ;; FIXME: maybe needs to do host->addr translation?
     (if-not (contains? trusted-hosts remote-addr)


Fix acking

Fix acking

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -211,7 +211,7 @@

 (defn add-messages-to-timeout-pool [{:keys [onyx.core/state] :as event}]
   (when (= (:onyx/type (:onyx.core/task-map event)) :input)
-    (swap! state update-in [:timeout-pool 0] rsc/add-to-head
+    (swap! state update-in [:timeout-pool] rsc/add-to-head
            (map :id (:onyx.core/batch event))))
   event)

@@ -314,7 +314,7 @@
            (let [tail (last (get-in @(:onyx.core/state event) [:timeout-pool]))]
              (doseq [m tail]
                (when (p-ext/pending? event m)
-                 (taoensso.timbre/info (format "Replay message %s" m))
+                 (taoensso.timbre/info (format "Input retry message %s" m))
                  (p-ext/retry-message event m)))
              (swap! (:onyx.core/state event) update-in [:timeout-pool] rsc/expire-bucket)
              (recur))))))))


Update trim-with-emit-set's docstring & :pre forms

--- src/oxcart/passes/tree_shake.clj
+++ src/oxcart/passes/tree_shake.clj
@@ -52,7 +52,15 @@

 (defn trim-with-emit-set
+  "λ Whole-AST → #{Var} → Whole-AST
+
+  Rewrites a Whole-AST to eliminate definitions of vars which are not
+  used. Note that this operation _preserves_ non def top level forms
+  rather than discarding them."
   [{:keys [modules] :as whole-program-ast} reach-set]
+  {:pre [(every? (partial contains? whole-program-ast) modules)
+         (every? #(get-in whole-program-ast [%1 :forms]) modules)
+         (every? var? reach-set)]}
   (let [new-ast (atom {:modules modules})]

     (doseq [m modules]


whitespace

whitespace

--- src/babel/english/lexicon.clj
+++ src/babel/english/lexicon.clj
@@ -321,15 +321,15 @@
    "express" {:synsem {:cat :verb
                        :sem {:pred :express}}}

-  "faint" {:synsem {:cat :verb
-                    :sem {:pred :faint}}}
+   "faint" {:synsem {:cat :verb
+                     :sem {:pred :faint}}}

    "finish" {:synsem {:cat :verb
                       :sem {:pred :finish}}}

    "fold" {:synsem {:cat :verb
                     :sem {:pred :fold}}}
-
+
    "forget" {:synsem {:cat :verb
                       :sem {:pred :forget}}
              :english {:past "forgot"}}


[FLINK-10465][tests] Do not stop sshd if it is supervised by runit.

--- flink-jepsen/src/jepsen/flink/utils.clj
+++ flink-jepsen/src/jepsen/flink/utils.clj
@@ -86,4 +86,7 @@
   []
   (info "Stop all supervised services.")
   (c/su
-    (c/exec :rm :-f (c/lit (str "/etc/service/*")))))
+    ;; HACK:
+    ;; Remove all symlinks in /etc/service except sshd.
+    ;; This is only relevant when tests are run in Docker because there sshd is started using runit.
+    (c/exec :find (c/lit (str "/etc/service -maxdepth 1 -type l ! -name 'sshd' -delete")))))


Add (let) & better literal handling to API.

--- src/cavm/query/expression.clj
+++ src/cavm/query/expression.clj
@@ -1,7 +1,7 @@
 (ns cavm.query.expression
   (:require [clojure.edn :as edn])
   (:require [honeysql.types :as hsqltypes])
-  (:refer-clojure :exclude  [eval]))
+  (:refer-clojure :exclude [eval letfn]))

 (def eval)

@@ -11,15 +11,24 @@
       (eval body (cons (zipmap argnames args) scope)))))

 (defn iffn [node scope]
-  (let [[_ test then else] node]
+  (let [[_ predicate then else] node]
     (cond
-      (eval test scope) (eval then scope)
+      (eval predicate scope) (eval then scope)
       :else (eval else scope))))
+
+(defn letfn [node scope]
+  (let [[_ assignments body] node]
+    (if (empty? assignments)
+      (eval body scope)
+      (let [[avar aval & remaining] assignments]
+        (eval `((~'fn ~[avar]
+                  (~'let ~(vec remaining) ~body)) ~aval) scope)))))

 (def specials
   {'fn lambdafn
    'quote (fn [n s] (second n))
-   'if iffn })
+   'if iffn
+   'let letfn})

 (def specialfns (set (vals specials)))

@@ -32,9 +41,14 @@
 (defn eval [node scope]
   (cond
     (symbol? node) ((first (filter #(contains? % node) scope)) node)
-    (list? node) (fn-node node scope)
+    (seq? node) (fn-node node scope)
     (instance? Number node) (double node)
-    :else node))
+    (keyword? node) node
+    (string? node) node
+    ; due to weird (empty <clojure.lang.MapEntry>) behavior, we have
+    ; to handle map? separate from coll?
+    (map? node) (into {} (mapv #(eval (vec %) scope) node))
+    (coll? node) (into (empty node) (mapv #(eval % scope) node))))

 (defn expression [exp & globals]
   (eval (edn/read-string {:readers {'sql/call hsqltypes/read-sql-call}} exp) (cons specials globals)))


Add additional redirects for old pages. Fixes #96.

--- src/clj/clojuredocs/entry.clj
+++ src/clj/clojuredocs/entry.clj
@@ -89,7 +89,11 @@
   (GET "/quickref/*" [] {:status 301 :headers {"Location" "/quickref"}})
   (GET "/clojure_core" [] {:status 301 :headers {"Location" "/core-library"}})
   (GET "/clojure_core/:ns" [ns] {:status 301 :headers {"Location" (str "/" ns)}})
-  (GET "/v/:id" [id] (old-v-page-redirect id)))
+  (GET "/v/:id" [id] (old-v-page-redirect id))
+  (GET "/examples_style_guide" [] {:status 301 :headers {"Location" "/examples-styleguide"}})
+  (GET "/Clojure%20Core/:ns" [ns] {:status 301 :headers {"Location" (str "/" ns)}})
+  (GET "/Clojure%20Core" [] {:status 301 :headers {"Location" "/core-library"}})
+  (GET "/clojure_core" [] {:status 301 :headers {"Location" "/core-library"}}))

 (defroutes _routes
   (context "/api" [] api.server/routes)


HTML-encode var names on search results page. Fixes #88.

--- src/clj/clojuredocs/pages.clj
+++ src/clj/clojuredocs/pages.clj
@@ -234,6 +234,7 @@

 (defn search-page-handler [{:keys [params uri user]}]
   (let [query (or (:q params) "")
+        html-query (util/html-encode query)
         limit 10
         page (or (try
                    (Integer/parseInt (:page params))
@@ -257,7 +258,7 @@
        [:div.row
         [:div.col-sm-12
          [:div.search-results-header
-          [:h1 "Search results for query: " [:b query]]
+          [:h1 "Search results for query: " [:b html-query]]
           [:p (inc offset)
            " to "
            (min (+ offset limit) (count total-results))
@@ -274,27 +275,28 @@
               "next page")]]]
          [:ul.search-results
           (for [{:keys [ns name doc see-alsos examples-count arglists forms]} results]
-            [:li.search-result
-             [:h2 (util/$var-link ns name name)]
-             [:h3 ns]
-             [:ul.arglists
-              (if forms
-                (map #($argform %) forms)
-                (map #($arglist name %) arglists))]
-             [:p (common/ellipsis doc 300)]
-             [:div.meta-info
-              (util/pluralize examples-count "example" "examples")
-              (when-not (empty? see-alsos)
-                [:span.see-alsos
-                 " · "
-                 "See also: "
-                 (->> (for [sa see-alsos]
-                        [:span.see-also
-                         (util/$var-link
-                           (:ns sa)
-                           (:name sa)
-                           [:span.ns (:ns sa) "/"] (:name sa))])
-                      (interpose ", "))])]])]
+            (let [html-name (util/html-encode name)]
+              [:li.search-result
+               [:h2 (util/$var-link ns name html-name)]
+               [:h3 ns]
+               [:ul.arglists
+                (if forms
+                  (map #($argform %) forms)
+                  (map #($arglist name %) arglists))]
+               [:p (common/ellipsis doc 300)]
+               [:div.meta-info
+                (util/pluralize examples-count "example" "examples")
+                (when-not (empty? see-alsos)
+                  [:span.see-alsos
+                   " · "
+                   "See also: "
+                   (->> (for [sa see-alsos]
+                          [:span.see-also
+                           (util/$var-link
+                             (:ns sa)
+                             (:name sa)
+                             [:span.ns (:ns sa) "/"] (-> sa :name util/html-encode))])
+                        (interpose ", "))])]]))]
          [:div.search-controls
           (if (> page 1)
             [:a {:href (str "/search?q=" query "&page=" (dec page))} "prev page"]


Create pail if it doesn't exist already.

--- src/clj/forma/hadoop/pail.clj
+++ src/clj/forma/hadoop/pail.clj
@@ -45,7 +45,7 @@
   "Executes the supplied query into the pail located at the supplied
   path, consolidating when finished."
   [tap pail-path query]
-  (let [pail (Pail. pail-path)]
+  (let [pail (Pail/create pail-path false)]
     (with-fs-tmp [_ tmp]
       (?- (tap tmp) query)
       (.absorb pail (Pail. tmp))