Replace use of `interval` (lossy) with type preserving narrow

--- src/tick/interval.clj
+++ src/tick/interval.clj
@@ -87,6 +87,7 @@
 ;; [t1 t0] interval between t0 and t1
 ;; [t0 d] interval between t0 and t0+d, where d is a given duration
 ;; [d t1] interval between t1-d and t1, where d is a given duration
+
 (defn interval
   [a b]
   (cond
@@ -516,7 +517,7 @@
            \F (recur
                 (next xs)
                 (next ys)
-                (clojure.core/conj result y))
+                (clojure.core/conj result (narrow x (t/beginning y) (t/end y))))
            \o (recur
                 (cons (narrow x (t/beginning y) (t/end x)) (next xs))
                 (cons (narrow y (t/end x) (t/end y)) (next ys))
@@ -570,12 +571,11 @@
              (\P \M) (recur xs (next ys) result)
              (\f \d \e) (recur (next xs) (next ys) result)
              \s (recur (next xs) ys result)
-             (\S \O) (recur (cons (interval (t/end y) (t/end x)) (next xs)) (next ys) result)
+             (\S \O)
+             (recur (cons (narrow x (t/end y) (t/end x)) (next xs)) (next ys) result)
              \F (recur (next xs) (next ys) (clojure.core/conj result (narrow x (t/beginning x) (t/beginning y))))
              \o (recur (next xs) ys (clojure.core/conj result (narrow x (t/beginning x) (t/beginning y))))
-             ;; TODO: Replace interval (lossy) with type
-             ;; preserving choice of IIntervalOps operation
-             \D (recur (cons (interval (t/end y) (t/end x)) (next xs))
+             \D (recur (cons (narrow x (t/end y) (t/end x)) (next xs))
                        (next ys)
                        (clojure.core/conj result (narrow x (t/beginning x) (t/beginning y))))))
          (apply clojure.core/conj result xs))


Add /ping resource in the standard place

--- src/tyranitar/web.clj
+++ src/tyranitar/web.clj
@@ -167,6 +167,10 @@
             []
             applications-routes))

+  (GET "/ping"
+       []
+       (response "pong" "text/plain" 200))
+
   (GET "/healthcheck"
        []
        (let [healthcheck-result (healthcheck)


model: Use new 'inbox' table.

model: Use new 'inbox' table.

--- src/pepa/model.clj
+++ src/pepa/model.clj
@@ -255,15 +255,15 @@
 (defn inbox
   "Returns a vector of pages in the Inbox."
   [db]
-  (vec (db/query db (db/sql+placeholders
-                     "SELECT p.id, p.file, p.number
-                      FROM pages AS p
-                      LEFT JOIN document_pages AS dp
-                        ON dp.page = p.id
-                      GROUP BY p.id, p.file, p.number, dp.page
-                        HAVING dp.page IS NULL AND (SELECT origin FROM files WHERE id = p.file) IN (%s)
-                      ORDER BY p.file, p.number"
-                     (inbox-origins db)))))
+  (vec (db/query db ["SELECT p.id, p.file, p.number
+                      FROM inbox AS i
+                      LEFT JOIN pages AS p
+                        ON i.page = p.id"])))
+
+(defn add-to-inbox!
+  "Unconditionally adds PAGES to inbox."
+  [db pages]
+  (db/insert-coll! db :inbox (for [id pages] {:page id})))

 ;;; TODO(mu): We need to cache this stuff.
 ;;; TODO(mu): We need to handle (= document file) more efficient


Une nouvelle solution à RNA Transcription de Exercism dans la track Clojure

--- exercism/clojure/rna-transcription/src/rna_transcription.clj
+++ exercism/clojure/rna-transcription/src/rna_transcription.clj
@@ -3,12 +3,9 @@
 (def nucleotide-transcription-map {\A \U \T \A \C \G \G \C})

 (defn transcribe [nucleotide]
-  (if (contains? nucleotide-transcription-map nucleotide )
-    (get nucleotide-transcription-map nucleotide)
-    (throw (AssertionError. "The provided nucleotide does not exist"))
-    )
-  )
+  (doto
+   (nucleotide-transcription-map nucleotide)
+    (assert)))

 (defn to-rna [dna]
-  (apply str (map rna-transcription/transcribe dna)))
-
+  (apply str (map rna-transcription/transcribe dna)))


Minor.

Minor.

--- src/fhofherr/clj_db_util/transactions.clj
+++ src/fhofherr/clj_db_util/transactions.clj
@@ -3,7 +3,7 @@
             [fhofherr.clj-db-util.db :as db-repr]))

 ;; Wrapper for a transaction. `op` is a function of one argument returning
-;; a map {::connection con ::value v}. The argument to `op` is the database
+;; a map {::db con ::value v}. The argument to `op` is the database
 ;; currently in use.
 (defrecord Transaction [op])

@@ -13,7 +13,9 @@
 (defmacro deftx
   "Define a function that creates a transaction. The first entry of the
   definitions argument vector will be bound to the database used during the
-  execution of the transaction. Further arguments are optional."
+  execution of the transaction. Further arguments are optional. While
+  the resulting functions have access to the object representing the database
+  any modifications they make to it will be lost."
   {:arglists '([fn-name [db & args] & body]
                [fn-name doc-string [db & args] & body])}
   [fn-name & body]
@@ -26,7 +28,7 @@
     `(defn ~fn-name {:doc ~doc-string}
        [~@(rest args)]
        (Transaction. (fn [~(first args)]
-                       {::connection ~(first args)
+                       {::db ~(first args)
                         ::value (do ~@(seq decls))})))))

 (defmacro deftx-
@@ -52,7 +54,7 @@
   [db v]
   v)

-;; Can't use deftx here as we need to return con* for the ::connection.
+;; Can't use deftx here as we need to return con* for the ::db.
 ;; If we would use deftx con would be returned.
 (defn tx-bind
   "Take a transacton `tx` containting a value `v` and a function `f` of
@@ -66,12 +68,21 @@
   [tx f]
   (Transaction. (fn [db]
                   (if-not (jdbc/db-is-rollback-only (db-repr/db-spec db))
-                    (let [{db* ::connection v ::value} ((:op tx) db)
+                    (let [{db* ::db v ::value} ((:op tx) db)
                           tx* (f v)]
                       (if-not (jdbc/db-is-rollback-only (db-repr/db-spec db*))
                         ((:op tx*) db*)
-                        {::connection db* ::value nil}))
-                    {::connection db ::value nil}))))
+                        {::db db* ::value nil}))
+                    {::db db ::value nil}))))
+
+(defn tx-exec
+  "Execute the transaction `tx` in the database represented by `db-spec`.
+  The `dialect` is added for convenience since some database functions need it
+  to perform their tasks (this might not be a good idea, in which case I'll
+  remove the dialect)."
+  [db tx]
+  (jdbc/with-db-transaction [db* (db-repr/db-spec db)]
+    (::value ((:op tx) (db-repr/from-db-spec (db-repr/dialect db) db*)))))

 (deftx tx-rollback
   "Rollback the transaction. Further steps won't be executed."
@@ -119,15 +130,6 @@
     `(-> ~first-tx-expr
          ~@(emit-tx-steps reordered-bindings last-exprs))))

-(defn tx-exec
-  "Execute the transaction `tx` in the database represented by `db-spec`.
-  The `dialect` is added for convenience since some database functions need it
-  to perform their tasks (this might not be a good idea, in which case I'll
-  remove the dialect)."
-  [db tx]
-  (jdbc/with-db-transaction [db* (db-repr/db-spec db)]
-    (::value ((:op tx) (db-repr/from-db-spec (db-repr/dialect db) db*)))))
-
 (defmacro tx-exec->
   "Like [[tx->]] but immediately call [[tx-exec]] on the result."
   [db bindings & last-exprs]


volume plugin preload FE

volume plugin preload FE

#65

--- src/cljs/swarmpit/component/volume/create.cljs
+++ src/cljs/swarmpit/component/volume/create.cljs
@@ -13,6 +13,15 @@

 (def cursor [:page :volume :form])

+(defonce volume-plugins (atom []))
+
+(defn volume-plugin-handler
+  []
+  (handler/get
+    (routes/path-for-backend :plugin-volume)
+    {:on-success (fn [response]
+                   (reset! volume-plugins response))}))
+
 (defn- form-name [value]
   (comp/form-comp
     "NAME"
@@ -24,17 +33,18 @@
        :onChange (fn [_ v]
                    (state/update-value [:volumeName] v cursor))})))

-(defn- form-driver [value]
+(defn- form-driver [value plugins]
   (comp/form-comp
     "DRIVER"
     (comp/select-field
       {:value    value
        :onChange (fn [_ _ v]
                    (state/update-value [:driver] v cursor))}
-      (comp/menu-item
-        {:key         "fdi1"
-         :value       "local"
-         :primaryText "local"}))))
+      (->> plugins
+           (map #(comp/menu-item
+                   {:key         %
+                    :value       %
+                    :primaryText %}))))))

 (defn- create-volume-handler
   []
@@ -63,7 +73,8 @@

 (rum/defc form < rum/reactive
                  init-state-mixin []
-  (let [{:keys [volumeName
+  (let [plugins (rum/react volume-plugins)
+        {:keys [volumeName
                 driver
                 isValid]} (state/react cursor)]
     [:div
@@ -84,4 +95,4 @@
          {:onValid   #(state/update-value [:isValid] true cursor)
           :onInvalid #(state/update-value [:isValid] false cursor)}
          (form-name volumeName)
-         (form-driver driver))]]]))+         (form-driver driver plugins))]]]))


Fix a couple of reflection warnings

Fix a couple of reflection warnings

--- src/clojure/clojurewerkz/cassaforte/client.clj
+++ src/clojure/clojurewerkz/cassaforte/client.clj
@@ -149,7 +149,7 @@
     (when load-balancing-policy
       (.withLoadBalancingPolicy builder load-balancing-policy))
     (when compression
-      (.withCompression (select-compression compression)))
+      (.withCompression builder (select-compression compression)))
     (when ssl
       (.withSSL builder (build-ssl-options ssl)))
     (when ssl-options
@@ -251,11 +251,10 @@
   ;; TODO: matching
   (if (map? values)
     (.bind statement (to-array (vals values)))
-    (.bind statement (to-array values))
-    ))
+    (.bind statement (to-array values))))

 (defn prepare
-  [session statement]
+  [^Session session  statement]
   (.prepare session statement))

 ;; (defn execute-async)
