commited by mistake

commited by mistake

--- backend/test/akvo/lumen/test_windshaft.clj
+++ backend/test/akvo/lumen/test_windshaft.clj
@@ -1,97 +0,0 @@
-(ns akvo.lumen.test-windshaft
-  (:require [clj-http.client :as http]
-            clj-http.conn-mgr
-            clojure.stacktrace
-            [cheshire.core :as json]
-            clojure.data))
-
-(defonce pool-2 (clj-http.conn-mgr/make-reusable-conn-manager {:timeout 20 :threads 8 :default-per-route 8}))
-(def base-url "http://windshaft:4000/lumen_tenant_1/layergroup")
-(def base-url-2 "http://windshaft2:4000/lumen_tenant_1/layergroup")
-
-(defn log-time [start tag]
-  (println "[" tag "]" (- (System/currentTimeMillis) start)))
-
-(defmacro tfuture [& body]
-  `(future
-     (try ~@body
-          (catch Exception e# (println (.getMessage (clojure.stacktrace/root-cause e#)))))))
-
-(defn tile [layer-group-id piece]
-  (tfuture
-    (let [start (System/currentTimeMillis)]
-      (assert (= 200 (:status (http/get (str base-url "/" layer-group-id piece) {:as :json :connection-manager pool-2}))))
-      (log-time start piece))))
-
-(defn png [layer-group-id piece]
-  (tfuture
-    (let [start (System/currentTimeMillis)]
-      (assert (= 200 (:status (http/get (str base-url "/" layer-group-id piece) {:connection-manager pool-2}))))
-      (log-time start piece))))
-
-(def s (atom 0))
-
-(defn test-windshaft []
-  (tfuture
-    (let [start (System/currentTimeMillis)
-          response (http/post base-url
-                              {:as                 :json
-                               :connection-manager pool-2
-                               :headers            {"content-type"     "application/json"
-                                                    "x-db-host"        "postgres"
-                                                    "x-db-user"        "lumen"
-                                                    "x-db-password"    "password"
-                                                    "x-db-last-update" 10000
-                                                    "x-db-port"        "5432"}
-                               :body               (json/generate-string
-                                                     {:version "1.5.0",
-                                                      :layers  [{:type    "mapnik",
-                                                                 :options {:sql              "select instance, geom, yearcons::integer as yearcons from liberia where yearcons ~ '^\\d{4}$';",
-                                                                           :geom_column      "geom",
-                                                                           :srid             4326,
-                                                                           :cartocss         "#s { marker-width: 5; marker-fill:#f45; marker-line-color:#813; marker-allow-overlap:true; marker-fill-opacity: 0.3;} #s[yearcons>=2009] {marker-fill: #1F78B4; marker-line-color: #0000FF;}",
-                                                                           :cartocss_version "2.0.0",
-                                                                           ;                             :random-number    (rand)
-                                                                           :interactivity    "instance"}}]})})
-          layer-group-id (-> response :body :layergroupid)]
-      (println response)
-      (swap! s inc)
-      (log-time start "first request")
-      (def global-layer layer-group-id)
-      (let [reqs [
-                  (tile layer-group-id "/0/10/481/493.grid.json")
-                  (png layer-group-id "/10/481/493.png")
-                  ;(tile layer-group-id "/0/11/969/991.grid.json")
-                  ; (tile layer-group-id "/0/0/0/0.grid.json")
-                  ;;(tile layer-group-id "/0/1/0/0.grid.json")
-                  ;(tile layer-group-id "/0/11/966/990.grid.json")
-                  ]]
-        (doseq [r reqs]
-          @r))
-      (log-time start "total")
-      (println "all good!"))))
-
-(comment
-  (let [reqs [
-              ;(tile global-layer "/0/10/481/493.grid.json")
-              ;(tile global-layer "/0/11/969/991.grid.json")
-
-              (tile global-layer "/0/0/0/0.grid.json")      ;; slow
-              (tile global-layer "/0/1/0/0.grid.json")
-
-              (tile global-layer "/0/11/966/990.grid.json")
-              ]]
-    (doseq [r reqs]
-      @r))
-
-  (png global-layer "/10/480/493.png")
-  (png global-layer "/10/483/493.png")
-  (png global-layer "/10/483/490.png")
-  (tile global-layer "/0/10/481/493.grid.json")
-  (tile global-layer "/0/20/481/493.grid.json")
-
-
-  (dotimes [_ 1000]
-    (test-windshaft)))
-
-


Test 2nd listen on same addr/port should fail.

--- src/cbfg/net-test.cljs
+++ src/cbfg/net-test.cljs
@@ -26,7 +26,7 @@
                         connect-ch (achan tn)
                         net (make-net tn listen-ch connect-ch)
                         accept-ch (achan tn)]
-                    (aput tn listen-ch [:host-a 1000 accept-ch])
+                    (aput tn listen-ch [:addr-a 1000 accept-ch])
                     (aclose tn listen-ch) ; Closing listen-ch should shutdown net and accept-ch's.
                     (and (e n (atake tn accept-ch) nil nil)
                          (e n (atake tn net) :done (atake tn net))))
@@ -34,10 +34,21 @@
                         connect-ch (achan tn)
                         net (make-net tn listen-ch connect-ch)
                         accept-ch (achan tn)]
-                    (aput tn listen-ch [:host-a 1000 accept-ch])
+                    (aput tn listen-ch [:addr-a 1000 accept-ch])
                     (aclose tn connect-ch) ; Closing connect-ch should shutdown net and accept-ch's.
                     (and (e n (atake tn accept-ch) nil nil)
-                         (e n (atake tn net) :done (atake tn net)))))
+                         (e n (atake tn net) :done (atake tn net))))
+                  (let [listen-ch (achan tn)
+                        connect-ch (achan tn)
+                        net (make-net tn listen-ch connect-ch)
+                        accept-ch (achan tn)
+                        accept-ch2 (achan tn)]
+                    (aput tn listen-ch [:addr-a 1000 accept-ch])
+                    (aput tn listen-ch [:addr-a 1000 accept-ch2]) ; 2nd listen on same addr/port should fail.
+                    (and (e n (atake tn accept-ch2) nil nil)
+                         (do (aclose tn listen-ch)
+                             (and (e n (atake tn accept-ch) nil nil)
+                                  (e n (atake tn net) :done (atake tn net)))))))
            "pass"
            (str "FAIL: on test-net #" @n)))))


Renamed to state-next.

Renamed to state-next.

--- src/cbfg/world/t2.cljs
+++ src/cbfg/world/t2.cljs
@@ -11,10 +11,10 @@
   (let [req-ch (achan actx)]
     (act-loop state-loop actx [name name state initial-state]
               (when-let [m (atake state-loop req-ch)]
-                (when-let [[state2 res] (loop-fn state-loop state m)]
+                (when-let [[state-next res] (loop-fn state-loop state m)]
                   (when (and res (:res-ch m))
                     (aput-close state-loop (:res-ch m) res))
-                  (recur name state2))))
+                  (recur name state-next))))
     req-ch))

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


Removed agents from old loader

Removed agents from old loader

--- src/cfpb/qu/loader.clj
+++ src/cfpb/qu/loader.clj
@@ -138,19 +138,9 @@
   [collection tabledef dir]
   (coll/drop collection)
   (let [sources (:sources tabledef)
-        columns (:columns tabledef)
-        agent-error-handler (fn [agent exception]
-                              (log/error "Error in table loading agent"
-                                         (.getMessage exception)))
-        agents (map (fn [source]
-                      (agent source
-                             :error-mode :continue
-                             :error-handler agent-error-handler))
-                    sources)]
-    (doseq [agent agents]
-      (send-off agent (fn [file]
-                        (load-csv-file collection (str dir "/" file) columns))))
-    (apply await agents)))
+        columns (:columns tabledef)]
+    (doseq [file sources]
+      (load-csv-file collection (str dir "/" file) columns))))

 (defn- load-table-slice
   [dataset slice slicedef tables dir]


Added key compression back into loader

Added key compression back into loader

--- src/cfpb/qu/loader.clj
+++ src/cfpb/qu/loader.clj
@@ -19,7 +19,7 @@
     [query :as q]
     [collection :as coll]
     [joda-time]]
-   [cfpb.qu.util :refer [->int ->num]]
+   [cfpb.qu.util :refer :all]
    [cfpb.qu.query.where :as where]
    [cfpb.qu.data :refer :all])
   (:import [org.bson.types ObjectId]))
@@ -108,12 +108,11 @@
   [data columns]
   (into {}
         (r/remove nil?
-                (r/map (fn [[column value]]
-                       (let [cdef (columns column)]
-                         (when-not (:skip cdef)
-                           [(keyword (or (:name cdef) column))
-                            (cast-value value cdef)]))) data))))
-
+                  (r/map (fn [[column value]]
+                           (let [cdef (columns column)]
+                             (when (and (seq cdef) (not (:skip cdef)))
+                               [(keyword (or (:name cdef) column))
+                                (cast-value value cdef)]))) data))))

 (defn read-csv-file
   "Reads an entire CSV file into memory as a seq of maps.
@@ -166,16 +165,17 @@
 (defn load-csv-file
   [file collection transform-fn]
   (with-open [in-file (io/reader (io/resource file))]
-    (let [data (csv/read-csv in-file)
-          headers (map keyword (first data))
-          data (map (partial zipmap headers) (rest data))
-          data (transform-fn data)
+    (let [csv (csv/read-csv in-file)
+          headers (map keyword (first csv))
+          data (->> (rest csv)
+                    (map (partial zipmap headers))
+                    transform-fn)
           chunks (partition-all *chunk-size* data)]
       (doseq [chunk chunks]
         (coll/insert-batch collection chunk)))))

 (defn load-table
-  [table collection concepts references definition]
+  [table collection concepts references definition & {:keys [keyfn]}]
   (let [tdef (get-in definition [:tables (keyword table)])
         dir (:dir definition)
         sources (:sources tdef)
@@ -185,10 +185,17 @@
                        (reduce (fn [data [column cdef]]
                                  (join-maps
                                   data (:column cdef) column
-                                  (get concepts (keyword (:concept cdef))) :_id (:value cdef)))
-                               data references))]
+                                  (get concepts (keyword (:concept cdef)))
+                                  :_id (:value cdef)))
+                               data references))
+        transform-keys (if keyfn
+                         (partial map #(convert-keys % keyfn))
+                         identity)]
     (doseq [file sources]
-      (load-csv-file (str dir "/" file) collection (comp add-concepts cast-data)))))
+      (load-csv-file
+       (str dir "/" file)
+       collection
+       (comp transform-keys add-concepts cast-data)))))

 (defmulti load-slice
   (fn [slice _ definition]
@@ -196,15 +203,17 @@

 (defmethod load-slice "table"
   [slice concepts definition]
-  (let [table (get-in definition [:slices (keyword slice) :table])
-        references (get-in definition [:slices (keyword slice) :references])]
-    (load-table table slice concepts references definition)))
+  (let [sdef (get-in definition [:slices (keyword slice)])
+        table (:table sdef)
+        references (:references sdef)
+        zipfn (field-zip-fn sdef)]
+    (load-table table slice concepts references definition :keyfn zipfn)))

 (defmethod load-slice "derived"
   [slice concepts definition]
   (let [database (:database definition)
         sdef (get-in definition [:slices (keyword slice)])
-        from-collection (:slice sdef)
+        from-collection (:slice sdef)
         dimensions (:dimensions sdef)
         aggregations (:aggregations sdef)
         match (if-let [where (:where sdef)]
@@ -225,7 +234,9 @@
         project (apply merge (concat project-dims project-aggs))
         aggregation [{"$group" group} {"$project" project} {"$match" match}]
         query-result (get-aggregation database from-collection aggregation)
-        data (:data query-result)
+        data (-> query-result
+                 :data
+                 (convert-keys (field-zip-fn sdef)))
         chunks (partition-all *chunk-size* data)]
     (doseq [chunk chunks]
       (coll/insert-batch slice chunk))))


Comment on some global state that we may pull into #'system.

--- src/clj/aspire/cli.clj
+++ src/clj/aspire/cli.clj
@@ -23,5 +23,6 @@
       (println usage)
       (System/exit 0))
     (when (:verbose opts)
+      ;; Global state!
       (alter-var-root #'a-util/*isverbose* (constantly true)))
     opts))


Satellite Uplink fix

Satellite Uplink fix

--- src/clj/game/cards.clj
+++ src/clj/game/cards.clj
@@ -1899,7 +1899,7 @@
                  :effect (effect (trash card) (play-instant target))}]}

    "Satellite Uplink"
-   {:req (req tagged) :msg (msg "expose " (join ", " (map :title targets)))
+   {:msg (msg "expose " (join ", " (map :title targets)))
     :choices {:max 2 :req #(= (first (:zone %)) :servers)}
     :effect (req (doseq [c targets] (expose state side c)))}


Tweak to Running Interference.

Tweak to Running Interference.

--- src/clj/game/cards.clj
+++ src/clj/game/cards.clj
@@ -1785,7 +1785,7 @@
                                       :run-ends
                                       {:effect (effect (unregister-events card))}}
                                      (assoc card :zone '(:discard))))
-    :events {:pre-rez nil}}
+    :events {:pre-rez nil :run-ends nil}}

    "Ryon Knight"
    {:abilities [{:msg "do 1 brain damage" :req (req (and this-server (zero? (:click runner))))


Automatically close conn-mgr and response when entity is closed

--- src/clj_http/core2.clj
+++ src/clj_http/core2.clj
@@ -12,6 +12,7 @@
            (org.apache.http.client.methods HttpGet)
            (org.apache.http.client.protocol HttpClientContext)
            (org.apache.http.config RegistryBuilder)
+           (org.apache.http.conn HttpClientConnectionManager)
            (org.apache.http.conn.routing HttpRoute)
            (org.apache.http.conn.ssl BrowserCompatHostnameVerifier
                                      SSLConnectionSocketFactory SSLContexts)
@@ -53,6 +54,22 @@
 (defn credentials-provider []
   (BasicCredentialsProvider.))

+(defn- coerce-body-entity
+  "Coerce the http-entity from an HttpResponse to a stream that closes itself
+  and the connection manager when closed."
+  [^HttpEntity http-entity ^HttpClientConnectionManager conn-mgr response]
+  (when http-entity
+    (proxy [FilterInputStream]
+        [^InputStream (.getContent http-entity)]
+      (close []
+        (try
+          ;; Eliminate the reflection warning from proxy-super
+          (let [^InputStream this this]
+            (proxy-super close))
+          (finally
+            (.close response)
+            (.shutdown conn-mgr)))))))
+
 (defn request [{:keys [cookie-store] :as req}]
   (let [conn-mgr (pooling-conn-mgr)
         client (http-client conn-mgr)
@@ -63,8 +80,7 @@
         status (.getStatusLine response)]
     (when cookie-store
       (.setCookieStore context cookie-store))
-    ;; TODO response, conn-mgr, and client needs to be closed
-    {:body (.getContent entity)
+    {:body (coerce-body-entity entity conn-mgr response)
      :length (.getContentLength entity)
      :chunked? (.isChunked entity)
      :repeatable? (.isRepeatable entity)


Max genome size is 1/4 of max points

Max genome size is 1/4 of max points

--- src/clojush/random.clj
+++ src/clojush/random.clj
@@ -93,7 +93,7 @@
     (random-push-code max-points atom-generators {:max-points @global-max-points}))
   ([max-points atom-generators argmap]
     (translate-plush-genome-to-push-program
-      {:genome (random-plush-genome (max (int (/ max-points 2)) 1)
+      {:genome (random-plush-genome (max (int (/ max-points 4)) 1)
                                     atom-generators
                                     argmap)}
       argmap)))


Make warn-on-*-bindings! function private

--- src/compojure/core.clj
+++ src/compojure/core.clj
@@ -76,7 +76,7 @@
           (throw (Exception. (str "Unexpected binding: " sym))))
       (mapcat identity binds))))

-(defn warn-on-*-bindings! [bindings]
+(defn- warn-on-*-bindings! [bindings]
   (when (and (vector? bindings) (contains? (set bindings) '*))
     (binding [*out* *err*]
       (println "WARNING: * should not be used as a route binding."))))


added erb sit down

added erb sit down

problem with the predicate, the word down is black

--- src/babel/english/lexicon.clj
+++ src/babel/english/lexicon.clj
@@ -863,6 +863,14 @@
                     :sem {:pred :cantare}}
            :english {:past "sang"}}

+
+"sit down" {:english {:past "sat down"
+                                  :participle "sitting down"
+                                  :past-participle "sat down"
+                                  :present {:3sing "sits down"}}
+                        :synsem {:cat :verb
+                                 :sem {:pred :sit down}}}
+
    "sleep" {:synsem {:cat :verb
                      :sem {:subj {:animate true}
                            :discrete false


added pensar stem changing

added pensar stem changing

--- src/babel/espanol/lexicon.clj
+++ src/babel/espanol/lexicon.clj
@@ -208,10 +208,10 @@
                    :pred :loro}
              :subcat '()}}

-    "empezar" {:italiano {:boot-stem1 "empiez"
+    "empezar" {:boot-stem1 "empiez"
                         :boot-stem2 "empez"}
              :synsem {:cat :verb
-                      :sem {:pred :begin}}}
+                      :sem {:pred :begin}}

    "enseñar" [{:synsem {:cat :verb
                         :sem {:pred :show}}}
@@ -326,6 +326,11 @@
                     :subcat {:1 {:cat :det
                                  :number :sing
                                  :def :def}}}})
+
+    "pensar" {:spanish {:boot-stem1 "piens"
+                        :boot-stem2 "pens"}
+             :synsem {:cat :verb
+                      :sem {:pred :think}}}

    "quedarse" (let [subject-semantics (ref {:animate true})
                     subject-agr (ref :top)]


Cleaner ns declaration

Cleaner ns declaration

--- clj-http-client/src/clj_http_client/core.clj
+++ clj-http-client/src/clj_http_client/core.clj
@@ -1,5 +1,5 @@
 (ns clj-http-client.core
-  (:use clojure.contrib.fcase clojure.contrib.except clojure.contrib.def)
+  (:use (clojure.contrib fcase except def))
   (:import (org.apache.commons.httpclient
              HttpClient DefaultHttpMethodRetryHandler Header
              HttpMethod HttpMethodBase)


add warning when :http-handler could not be resolved

--- src/main/shadow/cljs/devtools/server/dev_http.clj
+++ src/main/shadow/cljs/devtools/server/dev_http.clj
@@ -46,7 +46,9 @@
           #'push-state/handle

           (do (require (symbol (namespace http-handler)))
-              (find-var http-handler)))
+              (or (find-var http-handler)
+                  (do (log/warn ":http-handler var not found" http-handler)
+                      #'push-state/handle))))

         http-handler-fn
         (fn [req]


add newline at end of file

add newline at end of file

--- src/braid/ui/styles/vars.cljs
+++ src/braid/ui/styles/vars.cljs
@@ -23,4 +23,4 @@

 (def limbo-thread-accent-color "#CA1414")

-(def archived-thread-accent-color "#AAAAAA")+(def archived-thread-accent-color "#AAAAAA")


clearing type and using systems-for user

--- src/celestial/api/systems.clj
+++ src/celestial/api/systems.clj
@@ -14,6 +14,7 @@
   (:refer-clojure :exclude [type])
   (:require
     [celestial.persistency :as p]
+    [cemerick.friend :as friend]
     [celestial.persistency.systems :as s]
     [celestial.model :refer (sanitized-envs)]
     [clojure.core.strint :refer (<<)]
@@ -59,21 +60,22 @@

 (defn systems-range
   "Get systems in range by type"
-  [from to type]
-  {:pre [(> from -1) (if type (p/type-exists! type) true)]}
-  (let [systems (if type (s/get-system-index :type type) (into [] (s/all-systems)))
-        to* (min to (count systems))]
+  [from to]
+  {:pre [(> from -1)]}
+  (let [{:keys [username]} (friend/current-authentication)
+         systems (into [] (s/systems-for username)) to* (min to (count systems))]
     (when-not (empty? systems)
       (if (and (contains? systems from) (contains? systems (- to* 1)))
-        {:meta {:total (count systems)} :systems (doall (map (juxt identity s/get-system) (subvec systems from to*)))}
+        {:meta {:total (count systems)}
+         :systems (doall (map (juxt identity s/get-system) (subvec systems from to*)))}
         (throw+ {:type ::non-legal-range :message (<<  "No legal systems in range ~{from}:~{to*} try between ~{0}:~(count systems)")})))))

 (defroutes- systems {:path "/systems" :description "Operations on Systems"}

-  (GET- "/systems" [^:int page ^:int offset ^:string type]
+  (GET- "/systems" [^:int page ^:int offset]
       {:nickname "getSystems" :summary "Get all systems at page with offset"}
     (let [page* (Integer/valueOf page) offset* (Integer/valueOf offset)]
-      (success (systems-range (* (- page* 1) offset*) (* page*  offset*) type))))
+      (success (systems-range (* (- page* 1) offset*) (* page*  offset*)))))

   (GET- "/systems/:id" [^:int id] {:nickname "getSystem" :summary "Get system by id"}
         (success (s/get-system id)))


Enable debug for system ns

Enable debug for system ns

--- src/cider_ci/utils/system.clj
+++ src/cider_ci/utils/system.clj
@@ -5,12 +5,11 @@

 (ns cider-ci.utils.system
   (:require
+    [cider-ci.utils.debug :as debug]
     [clj-commons-exec :as commons-exec]
+    [clj-logging-config.log4j :as logging-config]
     [clojure.tools.logging :as logging]
-    [clj-logging-config.log4j :as logging-config]
     ))
-
-  ;(logging-config/set-logger! :level :debug)

 (defn exec
@@ -35,3 +34,8 @@
 (defn exec-with-success? [& args]
   (= 0 (:exit (apply exec args))))

+
+;### Debug #####################################################################
+;(debug/debug-ns *ns*)
+;(logging-config/set-logger! :level :debug)
+;(logging-config/set-logger! :level :info)


Fix upstream deps when run from repl.

Fix upstream deps when run from repl.

--- src/clj/cljs/repl/browser.clj
+++ src/clj/cljs/repl/browser.clj
@@ -274,7 +274,7 @@
                   support reflection. Defaults to \"src/\".
   "
   [& {:as opts}]
-  (let [ups-deps (cljsc/get-upstream-deps)
+  (let [ups-deps (cljsc/get-upstream-deps (java.lang.ClassLoader/getSystemClassLoader))
         opts (assoc opts
                :ups-libs (:libs ups-deps)
                :ups-foreign-libs (:foreign-libs ups-deps))


report ::caller that caused instrument failre

Signed-off-by: Rich Hickey <2f3b32171da334ad5d7d0db393d0928eef4308ab@gmail.com>

--- src/clj/clojure/spec/test.clj
+++ src/clj/clojure/spec/test.clj
@@ -11,7 +11,8 @@
   (:require
    [clojure.pprint :as pp]
    [clojure.spec :as s]
-   [clojure.spec.gen :as gen]))
+   [clojure.spec.gen :as gen]
+   [clojure.string :as str]))

 (in-ns 'clojure.spec.test.check)
 (in-ns 'clojure.spec.test)
@@ -70,15 +71,63 @@
   `(binding [*instrument-enabled* nil]
      ~@body))

+(defn- interpret-stack-trace-element
+  "Given the vector-of-syms form of a stacktrace element produced
+by e.g. Throwable->map, returns a map form that adds some keys
+guessing the original Clojure names. Returns a map with
+
+  :class         class name symbol from stack trace
+  :method        method symbol from stack trace
+  :file          filename from stack trace
+  :line          line number from stack trace
+  :var-scope     optional Clojure var symbol scoping fn def
+  :local-fn      optional local Clojure symbol scoping fn def
+
+For non-Clojure fns, :scope and :local-fn will be absent."
+  [[cls method file line]]
+  (let [clojure? (contains? '#{invoke invokeStatic} method)
+        demunge #(clojure.lang.Compiler/demunge %)
+        degensym #(str/replace % #"--.*" "")
+        [ns-sym name-sym local] (when clojure?
+                                  (->> (str/split (str cls) #"\$" 3)
+                                       (map demunge)))]
+    (merge {:file file
+            :line line
+            :method method
+            :class cls}
+           (when (and ns-sym name-sym)
+             {:var-scope (symbol ns-sym name-sym)})
+           (when local
+             {:local-fn (symbol (degensym local))}))))
+
+(defn- stacktrace-relevant-to-instrument
+  "Takes a coll of stack trace elements (as returned by
+StackTraceElement->vec) and returns a coll of maps as per
+interpret-stack-trace-element that are relevant to a
+failure in instrument."
+  [elems]
+  (let [plumbing? (fn [{:keys [var-scope]}]
+                    (contains? '#{clojure.spec.test/spec-checking-fn} var-scope))]
+    (sequence (comp (map StackTraceElement->vec)
+                    (map interpret-stack-trace-element)
+                    (filter :var-scope)
+                    (drop-while plumbing?))
+              elems)))
+
 (defn- spec-checking-fn
   [v f fn-spec]
   (let [fn-spec (@#'s/maybe-spec fn-spec)
         conform! (fn [v role spec data args]
                    (let [conformed (s/conform spec data)]
                      (if (= ::s/invalid conformed)
-                       (let [ed (assoc (s/explain-data* spec [role] [] [] data)
-                                  ::s/args args
-                                  ::s/failure :instrument-check-failed)]
+                       (let [caller (->> (.getStackTrace (Thread/currentThread))
+                                         stacktrace-relevant-to-instrument
+                                         first)
+                             ed (merge (assoc (s/explain-data* spec [role] [] [] data)
+                                         ::s/args args
+                                         ::s/failure :instrument-check-failed)
+                                       (when caller
+                                         {::caller (dissoc caller :class :method)}))]
                          (throw (ex-info
                                  (str "Call to " v " did not conform to spec:\n" (with-out-str (s/explain-out ed)))
                                  ed)))
@@ -252,7 +301,7 @@

 (defn- check-fn
   [f specs {gen :gen opts ::stc/opts}]
-  (let [{:keys [num-tests] :or {num-tests 100}} opts
+  (let [{:keys [num-tests] :or {num-tests 1000}} opts
         g (try (s/gen (:args specs) gen) (catch Throwable t t))]
     (if (throwable? g)
       {:result g}


Add basic concept page handler

Add basic concept page handler

--- src/clj/clojuredocs/pages.clj
+++ src/clj/clojuredocs/pages.clj
@@ -6,6 +6,7 @@
             [clojuredocs.util :as util]
             [clojuredocs.config :as config]
             [clojuredocs.search :as search]
+            [clojuredocs.search.static :as search.static]
             [clojuredocs.pages.common :as common]
             [clojuredocs.pages.search-feedback :as search-feedback]
             [clojuredocs.pages.intro :as intro]
@@ -106,11 +107,31 @@
   (or (lookup-var ns name)
       (lookup-var (expand-ns ns) name)))

+(defn concept-page-handler [concept]
+  (fn [r]
+    (common/$main
+      {:content
+       [:div.row
+        [:div.col-sm-2
+         [:div.sidenav
+          {:data-sticky-offset "30"}
+          [:h5 "Concepts"]
+          [:ul
+           (for [{:keys [name href]} search.static/concept-pages]
+             [:li [:a {:href href} name]])]]]
+        [:div.col-sm-10
+         [:div.markdown
+          (-> (str "src/md/concepts/" concept ".md")
+              common/memo-markdown-file
+              common/prep-for-syntaxhighligher)]]]})))
+
 (defroutes routes
   (GET "/robots.txt" [] robots-resp)
   (GET "/logout" [] logout-resp)
   (GET "/examples-styleguide" [] examples-styleguide-handler)
   (GET "/core-library" [] core-library-handler)
+
+  (GET "/concepts/:concept" [concept] (concept-page-handler concept))

   ;; Search Feedback
   (GET "/search-feedback" [] search-feedback/page-handler)
@@ -127,6 +148,7 @@
   (GET "/dev/styleguide/examples" [] dev/examples-styleguide-handler)
   (GET "/dev/search-perf" [] dev/perf-handler)
   (GET "/dev/canary" [] dev/canary-tests-handler)
+  (GET "/dev/api" [] dev/api-docs-handler)

   (GET "/gh-callback*" {{path :*} :route-params} (gh-auth/callback-handler path))
   (GET "/quickref" [] quickref/page-handler)


Fix stagnant water drinking bug

Fix stagnant water drinking bug

--- src/cljc/robinson/update.cljc
+++ src/cljc/robinson/update.cljc
@@ -1381,6 +1381,9 @@
     (log/info "player-adj-xys" (rw/player-adjacent-xys state))
     (update-in state [:world :player :thirst] (fn [thirst] (min 0 (- thirst water))))))

+(def quaff-popover-message
+  "This water is not potable. Are you sure?\n \n[<color fg=\"highlight\">y</color>]es [<color fg=\"highlight\">n</color>]o")
+
 (defn quaff-select
   "Select the next state depending on what quaffable items are available."
   [state]
@@ -1411,7 +1414,9 @@
         (quaff-only-adjacent-cell state)
       (and (= num-adjacent-dangerous-quaffable-cells 1)
            (zero? num-adjacent-quaffable-cells))
-        (rw/assoc-current-state state :quaff-popover)
+        (-> state
+          (assoc-in [:world :popover-message] quaff-popover-message)
+          (rw/assoc-current-state :quaff-popover))
       (or (> num-adjacent-quaffable-cells 1)
           (> num-adjacent-dangerous-quaffable-cells 1))
         (-> state
@@ -1426,12 +1431,10 @@

 (defn quaff-cell-at-pos
   ([state]
-  (let [cell      (apply rw/get-cell state (rc/pos->xy (get-in state [:world :quaff-pos])))
-        cell-type (get cell :type)]
-    (-> state
-      (update-in [:world :player :thirst] (fn [thirst] (min 0 (- thirst 10))))
-      (rp/player-update-hp (fn [hp] (max (- hp 10) 0)))
-      (rw/assoc-current-state :normal))))
+  (-> state
+    (update-in [:world :player :thirst] (fn [thirst] (min 0 (- thirst 10))))
+    (rp/player-update-hp (fn [hp] (max (- hp 10) 0)))
+    (rw/assoc-current-state :normal)))
   ([state {x :x y :y}]
   (if-let [water (get (rw/get-cell state x y) :water)]
     (do (log/info "Drinking potable water")
@@ -1441,7 +1444,7 @@
       (rw/assoc-current-state :normal)))
     (do (log/info "Drinking nonpotable water")
     (-> state
-      (assoc-in [:world :popover-message] "This water is not potable. Are you sure?\n \n[<color fg=\"highlight\">y</color>]es [<color fg=\"highlight\">n</color>]o")
+      (assoc-in [:world :popover-message] quaff-popover-message)
       (assoc-in [:world :quaff-pos] (rc/xy->pos x y))
       (rw/assoc-current-state :quaff-popover))))))


Sort the docs correctly

Sort the docs correctly

--- src/clojure/nightmod/docs.clj
+++ src/clojure/nightmod/docs.clj
@@ -22,9 +22,7 @@
                    edn/read-string
                    (remove blacklisted?)))

-(def doc-map (into {} (map #(vector (:name %) (:file %)) doc-list)))
-
-(def ns-list (vec (group-by :ns doc-list)))
+(def ns-list (vec (into (sorted-map) (group-by :ns doc-list))))

 (defn update-content!
   [node]


Use combiner as reducer when reducer not later specified.

--- src/clojure/parkour/graph.clj
+++ src/clojure/parkour/graph.clj
@@ -239,7 +239,8 @@
   [node cls-var & args]
   (if-not (identical? :partition (stage node))
     (error "combine" node)
-    (let [step (apply combiner-config cls-var args)]
+    (let [step [(apply combiner-config cls-var args)
+                (apply reducer-config cls-var args)]]
       (-> node (config step) (assoc :stage :combine)))))

 (defn reduce


Bumped lein-template patch version.

Bumped lein-template patch version.

--- lein-lambda-blog/project.clj
+++ lein-lambda-blog/project.clj
@@ -1,4 +1,4 @@
-(defproject lambda-blog/lein-template "0.1.0"
+(defproject lambda-blog/lein-template "0.1.1"
   :description "A Leiningen template for λ-blog."
   :url "https://github.com/Idorobots/lambda-blog"
   :license {:name "MIT License"


Consolidate illumination of mode buttons too.

--- src/afterglow/controllers/ableton_push.clj
+++ src/afterglow/controllers/ableton_push.clj
@@ -845,6 +845,16 @@
                assoc (:up-arrow control-buttons)
                (button-state (:up-arrow control-buttons) :dim))))))

+(defn- update-mode-buttons
+  "Illuminate the buttons which activate modes while they are held
+  down. Make them dim when not held, and bright when held."
+  [controller mode-buttons]
+  (doseq [button mode-buttons]
+    (swap! (:next-text-buttons controller)
+           assoc (button control-buttons)
+           (button-state (button control-buttons)
+                         (if (in-mode? controller button) :bright :dim)))))
+
 (defn- update-interface
   "Determine the desired current state of the interface, and send any
   changes needed to get it to that state."
@@ -865,18 +875,7 @@
         (when-not (or (show/running?) (in-mode? controller :stop))
           (enter-stop-mode controller :already-stopped true)))

-      ;; Reflect the shift button state
-      (swap! (:next-text-buttons controller)
-             assoc (:shift control-buttons)
-             (button-state (:shift control-buttons)
-                           (if (in-mode? controller :shift) :bright :dim)))
-
-      ;; Reflect the record button state
-      (swap! (:next-text-buttons controller)
-             assoc (:record control-buttons)
-             (button-state (:record control-buttons)
-                           (if (in-mode? controller :record) :bright :dim)))
-
+      (update-mode-buttons controller [:shift :record])
       (render-cue-grid controller snapshot)
       (update-scroll-arrows controller)

@@ -967,7 +966,7 @@
       (< @counter 36)
       (doseq [x (range 0 8)]
         (set-pad-color controller x (- 35 @counter) off-color))
-
+
       :else
       (do
         (clear-interface controller)


Surrogates!

Surrogates!

A hacky workaround to prevent broken layout when referencing native objects in headers

--- src/devtools/core.cljs
+++ src/devtools/core.cljs
@@ -25,6 +25,9 @@
 (defn js-value? [value]
   (not (cljs-value? value)))

+(defn surrogate? [value]
+  (exists? (aget value "__surrogate")))
+
 (defn template [tag style & more]
   (let [arr #js [tag (if (empty? style) #js {} #js {"style" style})]]
     (doseq [o more]
@@ -39,6 +42,12 @@
       (.push arr o))
     arr))

+(defn surrogate [object header]
+  (js-obj
+    "__surrogate" true
+    "target" object
+    "header" header))
+
 (defn spacer [& _] " ")

 (defn nil-template [_]
@@ -69,7 +78,7 @@
   (template "span" "color:#C41A16" (str dq value dq)))

 (defn fn-template [value]
-  (template "span" "color:#f00" (reference value) "fn"))
+  (template "span" "color:#f0f" (reference (surrogate value "λ"))))

 (defn header-inlined-templates [value renderer max]
   (let [rendered-items (apply concat (interpose [(spacer)] (map renderer (take max value))))]
@@ -97,12 +106,23 @@
         items (header-inlined-templates value renderer max-coll-elements)]
     (template "span" "color:#000" "[" items "]")))

+(defn bool-template [value]
+  (template "span" "color:#099" value))
+
 (defn generic-template [value]
   (template "span" "color:#000" (reference value)))
+
+(defn js-object-template [value]
+  (if (js-value? value)
+    (template "span" "color:#000" (reference (surrogate value "#js")))))
+
+(defn bool? [value]
+  (or (true? value) (false? value)))

 (defn atomic-template [value]
   (cond
     (nil? value) (nil-template value)
+    (bool? value) (bool-template value)
     (string? value) (string-template value)
     (number? value) (number-template value)
     (keyword? value) (keyword-template value)
@@ -121,6 +141,7 @@

 (defn inlined-value-template [value]
   (or (atomic-template value)
+      (js-object-template value)
       (generic-template value)))

 (defn header-template [value]
@@ -157,16 +178,29 @@
   (something-abbreviated? (js->clj template)))

 (defn want-value? [value]
-  (cljs-value? value))
+  (or (cljs-value? value)
+      (surrogate? value)))

 (defn header-hook [value]
-  (build-header value))
+  (if (surrogate? value)
+    (.-header value)
+    (build-header value)))

 (defn has-body-hook [value]
-  (abbreviated? (build-header value)))
+  (if (surrogate? value)
+    true
+    (abbreviated? (build-header value))))
+
+(defn build-surrogate-body [value]
+  (let [target (.-target value)]
+    (template "ol"
+              "list-style-type:none; padding-left:0px; margin-top:0px; margin-bottom:0px; margin-left:12px"
+              (template "li" "margin-left:12px" (reference target (pr-str target))))))

 (defn body-hook [value]
-  (build-body value))
+  (if (surrogate? value)
+    (build-surrogate-body value)
+    (build-body value)))

 (defn sanitize
   "wraps our hook in try-catch block to prevent leaking of exceptions if something goes wrong"


add space-padding for justification

add space-padding for justification

--- src/cljs/infinitelives/pixi/pixelfont.cljs
+++ src/cljs/infinitelives/pixi/pixelfont.cljs
@@ -47,10 +47,12 @@
   (.removeChildren batch))

 (defn make-char-sprite-set [font-key text &
-                            {:keys [tint x y]
+                            {:keys [tint x y space-padding]
                              :or
                              {tint 0xffffff
-                              x 0 y 0}}]
+                              x 0 y 0
+                              space-padding 0
+                              }}]
   (let [font (get-font font-key)]
     (loop [[c & l] (seq text)
            xp x yp y
@@ -66,9 +68,9 @@
         (if (nil? char)
           ;; if character is not present in font map, put a space
           (when (seq l)
-            (recur l (+ xp (:space font)) yp c sprite-set))
-
-          (let [sprite (s/make-sprite texture :x (+ xp koff) :y yp :xhandle 0 :yhandle 0 :tint tint :scale 1)]
+            (recur l (+ xp (:space font) space-padding) yp c sprite-set))
+
+          (let [sprite (s/make-sprite texture :x (int (+ xp koff)) :y yp :xhandle 0 :yhandle 0 :tint tint :scale 1)]
             (if (seq l)
               (recur l (+ xp w 1.0 koff) yp c (conj sprite-set sprite))
               (conj sprite-set sprite))))))))


Hackin some verbose layout

Hackin some verbose layout

--- src/clojure/picard/log4j/VerboseLayout.clj
+++ src/clojure/picard/log4j/VerboseLayout.clj
@@ -8,17 +8,28 @@
    :name picard.log4j.VerboseLayout
    :extends org.apache.log4j.Layout))

+(defn- format-value
+  [val]
+  (str/join
+   "\n                       " ;; lol
+   (map
+    #(str/trim (str/join (map str %)))
+    (partition 120 120 "" (str (or val "nil"))))))
+
 (defn- format-state
   [state]
   (str
    (format "%20s :\n" "State")
    (str/join
     "\n"
-    (map (fn [[k v]] (format "%20s : %s" (name k) v)) state))))
+    (map (fn [[k v]]
+           (format "%20s : %s"
+                   (name k) (format-value v)))
+         state))))

 (defn- format-event
   [event]
-  (format "%20s : %s\n" "Event" event))
+  (str (format "%20s : " "Event") (format-value event) "\n"))

 (defn- pretty-format
   [evt msg]


utilize Java resources

utilize Java resources

--- src/clojure/zensols/actioncli/resource.clj
+++ src/clojure/zensols/actioncli/resource.clj
@@ -9,21 +9,25 @@
 (def ^:private res-prop-fmt (atom "zensols.%s"))
 (def ^:private res-paths (atom {}))

-(defn- sysprop [name]
-  (System/getProperty (format @res-prop-fmt name)))
+(defn- sysprop [name & {:keys [throw?] :or {throw? true}}]
+  (let [val (System/getProperty (format @res-prop-fmt name))]
+    (if (and (nil? val) throw?)
+      (throw (ex-info (format "System property '%s' is unset" name)
+                      {:name name})))
+    val))

-(defn- syspath
+(defn- sysdefault
   ([name]
-   (syspath name name))
+   (sysdefault name name))
   ([name default]
-   (let [propstr (sysprop name)]
+   (let [propstr (sysprop name :throw? false)]
      (or propstr default))))

 (defn- sysfile
   ([name]
    (sysfile name name))
   ([name default]
-   (let [path (syspath name default)]
+   (let [path (sysdefault name default)]
      (if (= (type path) java.io.File)
        path
        (io/file path)))))
@@ -55,6 +59,27 @@
   [fmt-str]
   (reset! res-prop-fmt fmt-str))

+(defn- resource-to-path
+  ([prepath path]
+   (let [prepath (cond (instance? java.io.File prepath) (.getPath prepath)
+                       (instance? java.net.URL prepath) (.getFile prepath)
+                       true prepath)]
+     (if path
+       (str prepath "/" path)
+       prepath))))
+
+(defn- resolve-resource
+  ([type prepath]
+   (resolve-resource type prepath nil))
+  ([type prepath path]
+   (case type
+     :file (if (instance? java.io.File prepath)
+             (io/file prepath path)
+             (if path
+               (io/file (resource-to-path prepath nil) path)
+               (io/file (resource-to-path prepath nil))))
+     :resource (io/resource (resource-to-path prepath path)))))
+
 (defn register-resource
   "Register a resource to be used with [[resource-path]].
   This should be done at the beginning of the program, usually from `core`.
@@ -72,13 +97,16 @@
   * **:system-default** the default path to use if the system-file isn't found
   in the system properties
   * **:system-property** get the resource directly from the system properties"
-  [key & {:keys [function pre-path
-                 system-file system-property system-default]}]
-  (let [fnform (concat (list (or function 'io/file))
+  [key & {:keys [function pre-path constant type
+                 system-file system-property system-default]
+          :or {type :file}}]
+  (let [fnform (concat (list (or function 'resolve-resource) type)
                        (if pre-path
                          (list `(resource-path ~pre-path)))
+                       (if constant
+                         (list constant))
                        (if system-property
-                         (list `(sysprop ~system-property)))
+                         (list `(sysdefault ~system-property)))
                        (if system-file
                          (list (remove nil? `(sysfile ~system-file
                                                       ~system-default)))))


Delete public directory when watching starts.

--- src/incise/watcher.clj
+++ src/incise/watcher.clj
@@ -2,7 +2,8 @@
   (:require [taoensso.timbre :refer [error]]
             [clojure.stacktrace :refer [print-cause-trace]]
             [watchtower.core :refer [watcher rate file-filter extensions
-                                     on-change]]))
+                                     on-change]])
+  (:import [java.io File]))

 (defn log-exceptions [func]
   "Log (i.e. print) exceptions received from the given function."
@@ -21,8 +22,20 @@
     (doseq [file files]
       (change-fn file))))

+(def gitignore-file? [^File file]
+  (= (.getName file) ".gitignore"))
+
+(defn delete-recursively
+  "Delete a directory tree."
+  [^File root]
+  (when (.isDirectory root)
+    (doseq [file (remove gitignore-file? (.listFiles root))]
+      (delete-recursively file)))
+  (.delete root))
+
 (defn watch
   [change-fn]
+  (delete-recursively (File. "resources/public/"))
   (watcher ["resources/posts/" "resources/pages/"]
            (rate 300)
            (on-change (-> change-fn


Implement change-fn middlewares.

Implement change-fn middlewares.

--- src/incise/watcher.clj
+++ src/incise/watcher.clj
@@ -1,20 +1,33 @@
 (ns incise.watcher
-  (:require [watchtower.core :refer [watcher rate file-filter extensions
+  (:require [taoensso.timbre :refer [error]]
+            [clojure.stacktrace :refer [print-stack-trace]]
+            [watchtower.core :refer [watcher rate file-filter extensions
                                      on-change]]))

-(defn log-exceptions [func & args]
+(defn log-exceptions [func]
   "Log (i.e. print) exceptions received from the given function."
-  (try
-    (apply func args)
-    (catch Exception e
-      (println (.getMessage e)))))
+  (let [out *out*
+        err *err*]
+    (fn [& args]
+      (binding [*out* out
+                *err* err]
+        (try
+          (apply func args)
+          (catch Exception e
+            (error (with-out-str (print-stack-trace e)))))))))

+(defn per-change [change-fn]
+  (fn [files]
+    (doseq [file files]
+      (change-fn file))))

 (defn watch
   [change-fn]
   (watcher ["resources/posts/" "resources/pages/"]
            (rate 300)
-           (on-change (partial log-exceptions change-fn))))
+           (on-change (-> change-fn
+                          per-change
+                          log-exceptions))))

 (def watching nil)


Have to-schema-reference return the reference map, not the simple string URI

--- src/io/aviso/rook/swagger.clj
+++ src/io/aviso/rook/swagger.clj
@@ -103,7 +103,6 @@
   "Converts a schema to a schema reference; the schema must be named.  Returns a tuple
   of the possibly updated swagger object and a string reference to the schema within the swagger object
   (as a path string)."
-  ;; TODO: return the {:schema {"$ref" ...}} map instead?
   [swagger-options swagger-object schema]
   (cond-let
     [schema-name (s/schema-name schema)
@@ -115,7 +114,7 @@

     ;; Avoid forward slash in the swagger name, as that's problematic.
     [swagger-name (str schema-ns \: schema-name)
-     swagger-reference (str "#/definitions/" swagger-name)
+     swagger-reference {"$ref" (str "#/definitions/" swagger-name)}
      swagger-schema (get-in swagger-object [:definitions swagger-name])]

     (some? swagger-schema)
@@ -138,7 +137,7 @@
                  conj {:name     :request-body
                        :in       :body
                        :required true
-                       :schema   {"$ref" schema-reference}}))
+                       :schema   schema-reference}))
     ; no schema:
     swagger-object))


simplify exclusive-opts assertion

simplify exclusive-opts assertion

--- src/leiningen/new/tenzing.clj
+++ src/leiningen/new/tenzing.clj
@@ -171,15 +171,10 @@
 (defn warn-on-exclusive-opts!
   "Some options can't be used together w/o added complexity."
   [opts]
-  (when (and (or (om? opts)
-                 (om-next? opts))
-             (reagent? opts))
-    (main/warn "Please specify only +om/om-next or +reagent, not both.")
-    (main/exit))
-  (when (and (om? opts)
-             (om-next? opts))
-    (main/warn "Please specify only +om or +om-next, not both.")
-    (main/exit)))
+  (let [x (juxt om? om-next? reagent?)]
+    (when-not (>= 1 (count (keep identity (x opts))))
+      (main/warn "Please specify only +om, +om-next or +reagent, not multiple.")
+      (main/exit))))

 (defn render-boot-properties []
   (let [{:keys [exit out err]} (sh/sh "boot" "-V" :env {:BOOT_CLOJURE_VERSION "1.7.0"})]


simplify cljsjs handling via separate private option

--- src/leiningen/new/tenzing.clj
+++ src/leiningen/new/tenzing.clj
@@ -57,6 +57,10 @@
 (defn om? [opts]
   (some #{"+om"} opts))

+; derived option
+(defn cljsjs? [opts]
+  (or (om? opts) (reagent opts)))
+
 (defn sass? [opts]
   (some #{"+sass"} opts))

@@ -78,20 +82,19 @@
           (reagent? opts) (conj "reagent \"0.4.3\"" "cljsjs/react \"0.12.2-1\"")
           (garden?  opts) (conj "boot-garden \"1.2.5-1\"")
           (sass?    opts) (conj "boot-sassc  \"0.1.0\"")
-          (or (om? opts) (reagent? opts)) (conj "cljsjs/boot-cljsjs \"0.3.0\"")))
+          (cljsjs?  opts) (conj "cljsjs/boot-cljsjs \"0.3.0\"")))

 (defn build-requires [opts]
   (cond-> []
           (garden? opts) (conj "'[boot-garden.core :refer [garden]]")
           (sass?   opts) (conj "'[boot-sassc.core  :refer [sass]]")
-          (or (om? opts) (reagent? opts)) (conj "'[cljsjs.app :refer [from-cljsjs]]") ))
+          (cljsjs? opts) (conj "'[cljsjs.app :refer [from-cljsjs]]")))

 (defn build-steps [name opts]
   (cond-> []
           (garden? opts) (conj (str "(garden :styles-var '" name ".styles/screen\n:output-to \"css/garden.css\")"))
           (sass?   opts) (conj (str "(sass :output-to \"css/sass.css\")"))
-          (or (om? opts)
-              (reagent? opts)) (conj (str "(from-cljsjs)"))))
+          (cljsjs? opts) (conj (str "(from-cljsjs)"))))

 (defn production-task-opts [opts]
   (cond-> []
@@ -151,6 +154,7 @@
                    (vector (if (divshot? opts) ["divshot.json" (render "divshot.json" data)])
                            (if (garden? opts)  ["src/clj/{{sanitized}}/styles.clj" (render "styles.clj" data)])
                            (if (sass? opts)    ["sass/styles.sass" (render "styles.sass" data)])
+
                            (cond (reagent? opts) [app-cljs (render "reagent-app.cljs" data)]
                                  (om? opts)      [app-cljs (render "om-app.cljs" data)]
                                  :none           [app-cljs (render "app.cljs" data)])


shabam bm-get sometimes returned false incorrectly. Fixed.

--- src/leiningen/voom/shabam.clj
+++ src/leiningen/voom/shabam.clj
@@ -33,7 +33,7 @@
           m (bit-set 0 o)
           v (aget bm w)
           mv (bit-and v m)]
-      (pos? mv))))
+      (not (zero? mv)))))

 (defn ^"[J" bm-or
   [& bms]


make :compile-path a key that's always present in the project hash map

--- src/leiningen/core.clj
+++ src/leiningen/core.clj
@@ -8,14 +8,19 @@
   ;; This is necessary since we must allow defproject to be eval'd in
   ;; any namespace due to load-file; we can't just create a var with
   ;; def or we would not have access to it once load-file returned.
-  `(do (alter-var-root #'project
-                       (fn [_#] (assoc (apply hash-map (quote ~args))
+  `(do
+     (let [m# (apply hash-map (quote ~args))
+           root# ~(.getParent (java.io.File. *file*))]
+       (alter-var-root #'project
+                       (fn [_#] (assoc m#
                                   :name ~(name project-name)
                                   :group ~(or (namespace project-name)
                                               (name project-name))
                                   :version ~version
-                                  :root ~(.getParent (java.io.File. *file*)))))
-       (def ~(symbol (name project-name)) project)))
+                                  :compile-path (or (:compile-path m#)
+                                                    (str root# "/classes/"))
+                                  :root root#))))
+     (def ~(symbol (name project-name)) project)))

 ;; So it doesn't need to be fully-qualified in project.clj
 (with-ns 'clojure.core (use ['leiningen.core :only ['defproject]]))
@@ -48,8 +53,7 @@
         project (if (no-project-needed command)
                   (first args)
                   (read-project))
-        compile-path (or (:compile-path project)
-                         (str (:root project) "/classes/"))]
+        compile-path (:compile-path project)]
     (.mkdirs (File. compile-path))
     (binding [*compile-path* compile-path]
       (apply (resolve-command command) project args))


Fix code and removed outdated functions

Fix code and removed outdated functions

--- src/lights/my_show.clj
+++ src/lights/my_show.clj
@@ -264,8 +264,6 @@
       (show/add-midi-control-to-var-mapping
         "Automap MIDI" 10 23 :main-hue :min 0 :max 360)

-
-
       ; Reset beat mapping from MIDI button to a cue
       (show/add-midi-control-to-cue-mapping "Automap MIDI" 10 :control 58 7 7)

@@ -277,7 +275,6 @@
       (afterglow.show/set-variable! :lightness-max-general 50)
       (afterglow.show/set-variable! :lightness-max-general-percent 1)
       (afterglow.show/set-variable! :lightness-max-front-percent 1)
-
     )
   )

@@ -370,24 +367,6 @@
     (show/add-effect! :color (global-color-effect
       (params/build-color-param :h :main-hue :s 100 :l param)))
   )
-)
-
-(defn separate-colors
-  "Asign different colors to different fixtures. Experiment.
-  Take care of this https://github.com/brunchboy/afterglow/issues/30#issuecomment-165255504"
-  []
-  (afterglow.effects/scene "Different colors"
-    (show/add-effect! :color (afterglow.effects.color/color-effect
-      "Plain red" (create-color "red") (show/fixtures-named "back-odd")))
-    (show/add-effect! :color (afterglow.effects.color/color-effect
-      "Plain Blue" (create-color "blue") (show/fixtures-named "back-even")))
-    )
-  )
-
-(defn reset-beat
-  "Reset beat of the show"
-  []
-  (afterglow.rhythm/metro-start (:metronome *show*) 1)
 )

 (fiat-lux)


Fixed bug with passing strings to the html macro

--- modules/html/html.clj
+++ modules/html/html.clj
@@ -36,6 +36,17 @@
   (let [[attrs contents] (kwargs contents)]
     (make-tag name attrs (flatten contents))))

+(defn- add-tag-symbol
+  "Add the `tag symbol to each list beginning with a keyword."
+  [tree]
+  (if (seq? tree)
+    (tree-map
+      #(if (keyword? (first %))
+         (cons `tag %)
+         %)
+      tree)
+    tree))
+
 (defmacro xml
   "Any forms starting with a keyword in the body of this macro get an implicit
   tag function.
@@ -43,13 +54,7 @@
     (xml (:body (:p \"Hello World\")))"
   [& body]
   `(lines
-     (list
-       ~@(map
-           (partial tree-map
-             #(if (keyword? (first %))
-                (cons `tag %)
-                %))
-          body))))
+     (list ~@(map add-tag-symbol body))))

 (defmacro html
   "An alias for the xml macro."


Add test for rtd record hashs... currently failing in cljs.

--- test/active/clojure/record_test.cljc
+++ test/active/clojure/record_test.cljc
@@ -845,3 +845,19 @@
                        (make-many-fields 1 2 3))))
   #?(:clj (is (thrown? Exception
                        (make-many-fields 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27)))))
+
+(define-record-type set-contains-test-record-1
+  {:rtd-record? true}
+  make-set-contains-test-record-1
+  set-contains-test-record-1?
+  [v set-contains-test-record-1-v])
+
+(deftest set-contains-test
+  (is (= (hash (make-set-contains-test-record-1 :foo))
+         (hash (make-set-contains-test-record-1 :foo))))
+
+  (is (contains? (set (cons
+                       (make-set-contains-test-record-1 :foo)
+                       ;; Note: must have more than a few items to become a hash-set
+                       (map make-set-contains-test-record-1 (range 100))))
+                 (make-set-contains-test-record-1 :foo))))


fix REPL forgetting string aliases

fix REPL forgetting string aliases

fixes #751

--- src/main/shadow/cljs/repl.clj
+++ src/main/shadow/cljs/repl.clj
@@ -305,6 +305,7 @@

             [deps-sources state]
             (-> state
+                ;; FIXME: this is not additive, it may remove previous REPL state?
                 (data/overwrite-source rc)
                 (build-api/resolve-entries [ns]))

@@ -331,7 +332,7 @@

         [dep-sources state]
         (-> state
-            (data/overwrite-source ns-rc)
+            (data/add-source ns-rc) ;; additive, keep old state
             (res/resolve-repl ns deps))

         ns-info


wip: display nested object as columns

wip: display nested object as columns

--- src/metabase/driver/crate.clj
+++ src/metabase/driver/crate.clj
@@ -4,7 +4,9 @@
             [metabase.driver :as driver]
             [metabase.driver.crate.util :as crate-util]
             [metabase.driver.generic-sql :as sql]
-            [metabase.util :as u]))
+            [metabase.util :as u]
+            [clojure.tools.logging :as log])
+  (:import (java.sql DatabaseMetaData)))

 (def ^:private ^:const column->base-type
   "Map of Crate column types -> Field base types
@@ -55,6 +57,40 @@
 (defn- string-length-fn [field-key]
   (hsql/call :char_length field-key))

+(defn- describe-table-fields
+  [database, driver, {:keys [schema name]}]
+  (set (doseq [{column_name :column_name, type_name :type_name}
+             (jdbc/query
+                 (sql/db->jdbc-connection-spec database)
+                 [(format "select column_name, data_type as type_name
+                  from information_schema.columns
+                  where table_name like '%s' and table_schema like '%s'" name schema)])]
+          (merge {:name      column_name
+                 :custom    {:column-type type_name}
+                 :base-type (or (column->base-type driver (keyword type_name))
+                                (do (log/warn (format "Don't know how to map column type '%s' to a Field base_type, falling back to :type/*." type_name))
+                                    :type/*))}))))
+
+(defn- add-table-pks
+  [^DatabaseMetaData metadata, table]
+  (let [pks (->> (.getPrimaryKeys metadata nil nil (:name table))
+                 jdbc/result-set-seq
+                 (mapv :column_name)
+                 set)]
+    (update table :fields (fn [fields]
+                            (set (for [field fields]
+                                   (if-not (contains? pks (:name field))
+                                     field
+                                     (assoc field :pk? true))))))))
+
+(defn- describe-table [driver database table]
+  (sql/with-metadata [metadata driver database]
+                 (->> (assoc (select-keys table [:name :schema]) :fields (describe-table-fields database driver table))
+                      ;; find PKs and mark them
+                      (add-table-pks metadata))))
+
+(defn- field->alias [field]
+  (str \" (name field) \"))

 (defrecord CrateDriver []
   clojure.lang.Named
@@ -65,6 +101,7 @@
   (merge (sql/IDriverSQLDefaultsMixin)
          {:can-connect?   (u/drop-first-arg can-connect?)
           :date-interval  crate-util/date-interval
+          :describe-table describe-table
           :details-fields (constantly [{:name         "hosts"
                                         :display-name "Hosts"
                                         :default      "localhost:5432"}])
@@ -75,6 +112,8 @@
           :column->base-type         (u/drop-first-arg column->base-type)
           :string-length-fn          (u/drop-first-arg string-length-fn)
           :date                      crate-util/date
+          :quote-style               :ansi
+          :field->alias              (u/drop-first-arg field->alias)
           :unix-timestamp->timestamp crate-util/unix-timestamp->timestamp
           :current-datetime-fn       (constantly now)}))


wip, breadcrumb link for projects works.

--- src-cljs/kixi/hecuba/tabs/programmes.cljs
+++ src-cljs/kixi/hecuba/tabs/programmes.cljs
@@ -43,10 +43,14 @@
                                                        selection-key
                                                        template
                                                        nav-event)]
+      (doseq [a active-components]
+        (om/update! data (vector a :active) true))
+
       ;; (println "Nav Event: " nav-event)
       ;; (println "To Clear: " to-clear)
       ;; (println "URI: " uri " for path " path " selection-key " selection-key)
       (doseq [c to-clear]
+        (om/update! data (vector c :active) false)
         (om/update! data (vector c :data) [])
         (om/update! data (vector c :selected) nil))

@@ -180,6 +184,16 @@
   (let [[type _] (str/split selected #"-")]
     type))

+(defn programmes-div [programmes owner]
+  (reify
+    om/IRender
+    (render [_]
+      (html
+       ;; hide div if we've already chosen something
+       [:div {:id "programmes" :class (if (:active programmes) "hidden" "")}
+        [:h1 "Programmes"]
+        (om/build programmes-table programmes)]))))
+
 (defn programmes-table [cursor owner]
   (reify
     om/IRender
@@ -200,6 +214,22 @@
                      :id (str table-id "-selected")}
                 [:td id [:a {:id (str "row-" id)}]] [:td lead-organisations] [:td name] [:td created-at]]))]])))))

+(defn projects-div [tables owner]
+  (reify
+    om/IRender
+    (render [_]
+      (let [{:keys [programmes projects]} tables
+            history (om/get-shared owner :history)]
+        (html [:div {:id "projects" :class (if (:active projects) "hidden" "")}
+               [:h2 "Projects"]
+               [:ul {:class "breadcrumb"}
+                [:li [:a
+                      {:onClick (fn projects-div-history-change
+                                  [_ _]
+                                  (history/update-token-ids! history :programmes nil))}
+                      (title-for programmes)]]]
+               (om/build table projects {:opts {:histkey :projects}})])))))
+
 (defn programmes-tab [data owner]
   (let [{tables :tables} data]
     (reify
@@ -238,17 +268,20 @@
         ;; TODO sort out duplication here, wrap (on/build table ...) calls probably.
         ;;
         (let [{:keys [programmes projects properties devices sensors sensor-select]} tables]
-          (println ">>>> Sensors: " sensors)
           ;; (println "Tables: " tables)
           (html [:div
                  ;;(om/build clear-tables data)
-                 [:h1 {:id "programmes"} (:title data)]
-                 (om/build programmes-table programmes)
-
-                 [:h2 {:id "projects"} "Projects"]
-                 [:ul {:class "breadcrumb"}
-                  [:li (title-for programmes)]]
-                 (om/build table projects {:opts {:histkey :projects}})
+                 ;; [:div {:id "programmes"}
+                 ;;  [:h1 (:title data)]
+                 ;;  (om/build programmes-table programmes)]
+                 (om/build programmes-div programmes)
+
+                 ;; [:div {:id "projects"}
+                 ;;  [:h2 "Projects"]
+                 ;;  [:ul {:class "breadcrumb"}
+                 ;;   [:li (title-for programmes)]]
+                 ;;  (om/build table projects {:opts {:histkey :projects}})]
+                 (om/build projects-div tables)

                  [:h2  {:id "properties"} "Properties"]
                  [:ul {:class "breadcrumb"}


Add a select-box

Add a select-box

--- ui-gallery/desktop/src-common/ui_gallery/core.clj
+++ ui-gallery/desktop/src-common/ui_gallery/core.clj
@@ -16,8 +16,13 @@
                  [(ui/image "clojure.png")
                   :width 100
                   :height 100
-                  :space-top 50
-                  :space-bottom 50]
+                  :space-top 20
+                  :space-bottom 20]
+                 :row
+                 (ui/select-box ["I'm a select box"
+                                 "I am too"
+                                 "So am I"]
+                                ui-skin)
                  :row
                  (ui/label "I'm a label" ui-skin)
                  :row


Update mux namespace docs.

Update mux namespace docs.

--- src/multicodec/mux.clj
+++ src/multicodec/mux.clj
@@ -1,14 +1,6 @@
 (ns multicodec.mux
-  "A multiplexing logical codec which switches between multiple internal codecs
-  to read data. Uses internal functions to select codecs for reading and
-  writing.
-
-  - `codecs` is a map from header paths to codecs. Each codec should return a
-    path string when looking up `:header`.
-  - `select-encoder` takes the collection of codecs and the value to be encoded
-    and returns the selected codec to render the value with.
-  - `select-decoder` takes the collection of codecs and the header path and
-    returns the codec to use.
+  "A logical codec which multiplexes among a set of codecs to read data. It
+  uses internal functions to select codecs for reading and writing.

   By default, the first codec given is used for all encoding. The codec's
   `:header` is written first, then the codec is used to write the value.
@@ -18,7 +10,16 @@
   value from the remaining data.

   As a consequence, the delegated codecs _must not_ write or expect to consume
-  their own headers!"
+  their own headers!
+
+  To adjust this logic, set the codec's fields appropriately:
+
+  - `codecs` is a map from header paths to codecs. Each codec should return a
+    path string when looking up `:header`.
+  - `select-encoder` takes the collection of codecs and the value to be encoded
+    and returns the selected codec to render the value with.
+  - `select-decoder` takes the collection of codecs and the header path and
+    returns the codec to use."
   (:require
     [multicodec.core :as mc]
     [multicodec.header :as mh]))


add synth demo section

add synth demo section

--- ohack/src/ohack/core.clj
+++ ohack/src/ohack/core.clj
@@ -26,3 +26,34 @@
 (odoc odoc)

+;; so `synth` contains a bunch of instrument definitions that you can
+;; use already. you can try them by calling e.g.
+(synth/ping)
+
+;; some of them will fade away after a while.
+(synth/rise-fall-pad)
+
+;; some of them don't
+(synth/vintage-bass)
+
+;; in which case, stop(), i.e. overtone.live/stop(), switches off all sounds
+(stop)
+
+;; tip: C-M-x evals the expression (to the outermost surrounding
+;; expression!) that your cursor is /inside/, or /before/. To evaluate
+;; the expression that your cursor is /immdiately after/, use C-x-e
+
+;; other synths to try
+(comment
+  (synth/daf-bass)
+  (synth/buzz)
+  (synth/cs80lead)
+  (synth/ticker)
+  (synth/pad)
+  (synth/bass)
+  (synth/daf-bass)
+  (synth/grunge-bass)
+  (synth/ks1)
+
+  (stop)
+  )


Make `group-title` tag configurable through `with-options`.

--- src/om_forms/core.cljs
+++ src/om_forms/core.cljs
@@ -7,7 +7,8 @@

 (def ^:dynamic *options* {:form-horizontal    false
                           :label-column-class "col-sm-3"
-                          :input-column-class "col-sm-7"})
+                          :input-column-class "col-sm-7"
+                          :group-title {:tag :h2}})

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Implementation
@@ -119,8 +120,8 @@
   (apply input label placeholder cursor korks "password" opts))

 (defn group-title
-  [title & {:keys [class]}]
-  [:h2 {:class (str "group-title" (when class (str " " class)))} title])
+  [title & {:keys [class tag]}]
+  [(or tag (get-in *options* [:group-title :tag]) :h2) {:class (str "group-title" (when class (str " " class)))} title])

 (defn button
   [label on-click & {:keys [in-progress disabled] :as opts}]


year, month and date to search index

year, month and date to search index

--- src/ontrail/search.clj
+++ src/ontrail/search.clj
@@ -1,5 +1,5 @@
 (ns ontrail.search
-  (:use [ontrail mongodb utils exercise])
+  (:use [ontrail mongodb utils exercise formats])
   (:require [monger.collection :as mc]
             [monger.query :as mq]
             [clj-time.core :as time]
@@ -8,7 +8,7 @@
   (:import [org.bson.types ObjectId]))

 (def minimum-term-length 3)
-(def search-limit 100)
+(def search-limit 300)
 (def not-too-short-term? #(>= (count %) minimum-term-length))

 (def #^{:private true} logger (org.slf4j.LoggerFactory/getLogger (str *ns*)))
@@ -18,10 +18,13 @@

 (defn get-ex-terms [exercise]
   (let [part (partial get exercise)
-        words (.toLowerCase (str (part :user) " " (part :sport) " "
+        words (.toLowerCase (str "y:" (year (:creationDate exercise)) " "
+                                 "m:" (month (:creationDate exercise)) " "
+                                 "d:" (to-human-date (:creationDate exercise)) " "
+                                  (part :user) " " (part :sport) " "
                                  (part :body) " " (part :title) " "
                                  (tags-to-string (part :tags))))
-        clean-words (string/replace (strip-html words) #"[^a-zåäö0-9]+" " ")
+        clean-words (string/replace (strip-html words) #"[^a-zåäö#0-9]+" " ")
         bare-term-list (string/split clean-words #" +")]
     (filter not-too-short-term? bare-term-list))) ;; search terms must contain more than three letters, in order to ignore too common ones


Reduce/clarify lots of the debug logs

Reduce/clarify lots of the debug logs

--- src/potboiler/tree.clj
+++ src/potboiler/tree.clj
@@ -128,12 +128,12 @@
 )

 (defn send-to-node [db dest msgtype msg]
-  (log/infof "Sending %s %s" dest msgtype)
+  (log/debugf "Sending %s -> %s %s %s" (dbid db) dest msgtype msg)
   ((:send-to-node db) dest (assoc msg :sender (dbid db) :msgtype msgtype))
 )

 (defn send-to-client [db dest action data]
-  (log/infof "Sending %s %s" dest action data)
+  (log/debugf "Sending %s %s %s" dest action data)
   ((:send-to-client db) dest {:action action :data data})
 )

@@ -144,7 +144,7 @@
         storage {:hash valuehash :value canonvalue :parent oldmaster}
         masterhash (sha256 (str valuehash oldmaster))
         ]
-    (log/debugf "Adding '%s' resulting in new masterhash %s" value masterhash)
+    (log/debugf "%s: Adding '%s' resulting in new masterhash %s" (dbid db) value masterhash)
     (level/put (getdb db)
                masterhash (tostr storage)
                master masterhash)
@@ -169,7 +169,7 @@
     :current-master
       (if (-> (getobject db (:master msg)) nil? not)
         (do
-          (log/infof "Have master %s %s" (:master msg) msg)
+          (log/debugf "Have master %s %s" (:master msg) msg)
           (let [masterhash (masterkey db)]
             (-> (loop [msgs []
                    current masterhash]
@@ -189,7 +189,7 @@
                 )))
           )
         )
-        (log/errorf "Can't find master %s" (:master msg))
+        (log/errorf "%s: Can't find master %s" (dbid db) (:master msg))
       )
     (log/errorf "Unknown message type: %s %s" (:msgtype msg) msg)
   )


remove defunct patreon link

remove defunct patreon link

--- src/pronouns/pages.clj
+++ src/pronouns/pages.clj
@@ -102,10 +102,6 @@
          (twitter-name "morganastra")
          ", whose "
          (href "http://pronoun.is/ze/zir?or=she" "pronoun.is/ze/zir?or=she")]
-     [:p "Want to support this and similar websites? "
-         "Join us on "
-         (href "https://www.patreon.com/user?u=5238484" "Patreon")
-         "!"]
      [:p "pronoun.is is free software under the "
          (href "https://www.gnu.org/licenses/agpl.html" "AGPLv3")
          "! visit the project on "


Fix typo in doc string: it's to its

Fix typo in doc string: it's to its

--- src/re_frame/interceptor.cljc
+++ src/re_frame/interceptor.cljc
@@ -88,7 +88,7 @@
   through all interceptor functions.

   Generally speaking, an interceptor's `:before` function will (if present)
-  add to a `context's` `:coeffects`, while it's `:after` function
+  add to a `context's` `:coeffects`, while its `:after` function
   will modify the `context`'s `:effects`.  Very approximately.

   But because all interceptor functions are given `context`, and can


Story ID: RPC-236 print-diff is now ?print-diff commented it out as its currently redundant and needs to be upgraded

--- src/untangled_spec/report.clj
+++ src/untangled_spec/report.clj
@@ -38,7 +38,7 @@

       (throw (ex-info "invalid arrow" {:arrow arrow})))))

-(defn print-diff [act exp {:keys [raw-actual arrow]} print-fn]
+(defn ?print-diff [act exp {:keys [raw-actual arrow]} print-fn]
   (when (and (= arrow '=>)
              (coll? exp)
              (not (map? exp))
@@ -68,7 +68,7 @@
                  (when message (print-fn "ASSERTION:" message))
                  (print-fn "expected:" exp)
                  (print-fn "  actual:" act)
-                 (print-diff act exp test-result print-fn)
+                 ;(?print-diff act exp test-result print-fn)
                  (print-fn))
                (when true
                  ;TODO: ^true -> :key in config?


Add generator for Natural

Add generator for Natural

--- src/github_changelog/schema_generators.clj
+++ src/github_changelog/schema_generators.clj
@@ -10,7 +10,11 @@
 (def sha
   ((gen/fmap join) (check-generators/vector hexadecimal 40)))

-(def generators {schema/Sha sha})
+(def natural
+  (check-generators/choose 0 Long/MAX_VALUE))
+
+(def generators {schema/Sha sha
+                 schema/Natural natural})

 (defn generate [schema]
   (gen/generate schema generators))


Throw an exception if git checkout --orphan fails.

--- src/incise/deploy/workflows/git_branch.clj
+++ src/incise/deploy/workflows/git_branch.clj
@@ -36,8 +36,10 @@
   (contains? (git-branch-list *repo*) branch))

 (defn checkout-orphaned-branch [branch]
-  (sh "git checkout --orphan" branch)
-  (git-rm *repo* "."))
+  (let [{:keys [exit err]} (sh "git" "checkout" "--orphan" branch)]
+    (if (= 0 exit)
+      (git-rm *repo* ".")
+      (throw (RuntimeException. err)))))

 (defn setup-branch
   "Setup the given branch if it does not already exist and check it out."


update comment

update comment

--- src/clj/org/openforis/ceo/db/projects.clj
+++ src/clj/org/openforis/ceo/db/projects.clj
@@ -687,7 +687,8 @@
         (when-let [imagery-list (:projectImageryList params)]
           (call-sql "delete_project_imagery" project-id)
           (insert-project-imagery project-id imagery-list))
-        ;; FIXME: Old stored questions can have a different format than when passed from the UI.
+        ;; NOTE: Old stored questions can have a different format than when passed from the UI.
+        ;;       This is why we check the if the survey questions are different on the front (for now).
         (when update-survey
           (reset-collected-samples project-id))
         (data-response ""))


Fix logging.

Fix logging.

--- src/cljs/hatnik/web/client/z_actions.cljs
+++ src/cljs/hatnik/web/client/z_actions.cljs
@@ -109,9 +109,7 @@
   (let [{:keys [build schema]} (actions-config (:type data-pack))
         data (build data-pack)]
     (if (s/check schema data)
-      (do
-        (.log js/console (s/check schema data))
-        (msg/danger default-error-message))
+      (msg/danger default-error-message)
       (do
         (.modal ($ :#iModalAddAction) "hide")
         (ajax "/api/actions" "POST" data


mouse/x, mouse/y

mouse/x, mouse/y

--- src/cljx/jamesmacaulay/zelkova/mouse.cljx
+++ src/cljx/jamesmacaulay/zelkova/mouse.cljx
@@ -28,6 +28,12 @@
                 :event-sources {::position position-channel}))

 #+cljs
+(def x (z/lift first position))
+
+#+cljs
+(def y (z/lift second position))
+
+#+cljs
 (defn clicks-channel
   [graph opts]
   (let [dom-events (listen js/document "click")


CMR-736: Changed NRT aliasing.

CMR-736: Changed NRT aliasing.

--- src/cmr/indexer/data/concepts/keyword.clj
+++ src/cmr/indexer/data/concepts/keyword.clj
@@ -39,7 +39,7 @@
                 projects]} collection
         collection-data-type (if (and collection-data-type
                                       (some #{(str/lower-case collection-data-type)} nrt-aliases))
-                               nrt-aliases
+                               "nrt"
                                collection-data-type)
         project-long-names (map :long-name projects)
         project-short-names (map :short-name projects)


Refactor

Refactor

--- backend/src/akvo/lumen/lib/update.clj
+++ backend/src/akvo/lumen/lib/update.clj
@@ -17,20 +17,15 @@
 (hugsql/def-db-fns "akvo/lumen/lib/transformation.sql")
 (hugsql/def-db-fns "akvo/lumen/lib/dataset.sql")

-(defn columns-used-in-txs [initial-dataset-version latest-dataset-version]
-  (log/debug :columns (walk/keywordize-keys (:columns initial-dataset-version)))
-  (log/debug :all-txs (walk/keywordize-keys (:transformations latest-dataset-version)))
-  (let [res (loop [columns (-> initial-dataset-version :columns walk/keywordize-keys)
-                   txs (-> latest-dataset-version :transformations walk/keywordize-keys)
-                   cols0 #{}]
-              (let [tx (first txs)
-                    cols1 (apply  conj cols0 (engine/columns-used (first txs) columns))]
-                (if-let [txs (seq (next txs))]
-                  (recur (engine/undif-columns tx columns) txs cols1)
-                  cols1))
-              )]
-    (log/error :YUPIE res)
-    res))
+(defn- columns-used-in-txs [initial-dataset-version latest-dataset-version]
+  (loop [columns (-> initial-dataset-version :columns walk/keywordize-keys)
+         txs (-> latest-dataset-version :transformations walk/keywordize-keys)
+         cols0 #{}]
+    (let [tx (first txs)
+          cols1 (apply  conj cols0 (engine/columns-used (first txs) columns))]
+      (if-let [txs (seq (next txs))]
+        (recur (engine/undif-columns tx columns) txs cols1)
+        cols1))))

 (defn- successful-update
   "On a successful update we need to create a new dataset-version that
@@ -177,7 +172,3 @@
            (p/track error-tracker e)
            (log/error e))))
      (lib/ok {"updateId" job-execution-id}))))
-
-
-
-


API version of `relation` enforces intervals

This is so that expressions like `(relation (today) (tomorrow))` work.

--- src/tick/alpha/api.clj
+++ src/tick/alpha/api.clj
@@ -214,7 +214,10 @@
 (defn am [^LocalDate date] (interval/am date))
 (defn pm [^LocalDate date] (interval/pm date))

-(def relation interval/relation)
+(defn relation [i1 i2]
+  (interval/relation
+    (interval/interval i1)
+    (interval/interval i2)))

 (defn duration
   ([v]


Add test for dsl->logic not assuming hardcoded x

--- test/desdemona/query_test.clj
+++ test/desdemona/query_test.clj
@@ -61,6 +61,10 @@
   (is (= '(clojure.core.logic/featurec x {:ip "10.0.0.1"})
          (#'q/dsl->logic '(= (:ip x) "10.0.0.1"))
          (#'q/dsl->logic '(= "10.0.0.1" (:ip x)))))
+  (testing "logic variable is not hard coded to 'x"
+    (is (= '(clojure.core.logic/featurec y {:ip "10.0.0.1"})
+           (#'q/dsl->logic '(= (:ip y) "10.0.0.1"))
+           (#'q/dsl->logic '(= "10.0.0.1" (:ip y))))))
   (testing "logical conjunction"
     (is (= '(clojure.core.logic/conde
              [(clojure.core.logic/featurec x {:ip "10.0.0.1"})


if is more natural than if-not (in this case anyway).

--- src/overtunes/songs/canone_alla_quarta.clj
+++ src/overtunes/songs/canone_alla_quarta.clj
@@ -55,13 +55,13 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (defn run [[from to & tos]]
-    (if-not to
-      [from]
+    (if to
       (concat
         (if (<= from to)
           (range from to)
           (reverse (range (inc to) (inc from))))
-        (run (cons to tos)))))
+        (run (cons to tos)))
+      [from]))

 ;(demo# (map g-major
 ;            (run [0 3 1 3 -1 0])


Take 1000 mons.

Take 1000 mons.

--- src/wlmmap/handler.clj
+++ src/wlmmap/handler.clj
@@ -40,7 +40,7 @@
 (defn- generate-markers
   "return a string with the javascript code to generate addressPoints."
   [params]
-  (let [mons (take 100 (wcar* (car/smembers "frfr")))
+  (let [mons (take 1000 (wcar* (car/smembers "frfr")))
         all (remove #(nil? %)
                     (for [m mons]
                       (let [res (read-string (wcar* (car/get m)))


Save showing state for panel to localstorage


Trigger a single consolidation.

Trigger a single consolidation.

--- examples/src/test/clojure/stone/examples.clj
+++ examples/src/test/clojure/stone/examples.clj
@@ -26,7 +26,6 @@
 (st/publish wts now 1)
 (st/publish wts (+ now 1) 2)
 (st/publish wts (+ now 2) 3)
-(st/publish wts (+ now 3) 4)

 (println (take 2 (st/all storage)))
 (println (str "First timestamp stored " (st/end storage)))


Fail properly on unknown template

Fail properly on unknown template

--- lein-template/src/leiningen/new/modular.clj
+++ lein-template/src/leiningen/new/modular.clj
@@ -121,6 +121,10 @@
                        set)

          manifest (load-manifest (io/resource "manifest.edn") name)
+
+         _ (when-not (get-in manifest [:application-templates app-template :modules])
+             (throw (ex-info (format "No such template: %s" app-template)
+                             {:template app-template})))

          select-module?
          (fn [{:keys [module]}]


Remove dead code

Remove dead code

--- src/distributed_transducers_poc/trial.clj
+++ src/distributed_transducers_poc/trial.clj
@@ -14,18 +14,6 @@

 (defn word-frequency [text]
     (r/fold merge-counts count-words (clojure.string/split text #"\s+")))
-
-(defn- compute-next-row
-  [prev-row current-element other-seq pred]
-  (reduce
-    (fn [row [diagonal above other-element]]
-      (let [update-val
-            (if (pred other-element current-element)
-              diagonal
-              )]
-        (conj row update-val)))
-    [(inc (first prev-row))]
-    (map vector prev-row (next prev-row) other-seq)))

 (time (take 10 (doall (pmap #(clj-fuzzy.levensthein/distance "book" %) (clojure.string/split (slurp "resources/lilja.txt") #"\s+")))))


Solving 5.12

Solving 5.12

--- src/fpinscala/strictness_and_laziness.clj
+++ src/fpinscala/strictness_and_laziness.clj
@@ -199,15 +199,28 @@
 (defn unfold
   "Unfold for exercise 5.11"
   [z f]                                                     ;f produces both next value and next state
-  (let [val (f z)]
-    (when val
-      (cons val (lazy-seq (unfold val f))))))
-;fpins
+  (when-let [val (f z)]
+    (cons val (lazy-seq (unfold val f)))))
+;fpins
+(defn unfold-fpins
+  "Unfold for exercise 5.11"
+  [z f]                                                     ;f produces both next value and next state
+  (when-let [[h s] (f z)]
+    (cons h (lazy-seq (unfold-fpins s f)))))                      ;here is difference between mine and fpins :)
+;obviously I haven't fully comprehend point of unfold
+;and to use elements of "tuple" (vector in Clojure's case) appropriately
 ;-----------------------------------------------------------------------

 ;5.12
+;mine
 (defn fibs-via-unfold
   "Fibonacci sequence via unfold"
   []
   (cons 0 (map first (unfold [0 1] #(let [x0 (first %) x1 (second %)]
-                                     [x1 (+ x0 x1)])))))+                                     [x1 (+ x0 x1)])))))
+;fpins
+(defn fibs-via-unfold-fpins
+  "Fibonacci sequence via unfold by fpins"
+  []
+  (unfold-fpins [0 1] #(when-let [[f0 f1] %]
+                        [f0 [f1 (+ f0 f1)]])))


Trivial data export

Trivial data export


Grumble grumble

Grumble grumble

--- src/exploud/setup.clj
+++ src/exploud/setup.clj
@@ -30,7 +30,7 @@
   [server]
   (doto server
     (.setStopAtShutdown true)
-    (.setGracefulShutdown setup/shutdown-timeout)))
+    (.setStopTimeout setup/shutdown-timeout)))

 (defn start-server
   "Starts the server."


normalise-wall-move

normalise-wall-move


Add ns docstring

Add ns docstring

--- lein-light-nrepl/src/lighttable/nrepl/fs.clj
+++ lein-light-nrepl/src/lighttable/nrepl/fs.clj
@@ -1,6 +1,6 @@
 (ns lighttable.nrepl.fs
-  (:require
-    [clojure.java.io :as io]))
+  "Minimal implementation of fs 1.3.3"
+  (:require [clojure.java.io :as io]))

 (defn exists? [path]
   (.exists (io/file path)))


Add exif metadata extractor to project

Add exif metadata extractor to project

--- s3/project.clj
+++ s3/project.clj
@@ -17,6 +17,7 @@
                  [digest "1.4.4"]
                  [com.amazonaws/aws-java-sdk "1.10.17"]
                  [org.imgscalr/imgscalr-lib "4.2"]
+                 [social/exif-processor "0.1.2-socialsuperstore-SNAPSHOT"]
                  ]
   :plugins [[lein-ring "0.8.13"]]
   :ring {:handler s3.core/app}


improve logging

improve logging

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -78,7 +78,7 @@
       (when println? (println (str "grow at:" (morph-ps tree)
                                    "; frontier: " frontier-path
                                    "; looking for spec with "
-                                   "  cat:" (u/get-in child-spec [:synsem :cat]))))
+                                   "cat=" (u/get-in child-spec [:synsem :cat]))))
       (log/debug (str "grow at:" (morph-ps tree)))
       (lazy-cat
        (if (not (empty? frontier-path))


+fo-ps1

--- src/babel/italiano.cljc
+++ src/babel/italiano.cljc
@@ -3,7 +3,7 @@
   (:require
    [babel.engine :as engine]
    [babel.italiano.grammar :refer [small medium np-grammar]]
-   [babel.italiano.morphology :as morph]
+   [babel.italiano.morphology :as morph :refer [fo-ps1]]
    [babel.generate :as generate]
    [babel.over :as over]
    [babel.parse :as parse]


emit inducer name (when configured) prefixed with echo message

--- src/bract/core/echo.clj
+++ src/bract/core/echo.clj
@@ -14,6 +14,17 @@
     [bract.core Echo]))

+(def ^:dynamic *inducer-name* nil)
+
+
+(defmacro with-inducer-name
+  "Given an inducer name and body of code, evaluate the body of code in the context of the specified inducer name so
+  that it appears in all echo messages."
+  [inducer-name & body]
+  `(binding [*inducer-name* ~inducer-name]
+     ~@body))
+
+
 ;; ----- echo: diagnostics -----

@@ -22,6 +33,7 @@
   [x & more]
   (->> (cons x more)
     (string/join \space)
+    (str (when *module-name* (format "[%s] " *module-name*)))
     Echo/echo))


adding kvm env whitelist

adding kvm env whitelist

--- src/celestial/model.clj
+++ src/celestial/model.clj
@@ -54,7 +54,8 @@
 (def whitelist
   [[:proxmox :nodes] [:proxmox :ostemplates]
    [:docker :nodes] [:gce :ostemplates] [:digital-ocean]
-   [:vcenter :ostemplates] [:aws] [:physical] [:openstack]])
+   [:vcenter :ostemplates] [:aws] [:physical] [:openstack]
+   [:kvm :ostemplates] [:kvm :nodes]])

 (defn sanitized-envs
   "sanitized (from sensative data) environments "


binding nil to enable assertion

binding nil to enable assertion

--- src/celestial/model.clj
+++ src/celestial/model.clj
@@ -14,7 +14,7 @@
   (:require [celestial.common :refer (get!)]))

 (def ^{:doc "A local binding of current environment (used for hypervisors, provisioners etc..)" :dynamic true :private true}
-  env)
+  env nil)

 (defmacro set-env [e & body] `(binding  [env ~e] ~@body))


OM-659

--- src/cellophane/next.clj
+++ src/cellophane/next.clj
@@ -1192,11 +1192,17 @@
       ;; map case
       (if (= '[*] query)
         data
-        (let [{props false joins true} (group-by #(or (join? %) (ident? %)) query)
+        (let [{props false joins true} (group-by #(or (join? %)
+                                                      (ident? %)
+                                                      (and (seq? %)
+                                                           (ident? (first %))))
+                                         query)
               props (mapv #(cond-> % (seq? %) first) props)]
           (loop [joins (seq joins) ret {}]
             (if-not (nil? joins)
               (let [join        (first joins)
+                    join        (cond-> join
+                                  (seq? join) first)
                     join        (cond-> join (ident? join) (hash-map '[*]))
                     [key sel]   (join-entry join)
                     recurse?    (recursion? sel)


Adding updated concise_logs file to reflect changes in new plugins

Signed-off-by: trauf <b8cc4d695074a5c55e7046612ecaa2660307ac88@plumgrid.com>

--- plugins/concise_logs.clj
+++ plugins/concise_logs.clj
@@ -1,13 +1,12 @@
 (include "../pg_utils.clj")
-(require '[plugins.process-crash-relaunch :as PC]) ; TODO: Change it to PCR
-(require '[plugins.director-bootup-stage1 :as DBS1])
-(require '[plugins.director-bootup-stage2 :as DBS2])
-(require '[plugins.director-exit :as DE])
-(require '[plugins.edge-bootup :as EB])
-(require '[plugins.edge-reconnect :as ERC])
-(require '[plugins.resource-load :as RL])
+(require '[plugins.process_crash_relaunch :as PC]) ; TODO: Change it to PCR
+(require '[plugins.director_bootup_stage1 :as DBS1])
+(require '[plugins.director_bootup_stage2 :as DBS2])
+(require '[plugins.director_exit :as DE])
+(require '[plugins.edge_bootup :as EB])
+(require '[plugins.edge_reconnect :as ERC])
 (require '[plugins.ifup :as IFU])
-(require '[plugins.topo-load-via-cdb :as TLVCDB])
+(require '[plugins.topo_load_via_cdb :as TLVCDB])
 (require '[plugins.topo-load-via-api :as TLVAPI])

@@ -34,29 +33,26 @@
         (pg-stream
           (where (re-find #"RPCIF_system_manager.*|service_directory_.*|system_manager_.*|HealthMonitorProcessFailure.*" (:handler event))
             (where (re-find #"\[process_child_exit\]: .*|\[report_process_failure\]:.*|activate_service: .*|EVENT.*|\[service_has_recovered\].*|process_death.*" (:pgmsg event))
-              (PC/process-crash-relaunch)
-              )
-            (where (re-find #".* CPU load: .* Mem load: .*" (:pgmsg event))
-              (RL/resource-load)
+              (PC/process_crash_relaunch)
               )
             )
           (where (re-find #"service_directory_.*|RPCIF_service_directory.*|ServiceDirectory.*" (:handler event))
             (where (re-find #"\[init\]:.*|\[operator\(\)\]:.*|EVENT.*|init:.*" (:pgmsg event))
-              (DBS2/director-bootup-stage2)
+              (DBS2/director_bootup_stage2)
               )
             )
           (where (re-find #"SMLite_.*" (:handler event))
-            (DBS1/director-bootup-stage1)
+            (DBS1/director_bootup_stage1)
             (where (re-find #"\[child_exit_monitor\]: .*" (:pgmsg event))
-              (DE/director-exit)
+              (DE/director_exit)
               )
             )
           (where (re-find #"SELite_.*" (:handler event))
             (where (re-find #"\[SELite\]: .*|\[nos_monitor\]: .*|\[launch_sem\]: .*|\[rx_sm_msg_handler\]: .*" (:pgmsg event))
-              (EB/edge-bootup)
+              (EB/edge_bootup)
               )
             (where (re-find #"\[nos_monitor\]: .*|\[handle_nos_reconnect\]: .*|\[child_exit_monitor\]: .*|\[launch_sem\]: .*|\[rx_sm_msg_handler\]: .*" (:pgmsg event))
-              (ERC/edge-reconnect)
+              (ERC/edge_reconnect)
               )
             )
           (where (re-find #"RPCIF_.*|PE_.*|pem_helper_*" (:handler event))
@@ -66,7 +62,7 @@
             )
           (where (re-find #"RPCIF_.*|ConnectivityManager.*|cdb_.*" (:handler event))
             (where (re-find #"EVENT .*|Requesting cdb.*|Dom0::.*|request_config_post.*" (:pgmsg event))
-              (TLVCDB/topo-load-via-cdb)
+              (TLVCDB/topo_load_via_cdb)
               )
             )
 ;          (where (re-find #"rest_gateway_.*|ConnectivityManager.*|rest_gateway_.*" (:handler event))
@@ -80,25 +76,25 @@
     (expired
       #(prn "******* Expired1> ******** " %)
       (where (re-find #"process_crash_relaunch" (:plugin_type event))
-        (PC/process-crash-relaunch-expired)
+        (PC/process_crash_relaunch_expired)
         )
       (where (re-find #"director_bootup_stage1" (:plugin_type event))
-        (DBS1/director-bootup-stage1-expired)
+        (DBS1/director_bootup_stage1_expired)
         )
       (where (re-find #"director_bootup_stage2" (:plugin_type event))
-        (DBS2/director-bootup-stage2-expired)
+        (DBS2/director_bootup_stage2_expired)
         )
       (where (re-find #"edge_bootup" (:plugin_type event))
-        (EB/edge-bootup-expired)
+        (EB/edge_bootup_expired)
         )
       (where (re-find #"edge_reconnect" (:plugin_type event))
-        (ERC/edge-reconnect-expired)
+        (ERC/edge_reconnect_expired)
         )
       (where (re-find #"ifup" (:plugin_type event))
-        (IFU/ifup-expired)
+        (IFU/ifup_expired)
         )
       (where (re-find #"topo_load_via_cdb" (:plugin_type event))
-        (TLVCDB/topo-load-via-cdb-expired)
+        (TLVCDB/topo_load_via_cdb_expired)
         )
       )
     )


remove type hint for class on add-encoder as it won't compile in clojure 1.3

--- src/cheshire/custom.clj
+++ src/cheshire/custom.clj
@@ -159,7 +159,7 @@

    See encode-str, encode-map, etc, in the cheshire.custom
    namespace for encoder examples."
-  [^java.util.Class cls encoder]
+  [cls encoder]
   (extend cls
     Jable
     {:to-json encoder}))


some documentation

some documentation

I had written notes while figuring it all out.  Thought it might be
useful to others.  parse-args could probably use some refactoring or
at least renaming.  It's kicking off a fair number of things above and
beyond parsing args

--- src/clj/runbld/opts.clj
+++ src/clj/runbld/opts.clj
@@ -101,13 +101,17 @@
      "/etc/runbld/runbld.conf")))

 (s/defn assemble-all-opts :- java.util.Map
+  "Merge the options gathered from defaults, system config, the config
+  file specified on the command line, and any separate opts specified
+  by command line arguments"
   [{:keys [job-name] :as opts} :- {(s/required-key :job-name) s/Str
                                    s/Keyword s/Any}]
   (deep-merge-with deep-merge
                    config-file-defaults
                    (if (environ/env :dev)
                      (do
-                       (io/log "DEV enabled, not attempting to read" (str (system-config)))
+                       (io/log "DEV enabled, not attempting to read"
+                               (str (system-config)))
                        {})
                      (let [sys (system-config)]
                        (if (.isFile sys)
@@ -192,6 +196,14 @@
      filename)))

 (s/defn parse-args :- Opts
+  "Prepares the configuration/options for runbld.  This currently includes:
+  1. reading, parsing, validating the command line args
+  2. printing usage
+  3. gathering information about the JVM and the environment
+  4. connecting to and initializing ES
+  5. writing out the script file that will drive the build
+
+  And returning all of the useful information from the above."
   ([args :- [s/Str]]
    (let [{:keys [options arguments summary errors]
           :as parsed-opts} (cli/parse-opts args opts :nodefault true)]


Adapt `mouse-button` for use with p5js. Issue #255.

--- src/cljc/quil/core.cljc
+++ src/cljc/quil/core.cljc
@@ -2426,9 +2426,9 @@

        :cljs
        (condp = button-code
-         37 :left
-         39 :right
-         3  :center
+         (aget js/p5.prototype "LEFT") :left
+         (aget js/p5.prototype "RIGHT") :right
+         (aget js/p5.prototype "CENTER") :center
          nil))))

 (defn


* src/cljs/cljs/core.cljs: more cleanup. this does not work, we need to figure out how to pass "this" along as a real parameter.

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -1993,17 +1993,17 @@
   (-reduce [v f]
 	   (ci-reduce array f))
   (-reduce [v f start]
-	   (ci-reduce array f start)))
+	   (ci-reduce array f start))
+
+  IFn
+  (-invoke [coll k]
+    (-lookup coll k))
+  (-invoke [coll k not-found]
+    (-lookup coll k not-found)))

 (set! cljs.core.Vector/EMPTY (Vector. nil (array)))

 (set! cljs.core.Vector/fromArray (fn [xs] (Vector. nil xs)))
-
-(extend-type cljs.core.Vector
-  IFn
-  (-invoke
-    ([_ k] (-lookup (js* "this") k))
-    ([_ k not-found] (-lookup (js* "this") k not-found))))

 (defn vec [coll]
   (reduce conj cljs.core.Vector/EMPTY coll)) ; using [] here causes infinite recursion
@@ -2074,7 +2074,13 @@
   (-reduce [coll f]
     (ci-reduce coll f))
   (-reduce [coll f start]
-    (ci-reduce coll f start)))
+    (ci-reduce coll f start))
+
+  IFn
+  (-invoke [coll k]
+    (-lookup coll k))
+  (-invoke [coll k not-found]
+    (-lookup coll k not-found)))

 (defn subvec
   "Returns a persistent vector of the items in vector from
@@ -2086,12 +2092,6 @@
      (subvec v start (count v)))
   ([v start end]
      (Subvec. nil v start end)))
-
-(extend-type cljs.core.Subvec
-  IFn
-  (-invoke
-    ([_ k] (-lookup (js* "this") k))
-    ([_ k not-found] (-lookup (js* "this") k not-found))))

 ;;; PersistentQueue ;;;

@@ -2279,17 +2279,17 @@
         (.splice new-keys (scan-array 1 k new-keys) 1)
         (js-delete new-strobj k)
         (ObjMap. meta new-keys new-strobj))
-      coll))) ; key not found, return coll unchanged
+      coll)) ; key not found, return coll unchanged
+
+  IFn
+  (-invoke [coll k]
+    (-lookup coll k))
+  (-invoke [coll k not-found]
+    (-lookup coll k not-found)))

 (set! cljs.core.ObjMap/EMPTY (ObjMap. nil (array) (js-obj)))

 (set! cljs.core.ObjMap/fromObject (fn [ks obj] (ObjMap. nil ks obj)))
-
-(extend-type cljs.core.ObjMap
-  IFn
-  (-invoke
-    ([_ k] (-lookup (js* "this") k))
-    ([_ k not-found] (-lookup (js* "this") k not-found))))

 ; The keys field is an array of all keys of this map, in no particular
 ; order. Each key is hashed and the result used as a property name of
@@ -2377,7 +2377,13 @@
             (let [new-bucket (aclone bucket)]
               (.splice new-bucket i 2)
               (aset new-hashobj h new-bucket)))
-          (HashMap. meta (dec count) new-hashobj))))))
+          (HashMap. meta (dec count) new-hashobj)))))
+
+  IFn
+  (-invoke [coll k]
+    (-lookup coll k))
+  (-invoke [coll k not-found]
+    (-lookup coll k not-found)))

 (set! cljs.core.HashMap/EMPTY (HashMap. nil 0 (js-obj)))

@@ -2387,12 +2393,6 @@
       (if (< i len)
         (recur (inc i) (assoc out (aget ks i) (aget vs i)))
         out)))))
-
-(extend-type cljs.core.HashMap
-  IFn
-  (-invoke
-    ([_ k] (-lookup (js* "this") k))
-    ([_ k not-found] (-lookup (js* "this") k not-found))))

 (defn hash-map
   "keyval => key val
@@ -2494,15 +2494,15 @@

   ISet
   (-disjoin [coll v]
-    (Set. meta (dissoc hash-map v))))
+    (Set. meta (dissoc hash-map v)))
+
+  IFn
+  (-invoke [coll k]
+    (-lookup coll k))
+  (-invoke [coll k not-found]
+    (-lookup coll k not-found)))

 (set! cljs.core.Set/EMPTY (Set. nil (hash-map)))
-
-(extend-type cljs.core.Set
-  IFn
-  (-invoke
-    ([_ k] (-lookup (js* "this") k))
-    ([_ k not-found] (-lookup (js* "this") k not-found))))

 (defn set
   "Returns a set of the distinct elements of coll."


Revert unintended change to string-print (from merge 188e835)

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -2301,7 +2301,7 @@
 ; This should be different in different runtime environments. For example
 ; when in the browser, could use console.debug instead of print.
 (defn string-print [x]
-  (goog.global/print x)
+  (js* "print(~{x})")
   nil)

 (defn flush [] ;stub


* src/cljs/cljs/core.cljs: instance? should always return true for js/Object unless o is null or undefined

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -609,7 +609,7 @@
   (js* "(void 0 === ~{x})"))

 (defn instance? [t o]
-  (js* "((~{o} instanceof ~{t}) || (~{o}.constructor === ~{t}))"))
+  (js* "(~{o} != null && (~{o} instanceof ~{t} || ~{o}.constructor === ~{t} || ~{t} === Object))"))

 (defn seq?
   "Return true if s satisfies ISeq"