@@ -276,7 +275,7 @@
                                      default-timestamp]}]
    (let [^Statement built-statement (build-statement query)]
      (when default-timestamp
-       (.setDefaultTimestamp built-statement))
+       (.setDefaultTimestamp built-statement default-timestamp))
      (when enable-tracing
        (.enableTracing built-statement))
      (when fetch-size


Remove duplicate log entry

Remove duplicate log entry

--- src/puppetlabs/trapperkeeper/internal.clj
+++ src/puppetlabs/trapperkeeper/internal.clj
@@ -622,10 +622,9 @@
       (a/stop [this throw?]
         (let [errors (shutdown! app-context)]
           (if (and throw? (seq errors))
-            (let [msg (i18n/trs "Error during app shutdown!")
-                  e (ex-info msg {:errors errors})]
-              (log/error e msg)
-              (throw e))
+            (let [msg (i18n/trs "Error during app shutdown!")]
+              (log/error msg)
+              (throw (ex-info msg {:errors errors})))
             this)))
       (a/restart [this]
         (try


Remove the entry when an in valid value is given.

--- src/fm/simrunner/config.clj
+++ src/fm/simrunner/config.clj
@@ -98,8 +98,9 @@

 (defn with-value [config param-id value]
   (if-let [param-def (get param-defs param-id)]
-    (when-let [value (param-value param-id value)]
-      (assoc config param-id value))
+    (if-let [value (param-value param-id value)]
+      (assoc config param-id value)
+      (dissoc config param-id))
     (throw (IllegalArgumentException.
              (format "Undefined config parameter: '%s'!" param-id)))))


repl can create todos and notes

repl can create todos and notes

--- src/todos/core.clj
+++ src/todos/core.clj
@@ -2,7 +2,8 @@
   (:gen-class)
   (:require [todos.input :as inp])
   (:require [todos.todo-item :as t-item])
-  (:require [todos.storage :as storage]))
+  (:require [todos.storage :as storage])
+  (:require [clojure.string :as stri]))

 (defn demo
   "This is currently just a demo!"
@@ -36,12 +37,17 @@
   (do
     (doseq [i @current-stack]
       (println (format "> %s <" ((i :name)) )))
-    (let [[cmd & args] (inp/user-cmd-input ">> ")]
+    (let [[cmd & args] (inp/user-cmd-input ">> ")
+          current-todo (or (first @current-stack) todolist)]
       (cond
         (= cmd "ls")
-        (( ;evaluate the print of current todolist
-          (or (first @current-stack) todolist)
-          :print) "")
+        ((current-todo :print) "")
+        ;
+        (= cmd "create")
+        ((current-todo :todo-add) (t-item/todo-create (stri/join " " args)))
+        ;
+        (= cmd "note")
+        ((current-todo :note-add) (stri/join " " args))
         )
       ; exit clause
       (if (not= cmd "exit")


combineTiles.clj: started writing the backtracker

--- clojure/org/gavrog/clojure/combineTiles.clj
+++ clojure/org/gavrog/clojure/combineTiles.clj
@@ -16,14 +16,30 @@
   (for [orb (partition-by-automorphism-group ds)]
     (canonical ds (first orb))))

-(defn- signatures [ds]
-  (into {} (for [orb (partition-by-automorphism-group ds)
-                 :let [inv (invariant ds (first orb))],
-                 D orb]
-             [D inv])))
+(defn- signatures [ds, idcs]
+  (into {} (for [D (orbit-reps ds idcs)
+                 :let [sub (orbit ds idcs D)]
+                 block (partition-by-automorphism-group sub)
+                 :let [inv (invariant sub (first block))],
+                 E block]
+             [E inv])))

 (defn combine-tiles [ds]
-  (make-backtracker
-    {:root []
-     :extract (fn [[]])
-     :children (fn [[]])}))
+  (let [d (dim ds)
+        face-idcs (range d)
+        counts (components-with-multiplicities ds)
+        parts (keys counts)
+        forms (into {} (for [sub parts] [sub (inequivalent-forms sub)]))
+        sigs (into {} (for [sub parts] [sub (signatures sub face-idcs)]))]
+    (make-backtracker
+      {:root (let [sub (first parts)]
+               [sub
+                (sigs sub)
+                (orbit-reps sub face-idcs)
+                (assoc counts sub (dec (counts sub)))])
+       :extract (fn [[symbol _ free-elements free-components]]
+                  (when (and (empty? free-elements)
+                             (every? (comp zero? second) free-components)
+                             (canonical? symbol))
+                    symbol))
+       :children (fn [[]])})))


Add Eastwood to Clojure plugins

Add Eastwood to Clojure plugins

--- clojure/lein.symlink/profiles.clj
+++ clojure/lein.symlink/profiles.clj
@@ -7,7 +7,8 @@
                   [lein-cloverage "1.0.2"]
                   [lein-marginalia "0.7.1"]
                   [lein-swank "1.4.4"]
-                  [lein-kibit "0.0.8"]]
+                  [lein-kibit "0.0.8"]
+                  [jonase/eastwood "0.0.2"]]

         :injections [(let [orig (ns-resolve (doto 'clojure.stacktrace require)
                                             'print-cause-trace)


Fix wrong derefs

Fix wrong derefs

Signed-off-by: Eric Dvorsak <96f164ad4d9b2b0dacf8ebee2bb1eeb3aa69adf1@dvorsak.fr>

--- src/status_im/chat/views/input/input.cljs
+++ src/status_im/chat/views/input/input.cljs
@@ -35,7 +35,7 @@
       :on-submit-editing      (fn [e]
                                 (if single-line-input?
                                   (re-frame/dispatch [:send-current-message])
-                                  (.setNativeProps @input-ref (clj->js {:text input-text}))))
+                                  (.setNativeProps input-ref (clj->js {:text input-text}))))
       :on-layout              (fn [e]
                                 (set-container-width-fn (.-width (.-layout (.-nativeEvent e)))))
       :on-change              (fn [e]
@@ -125,7 +125,7 @@
                                   :editable            true
                                   :on-submit-editing   (fn []
                                                          (when-not (or (string/blank? seq-arg-input-text)
-                                                                       (get-in @command [:command :hide-send-button]))
+                                                                       (get-in command [:command :hide-send-button]))
                                                            (re-frame/dispatch [:send-seq-argument]))
                                                          (utils/set-timeout
                                                            #(re-frame/dispatch [:chat-input-focus :seq-input-ref])


Add pom to jar instead of writing to file separately

If a separate file is required then it can be done in the pom middleware
or elsewhere. The pom.xml can be extracted from the jar to stdout via:

$ unzip -q -c <jarfile> META-INF/maven/<group-id>/<artifact-id>/pom.xml

--- src/tailrecursion/boot/middleware/jar.clj
+++ src/tailrecursion/boot/middleware/jar.clj
@@ -43,11 +43,17 @@
       (doseq [f (.listFiles src)] (add! target base f))
       (doto target (.putNextEntry (ent base src)) (write! src) (.closeEntry)))))

+(defn- artifact-info [pom]
+  (when (and (:project pom) (:version pom))
+    (let [p (cycle (split (str (:project pom)) #"/"))]
+      {:group-id    (first p)
+       :artifact-id (second p)
+       :version     (:version pom)
+       :pom-xml     (:xml pom)})))
+
 (defn jar [handler]
   (fn [spec]
-    (let [artifact-id (when-let [p (name (get-in spec [:pom :project]))]
-                        (clojure.string/replace p #"^[^/]*/" ""))
-          version     (get-in spec [:pom :version])
+    (let [{:keys [artifact-id group-id version pom-xml]} (artifact-info (:pom spec))
           jar-name    (str (if artifact-id (str artifact-id "-" version) "out") ".jar")
           jspec       (merge-with
                         (comp (partial some identity) vector)
@@ -57,9 +63,13 @@
           directories (->> (get-in spec [:boot :directories])
                         (union (:resources jspec))
                         (map file))
+          pom-dir     (mkdir ::pom)
           manifest    (make-manifest (:main jspec) (:manifest jspec))]
       (with-open [j (JarOutputStream. (output-stream jar-file) manifest)]
+        (when pom-xml
+          (let [pom-path ["META-INF" "maven" group-id artifact-id "pom.xml"]
+                pom-file (doto (apply file pom-dir pom-path) make-parents)]
+            (spit pom-file pom-xml)
+            (add! j pom-dir pom-dir)))
         (doseq [d directories] (add! j d d)))
-      (when-let [pom (get-in spec [:pom :xml])]
-        (spit (file (:output-dir jspec) "pom.xml") pom))
       (handler (assoc spec :jar jspec)))))


:pencil2: Use correct i18n key for strokes

Signed-off-by: mathieu.brunot <cbb78c9d6ecc8139b4697c3352cc1f1edbdf61d7@monogramm.io>

--- frontend/src/uxbox/main/ui/workspace/sidebar/options.cljs
+++ frontend/src/uxbox/main/ui/workspace/sidebar/options.cljs
@@ -62,7 +62,7 @@
     :id ::fill
     :icon i/fill
     :comp options-fill/fill-menu}
-   {:name (tr "element.fill")
+   {:name (tr "element.stroke")
     :id ::stroke
     :icon i/stroke
     :comp options-stroke/stroke-menu}


Use proper config for database initialization.

--- backend/src/uxbox/db.clj
+++ backend/src/uxbox/db.clj
@@ -49,7 +49,7 @@
     (hikari/make-datasource dbconf)))

 (defstate datasource
-  :start (create-datasource (:database cfg/config))
+  :start (create-datasource cfg/config)
   :stop (hikari/close-datasource datasource))

 ;; --- Suricatta Async Adapter


CMR-8093 - updating log so that ops can observe and confirm the override setting without needed to ask for help (#1520)

--- transmit-lib/src/cmr/transmit/kms.clj
+++ transmit-lib/src/cmr/transmit/kms.clj
@@ -64,12 +64,14 @@
    Return value is the KMS schema override map as configured in AWS as
    CMR_KMS_SCHEMA_OVERRIDE_JSON."
   []
-  (try
-    (json/parse-string (config/kms-scheme-override-json) true)
-    (catch com.fasterxml.jackson.core.JsonParseException e
-      (error "Failed to parse Scheme Override JSON while loading KMS resource [%s]: %s",
-             (config/kms-scheme-override-json)
-             (.getMessage e)))))
+  (let [overrides (config/kms-scheme-override-json)]
+    (debug (format "Requested KMS schema overrides: %s." overrides))
+    (try
+      (json/parse-string overrides true)
+      (catch com.fasterxml.jackson.core.JsonParseException e
+        (error "Failed to parse Scheme Override JSON while loading KMS resource [%s]: %s",
+               (config/kms-scheme-override-json)
+               (.getMessage e))))))

 ;; These are the default locations in KMS for all supported schemes
 (def keyword-scheme->gcmd-resource-name


rm dummy test

rm dummy test

--- test/dalap/test/core.clj
+++ test/dalap/test/core.clj
@@ -1,6 +1,3 @@
 (ns dalap.test.core
   (:use [dalap.core])
   (:use [clojure.test]))
-
-(deftest replace-me ;; FIXME: write
-  (is false "No tests have been written."))


Whitespace.

Whitespace.

--- modules/core/src/main/clojure/immutant/runtime/bootstrap.clj
+++ modules/core/src/main/clojure/immutant/runtime/bootstrap.clj
@@ -26,9 +26,9 @@
            [java.util ArrayList]))

 (extend-type org.jboss.modules.ModuleClassLoader
-    pomegranate/URLClasspath
-    (can-modify? [this] false)
-    (add-url [this _]))
+  pomegranate/URLClasspath
+  (can-modify? [this] false)
+  (add-url [this _]))

 (defn ^{:private true} stringify-symbol
   "Turns a symbol into a namspace/name string."
@@ -84,7 +84,7 @@
                     (let [path (project key)]
                       (concat acc (if (coll? path)
                                     path
-                                         (vector path)))))
+                                    (vector path)))))
                   []
                   [:resources-path ;; lein1
                    :resource-paths ;; lein2


Added a seq of scales for the leader so far, but commented it out as I haven't gotten it working with bass or the follower.

--- src/overtunes/songs/canone_alla_quarta.clj
+++ src/overtunes/songs/canone_alla_quarta.clj
@@ -15,7 +15,7 @@
 (defn modulate [scale mode] (translate scale mode (- (scale 0) (scale mode))))
 (def g-major (translate major 0 74))
 (def scales (repeat (modulate g-major 0)))
-;(def scales (repeat g-major))
+;(def scales (concat (repeat 9 g-major) (repeat 23 (modulate g-major 3)) (repeat 6 (modulate g-major 4)) (repeat g-major)))

 (defn bpm [per-minute] #(-> % (/ per-minute) (* 60) (* 1000)))
 (defn syncopate [timing durations] #(->> % (sum-n durations) timing))


Added structure heading.

Added structure heading.


logging

logging

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -98,12 +98,16 @@
   [language-model spec depth total-depth
                        & {:keys [max-total-depth]
                           :or {max-total-depth max-total-depth}}]
+  (log/debug (str "lightning-bolt with depth:" depth " and spec:" (strip-refs spec)))
   (let [grammar (:grammar language-model)
         depth (if depth depth 0)
         ;; this is the relative depth; that is, the depth from the top of the current lightning bolt.
         ;; total-depth, on the other hand, is the depth all the way to the top of the entire
         ;; expression, which might involve several parent lightning bolts.
-        parents (shuffle (candidate-parents grammar spec))]
+        parents
+        (let [parents (shuffle (candidate-parents grammar spec))]
+          (log/debug (str "candidate-parents:" (string/join "," (map :rule parents))))
+          parents)]
     (let [lexical ;; 1. generate list of all phrases where the head child of each parent is a lexeme.
           (when (= false (get-in spec [:head :phrasal] false))
             (lazy-mapcat
@@ -111,10 +115,16 @@
                (log/debug (str "parent: " (:rule parent) " over lexical heads."))
                (let [lexicon (or (:lexicon (:generate language-model)) (:lexicon language-model))
                      subset (if-let [index-fn (:index-fn language-model)]
-                              (index-fn (get-in parent [:head] :top))
+                              (do
+                                (log/debug (str "using index to find lexical heads for parent:"
+                                                (:rule parent)))
+                                (index-fn (get-in parent [:head] :top)))
                               (flatten (vals lexicon)))]
                  (let [result
-                       (mapcat #(over/overh parent %)
+                       (mapcat #(do
+                                  (log/debug (str "trying parent: " (:rule parent) " with lexical head:"
+                                                  ((:morph language-model) %)))
+                                  (over/overh parent %))
                                (shuffle subset))]
                    (if (and (not (empty? subset)) (empty? result)
                             (> (count subset)
@@ -218,11 +228,15 @@
      truncate-children max-total-depth top-level-spec)))

 (defn do-defaults [tree language-model]
+  (log/debug (str "calling do-defaults on tree:" ((:morph language-model) tree)))
   (if-let [default-fn (:default-fn language-model)]
-    (default-fn tree)
+    (let [result
+          (default-fn tree)]
+      (log/debug (str "result of calling do-defaults on tree:" ((:morph language-model) result)))
+      result)
     ;;
     (do
-      (log/info (str "language-model has no default function."))
+      (log/trace (str "language-model has no default function."))
       tree)))

 (defn add-complement-to-bolt [bolt path language-model total-depth top-level-spec
@@ -349,7 +363,7 @@
   (let [result
         (filter not-fail?
                 (mapfn (fn [rule]
-                         (log/trace (str "candidate-parents: rule: " (:rule rule)))
+                         (log/trace (str "candidate-parents: testing rule: " (:rule rule)))
                          (if (and (not-fail? (unify (get-in rule [:synsem :cat] :top)
                                                     (get-in spec [:synsem :cat] :top)))
                                   (not-fail? (unify (get-in rule [:synsem :infl] :top)
@@ -390,7 +404,7 @@
     (if (> max-total-depth 0)
       (let [prob (- 1.0 (/ (- max-total-depth depth)
                            max-total-depth))]
-        (log/trace (str "P(c," depth ") = " prob " (c: probablity of choosing lexemes rather than phrases given a depth)."))
+        (log/trace (str "P(c," depth ") = " prob " (c: probability of choosing lexemes rather than phrases given depth " depth ")"))
         (> (* 10 prob) (rand-int 10)))
       false)))


+(defn lazy-mapcat); greatly improving generation speed

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -81,6 +81,14 @@
                       path-vals))]
     (deserialize truncated-serialized)))

+;; Thanks to http://clojurian.blogspot.com.br/2012/11/beware-of-mapcat.html
+(defn lazy-mapcat  [f coll]
+  (lazy-seq
+   (if (not-empty coll)
+     (concat
+      (f (first coll))
+      (lazy-mapcat f (rest coll))))))
+
 (defn generate [spec grammar lexicon index morph]
   (cond (or (vector? spec)
             (seq? spec))
@@ -88,12 +96,12 @@
           (log/debug (str "generating from " (count spec) " spec(s)"))
           (let [expression
                 (first (take 1
-                             (mapcat (fn [each-spec]
-                                       (log/info (str "generate: generating from spec: "
-                                                      each-spec))
-                                       (let [expressions
-                                             (generate-all each-spec grammar lexicon index morph)]
-                                         expressions))
+                             (lazy-mapcat (fn [each-spec]
+                                           (log/info (str "generate: generating from spec: "
+                                                          each-spec))
+                                           (let [expressions
+                                                 (generate-all each-spec grammar lexicon index morph)]
+                                             expressions))
                                      spec)))]
             ;; TODO: show time information
             (if expression
@@ -145,7 +153,7 @@
              (add-complements-to-bolts [:comp] grammar lexicon index morph total-depth)))))

 (defn add-complements-to-bolts [bolts path grammar lexicon index morph total-depth]
-  (mapcat
+  (lazy-mapcat
    #(if (not (= :none (get-in % path :none)))
       (do
         (log/debug (str "add-complements-to-bolts@" path))
@@ -185,18 +193,18 @@
             depth (if depth depth 0)
             parents (candidate-parents grammar spec)]
         (let [lexical ;; 1. generate list of all phrases where the head child of each parent is a lexeme.
-              (mapcat (fn [parent]
+              (lazy-mapcat (fn [parent]
                         (if (= false (get-in parent [:head :phrasal] false))
-                          (let [candidate-lexemes (filter #(not (nil? %)) (lazy-seq (get-lex parent :head index spec)))]
+                          (let [candidate-lexemes (filter #(not (nil? %)) (get-lex parent :head index spec))]
                             (filter #(not (nil? %))
                                     (over/overh parent (mapfn copy candidate-lexemes))))))
                       parents)
               phrasal ;; 2. generate list of all phrases where the head child of each parent is itself a phrase.
               (if (< depth max-total-depth)
-                (mapcat (fn [parent]
-                          (over/overh parent
-                                      (lightning-bolts grammar lexicon (get-in parent [:head])
-                                                       (+ 1 depth) index morph (+ 1 total-depth))))
+                (lazy-mapcat (fn [parent]
+                              (over/overh parent
+                                          (lightning-bolts grammar lexicon (get-in parent [:head])
+                                                           (+ 1 depth) index morph (+ 1 total-depth))))
                         parents))]
           (if (lexemes-before-phrases total-depth)
             (concat lexical phrasal)


pass comp-paths to comp-paths-to-bolts-map

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -105,25 +105,24 @@

 (defn comp-paths-to-bolts-map
   "return a map between the set of all complements in the given _bolt_,and the lazy sequence of bolts for that spec."
-  [bolt model depth max-depth]
+  [bolt comp-paths model depth max-depth]
   (if (and (not (nil? bolt)))
-    (let [comp-paths (find-comp-paths bolt)]
-      (if (not (empty? comp-paths))
-        (zipmap
-         comp-paths
-         (mapfn #(let [spec (get-in bolt %)
-                       lexemes (get-lexemes model spec)
-                       bolts-at (if (< depth max-depth)
+    (if (not (empty? comp-paths))
+      (zipmap
+       comp-paths
+       (mapfn #(let [spec (get-in bolt %)
+                     lexemes (get-lexemes model spec)
+                     bolts-at (if (< depth max-depth)
                                   (lightning-bolts
                                    model
                                    (get-in bolt %)
                                    depth max-depth))
-                       lexemes-before-phrases
-                       (lexemes-before-phrases depth max-depth)]
-                   (if lexemes-before-phrases
-                     (lazy-cat lexemes bolts-at)
-                     (lazy-cat bolts-at lexemes)))
-                comp-paths))))))
+                     lexemes-before-phrases
+                     (lexemes-before-phrases depth max-depth)]
+                 (if lexemes-before-phrases
+                   (lazy-cat lexemes bolts-at)
+                   (lazy-cat bolts-at lexemes)))
+              comp-paths)))))

 (defn add-comps
   "given a bolt, return the lazy sequence of all bolts derived from this bolt after adding,
@@ -145,8 +144,8 @@
                   (fn [bolt-at]
                     (if (= false (get-in bolt-at [:phrasal]))
                       [(do-defaults (assoc-in bolt path bolt-at) model)]
-                      (let [comps-map (comp-paths-to-bolts-map bolt-at model (+ 1 depth) max-depth)
-                            comp-paths (find-comp-paths bolt)
+                      (let [comp-paths (find-comp-paths bolt-at)
+                            comps-map (comp-paths-to-bolts-map bolt-at comp-paths model (+ 1 depth) max-depth)
                             comp-bolts (vals comps-map)]
                         (when (not (some empty? comp-bolts))
                           (mapfn #(do-defaults (assoc-in bolt path %) model)
@@ -164,8 +163,8 @@
   (log/debug (str "generate2: spec: " spec))
   (flatten
    (mapfn (fn [bolt]
-            (let [comps-map (comp-paths-to-bolts-map bolt model 0 max-total-depth)
-                  comp-paths (find-comp-paths bolt)
+            (let [comp-paths (find-comp-paths bolt)
+                  comps-map (comp-paths-to-bolts-map bolt comp-paths model 0 max-total-depth)
                   comp-bolts (vals comps-map)]
               ;; filter by the following constraint:
               ;; that for every path that points to a complement of a bolt,


Fix misplaced docstring

Fix misplaced docstring

--- src/io/aviso/rook/utils.clj
+++ src/io/aviso/rook/utils.clj
@@ -49,8 +49,8 @@
   (prn))

 (defn summarize-method-and-uri
+  "Formats a method (a keyword, e.g. :get) and a URI into a single string."
   [method uri]
-  "Formats a method (a keyword, e.g. :get) and a URI into a single string."
   (format "%s `%s'"
           (-> method name .toUpperCase)
           uri))


Fix missing :use in lazytest.loader

Fix missing :use in lazytest.loader

--- src/main/clojure/lazytest/loader.clj
+++ src/main/clojure/lazytest/loader.clj
@@ -1,6 +1,7 @@
 (ns lazytest.loader
   "Loading namespaces and managing dependencies."
   (:use [lazytest.dependency :only (graph depend)]
+	[lazytest.nsdeps :only (deps-from-ns-decl)]
 	[clojure.contrib.find-namespaces :only (find-clojure-sources-in-dir
 						read-file-ns-decl)]
 	[clojure.java.io :only (file)]))


Nice error for invalid XML

Nice error for invalid XML

--- src/buildviz/gosync.clj
+++ src/buildviz/gosync.clj
@@ -238,7 +238,9 @@
       (try
         (put-junit-xml job-name build-no (junit-xml-func))
         (catch Exception e
-          (log/errorf e "Unable to sync testresults for %s %s" job-name build-no))))))
+          (if-let [data (ex-data e)]
+            (log/errorf "Unable to sync testresults for %s %s (status %s): %s" job-name build-no (:status data) (:body data))
+            (log/errorf e "Unable to sync testresults for %s %s" job-name build-no)))))))

 ;; run


setting eoq-backoff to a mintute

setting eoq-backoff to a mintute

--- src/celestial/redis.clj
+++ src/celestial/redis.clj
@@ -70,7 +70,7 @@
        (atom {}))))

 (defn create-worker [name f]
-  (carmine-mq/worker (server-conn) name {:handler f}))
+  (carmine-mq/worker (server-conn) name {:handler f :eoq-backoff-ms minute}))

 (defn hsetall* [rk m]
   "The persistency of hgetall*"


build-index: don't propagate `union-expr` after first level of recursion

same as Om bf9ebae557b2cbd18324fcb5606814b5e842b469

--- src/cellophane/next.clj
+++ src/cellophane/next.clj
@@ -1029,7 +1029,7 @@
                               (let [class' (-> query'' meta :component)]
                                 (when-not (and recursion? (nil? class'))
                                   (build-index* class' query''
-                                    path' classpath union-expr union-keys))))))
+                                    path' classpath (if recursion? union-expr nil) union-keys))))))

                         ;; Union query case
                         (map? query)


don't animate the player pieces! simple as that :D

--- src/chessground/ui.cljs
+++ src/chessground/ui.cljs
@@ -173,6 +173,7 @@
                                              :color color
                                              :role (get piece :role)
                                              :anim (when (and (== last-move-dest key)
+                                                              (not= draggable-color color)
                                                               (get-in app [:animation :enabled?]))
                                                      #js {:orig last-move-orig
                                                           :dest key


the docs say 'lein midje-doc once' should work (run being optional); now it does/is

--- src/leiningen/midje_doc.clj
+++ src/leiningen/midje_doc.clj
@@ -64,4 +64,5 @@
    "markdown"  (midje-doc-markdown project)
    "run"       (apply midje-doc-run project args)
    "purge"     (midje-doc-purge project)
-   "scaffold"  (midje-doc-scaffold project)))
+   "scaffold"  (midje-doc-scaffold project)
+   (apply midje-doc-run project sub args)))


addition overflow, fix typo in hash-ordered-coll and hash-unordered-coll

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -688,9 +688,9 @@
   [coll]
   (loop [n 0 hash-code 1 coll (seq coll)]
     (if-not (nil? coll)
-      (recur (inc n) (+ (* 31 hash-code) (hash (first coll)))
+      (recur (inc n) (bit-or (+ (imul 31 hash-code) (hash (first coll))) 0)
         (next coll))
-      (mix-collection-hash hash-code (imul 2 n)))))
+      (mix-collection-hash hash-code n))))

 (defn ^number hash-unordered-coll
   "Returns the hash code, consistent with =, for an external unordered
@@ -701,8 +701,8 @@
   [coll]
   (loop [n 0 hash-code 0 coll (seq coll)]
     (if-not (nil? coll)
-      (recur (inc n) (+ hash-code (hash (first coll))) (next coll))
-      (mix-collection-hash hash-code (imul 2 n)))))
+      (recur (inc n) (bit-or (+ hash-code (hash (first coll))) 0) (next coll))
+      (mix-collection-hash hash-code n))))

 ;;;;;;;;;;;;;;;;;;; protocols on primitives ;;;;;;;;
 (declare hash-map list equiv-sequential)


Added true? and false?. per #34

Added true? and false?. per #34

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -1482,6 +1482,14 @@

 (defn zero? [n]
   (== 0 n))
+
+(defn false?
+  "Returns true if x is the value false, false otherwise."
+  [x] (js* "~{x} === false"))
+
+(defn true?
+  "Returns true if x is the value true, false otherwise."
+  [x] (js* "~{x} === true"))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; fn stuff ;;;;;;;;;;;;;;;;

@@ -1883,5 +1891,12 @@
                 (bit-test 1000 3)
                 (bit-test 16713 11)
                 (bit-test 1024 10)]))
+  (assert (= [true false true false false false]
+             [(true? true)
+              (true? false)
+              (false? false)
+              (false? true)
+              (true? undefined)
+              (false? undefined)]))
   :ok
 )


Something about these rubs me the wrong way

--- modules/messaging/src/main/clojure/immutant/messaging.clj
+++ modules/messaging/src/main/clojure/immutant/messaging.clj
@@ -40,12 +40,12 @@

 (defn publish
   "Send a message to a destination"
-  [dest-name message & {:keys [priority persistent ttl properties encoding]
-                        :or {properties {}} :as opts}]
+  [dest-name message & {:as opts}]
   (with-session (fn [session]
                   (let [destination (destination session dest-name)
                         producer (.createProducer session destination)
-                        encoded (set-properties! (codecs/encode session message opts) properties)
+                        encoded (set-properties! (codecs/encode session message opts)
+                                                 (opts :properties))
                         {:keys [delivery priority ttl]} (wash-publish-options opts producer)]
                     (.send producer encoded delivery priority ttl)))))


do it the other way

do it the other way

--- src/metabase/util/stats.clj
+++ src/metabase/util/stats.clj
@@ -139,10 +139,10 @@
   "characterize a user record"
   [user]
   {:total 1
-   :active (if (user :is_active) 1 0) ;; HOW DO I GET THE LIST OF ALL USERS INCLUDING INACTIVES?
-   :admin (if (user :is_superuser) 1 0)
-   :logged_in (if (nil? (user :last_login)) 0 1)
-   :sso (if (nil? (user :google_auth)) 0 1)})
+   :active (if (:is_active user) 1 0) ;; HOW DO I GET THE LIST OF ALL USERS INCLUDING INACTIVES?
+   :admin (if (:is_superuser user) 1 0)
+   :logged_in (if (nil? (:last_login user)) 0 1)
+   :sso (if (nil? (:google_auth user)) 0 1)})

 (defn- user-metrics
@@ -166,8 +166,8 @@
   TODO: characterize by whether it has params, # of revisions, created by an admin"
   [question]
     {:total 1
-     :native (if (= (question :iquery_type) "native") 1 0)
-     :gui (if (not= (question :iquery_type) "native") 1 0)})
+     :native (if (= (:query_type question) "native") 1 0)
+     :gui (if (not= (:query_type question) "native") 1 0)})

 (defn- question-metrics
   "Get metrics based on questions


cleanup in progress

cleanup in progress

--- src/midje/util/checkers.clj
+++ src/midje/util/checkers.clj
@@ -1,10 +1,13 @@
+;; -*- indent-tabs-mode: nil -*-
+
 (ns midje.util.checkers
   (:use [clojure.set :only [difference union subset?]]
         [clojure.contrib.seq :only [rotations]]
-	[clojure.contrib.def :only [defmacro-]]
-	[clojure.contrib.pprint :only [cl-format]]
-	[clojure.contrib.combinatorics :only [permutations]]
-        [midje.util.form-utils :only [regex? vector-without-element-at-index]]))
+        [clojure.contrib.def :only [defmacro-]]
+        [clojure.contrib.pprint :only [cl-format]]
+        [clojure.contrib.combinatorics :only [permutations]]
+        [midje.util.form-utils :only [regex? vector-without-element-at-index
+                                      tack-on-to]]))

 (declare chatty-checker-falsehood? captured-exception?)

@@ -17,22 +20,22 @@
 (defn extended-= [actual expected]
   (try
     (cond (chatty-checker-falsehood? actual)
-	  actual
-
-	  (chatty-checker-falsehood? expected)
-	  expected
-
-	  (extended-fn? expected)
+          actual
+
+          (chatty-checker-falsehood? expected)
+          expected
+
+          (extended-fn? expected)
           (let [function-result (expected actual)]
             (if (chatty-checker-falsehood? function-result) false function-result))

-	  (regex? expected)
-	  (if (regex? actual)
-	    (= (.toString actual) (.toString expected))
-	    (re-find expected actual))
-
-	  :else
-	  (= actual expected))
+          (regex? expected)
+          (if (regex? actual)
+            (= (.toString actual) (.toString expected))
+            (re-find expected actual))
+
+          :else
+          (= actual expected))
     (catch Exception ex false)))

@@ -40,8 +43,10 @@
 ;; Simple checkers

 (defn- named [name expected function]
+  "Adds a string name that looks like a function call to
+   a functions metadata under :name"
   (with-meta function
-	{:name (format "(%s %s)" name expected)}))
+        {:name (format "(%s %s)" name expected)}))

 (defn truthy
@@ -69,7 +74,7 @@
   {:midje/checker true}
   [expected]
     (named 'exactly expected
-	   (fn [actual] (= expected actual))))
+           (fn [actual] (= expected actual))))

 @@ -146,136 +151,168 @@
  ;;Checkers that work with collections.

-
-(defn- all-expected-permutations [expected]
-  (cond (and (not-any? extended-fn? expected)
-	     (not-any? regex? expected))
-	[expected]
-
-	(<= (count expected) 4)
-	(permutations expected)
-
-	:else
-	(rotations expected)))
-
-(defn- total-match? [comparison]
+(defn- inexact-checker?
+  "Can the checker potentially match non-unique elements
+   in a seq? (Ex: regex #'a+' can match 'a' and 'aa'.)"
+  [checker]
+  (or (extended-fn? checker)
+      (regex? checker)))
+
+(defn- feasible-permutations
+  "Permute the given list if it contains inexact checkers.
+   Only produces all permutations for short lists."
+  [checkers]
+  (cond (not-any? inexact-checker? checkers)
+        [checkers]
+
+        (<= (count checkers) 4)
+        (permutations checkers)
+
+        :else
+        (rotations checkers)))
+
+(defn- total-match?
+  "Have all the expected elements have been discovered?"
+  [comparison]
   (= (count (:expected-found comparison))
      (count (:expected comparison))))

-(defn- closer-match? [candidate best-so-far]
+(defn- closer-match?
+  "Did the candidate match more expected elements than before?"
+  [candidate best-so-far]
   (> (count (:actual-found candidate))
      (count (:actual-found best-so-far))))

 (defn- better-of [candidate best-so-far]
   (if (closer-match? candidate best-so-far) candidate best-so-far))

-(defn- tack-on-to [hashmap & kvs]
-  (merge-with conj hashmap (apply (partial assoc {}) kvs)))
-
-(defn- collection-like? [thing]
+(defn- collection-like?
+  "Extend coll? to include strings."
+  [thing]
   (or (coll? thing)
       (string? thing)))

-(defn- right-hand-singleton? [thing]
+(defn- right-hand-singleton?
+  "The kind of thing that, in (contains X), means (contains [X])"
+  [thing]
   (or (not (coll? thing)) (map? thing)))

 (defn- same-lengths? [actual expected]
   (= (count actual) (count expected)))

-(defn- expected-fits? [actual expected]
+(defn- expected-fits?
+  "Could expected fit as a subsequence of actual?"
+  [actual expected]
   (>= (count actual) (count expected)))

-
-(defn- midje-try-re [re string function]
+(defn- noted-falsehood
+  "Produce a partially constructed chatty falsehood that contains
+   a :notes key with the strings."
+  [& strings ]
+  (tag-as-chatty-falsehood {:notes strings}))
+
+(defn- try-re
+  "Use the function (re-find or re-matches) to apply re to the thing.
+   If function blows up, return a chatty failure about it."
+  [re thing function]
   (try
-    (function re string)
+    (function re thing)
     (catch Exception ex
-      (tag-as-chatty-falsehood {
-				:notes [(str (pr-str re)
-					     " can't be used on "
-					     (pr-str string)
-					     ", a " (type string) ".")]}))))
-
-
--
-(defn in-any-order--one-permutation [actual expected kind]
-  (let [starting-candidate  {:actual-found [], :expected-found [],
-			     :expected-skipped-over [], :expected expected }
-	gaps-ok? (some #{:gaps-ok} kind)]
+      (noted-falsehood (format "%s can't be used on %s, a %s."
+                               (pr-str re) (pr-str thing) (type thing) ".")))))
+
+(defn- base-starting-candidate
+  "A data structure that represents which actual elements, matching
+   expected elements, have been found from an original set of expected
+   elements."
+  [expected]
+  {:actual-found [], :expected-found [], :expected expected })
+
++;; The code that compares two sequentials.
+
+(defn in-any-order--one-permutation
+  "Compare actual elements to expected, which is one of perhaps many
+   permutations of the original expected list. kind is a subset of
+   #{:gaps-ok :in-any-order}."
+  [actual expected kind]
+  (let [starting-candidate (assoc (base-starting-candidate expected) :expected-skipped-over [])
+        gaps-ok? (some #{:gaps-ok} kind)]
     (loop [walking-actual   actual
-	   walking-expected expected
-	   best-so-far      starting-candidate
-	   candidate        starting-candidate]
+           walking-expected expected
+           best-so-far      starting-candidate
+           candidate        starting-candidate]

       ;; (prn "walking actual" walking-actual "walking expected" walking-expected)
       (cond (or (empty? walking-actual) (empty? walking-expected))
-	    (better-of candidate best-so-far)
-
-	    (extended-= (first walking-actual) (first walking-expected))
-	    ;; window good so far, keep working on it
-	    (recur (rest walking-actual)
-		   (concat (:expected-skipped-over candidate) (rest walking-expected))
-		   best-so-far
-		   (merge
-		    (tack-on-to candidate
-				:actual-found (first walking-actual)
-				:expected-found (first walking-expected))
-		    {:expected-skipped-over []}))
-
-	    (not (empty? (rest walking-expected)))
-	    ;; Perhaps another value in the current expected permutation will work.
-	    ;; We can, after all, be in any order.
-	    (recur walking-actual
-		   (rest walking-expected)
-		   best-so-far
-		   (tack-on-to candidate
-			       :expected-skipped-over (first walking-expected)))
-
-	    (not (empty? (rest walking-actual)))
-	    ;; OK, there's no match for this actual element in the whole expected.
-	    (if gaps-ok?
-	      ;; Since gaps are OK, we can drop the bad actual element and look for next one.
-	      (recur (rest walking-actual)
-		     (concat (:expected-skipped-over candidate) walking-expected)
-		     (better-of candidate best-so-far)
-		     (merge candidate {:expected-skipped-over []}))
-
-	      ;; Start again with a new actual: the tail of what we started with.
-	      (recur (rest (concat (:actual-found candidate) walking-actual))
-		   expected
-		   (better-of candidate best-so-far)
+            (better-of candidate best-so-far)
+
+            (extended-= (first walking-actual) (first walking-expected))
+            ;; A palpable hit! Try any remainder.
+            (recur (rest walking-actual)
+                   (concat (:expected-skipped-over candidate) (rest walking-expected))
+                   best-so-far
+                   (merge
+                    (tack-on-to candidate
+                                :actual-found (first walking-actual)
+                                :expected-found (first walking-expected))
+                    {:expected-skipped-over []}))
+
+            (not (empty? (rest walking-expected)))
+            ;; Perhaps the next expected element will work. We can, after all, be in any order.
+            (recur walking-actual
+                   (rest walking-expected)
+                   best-so-far
+                   (tack-on-to candidate
+                               :expected-skipped-over (first walking-expected)))
+
+            (not (empty? (rest walking-actual)))
+            ;; OK, there's no match for this actual element in the whole expected.
+            (if gaps-ok?
+              ;; Since gaps are OK, we can drop the bad actual element and check the next one.
+              (recur (rest walking-actual)
+                     (concat (:expected-skipped-over candidate) walking-expected)
+                     (better-of candidate best-so-far)
+                     (merge candidate {:expected-skipped-over []}))
+
+              ;; This actual is blown. Try the next one.
+              (recur (rest (concat (:actual-found candidate) walking-actual))
+                   expected
+                   (better-of candidate best-so-far)
                    starting-candidate))

-	    :else
-	    (better-of candidate best-so-far)))))
-
-(defmulti seq-comparison (fn [actual expected kind]
-			   (or (some #{:in-any-order} kind) :strict-order)))
+            :else
+            (better-of candidate best-so-far)))))
+
+(defmulti seq-comparison
+  "Compare an actual seq to an expected seq, governed by kind."
+  (fn [actual expected kind]
+    (or (some #{:in-any-order} kind) :strict-order)))

 (defmethod seq-comparison :in-any-order
   [actual expected kind]
-
-  (loop [expected-permutations (all-expected-permutations expected)
-	 best-so-far {:actual-found [], :expected-found [],
-		      :expected-skipped-over [], :expected expected }]
+  (loop [expected-permutations (feasible-permutations expected)
+         best-so-far (base-starting-candidate expected)]
     (if (empty? expected-permutations)
       best-so-far
       (let [comparison (in-any-order--one-permutation actual
-						      (first expected-permutations)
-						      kind)]
-	(if (total-match? comparison)
-	  comparison
-	  (recur (rest expected-permutations)
-		 (better-of comparison best-so-far)))))))
+                                                      (first expected-permutations)
+                                                      kind)]
+        (if (total-match? comparison)
+          comparison
+          (recur (rest expected-permutations)
+                 (better-of comparison best-so-far)))))))

 (defmethod seq-comparison :strict-order
   [actual expected kind]
-  (let [starting-candidate  {:actual-found [], :expected-found [], :expected expected }
-	gaps-ok? (some #{:gaps-ok} kind)]
-
-    (loop [actual           actual
-	   walking-actual   actual
+  (let [starting-candidate (base-starting-candidate expected)
+        gaps-ok? (some #{:gaps-ok} kind)]
+
+    ;; This embeds two loops. walking-actual controls the inner loop. It walks
+    ;; until success or it hits a mismatch. actual controls the outer loop.
+    ;; Upon each mismatch, it tries again with the #'rest of itself.
+    (loop [actual           actual
+           walking-actual   actual
            walking-expected expected
            best-so-far      starting-candidate
            candidate        starting-candidate]
@@ -283,37 +320,36 @@
       (cond (or (empty? walking-actual) (empty? walking-expected))
             (better-of candidate best-so-far)

-	    (extended-= (first walking-actual) (first walking-expected))
-	    ;; actual good so far, keep working on it
-	    (recur actual
-	           (rest walking-actual)
-		   (rest walking-expected)
-		   best-so-far
-		   (tack-on-to candidate
-			       :actual-found (first walking-actual)
-			       :expected-found (first walking-expected)))
-
-	    (and gaps-ok? (not (empty? (rest walking-actual))))
-	    ;; This is a gap in the walking actual. Skip it.
+            (extended-= (first walking-actual) (first walking-expected))
+            ;; actual good so far, keep working on it
             (recur actual
-	           (rest walking-actual)
-		   walking-expected
-		   best-so-far
+                   (rest walking-actual)
+                   (rest walking-expected)
+                   best-so-far
+                   (tack-on-to candidate
+                               :actual-found (first walking-actual)
+                               :expected-found (first walking-expected)))
+
+            (and gaps-ok? (not (empty? (rest walking-actual))))
+            ;; This is a gap in the walking actual. Skip it.
+            (recur actual
+                   (rest walking-actual)
+                   walking-expected
+                   best-so-far
                    candidate)

-	    (not (empty? actual))
-	    ;; See if we can find something better later on.
-	    (recur (rest actual)
-		   (rest actual)
-		   expected
-		   (better-of candidate best-so-far)
-		   starting-candidate)))))
-
-; Searches through particular types of actual results
-
-(defn standardized-arguments [actual expected kind]
-  ;; The choice to make these (throw Error) rather than be falsey is purely
-  ;; one of implementation convenience.
+            (not (empty? actual))
+            ;; See if we can find something better later on.
+            (recur (rest actual)
+                   (rest actual)
+                   expected
+                   (better-of candidate best-so-far)
+                   starting-candidate)))))
+
++;;
+
+(defn compatibility-check [actual expected kind]
   (cond (regex? expected)
 	(cond (and (not (sequential? actual))
 		   (not (empty? kind)))
@@ -324,9 +360,21 @@
 	(not (collection-like? actual))
 	(throw (Error. (str "You can't compare " (pr-str actual) " (" (type actual)
 			    ") to " (pr-str expected) " (" (type expected) ").")))
-	)
+
+	(and (map? actual)
+	     (not (map? expected)))
+	(try (into {} expected)
+	     (catch Throwable ex
+	       (throw (Error. (str "If " (pr-str actual) " is a map, "
+				   (pr-str expected)
+				   " should look like map entries.")))))))
+

-
+(defn- standardized-arguments [actual expected kind]
+  "Reduce arguments to standard forms so there are fewer combinations to
+   consider. Also blow up for some incompatible forms."
+
+  (compatibility-check actual expected kind)
   (cond (sequential? actual)
 	(cond (set? expected)
 	      [actual (vec expected) (union kind #{:in-any-order})]
@@ -342,16 +390,11 @@
 	      [actual expected kind]

 	      :else
-	      (try
-		[actual (apply hash-map (apply concat expected)) kind]
-		(catch Throwable ex
-		  (throw (Error. (str "If " (pr-str actual) " is a map, "
-				      (pr-str expected)
-				      " should look like map entries."))))))
-
+	      [actual (into {} expected) kind])
+
 	(set? actual)
 	(recur (vec actual) expected #{:in-any-order :gaps-ok})
-
+
 	(string? actual)
 	(cond (and (not (string? expected))
 		   (not (regex? expected)))
@@ -362,103 +405,104 @@
 	:else
 	[actual expected kind]))

+
 (defn- best-seq-match-actual [comparison]
   (str "Best match found: " (pr-str (:actual-found comparison))))

 (defn- best-seq-match-expected [comparison expected]
   (if (or (some extended-fn? expected)
-	  (some regex? expected))
+          (some regex? expected))
     (str "      It matched: ["
-	 (apply str
-		(interpose " "
-			   (map #(cond (and (fn? %) (:name (meta %)))
-				       (:name (meta %))
-
-				       :else
-				       (pr-str %))
-				(:expected-found comparison))))
-	 "] (in that order)")))
+         (apply str
+                (interpose " "
+                           (map #(cond (and (fn? %) (:name (meta %)))
+                                       (:name (meta %))
+
+                                       :else
+                                       (pr-str %))
+                                (:expected-found comparison))))
+         "] (in that order)")))

 (defn- best-map-match-actual [comparison]
   (str "Best match found: {"
        (apply str
-	      (interpose ", "
-			 (sort (map (fn [[k v]] (str (pr-str k) " " (pr-str v)))
-				    (:actual-found comparison)))))
+              (interpose ", "
+                         (sort (map (fn [[k v]] (str (pr-str k) " " (pr-str v)))
+                                    (:actual-found comparison)))))
        "}."))

 (defn- best-map-match-expected [comparison expected]
   (if (or (some extended-fn? (vals expected))
-	  (some regex? (vals expected)))
+          (some regex? (vals expected)))
     (str "      It matched: {"
-	 (apply str
-		(interpose ", "
-			   (sort (map (fn [[k v]]
-					(cond (and (fn? v) (:name (meta v)))
-					      (str (pr-str k) " " (:name (meta v)))
-
-					      :else
-					      (str (pr-str k) " " (pr-str v))))
-				      (:expected-found comparison)))))
-	 "}.")))
+         (apply str
+                (interpose ", "
+                           (sort (map (fn [[k v]]
+                                        (cond (and (fn? v) (:name (meta v)))
+                                              (str (pr-str k) " " (:name (meta v)))
+
+                                              :else
+                                              (str (pr-str k) " " (pr-str v))))
+                                      (:expected-found comparison)))))
+         "}.")))

 ;; TODO: try different combinations?
 (defn map-comparison--one-permutation [actual expected keys]
   ;;  (prn "map-comparison" actual expected)
   (reduce (fn [so-far key]
-	    ;; (println so-far key)
-	    (if (and (find actual key)
-		     (extended-= (get actual key) (get expected key)))
-	      (merge-with merge so-far {:actual-found {key (get actual key)}
-					:expected-found {key (get expected key)} })
-	      so-far))
-	  {:actual-found {} :expected-found {} :expected expected}
-	  keys))
+            ;; (println so-far key)
+            (if (and (find actual key)
+                     (extended-= (get actual key) (get expected key)))
+              (merge-with merge so-far {:actual-found {key (get actual key)}
+                                        :expected-found {key (get expected key)} })
+              so-far))
+          {:actual-found {} :expected-found {} :expected expected}
+          keys))

 (defn map-comparison [actual expected kind]
-  (loop [expected-permutations (all-expected-permutations (keys expected))
-	 best-so-far {:actual-found [], :expected-found [],
-		      :expected expected }]
+  (loop [expected-permutations (feasible-permutations (keys expected))
+         best-so-far {:actual-found [], :expected-found [],
+                      :expected expected }]
     (if (empty? expected-permutations)
       best-so-far
       (let [comparison (map-comparison--one-permutation actual
-							expected
-							(first expected-permutations))]
-	(if (total-match? comparison)
-	  comparison
-	  (recur (rest expected-permutations)
-		 (better-of comparison best-so-far)))))))
+                                                        expected
+                                                        (first expected-permutations))]
+        (if (total-match? comparison)
+          comparison
+          (recur (rest expected-permutations)
+                 (better-of comparison best-so-far)))))))

 (defn map-match? [actual expected kind]
 ;  (println 'map-match actual expected kind)
   (let [comparison (map-comparison actual expected kind)
-	mismatch-description (fn [comparison expected]
-			       (remove nil? [ (best-map-match-actual comparison)
-					      (best-map-match-expected comparison expected) ]))]
+        mismatch-description (fn [comparison expected]
+                               (remove nil? [ (best-map-match-actual comparison)
+                                              (best-map-match-expected comparison expected) ]))]
     (or (total-match? comparison)
-	(tag-as-chatty-falsehood
-	 {
-	  :notes (mismatch-description comparison expected)}))))
+        (tag-as-chatty-falsehood
+         {
+          :notes (mismatch-description comparison expected)}))))

 (defn full-sequence-match? [actual expected kind]
   (let [comparison (seq-comparison actual expected kind)
-	mismatch-description (fn [comparison expected]
-			       (remove nil? [ (best-seq-match-actual comparison)
-					      (best-seq-match-expected comparison expected) ]))]
+        mismatch-description (fn [comparison expected]
+                               (remove nil? [ (best-seq-match-actual comparison)
+                                              (best-seq-match-expected comparison expected) ]))]
     (or (total-match? comparison)
-	(tag-as-chatty-falsehood
-	 {
-	  :notes (mismatch-description comparison expected) }))))
+        (tag-as-chatty-falsehood
+         {
+          :notes (mismatch-description comparison expected) }))))

 (defn- actual-x-contains? [actual expected kind]
   ;;  (prn 'actual-x-contains? actual expected kind)
   (cond (map? actual)
-	(map-match? actual expected kind)
-
-	:else
-	(full-sequence-match? actual expected kind))
+        (map-match? actual expected kind)
+
+        :else
+        (full-sequence-match? actual expected kind))
   )

 (defn- add-actual [actual result]
@@ -473,71 +517,71 @@
   `(with-meta
      (fn [expected# & kind#]
        (vary-meta
-	 (named '~name expected#
-		(fn [actual#]
-		  ;; (prn "checking" actual# expected# kind#)
-		  (add-actual actual#
-			      (try (~checker-fn actual# expected# kind#)
-				   (catch Error ex#
-				     (tag-as-chatty-falsehood {
-							       :notes [(.getMessage ex#)]}))))))
-	 merge
-	 {:midje/chatty-checker true, :midje/checker true}))
+         (named '~name expected#
+                (fn [actual#]
+                  ;; (prn "checking" actual# expected# kind#)
+                  (add-actual actual#
+                              (try (~checker-fn actual# expected# kind#)
+                                   (catch Error ex#
+                                     (tag-as-chatty-falsehood {
+                                                               :notes [(.getMessage ex#)]}))))))
+         merge
+         {:midje/chatty-checker true, :midje/checker true}))
        {:midje/checker true}))

 (def contains (container-checker contains
     (fn [actual expected kind]
       (let [ [actual expected kind] (standardized-arguments actual expected kind)]
-	(cond (regex? expected)
-	      (midje-try-re expected actual re-find)
-
-	      :else
-	      (apply actual-x-contains? [actual expected kind]))))))
+        (cond (regex? expected)
+              (try-re expected actual re-find)
+
+              :else
+              (apply actual-x-contains? [actual expected kind]))))))

 (def just (container-checker just
     (fn [actual expected kind]
       (let [ [actual expected kind] (standardized-arguments actual expected kind)]
-	(cond (regex? expected)
-	      (midje-try-re expected actual re-matches)
-
-	      (same-lengths? actual expected)
-	      (apply actual-x-contains? [actual expected kind])
-
-	      :else
-	      (tag-as-chatty-falsehood
-	       {
-		:notes [(cl-format nil
-				   "Expected ~R element~:P. There ~[were~;was~:;were~]~:* ~R."
-				   (count expected)
-				   (count actual))]}))))))
+        (cond (regex? expected)
+              (try-re expected actual re-matches)
+
+              (same-lengths? actual expected)
+              (apply actual-x-contains? [actual expected kind])
+
+              :else
+              (tag-as-chatty-falsehood
+               {
+                :notes [(cl-format nil
+                                   "Expected ~R element~:P. There ~[were~;was~:;were~]~:* ~R."
+                                   (count expected)
+                                   (count actual))]}))))))

 (defn- has-xfix [x-name pattern-fn take-fn]
   (fn [actual expected kind]
     (cond (set? actual)
-	  (tag-as-chatty-falsehood {
-				    :notes [(str "Sets don't have " x-name "es.")]})
-
-	  (map? actual)
-	  (tag-as-chatty-falsehood {
-				    :notes [(str "Maps don't have " x-name "es.")]})
-
-	  :else
-	  (let [ [actual expected kind] (standardized-arguments actual expected kind)]
-	    (cond (regex? expected)
-		  (midje-try-re (pattern-fn expected) actual re-find)
-
-		  (expected-fits? actual expected)
-		  (apply actual-x-contains?
-			 [(take-fn (count expected) actual) expected kind])
-
-		  :else
-		  (tag-as-chatty-falsehood
-		   {
-		    :notes [(str (cl-format nil
-					    "A collection with ~R element~:P cannot match a "
-					    (count actual))
-				 x-name
-				 (cl-format nil " of size ~R." (count expected)))]}))))))
+          (tag-as-chatty-falsehood {
+                                    :notes [(str "Sets don't have " x-name "es.")]})
+
+          (map? actual)
+          (tag-as-chatty-falsehood {
+                                    :notes [(str "Maps don't have " x-name "es.")]})
+
+          :else
+          (let [ [actual expected kind] (standardized-arguments actual expected kind)]
+            (cond (regex? expected)
+                  (try-re (pattern-fn expected) actual re-find)
+
+                  (expected-fits? actual expected)
+                  (apply actual-x-contains?
+                         [(take-fn (count expected) actual) expected kind])
+
+                  :else
+                  (tag-as-chatty-falsehood
+                   {
+                    :notes [(str (cl-format nil
+                                            "A collection with ~R element~:P cannot match a "
+                                            (count actual))
+                                 x-name
+                                 (cl-format nil " of size ~R." (count expected)))]}))))))

 (def has-prefix
      (container-checker has-prefix
@@ -545,13 +589,13 @@
 (def has-suffix
      (container-checker has-suffix
       (has-xfix "suffix" #(re-pattern (str (.toString %) "$" )) take-last)))
-
+
 (defn has [quantifier predicate]
   (fn [actual]
     (quantifier predicate
-		(if (map? actual)
-		  (vals actual)
-		  actual))))
+                (if (map? actual)
+                  (vals actual)
+                  actual))))

  ;; These are used in some internal tests. Worth publicizing?


colorize functions should allow multiple arguments.

--- src/midje/util/colorize.clj
+++ src/midje/util/colorize.clj
@@ -22,7 +22,7 @@
               (def note color/cyan-bg))

   (do
-    (def fail identity)
-    (def pass identity)
-    (def note identity)))
+    (def fail str)
+    (def pass str)
+    (def note str)))


removed dead/useless code

removed dead/useless code

--- src/blogiseq/core.clj
+++ src/blogiseq/core.clj
@@ -83,11 +83,6 @@
   (md/md-to-html-string
     (slurp path)))

-(defn app [req]
-  {:status 200
-   :headers {"Content-Type"  "text/html"}
-   :body (hiccup/html site)})
-
 (defonce server (atom nil))

 (defn copy-path-if-not-exists
@@ -105,8 +100,6 @@

 (defn is-image? [path]
   (not (nil? (re-find #"jpg$|png$|gif$" (clojure.string/lower-case path)))))
-
-(is-image? "resources/photowalls/usa")

 (defn dir-to-photowall [path]
   (let [f (clojure.java.io/file path)


simplified get-winner function

simplified get-winner function

--- src/c4_arena/core.clj
+++ src/c4_arena/core.clj
@@ -30,23 +30,15 @@
 (defn get-winner [state-val i]
   (let [cand (state-val i)
         dirs [1 nrows (dec nrows) (inc nrows)]]
-    (when (some
-           (fn [dir]
-             (<= (dec n-to-win)
-                 (+
-                  (count
-                   (for [j (reductions + (repeat dir))
-                         :let [k (- i j)]
-                         :while (and (<= 0 k (dec (* ncols nrows)))
-                                     (= cand (state-val k)))]
-                     true))
-                  (count
-                   (for [j (reductions + (repeat dir))
-                         :let [k (+ i j)]
-                         :while (and (<= 0 k (dec (* ncols nrows)))
-                                     (= cand (state-val k)))]
-                     true)))))
-           dirs)
+    (when (->> (for [dir dirs]
+                 (count
+                  (for [sign [- +]
+                        j (reductions + (repeat dir))
+                        :let [k (sign i j)]
+                        :while (and (<= 0 k (dec (* ncols nrows)))
+                                    (= cand (state-val k)))]
+                    true)))
+               (some (fn [n] (>= n (dec n-to-win)))))
       (dec cand))))

 (defn process-move [state winner turn move]


Normalize personel-name

Normalize personel-name

--- src/catalog/vubis.clj
+++ src/catalog/vubis.clj
@@ -170,6 +170,16 @@
          (string/join " ")
          string/trim
          remove-nonprintable-chars)))
+
+(defn trim-punctuation [s]
+  (-> s
+      (string/replace #"[\p{Punct}]+$" "")
+      (string/replace #"^[\p{Punct}]+" "")))
+
+(defn get-personel [s]
+  (-> s
+      trim-punctuation
+      normalize-name))

 (defn clean-raw-item
   "Return a proper production based on a raw item, e.g.
@@ -223,7 +233,7 @@
                     :movie_country (and general-note
                                         (second (re-find #"^Originalversion: (.*)$" general-note)))
                     :producer producer-long
-                    :personel-name personel-name))
+                    :personel-name (get-personel personel-name)))
       :ludo (-> item
                 (assoc-some
                  :game-category game-category


changing to build

changing to build

--- src/celestial/api.clj
+++ src/celestial/api.clj
@@ -132,7 +132,7 @@
            (success {:msg "Deleted action" :id id})))

 (defroutes static-routes
-  (route/files "/" {:root (str (System/getProperty "user.dir") "/public/celestial-ui/dist/")})
+  (route/files "/" {:root (str (System/getProperty "user.dir") "/public/celestial-ui/build")})
   )

 (defroutes app-routes


change defrecord to use case for ILookup

--- src/clj/cljs/core.clj
+++ src/clj/cljs/core.clj
@@ -896,9 +896,9 @@
                   'ILookup
                   `(~'-lookup [this# k#] (-lookup this# k# nil))
                   `(~'-lookup [this# ~ksym else#]
-                              (cond
-                               ~@(mapcat (fn [f] [`(keyword-identical? ~ksym ~(keyword f)) f]) base-fields)
-                               :else (get ~'__extmap ~ksym else#)))
+                              (case ~ksym
+                                ~@(mapcat (fn [f] [(keyword f) f]) base-fields)
+                                (get ~'__extmap ~ksym else#)))
                   'ICounted
                   `(~'-count [this#] (+ ~(count base-fields) (count ~'__extmap)))
                   'ICollection


* src/clj/cljs/core.clj: add not-nil? compiler macro

--- src/clj/cljs/core.clj
+++ src/clj/cljs/core.clj
@@ -47,6 +47,9 @@

 (defmacro nil? [x]
   `(identical? ~x nil))
+
+(defmacro not-nil? [x]
+  (bool-expr (list 'js* "(~{} != null)" x)))

 (defmacro true? [x]
   (bool-expr (list 'js* "~{} === true" x)))


CLJS-980: ClojureScript REPL stacktraces overrun prompt in many cases

Added a few flush statements after printing errors and added a tiny thread
sleep to allow things to flush before printing prompt.

--- src/clj/cljs/repl.clj
+++ src/clj/cljs/repl.clj
@@ -148,7 +148,8 @@
        (f)
        (println (:value ret))
        (when-let [st (:stacktrace ret)]
-         (println st)))))
+         (println st)
+         (flush)))))

 (defn evaluate-form
   "Evaluate a ClojureScript form in the JavaScript environment. Returns a
@@ -209,7 +210,8 @@
               :success (:value ret)))))
       (catch Throwable ex
         (.printStackTrace ex)
-        (println (str ex))))))
+        (println (str ex))
+        (flush)))))

 (defn load-stream [repl-env filename res]
   (let [env (ana/empty-env)]
@@ -373,6 +375,8 @@
             {:line 1 :column 1})
           identity opts)
         (loop []
+          ;; try to let things flush before printing prompt
+          (Thread/sleep 10)
           (print (str "ClojureScript:" ana/*cljs-ns* "> "))
           (flush)
           (let [rdr (readers/source-logging-push-back-reader


need to analyze core otherwise all downstream REPLs must remember to do this, w/o this step evaluating the first cljs.user form will fail

--- src/clj/cljs/repl.clj
+++ src/clj/cljs/repl.clj
@@ -558,58 +558,60 @@
              opts (if-let [merge-opts (:merge-opts (-setup repl-env opts))]
                     (merge opts merge-opts)
                     opts)]
-         (evaluate-form repl-env env "<cljs repl>"
-           (with-meta
-             '(ns cljs.user
-                (:require [cljs.repl :refer-macros [doc]]))
-             {:line 1 :column 1})
-           identity opts)
-         (when-let [src (:watch opts)]
-           (future
-             (let [log-file (io/file (util/output-directory opts) "watch.log")]
-               (println "Watch compilation log available at:" (str log-file))
-               (binding [*out* (FileWriter. log-file)]
-                 (cljsc/watch src (dissoc opts :watch))))))
-         (loop []
-           ;; try to let things flush before printing prompt
-           (Thread/sleep 10)
-           (print (str "ClojureScript:" ana/*cljs-ns* "> "))
-           (flush)
-           (let [rdr (readers/source-logging-push-back-reader
-                       (PushbackReader. (io/reader *in*))
-                       1
-                       "NO_SOURCE_FILE")
-                 form (try
-                        (binding [*ns* (create-ns ana/*cljs-ns*)
-                                  reader/*data-readers* tags/*cljs-data-readers*
-                                  reader/*alias-map*
-                                  (apply merge
-                                    ((juxt :requires :require-macros)
-                                      (ana/get-namespace ana/*cljs-ns*)))]
-                          (reader/read rdr nil read-error))
-                        (catch Exception e
-                          (println (.getMessage e))
-                          read-error))]
-             ;; TODO: need to catch errors here too - David
-             (cond
-               (identical? form read-error) (recur)
-               (= form :cljs/quit) :quit
-
-               (and (seq? form) (is-special-fn? (first form)))
-               (do
-                 (try
-                   ((get special-fns (first form)) repl-env env form opts)
-                   (catch Throwable ex
-                     (println "Failed to execute special function:" (pr-str (first form)))
-                     (trace/print-cause-trace ex 12)))
-                 ;; flush output which could include stack traces
-                 (flush)
-                 (newline)
-                 (recur))
-
-               :else
-               (do (eval-and-print repl-env env form opts)
-                   (recur)))))
+         (comp/with-core-cljs opts
+           (fn []
+             (evaluate-form repl-env env "<cljs repl>"
+               (with-meta
+                 '(ns cljs.user
+                    (:require [cljs.repl :refer-macros [doc]]))
+                 {:line 1 :column 1})
+               identity opts)
+             (when-let [src (:watch opts)]
+               (future
+                 (let [log-file (io/file (util/output-directory opts) "watch.log")]
+                   (println "Watch compilation log available at:" (str log-file))
+                   (binding [*out* (FileWriter. log-file)]
+                     (cljsc/watch src (dissoc opts :watch))))))
+             (loop []
+               ;; try to let things flush before printing prompt
+               (Thread/sleep 10)
+               (print (str "ClojureScript:" ana/*cljs-ns* "> "))
+               (flush)
+               (let [rdr (readers/source-logging-push-back-reader
+                           (PushbackReader. (io/reader *in*))
+                           1
+                           "NO_SOURCE_FILE")
+                     form (try
+                            (binding [*ns* (create-ns ana/*cljs-ns*)
+                                      reader/*data-readers* tags/*cljs-data-readers*
+                                      reader/*alias-map*
+                                      (apply merge
+                                        ((juxt :requires :require-macros)
+                                          (ana/get-namespace ana/*cljs-ns*)))]
+                              (reader/read rdr nil read-error))
+                            (catch Exception e
+                              (println (.getMessage e))
+                              read-error))]
+                 ;; TODO: need to catch errors here too - David
+                 (cond
+                   (identical? form read-error) (recur)
+                   (= form :cljs/quit) :quit
+
+                   (and (seq? form) (is-special-fn? (first form)))
+                   (do
+                     (try
+                       ((get special-fns (first form)) repl-env env form opts)
+                       (catch Throwable ex
+                         (println "Failed to execute special function:" (pr-str (first form)))
+                         (trace/print-cause-trace ex 12)))
+                     ;; flush output which could include stack traces
+                     (flush)
+                     (newline)
+                     (recur))
+
+                   :else
+                   (do (eval-and-print repl-env env form opts)
+                       (recur)))))))
          (-tear-down repl-env))))))

 (defn repl


CLJS-1161: actually print error stack traces to *err*, allow higher-level rebindings of *cljs-ns*

--- src/clj/cljs/repl.clj
+++ src/clj/cljs/repl.clj
@@ -489,7 +489,7 @@
         (ana/analyze-file src opts)
         (-evaluate repl-env f 1 (cljsc/add-dep-string opts compiled))
         (-evaluate repl-env f 1 (cljsc/src-file->goog-require src)))
-      (binding [ana/*cljs-ns* 'cljs.user]
+      (binding [ana/*cljs-ns* ana/*cljs-ns*]
         (let [res (if (= File/separatorChar (first f)) f (io/resource f))]
           (assert res (str "Can't find " f " in classpath"))
           (load-stream repl-env f res))))))
@@ -684,8 +684,7 @@
             #(prn "Error evaluating:" form :as js)
             (constantly nil))
           opts)))
-    (binding [*out* *err*]
-      (.printStackTrace e))))
+    (.printStackTrace e *err*)))

 (defn repl*
   [repl-env {:keys [init need-prompt quit-prompt prompt flush read eval print caught reader
@@ -731,7 +730,7 @@
         done? (atom false)]
     (env/with-compiler-env (or compiler-env (env/default-compiler-env opts))
      (binding [*err* (if bind-err *out* *err*)
-               ana/*cljs-ns* 'cljs.user
+               ana/*cljs-ns* ana/*cljs-ns*
                *cljs-verbose* repl-verbose
                ana/*cljs-warnings*
                (assoc ana/*cljs-warnings*


fix slack thread messages

fix slack thread messages

--- src/clj/tictag/db.clj
+++ src/clj/tictag/db.clj
@@ -58,7 +58,7 @@
                                (from :ping-threads)
                                (where [:= :ping-threads.slack-ts ts])
                                sql/format))]
-    (assoc db :_last-ping (:ping-ts ping))
+    (assoc db :_last-ping (:ping_ts ping))
     db))

 (defn beeminder-id [user-id]
@@ -175,7 +175,7 @@
        (where [:= :user_id (:id user)])
        (merge-where
         (when-let [now (:_last-ping db)]
-          [:<= :ts now]))
+          [:= :ts now]))
        (order-by [:ts :desc])
        (limit count))))


stage-file now passing test. Fixed build-index.

build-index now correctly sorts entries by pathname.

--- src/clj_git/index.clj
+++ src/clj_git/index.clj
@@ -11,14 +11,15 @@
 ; TOOD: Get this to return a simple [int] type
 ;   -> Move all functions to simpler types..
 (defn build-index [index-struct]
-  (let [out (java.io.ByteArrayOutputStream.)
-        wstr (fn [s] (.write out (.getBytes s)))
-        wchars (fn [cs] (doseq [c cs] (.write out (int c))))
-        file-count (count index-struct)]
+  (let [out                 (java.io.ByteArrayOutputStream.)
+        wstr                (fn [s] (.write out (.getBytes s)))
+        wchars              (fn [cs] (doseq [c cs] (.write out (int c))))
+        file-count          (count index-struct)
+        sorted-index-struct (sort-by #(:name %) index-struct)]
     (wstr "DIRC")
     (wchars [0 0 0 2])
     (wchars (int-bytes file-count 4))
-    (doseq [entry index-struct]
+    (doseq [entry sorted-index-struct]
       (let [ctime-s   (/ (.getTime    (:ctime entry)) 1000)
             ctime-ns  (mod (.getTime  (:ctime entry)) 1000)
             mtime-s   (/ (.getTime    (:mtime entry)) 1000)
@@ -190,7 +191,12 @@

 (defn stage-file [filename]
   (let [new-entry (file-index-entry filename)]
-    nil))
+    (write-file-blob filename)
+    (->> (read-index)
+      (filter #(not= (:name %) filename))
+      (cons new-entry)
+      (write-index))
+))

 ; Use the following rules to quickly check for modified files:
 ;         if filesystem mtime matches index           -> return False


Reinstate throttle code with comments

Reinstate throttle code with comments

Add throttle code back in that adds a delay to requesting query data,
that is triggered by typing in the search field, from ElasticSearch.
Also, switch from using (go (while true … )) to (go-loop []).

--- src/cljs/app/app.cljs
+++ src/cljs/app/app.cljs
@@ -1,64 +1,65 @@
 (ns app.app
   (:require [goog.dom :as dom]
             [goog.events :as events]
-            [cljs.core.async :as async :refer [<! >! put! close! chan sliding-buffer]]
+            [cljs.core.async :as async :refer [<! >! put! close! chan
+                                               timeout sliding-buffer]]
             [reagent.core :as reagent]
             [kioo.reagent :as kioo]
             [cljs-http.client :as http])
   (:require-macros [kioo.reagent :refer [defsnippet deftemplate]]
-                   [cljs.core.async.macros :refer [go]]))
+                   [cljs.core.async.macros :refer [go-loop]]))

 ; ElasticSearch API URL
 (def query-url "http://168.235.155.245/beers/2015/_search")

 ; Application state
-(def query-results (reagent/atom {}))
+(def state (reagent/atom {}))

 (defn get-results [in]
   (let [out (chan)]
-    (go
-      (while true
-        (>! out (<! (http/get query-url {:query-params {"q" (<! in)}})))))
+    (go-loop []
+      (>! out (<! (http/get query-url {:query-params {"q" (<! in)}}))))
     out))

 (defn extract-hits [in]
   (let [out (chan)]
-    (go
-      (while true
-        (>! out (get-in (<! in) [:body :hits :hits]))))
+    (go-loop []
+      (>! out (get-in (<! in) [:body :hits :hits])))
     out))

 (defn update-results-state [in]
-  (go
-    (while true
-      (.log js/console (swap! query-results assoc :query-results (<! in))))))
+  (go-loop []
+    (.log js/console (swap! state assoc :results (<! in)))))

-(defn timeout [ms]
-  (let [c (chan)]
-    (js/setTimeout (fn [] (close! c)) ms)
-    c))
+; (defn timeout [ms]
+;   (let [c (chan)]
+;     (js/setTimeout (fn [] (close! c)) ms)
+;     c))

 (defn throttle [c ms]
   (let [c' (chan)]
-    (go
-      (while true
-        (>! c' (<! c))
-        (<! (timeout ms))))
+    (go-loop []
+      ; Take from the input channel and pass through.
+      (>! c' (<! c))
+
+      ; Park while trying to take from an unused channel. The channel receives
+      ; no input, and will time out, delaying the above take from the input
+      ; channel.
+      (<! (timeout ms)))
     c'))

 ; Process pipeline entry point
 (def query-chan (chan))
-; (def throttled-query-chan (throttle query-chan 500))
+(def throttled-query-chan (throttle query-chan 1000))

 ; Rest of process pipeline
-(def get-results-out (get-results query-chan))
+(def get-results-out (get-results throttled-query-chan))
 (def extract-hits-out (extract-hits get-results-out))
 (update-results-state extract-hits-out)

 ; Use channels instead of callbacks for DOM interaction. Taken from
 ; David Nolen's Clojurescript 101:
 ; http://swannodette.github.io/2013/11/07/clojurescript-101/
-; .addEventListener or this listen function?
 (defn listen [el type]
   (let [out (chan)]
     (events/listen el type
@@ -72,15 +73,14 @@
 ; throttled to an interval
 (defn query-input-loop []
   (let [typing (listen (search-field) "keypress")]
-    (go
-      (while true
-        (<! typing)
-        (>! query-chan (.-value (search-field)))))))
+    (go-loop []
+      (<! typing)
+      (>! query-chan (.-value (search-field))))))

 ; Templating
 (defsnippet result-data "templates/results.html" [:.list-row] [result-element]
   {[:.list-row] (kioo/content [:li (first result-element)]
-                             [:li (second result-element)])})
+                              [:li (second result-element)])})

 (defsnippet result-card "templates/results.html" [:.card] [result-map]
   {[:.list-column] (kioo/content [:li
@@ -89,13 +89,13 @@
                                        (get result-map :_source))]])})

 (deftemplate result-cards "templates/results.html" []
-  {[:.card] (map result-card (get @query-results :query-results))})
+  {[:.card] (map result-card (get @state :results))})

 (deftemplate page "index.html" []
   {[:.results] (result-cards)})

 (defn init []
-  ;(reagent/render-component [page] (.-body js/document))
+  (reagent/render-component [page] (.-body js/document))
   (query-input-loop))

 ; (let [query-url "http://168.235.155.245/beers/2015/_search"


Add some requireds needed for analysis

Add some requireds needed for analysis

--- src/onyx_jepsen/checker.clj
+++ src/onyx_jepsen/checker.clj
@@ -1,8 +1,13 @@
 (ns onyx-jepsen.checker
   (:require [onyx.extensions]
             [jepsen [checker :as checker]]
+            [onyx.system :as system]
+            [onyx.log.zookeeper]
+            [onyx.log.curator]
+            [com.stuartsierra.component :as component]
             [onyx.log.replica :as replica]
-            [clojure.core.async :as casync :refer [chan >!! <!! close! alts!!]]))
+            [clojure.core.async :as casync :refer [chan >!! <!! close! alts!!]]
+            [clojure.tools.logging :refer :all]))

 (defn read-peer-log [log]
   (let [ch (chan 1000)


Fix the redis properties schema used by the rate limit (#832)

--- src/ctia/properties.clj
+++ src/ctia/properties.clj
@@ -82,7 +82,7 @@
                       "ctia.http.rate-limit.redis.port" s/Int
                       "ctia.http.rate-limit.redis.ssl" s/Bool
                       "ctia.http.rate-limit.redis.password" s/Str
-                      "ctia.http.rate-limit.redis.db" s/Str
+                      "ctia.http.rate-limit.redis.db" s/Int
                       "ctia.http.rate-limit.redis.timeout-ms" s/Int})

    (st/optional-keys {"ctia.http.send-server-version" s/Bool})


Minor parameters naming change on cats.core/mempty function.

--- src/cats/core.cljc
+++ src/cats/core.cljc
@@ -63,8 +63,8 @@
   ([]
    (let [ctx (ctx/get-current)]
      (p/mempty ctx)))
-  ([context]
-   (let [ctx (ctx/get-current context)]
+  ([ctx-or-val]
+   (let [ctx (ctx/get-current ctx-or-val)]
      (p/mempty ctx))))

 (defn mappend


Whitespace.

Whitespace.


Add support for lists and sets

Add support for lists and sets

--- src/datadrill/core.cljs
+++ src/datadrill/core.cljs
@@ -4,10 +4,11 @@
 (enable-console-print!)

 (def store (r/atom {:data {:a "a"
-                         :b [1 2 3 3 {:a "a" :b "b"}]
-                         :c "c"
-                         :d {:x "x" :y "y" :z [1 2 3 4]}}
-                  :expansion #{}}))
+                           :b [1 2 3 3 {:a "a" :b "b"}]
+                           :c #{1 2 3}
+                           :d {:x "x" :y "y" :z [1 2 3 4]}
+                           :e '(1 2 3)}
+                    :expansion #{}}))

 (defn emit [event args]
   (prn "Emit: " event args)
@@ -36,19 +37,28 @@
     [:button {:onClick #(emit :contract path)} "-"]
     [:button {:onClick #(emit :expand path)} "+"]))

-(defn VecNode [{:keys [data path expansion]}]
+(defn ListVecNode [{:keys [data path expansion]}]
   (let [expanded? (get expansion path)]
     [:div
      [ExpandButton {:expanded? expanded? :path path}]
-     [:span "["]
+     [:span (if (list? data) "(" "[")]
      (if expanded?
        (map-indexed (fn [i x] ^{:key i} [DataDrill {:data x :path (conj path i) :expansion expansion}]) data)
-       (str (count data))
+       (str (count data) " items"))
+     [:span (if (list? data) ")" "]")]]))
+
+(defn SetNode [{:keys [data path expansion]}]
+  (let [expanded? (get expansion path)]
+    [:div
+     [ExpandButton {:expanded? expanded? :path path}]
+     [:span "#{"]
+     (if expanded?
+       (map-indexed (fn [i x] ^{:key i} [DataDrill {:data x :path (conj path x)} :expansion expansion]) data)
+       (str (count data) " items")
        )
-     [:span "]"]]))
+     [:span "}"]]))

 (defn MapNode [{:keys [data path expansion]}]
-  (prn "Mapnode: " data "path: " path "expan: " expansion)
   (let [expanded? (get expansion path)]
     [:div
      [ExpandButton {:expanded? expanded? :path path}]
@@ -61,7 +71,8 @@

 (defn DataDrill [{:keys [data] :as all}]
   (cond (map? data) [MapNode all]
-        (vector? data) [VecNode all]
+        (set? data) [SetNode all]
+        (or (vector? data) (list? data)) [ListVecNode all]
         :else [Node all]))

 (defn App []


correct spelling of leave-one-out-cross-validation

--- src/r_incantations/core.clj
+++ src/r_incantations/core.clj
@@ -304,7 +304,7 @@

 (defn ch09-ml-null-model
   "This is a null-model for the Euclidian-distance ML algorithm from
-  the book, prepped for leave-one-out validation.
+  the book, prepped for leave-one-out-cross-validation.

    * Use with ch09-ml-validate.
    * Assumes test-sel is a single row index.
@@ -339,7 +339,7 @@

 (defn ch09-ml-book
   "This is same Euclidian-distance ML algorithm from the book, prepped
-   for leave-one-out validation.
+   for leave-one-out-cross-validation.

    * Use with ch09-ml-validate.
    * Assumes test-sel is a single row index.
@@ -362,7 +362,7 @@
         (:proc test-data) (:mem test-data)))))

 (defn ch09-ml-validate
-  "Does leave-one-out cross-validation on memproc data.
+  "Does leave-one-out-cross-validation on memproc data.
    http://en.wikipedia.org/wiki/Cross-validation_(statistics)#Leave-one-out_cross-validation.

    ex: (ch09-ml-validate ch09-ml-null-model)


Add new statement-url route

Add new statement-url route

--- src/discuss/config.cljs
+++ src/discuss/config.cljs
@@ -11,4 +11,5 @@
                  :add-start-premise   "add/start_premise"
                  :add-justify-premise "add/justify_premise"}
           :get  {:reference-usages "get/reference/usages"
-                 :statements       "get/statements"}})+                 :statements       "get/statements"
+                 :statement-url    "api/get/statement/url"}})


Add new route

Add new route

--- src/discuss/config.cljs
+++ src/discuss/config.cljs
@@ -10,6 +10,7 @@
           :add  {:add-start-statement "add/start_statement"
                  :add-start-premise   "add/start_premise"
                  :add-justify-premise "add/justify_premise"}
-          :get  {:reference-usages "get/reference/usages"
+          :get  {:references       "get/references"
+                 :reference-usages "get/reference/usages"
                  :statements       "get/statements"
                  :statement-url    "api/get/statement/url"}})


Catch the exception this can throw

Catch the exception this can throw

--- src/myshelf/shelves.clj
+++ src/myshelf/shelves.clj
@@ -75,7 +75,10 @@
   (let [add-url (build-url "shelf" "add_to_shelf.xml")
         params {:name shelf
                 :book_id book-id}]
-    (make-auth-request-POST consumer
-                            access-token
-                            add-url
-                            params)))
+    (try
+      (make-auth-request-POST consumer
+                              access-token
+                              add-url
+                              params)
+      (catch Exception ex
+        nil))))


change min build to simple level to avoid errors

--- ui/project.clj
+++ ui/project.clj
@@ -15,7 +15,7 @@
                  [funcool/bide "1.4.0"]
                  [cljsjs/material-ui "0.17.0-0"
                   :exclusions [cljsjs/react cljsjs/react-dom]]
-                 [day8.re-frame/http-fx "0.1.3"]]
+                 [day8.re-frame/http-fx "0.1.3"]]

   :npm {:dependencies []}

@@ -45,8 +45,9 @@
                 :source-paths ["src"]
                 :compiler {:output-to "resources/public/js/compiled/app.js"
                            :main plant-care-ui.core
-                           :optimizations :advanced
-                           :pretty-print false}}]}
+                           :optimizations :simple
+                           :pretty-print false
+                           :pseudo-names false}}]}

   :figwheel {:server-port 3000
              :css-dirs ["resources/public/css"]}


Remove unnecessary font weights

Remove unnecessary font weights

--- src/braid/client/register/views.cljs
+++ src/braid/client/register/views.cljs
@@ -20,7 +20,7 @@
                           :animation
                           :flex-grow}
            :vendors ["webkit"]}
-          (at-import "https://fonts.googleapis.com/css?family=Open+Sans:400,300,400italic,700")
+          (at-import "https://fonts.googleapis.com/css?family=Open+Sans:400,700")
           (app-styles)
           (form-styles))}}])


make session id with randomuuid

make session id with randomuuid

--- src/clj/closerve/session_manager.clj
+++ src/clj/closerve/session_manager.clj
@@ -1,4 +1,7 @@
-(ns closerve.session-manager)
+(ns closerve.session-manager
+  (:use [closerve util])
+  )
+

 (defprotocol SessionManager
   (init-session-manager [this] "init session manager with options")
@@ -15,7 +18,8 @@
   SessionManager
   (init-session-manager [this]
     (reset! session-counter (long (/ (.getTime (java.util.Date.)) 1000))))
-  (make-new-session [this] (swap! session-counter inc))
+  ;; make the session-id more random
+  (make-new-session [this] (str (make-random-uuid) (swap! session-counter inc)))
   (get-session-var [this session-id k] (get-in @session-store [session-id k]))
   (set-session-var [this session-id k v] (swap! session-store assoc-in [session-id k] v))
   (get-cookie-key [this] cookie-key)


Correct small error in add-locations code...

--- src/cljs/comic_reader/ui/reader.cljs
+++ src/cljs/comic_reader/ui/reader.cljs
@@ -36,7 +36,7 @@
    (location-sorted-set)))

 (defn add-locations [app-db locations]
-  (update app-db :locations conj-locations))
+  (update app-db :locations conj-locations locations))

 (defn setup! []
   (trace-forms {:tracer (tracer :color "green")}


Sort thread ids.

Sort thread ids.

--- src/dsbdp/main.clj
+++ src/dsbdp/main.clj
@@ -29,7 +29,7 @@
         delta-cntr (delta-counter)]
     (.setThreadContentionMonitoringEnabled tmxb true)
     (fn []
-      (let [t-ids (vec (.getAllThreadIds tmxb))]
+      (let [t-ids (sort (vec (.getAllThreadIds tmxb)))]
         (doseq [t-id t-ids]
           (let [^ThreadInfo t-info (.getThreadInfo tmxb ^long t-id)
                 t-name (.getThreadName t-info)


Add batch delay and batch size command line arguments.

--- src/dsbdp/main.clj
+++ src/dsbdp/main.clj
@@ -52,7 +52,15 @@
                        (delta-cntr (str "blocked-" t-id) blocked)))))))))

 (def cli-options
-  [["-h" "--help"]
+  [["-b" "--batch-size BATCH-SIZE"
+    "The number of data instances to be generated for one batch."
+    :default 2000
+    :parse-fn #(Integer/parseInt %)]
+   ["-d" "--batch-delay BATCH-DELAY"
+    "The delay in ms between generating batches."
+    :default 1
+    :parse-fn #(Integer/parseInt %)]
+   ["-h" "--help"]
    ["-i" "--in-data IN-DATA"
     "The input data to be used."
     :default nil
@@ -66,7 +74,8 @@
     :parse-fn #(binding [*read-eval* false] (read-string %))]
    ["-s" "--scenario SCENARIO"
     "The scenario that is to be used."
-    :default "no-op"]])
+    :default "no-op"]
+   ])

 (defn -main [& args]
   (println "Starting dsbdp main...")
@@ -119,6 +128,8 @@
                                            fn-mapping
                                            sample-pcap-processing-definition-json))
                        out-fn))
+          batch-delay (:batch-delay options)
+          batch-size (:batch-size options)
           in-loop (ProcessingLoop.
                     "DataGenerationLoop"
                     (cond
@@ -135,13 +146,19 @@
                           (fn []
                             (proc-fn in-data)
                             (.inc out-cntr)))
-                      (not (nil? in-data)) (let [in-fn (get-in-fn pipeline)]
-                                             (fn []
-                                         ;      (doseq [i (repeat 2000 0)]
-                                                 (in-fn in-data)
-                                                 (.inc in-cntr))
-                                           )
-                                         ;      (sleep 1)))
+                      (and
+                        in-data
+                        (> batch-delay 0)
+                        (> batch-size 0)) (let [in-fn (get-in-fn pipeline)]
+                                           (fn []
+                                             (doseq [i (repeat batch-size 0)]
+                                               (in-fn in-data)
+                                               (.inc in-cntr)))
+                                             (sleep batch-delay))
+                      in-data (let [in-fn (get-in-fn pipeline)]
+                                (fn []
+                                  (in-fn in-data)
+                                  (.inc in-cntr)))
                       :default (fn [] (.inc out-cntr))))
           thread-info-fn (create-thread-info-fn)
           stats-fn (fn []