Don't infer semantics of numbers in arithmetic

Since durations are easy to construct, using numbers should be avoid
and may lead to surprises.

--- src/tick/core.clj
+++ src/tick/core.clj
@@ -25,20 +25,6 @@
   (if *clock*
     (LocalDate/now *clock*)
     (LocalDate/now)))
-
-(defprotocol ITimeArithmetic
-  (+ [_ _] "Add time")
-  (- [_ _] "Subtract time")
-  (inc [_] "Increment time")
-  (dec [_] "Decrement time")
-  (maximum [_ _] "Return maximum")
-  (minimum [_ _] "Return minimum"))
-
-(defn tomorrow []
-  (+ (today) 1))
-
-(defn yesterday []
-  (- (today) 1))

 (defprotocol ITimeAt
   (on [_ _] "Set time be ON a date")
@@ -355,12 +341,6 @@
   (> [x y] (.isAfter x y))
   (>= [x y] (not (.isBefore x y))))

-(defn max [arg & args]
-  (reduce #(maximum %1 %2) arg args))
-
-(defn min [arg & args]
-  (reduce #(minimum %1 %2) arg args))
-
 (defprotocol ITimeRangeable
   (range [_] [_ _] [_ _ _] "Returns a lazy seq of times from start (inclusive) to end (exclusive, nil means forever), by step, where start defaults to 0, step to 1, and end to infinity."))

@@ -370,6 +350,20 @@
 (extend-protocol IDivisible
   String
   (/ [s d] (/ (parse s) d)))
+
+(defprotocol ITimeArithmetic
+  (+ [_ _] "Add time")
+  (- [_ _] "Subtract time")
+  (inc [_] "Increment time")
+  (dec [_] "Decrement time")
+  (maximum [_ _] "Return maximum")
+  (minimum [_ _] "Return minimum"))
+
+(defn max [arg & args]
+  (reduce #(maximum %1 %2) arg args))
+
+(defn min [arg & args]
+  (reduce #(minimum %1 %2) arg args))

 (extend-type Instant
   ITimeArithmetic
@@ -405,8 +399,8 @@

 (extend-type LocalDate
   ITimeArithmetic
-  (+ [t x] (if (number? x) (.plusDays t x) (.plus t x)))
-  (- [t x] (if (number? x) (.minusDays t x) (.minus t x)))
+  (+ [t x] (.plus t x))
+  (- [t x] (.minus t x))
   (inc [t] (.plusDays t 1))
   (dec [t] (.minusDays t 1))
   (maximum [x y] (if (neg? (compare x y)) y x))
@@ -419,6 +413,12 @@
     ([from to step] (cond->> (iterate #(.plusDays % step) from)
                       to (take-while #(< % to))))))

+(defn tomorrow []
+  (inc (today)))
+
+(defn yesterday []
+  (dec (today)))
+
 (extend-type LocalDateTime
   ITimeArithmetic
   (+ [t x] (.plus t x))
@@ -446,8 +446,8 @@

 (extend-type YearMonth
   ITimeArithmetic
-  (+ [t x] (if (number? x) (.plusMonths t x) (.plus t x)))
-  (- [t x] (if (number? x) (.minusMonths t x) (.minus t x)))
+  (+ [t x] (.plus t x))
+  (- [t x] (.minus t x))
   (inc [t] (.plusMonths t 1))
   (dec [t] (.minusMonths t 1))
   (maximum [x y] (if (neg? (compare x y)) y x))
@@ -462,8 +462,8 @@

 (extend-type Year
   ITimeArithmetic
-  (+ [t x] (if (number? x) (.plusYears t x) (.plus t x)))
-  (- [t x] (if (number? x) (.minusYears t x) (.minus t x)))
+  (+ [t x] (.plus t x))
+  (- [t x] (.minus t x))
   (inc [t] (.plusYears t 1))
   (dec [t] (.minusYears t 1))
   (maximum [x y] (if (neg? (compare x y)) y x))


Update Oxford's API to v1

Update Oxford's API to v1

--- src/tobias/cv.clj
+++ src/tobias/cv.clj
@@ -36,18 +36,16 @@
   (reify CvProvider
     (name [_] "Microsoft")
     (features [_ image]
-      (http/post (str "https://api.projectoxford.ai/face/v0/detections"
-                      "?analyzesFaceLandmarks=false"
-                      "&analyzesAge=true"
-                      "&analyzesGender=true"
-                      "&analyzesHeadPose=false")
+      (http/post (str "https://api.projectoxford.ai/face/v1.0/detect"
+                      "?returnFaceId=false"
+                      "&returnFaceAttributes=age,gender")
                  {:headers {"Content-Type" "application/octet-stream"
                             "Ocp-Apim-Subscription-Key" (:key microsoft-creds)}
                   :body image}))
     (normalize [_ result]
       (map (fn [r]
-             {:age    (age->sym (get-in r [:attributes :age]))
-              :gender (str->kw  (get-in r [:attributes :gender]))})
+             {:age    (age->sym (get-in r [:faceAttributes :age]))
+              :gender (str->kw  (get-in r [:faceAttributes :gender]))})
            result))))

 (def sightcorp


added the insert-chunk! function to the models.chunk namespace

--- src/bitfondue/models/chunks.clj
+++ src/bitfondue/models/chunks.clj
@@ -1 +1,10 @@
-(ns bitfondue.models.chunks)
+(ns bitfondue.models.chunks
+  (:require (bitfondue [config :as config]
+                       [database :as database])))
+
+(defn insert-chunk!
+  "Insert a chunk into the database"
+  [chunk]
+  (database/insert-chunk<! config/database
+                           (:title chunk)))
+


Move the second level div into each top-level component

--- src/cljs/comic_reader/main.cljs
+++ src/cljs/comic_reader/main.cljs
@@ -35,9 +35,10 @@
   (let [site-list (rf/subscribe [:site-list])]
     (fn []
       (when-let [site-list @site-list]
-        [:ul (map (id-btn-for-callback
-                   #(r/go-to (r/comics-path {:site (name (:id %))})))
-                  site-list)]))))
+        [:div
+         [:ul (map (id-btn-for-callback
+                    #(r/go-to (r/comics-path {:site (name (:id %))})))
+                   site-list)]]))))

 (defn comic-list []
   (let [site (rf/subscribe [:site])
@@ -46,13 +47,14 @@
       (let [site       @site
             comic-list @comic-list]
         (when (and site comic-list)
-          [:ul (map (id-btn-for-callback
-                     (fn [item]
-                       (r/go-to (r/read-path {:site site
-                                              :comic (:id item)
-                                              :chapter 1
-                                              :page 1}))))
-                    comic-list)])))))
+          [:div
+           [:ul (map (id-btn-for-callback
+                      (fn [item]
+                        (r/go-to (r/read-path {:site site
+                                               :comic (:id item)
+                                               :chapter 1
+                                               :page 1}))))
+                     comic-list)]])))))

 (defn img-component [site
                      {:keys [comic]}
@@ -99,13 +101,12 @@
 (defn comic-reader []
   (let [page (rf/subscribe [:page])]
     (fn []
-      [:div
-       (case @page
-         :sites [site-list]
-         :comics [comic-list]
-         :read [reader]
-         nil ""
-         [four-oh-four])])))
+      (case @page
+        :sites [site-list]
+        :comics [comic-list]
+        :read [reader]
+        nil ""
+        [four-oh-four]))))

 (defn ^:export run []
   (init-handlers!)


Only trim descriptions from DBpedia

Only trim descriptions from DBpedia

--- src/cljs/db_quiz/normalize.cljs
+++ src/cljs/db_quiz/normalize.cljs
@@ -263,14 +263,17 @@
   "Truncate description to the configured maximum length.
   Cuts the description on a complete sentence."
   [description]
-  (let [maximum-length (:max-question-length config)]
-    (cond (> (count description) maximum-length)
-          (reduce (fn [a b]
-                    (if (> (count a) maximum-length)
-                        a
-                        (str a ". " b)))
-                  (split description #"\.\s+"))
-          :else description)))
+  (let [maximum-length (:max-question-length config)
+        data-source (get-in @app-state [:options :data-source])]
+    (if (= data-source :dbpedia)
+      (cond (> (count description) maximum-length)
+            (reduce (fn [a b]
+                      (if (> (count a) maximum-length)
+                          a
+                          (str a ". " b)))
+                    (split description #"\.\s+"))
+            :else description)
+      description)))

 (def clear-label
   (comp trim delete-parenthesized-parts))


Control the waveform and frequency.

Control the waveform and frequency.

--- src/cljs/leipzig_live/core.cljs
+++ src/cljs/leipzig_live/core.cljs
@@ -32,6 +32,8 @@
 (defn beep []
   (let [oscillator (.createOscillator context)]
     (.connect oscillator (.-destination context))
+    (-> oscillator .-frequency .-value (set! 440))
+    (-> oscillator .-type (set! "square"))
     (.start oscillator 0)
     (swap! state assoc-in [:playing] oscillator)))


Use doto for concision.

Use doto for concision.

--- src/cljs/leipzig_live/core.cljs
+++ src/cljs/leipzig_live/core.cljs
@@ -31,10 +31,11 @@
 (defonce context (js/window.AudioContext.))
 (defn beep []
   (let [oscillator (.createOscillator context)]
-    (.connect oscillator (.-destination context))
-    (-> oscillator .-frequency .-value (set! 440))
-    (-> oscillator .-type (set! "square"))
-    (.start oscillator 0)
+    (doto oscillator
+      (.connect (.-destination context))
+      (-> .-frequency .-value (set! 440))
+      (-> .-type (set! "square"))
+      (.start 0))
     (swap! state assoc-in [:playing] oscillator)))

 (defn kill []


Use regular read-string for get-version because it is internal

--- src/clojure/nightcode/utils.clj
+++ src/clojure/nightcode/utils.clj
@@ -1,8 +1,8 @@
 (ns nightcode.utils
-  (:require [clojure.java.io :as java.io]
+  (:require [clojure.edn :as edn]
+            [clojure.java.io :as java.io]
             [clojure.xml :as xml]
-            [seesaw.core :as s]
-            [clojure.edn :as edn])
+            [seesaw.core :as s])
   (:import [bsh.util JConsole]
            [clojure.lang LineNumberingPushbackReader]
            [com.camick WrapLayout]
@@ -93,8 +93,8 @@
 (defn get-version
   []
   (let [project-clj (-> (java.io/resource "project.clj")
-                        (slurp)
-                        (edn/read-string))]
+                        slurp
+                        read-string)]
     (if (= (name (nth project-clj 1)) "nightcode")
       (nth project-clj 2)
       "beta")))


Remove duplicate require of schema.core

Remove duplicate require of schema.core


(maint) Bump version to 7.0.0

(maint) Bump version to 7.0.0


Version 2.1.8

Version 2.1.8


Release 2.3.0

Release 2.3.0


Removed obsolete icon code

Removed obsolete icon code

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

--- src/conexp/contrib/gui/util.clj
+++ src/conexp/contrib/gui/util.clj
@@ -150,81 +150,6 @@
        (.add menu-bar menu))
      (.validate frame)
      new-menus)))
-
-;;; Tool Bar
-
-(defvar ^String default-icon-image (get-resource "images/default.jpg")
-  "Default icon image used when no other image is found.")
-(defvar icon-size 17
-  "Default icon size.")
-
-(defn- ^JButton make-icon
-  "Converts hash representing an icon to an actual JButton."
-  [frame icon-hash]
-  (if (empty? icon-hash)
-    (javax.swing.JToolBar$Separator.)
-    (let [button (JButton.)]
-      (doto button
-        (.setName (:name icon-hash))
-        (listen :action
-                (fn [evt]
-                  (with-swing-error-msg frame "Error"
-                    ((:handler icon-hash) frame))))
-        (.setToolTipText (:name icon-hash)))
-      (let [icon (:icon icon-hash)
-            image (-> ^BufferedImage
-                      (ImageIO/read ^File (if (and icon
-                                                   (.exists (File. ^String icon)))
-                                            (File. ^String icon)
-                                            (File. default-icon-image)))
-                      (.getScaledInstance icon-size icon-size
-                                          Image/SCALE_SMOOTH))]
-        (.setIcon button (ImageIcon. ^Image image)))
-      button)))
-
-(defn- collapse-separators
-  "Given a sequence of Java objects returns a sequence of the same
-  objects where adjacent Separators are collapsed into one."
-  [objects]
-  (let [partitioned-objects (partition-by class objects)]
-    (apply concat (map #(if (instance? javax.swing.JSeparator (first %))
-                          (list (first %))
-                          %)
-                       partitioned-objects))))
-
-(defn add-icons
-  "Adds icons (sepcified as hash-maps) to toolbar of frame, returning
-  added icons."
-  [^JFrame frame, icons]
-  (let [our-icons (map #(make-icon frame %) icons)]
-    (do-swing
-     (let [toolbar (first (select frame [:JToolBar])),
-           new-icons (collapse-separators (concat (.getComponents toolbar)
-                                                  our-icons))]
-       (.removeAll toolbar)
-       (doseq [^JComponent icon new-icons]
-         (.add toolbar icon))
-       (.validate frame)))
-    our-icons))
-
-(defn remove-icons
-  "Removes icons (as Java objects) from toolbar of frame. The
-  resulting toolbar in frame will have no two equal icons side by
-  side."
-  [^JFrame frame, icons]
-  (do-swing
-   (let [^JToolBar toolbar (first (select frame [:JToolBar])),
-         rem-icons (collapse-separators (remove (set icons) (seq (.getComponents toolbar))))]
-     (.removeAll toolbar)
-     (doseq [^JComponent icon rem-icons]
-       (.add toolbar icon))
-     (.validate frame))))
-
-;; toolbar shortcut variables for convenience
-
-(defvar | {}
-  "Separator for icons in toolbars used in add-icons.")
-

 ;;; Tabs


a little somethin I dunno what

a little somethin I dunno what

--- src/viz/core.cljs
+++ src/viz/core.cljs
@@ -129,14 +129,14 @@
       (q/fill 0xFFFFFFFF)
       (doseq [leef leaves]
         (let [pos (:pos leef)]
-          (ellipse state pos [0.5 0.5])
+          (ellipse state pos [0.3 0.3])
           ))

       (q/stroke 0xFF000000)
       (q/fill 0xFF000000)
       (doseq [active-node active]
         (let [pos (:pos active-node)]
-          (ellipse state pos [0.5 0.5])
+          (ellipse state pos [0.35 0.35])
           ))

       ))


whoops

whoops

--- src/demogorgon/config.clj
+++ src/demogorgon/config.clj
@@ -2,10 +2,10 @@

 (def config
      {:un-dir "/opt/nethack.nu/var/unnethack/"
-      :twitter {:consumer_key "reEFD0AjpXtn7mJ6MVlX1g"
-                :consumer_secret "Nij9GdGR58VRDR5dbTqQin97HnhgdXwogY6lnrKxSrs"
-                :oauth_token "179042090-SNSfPwsE2EIKTAUPicBLKaccdbBkgoSt5y737FsY"
-                :oauth_token_secret "SqskJ8PTPXfMCwMxwioJRcpHGGNutC7xsgfeBmR9rMU"}
+      :twitter {:consumer_key ""
+                :consumer_secret ""
+                :oauth_token ""
+                :oauth_token_secret ""}
       :irc {:nick "demogorgon"
             :username "demogorgon"
             :realname "demogorgon"


rename variable

rename variable

--- src/babel/forest.cljc
+++ src/babel/forest.cljc
@@ -142,7 +142,7 @@
                                     (count filtered-lexical-complements)))
               shuffled-candidate-lexical-complements (lazy-shuffle filtered-lexical-complements)

-              return-val
+              complements
               (filter (fn [result]
                         (not (fail? result)))
                       (map (fn [complement]
@@ -184,7 +184,7 @@
                                      (log/debug (str "no phrasal complements for: " (get-in bolt [:rule]) ".")))
                                    (lazy-cat phrasal-complements shuffled-candidate-lexical-complements)))))))]
           (let [run-time (- (current-time) start-time)]
-            (if (empty? return-val)
+            (if (empty? complements)
               ;; else, no complements could be added to this bolt: Throw an exception or log/warn. debateable about which to do
               ;; in which circumstances.
               (let [log-limit 1000
@@ -232,8 +232,8 @@
                          (not (= true (get-in bolt (concat path [:phrasal])))))
                   (exception message)))

-              ;; else, return-val was not empty.
-              return-val))))
+              ;; else, complements was not empty.
+              complements))))

       ;; path doesn't exist in bolt: simply return the bolt unmodified.
       (list bolt))))


Additional type hinting

Additional type hinting

--- src/onyx/peer/virtual_peer.clj
+++ src/onyx/peer/virtual_peer.clj
@@ -1,12 +1,14 @@
 (ns ^:no-doc onyx.peer.virtual-peer
-    (:require [clojure.core.async :refer [chan >!! <!! thread alts!! close! dropping-buffer]]
-              [com.stuartsierra.component :as component]
-              [onyx.extensions :as extensions]
-              [taoensso.timbre :as timbre]
-              [onyx.peer.operation :as operation]
-              [onyx.peer.task-lifecycle :refer [task-lifecycle]]
-              [onyx.log.entry :refer [create-log-entry]]
-              [onyx.static.default-vals :refer [defaults arg-or-default]]))
+  (:require [clojure.core.async :refer [chan >!! <!! thread alts!! close! dropping-buffer]]
+            [com.stuartsierra.component :as component]
+            [onyx.extensions :as extensions]
+            [taoensso.timbre :as timbre]
+            [onyx.peer.operation :as operation]
+            [onyx.peer.task-lifecycle :refer [task-lifecycle]]
+            [onyx.log.entry :refer [create-log-entry]]
+            [onyx.static.default-vals :refer [defaults arg-or-default]])
+  (:import [clojure.core.async.impl.buffers SlidingBuffer]
+           [clojure.core.async.impl.channels ManyToManyChannel]))

 (defn send-to-outbox [{:keys [outbox-ch] :as state} reactions]
   (doseq [reaction reactions]
@@ -68,7 +70,7 @@
         high-water-pct (arg-or-default :onyx.peer/backpressure-high-water-pct opts)
         check-interval (arg-or-default :onyx.peer/backpressure-check-interval opts)
         on? (atom false)
-        buf (.buf (:inbound-ch messenger-buffer))
+        buf ^SlidingBuffer (.buf ^ManyToManyChannel (:inbound-ch messenger-buffer))
         low-water-ratio (/ low-water-pct 100)
         high-water-ratio (/ high-water-pct 100)]
     (while (not (Thread/interrupted))


terminate game for draws

terminate game for draws

--- src/c4_arena/core.clj
+++ src/c4_arena/core.clj
@@ -37,24 +37,28 @@

 (defn get-winner [state-val i]
   (let [cand (state-val i)]
-    (when (->>
-           ;; For all 4 angles
-           (for [angle [1 nrows (dec nrows) (inc nrows)]]
-             ;; Count length of
-             (count
-              (for [dir [- +] ;; in both directions
-                    j (reductions + (repeat angle)) ;; straight line
-                    :let [k (dir i j)]
-                    ;; while position is
-                    :while (and
-                            ;; on the board
-                            (<= 0 k (dec (* ncols nrows)))
-                            ;; the symbol as the candidate
-                            (= cand (state-val k)))]
-                true)))
-           ;; At least one line is longer than needed to win
-           (some (fn [n] (>= n (dec n-to-win)))))
-      (dec cand))))
+    (cond
+      ;; Check for winner
+      (->>
+       ;; For all 4 angles
+       (for [angle [1 nrows (dec nrows) (inc nrows)]]
+         ;; Count length of
+         (count
+          (for [dir [- +] ;; in both directions
+                j (reductions + (repeat angle)) ;; straight line
+                :let [k (dir i j)]
+                ;; while position is
+                :while (and
+                        ;; on the board
+                        (<= 0 k (dec (* ncols nrows)))
+                        ;; the symbol as the candidate
+                        (= cand (state-val k)))]
+            true)))
+       ;; At least one line is longer than needed to win
+       (some (fn [n] (>= n (dec n-to-win)))))
+      (dec cand)
+      ;; Check if there is no remaining space on the board
+      (not-any? #{0} state-val) -1)))

 (declare initial-loop)
 (defn game-loop [players]


Use dbug macro to prevent evaluation of params is dbug disabled

--- src/adzerk/boot_cljs/impl.clj
+++ src/adzerk/boot_cljs/impl.clj
@@ -103,7 +103,7 @@
                                                            (str "at line " (:line env) " " path)
                                                            (when path
                                                              (str "in file " path))))
-                        (butil/dbug "%s\n" (butil/pp-str warning-data))
+                        (butil/dbug* "%s\n" (butil/pp-str warning-data))
                         (swap! warnings conj warning-data)))))]
     (try
       (build


Report more errors.

Report more errors.

--- src/afterglow/controllers.clj
+++ src/afterglow/controllers.clj
@@ -76,8 +76,8 @@
       (try
         (apply bind-to-show (concat [show (match-input-output-pair device)]
                                     (flatten (seq args))))
-        (catch Exception e
-          (timbre/error e "Problem binding to controller"))))
+        (catch Throwable t
+          (timbre/error t "Problem binding to controller"))))

     ;; Wait for the next candidate device, unless we have been told to end
     (when-not (= args :done)


CMR-1810: Fixed docstring for a function

--- virtual-product-app/src/cmr/virtual_product/services/virtual_product_service.clj
+++ virtual-product-app/src/cmr/virtual_product/services/virtual_product_service.clj
@@ -273,9 +273,7 @@
       [[provider-id gran-ur] (get src-gran-ur-entry-map src-gran-ur)])))

 (defn translate-granule-entries
-  "Translate virtual granules in the granule-entries into the corresponding source entries.
-  Remove the duplicates from the final set of entries. See routes.clj for the JSON schema of
-  granule-entries."
+  "Translate virtual granules in the granule-entries into the corresponding source entries. See routes.clj for the JSON schema of granule-entries."
   [context granule-entries]
   (let [annotated-entries (annotate-entries granule-entries)
         ;; Group entries by the combination of provider-id and entry-title of source collection for


sudo bug

sudo bug

--- src/flax/node_manager.clj
+++ src/flax/node_manager.clj
@@ -19,22 +19,22 @@
       checkpoint
       (let [argv (remove nil?
                    (flatten
-                     ["sudo" (if-let [u (:user checkpoint)] ["-u" u]) "bash" "-c" (or (:invocation checkpoint) "")]))
+                     [(if-let [u (:user checkpoint)] ["sudo" "-u" u]) "bash" "-c" (:invocation checkpoint)]))
             proc (-> (Runtime/getRuntime)
                    (.exec (into-array String argv)))
             stdout (stream-to-reader (.getInputStream proc))
             stderr (stream-to-reader (.getErrorStream proc))]
         (when-not (false? (:log checkpoint))
-          (log logger :debug (clojure.string/join " " argv)))
+          (log logger :info (clojure.string/join " " argv)))
         (loop [out []
                err []]
           (let [line (.readLine stdout)
                 errl (.readLine stderr)]
             (when-not (false? (:log checkpoint))
               (when-not (clojure.string/blank? line)
-                (log logger :info line))
+                (log logger :debug line))
               (when-not (clojure.string/blank? errl)
-                (log logger :info errl)))
+                (log logger :debug errl)))
             (if-not (and (nil? line)
                          (nil? errl))
               (recur (if-not (nil? line)


Small reformatting

Small reformatting

--- web-app/src/cljs/potato/core.cljs
+++ web-app/src/cljs/potato/core.cljs
@@ -821,114 +821,114 @@
                                               (not (om/get-state owner :editing)))
                                      (potato.mathjax/add-node node))))]
     (reify
-        om/IDisplayName (display-name [_] "message-view")
-        om/IInitState
-        (init-state [_]
-          {:editing false})
-        om/IDidMount
-        (did-mount [_]
-          (let [user-id     (:id (:current-user (deref potato.state/global)))
-                the-node    (om/get-node owner)]
-            (handle-update-or-mount owner)
-            ;; Check if the screen should be scrolled to this message.
-            ;; TODO: We should really only run this code when the
-            ;; message is the last one in the list. Right now it's being
-            ;; run for all messages, which is never necessary.
-            (when (= (update-index-of-message message) 0)
-              (if (or (:initial-load message) (:client-top message) (= (:from message) user-id))
-                ;; if the message has been inserted by the initial history load, by a scrolling top, or is from me: scroll
-                (scrollToBottom the-node)
-                ;; else this is a new message from somebody else at the bottom
-                (let [rect (.getBoundingClientRect the-node)]
-                  (if (and (>= (.-top rect) 0) (>= (.-left rect) 0)
-                           (<= (.-bottom rect) (or (.-innerHeight js/window) (.-clientHeight (.documentElement js/document))))
-                           (<= (.-right rect) (or (.-innerWidth js/window) (.-clientWidth (.documentElement js/document)))))
-                    ;; if the node is visible: scroll
-                    (scrollToBottom the-node)
-                    ;; if the node isn't visible, test how far we are in the scroll
-                    (let [the-ul      (goog.dom/getAncestorByTagNameAndClass the-node "ul" nil)
-                          the-article (goog.dom/getAncestorByTagNameAndClass the-node "article" nil)]
-                      (if (< (- (.-scrollHeight the-article) (.-scrollTop the-article)) (* 1.5 (.-height (goog.style/getSize the-ul))))
-                        ;; more than half a page away, scroll
-                        (scrollToBottom the-node)
-                        (print "No scroll, too far from bottom")))))))))
-        om/IDidUpdate
-        (did-update [_ _ _]
+      om/IDisplayName (display-name [_] "message-view")
+      om/IInitState
+      (init-state [_]
+        {:editing false})
+      om/IDidMount
+      (did-mount [_]
+        (let [user-id     (:id (:current-user (deref potato.state/global)))
+              the-node    (om/get-node owner)]
           (handle-update-or-mount owner)
-          ;; TODO: add scroll control behaviour
-          ;; - is the node visible; if it is not but above: realign
-          ;; - is the scroll position lower than the existing node
-          )
-        om/IWillUpdate
-        (will-update [_ next-props {:keys [editing]}]
-          (when editing
-            (let [fieldset            (goog.dom/getElementByClass "chat-entry" (om/get-node owner))
-                  keyboard-controller (om/get-shared owner :keyboard-control)
-                  typing-chan         (om/get-shared owner :typing-chan)
-                  editable            (potato.keyboard/append-editable-div {:parent-node     fieldset
-                                                                            :keyboard        keyboard-controller
-                                                                            :typing-callback #(async/put! typing-chan true)
-                                                                            :id              "edit-entry"
-                                                                            :text-content    (:text editing)})
-                  cid                   (:active-channel (deref potato.state/global))]
-              (potato.keyboard/set-event! editable potato.keyboard/ENTER
-                                          {:callback (fn [] (when-not (get-in (deref potato.state/global)
-                                                                              [:channels cid :has-autocomplete-menu])
-                                                              (let [new-text (fixup-input-text (potato.keyboard/content editable))]
-                                                                (http/post potato.urls/update-chat {:json-params {:message (:id message)
-                                                                                :text new-text}})
-                                                                (potato.keyboard/destroy! editable)
-                                                                (potato.keyboard/reset-cursor! keyboard-controller)
-                                                                (om/set-state! owner :editing false)
-                                                                (potato.keyboard/really-focus (goog.dom/getElement "channel-input")))
-                                                              (at-magic-close!)
-                                                              true))
-                                           :act-on-magic true})
-              (potato.keyboard/set-event! editable potato.keyboard/ESC
-                                          {:callback (fn []
-                                                       (when-not (get-in (deref potato.state/global)
-                                                                         [:channels cid :has-autocomplete-menu])
-                                                         (potato.keyboard/destroy! editable)
-                                                         (potato.keyboard/reset-cursor! keyboard-controller)
-                                                         (om/set-state! owner :editing false)
-                                                         (potato.keyboard/really-focus (goog.dom/getElement "channel-input")))
-                                                       (at-magic-close!)
-                                                       true)
-                                           :act-on-magic true})
-              (potato.keyboard/set-magic! editable "@" {:callback (fn [text event editable]
-                                                                    (at-magic-callback owner text event editable :user))})
-              (potato.keyboard/set-magic! editable ":" {:callback (fn [text event editable]
-                                                                    (at-magic-callback owner text event editable :emoji))}))))
-        om/IRenderState
-        (render-state [_ {:keys [update-time editing previous-from previous-date]}]
-          (let [user-entry (-> @potato.state/global :user-to-name-map (get (:from message)))]
-            (om.dom/li
-                #js {:id (str (:key-prefix opts) "-" (:id message))
-                     :className (clojure.string/join " "
-                                                     (remove nil?
-                                                             [(if (and
-                                                                   (== (:from message) previous-from)
-                                                                   (<  (.diff (js/moment (:created_date message)) (js/moment previous-date)) 60000))
-                                                                "chat-monologue")
-                                                              (if (:highlighted-p opts)
-                                                                "chat-highlighted")]))}
-                (let [image (:image-name user-entry)]
-                  (if image
-                    (om.dom/img #js {:className "chat-author-picture"
-                                     :src image})
-                    ;; ELSE: Image information is not available yet, simply display an empty div
-                    (om.dom/div #js {:className "chat-author-picture"})))
-                (om.dom/figure #js {:className (str "chat-entry" (if (:unconfirmed message) " unconfirmed-message"))
-                                    :data-id   (:hash message)}
-                    (om.dom/figcaption nil
-                        (om.dom/address #js {:className "chat-author"
-                                             :title (:nickname user-entry)}
-                                        (or (:description user-entry) ""))
-                        (display-time (:created_date message)))
-                    (om/build message-quote message {:state {:update-time      update-time
-                                                             :editing          editing
-                                                             :editable         (not (:unconfirmed message))
-                                                             :editing-callback #(om/set-state! owner :editing %)}}))))))))
+          ;; Check if the screen should be scrolled to this message.
+          ;; TODO: We should really only run this code when the
+          ;; message is the last one in the list. Right now it's being
+          ;; run for all messages, which is never necessary.
+          (when (= (update-index-of-message message) 0)
+            (if (or (:initial-load message) (:client-top message) (= (:from message) user-id))
+              ;; if the message has been inserted by the initial history load, by a scrolling top, or is from me: scroll
+              (scrollToBottom the-node)
+              ;; else this is a new message from somebody else at the bottom
+              (let [rect (.getBoundingClientRect the-node)]
+                (if (and (>= (.-top rect) 0) (>= (.-left rect) 0)
+                         (<= (.-bottom rect) (or (.-innerHeight js/window) (.-clientHeight (.documentElement js/document))))
+                         (<= (.-right rect) (or (.-innerWidth js/window) (.-clientWidth (.documentElement js/document)))))
+                  ;; if the node is visible: scroll
+                  (scrollToBottom the-node)
+                  ;; if the node isn't visible, test how far we are in the scroll
+                  (let [the-ul      (goog.dom/getAncestorByTagNameAndClass the-node "ul" nil)
+                        the-article (goog.dom/getAncestorByTagNameAndClass the-node "article" nil)]
+                    (if (< (- (.-scrollHeight the-article) (.-scrollTop the-article)) (* 1.5 (.-height (goog.style/getSize the-ul))))
+                      ;; more than half a page away, scroll
+                      (scrollToBottom the-node)
+                      (print "No scroll, too far from bottom")))))))))
+      om/IDidUpdate
+      (did-update [_ _ _]
+        (handle-update-or-mount owner)
+        ;; TODO: add scroll control behaviour
+        ;; - is the node visible; if it is not but above: realign
+        ;; - is the scroll position lower than the existing node
+        )
+      om/IWillUpdate
+      (will-update [_ next-props {:keys [editing]}]
+        (when editing
+          (let [fieldset            (goog.dom/getElementByClass "chat-entry" (om/get-node owner))
+                keyboard-controller (om/get-shared owner :keyboard-control)
+                typing-chan         (om/get-shared owner :typing-chan)
+                editable            (potato.keyboard/append-editable-div {:parent-node     fieldset
+                                                                          :keyboard        keyboard-controller
+                                                                          :typing-callback #(async/put! typing-chan true)
+                                                                          :id              "edit-entry"
+                                                                          :text-content    (:text editing)})
+                cid                   (:active-channel (deref potato.state/global))]
+            (potato.keyboard/set-event! editable potato.keyboard/ENTER
+                                        {:callback (fn [] (when-not (get-in (deref potato.state/global)
+                                                                            [:channels cid :has-autocomplete-menu])
+                                                            (let [new-text (fixup-input-text (potato.keyboard/content editable))]
+                                                              (http/post potato.urls/update-chat {:json-params {:message (:id message)
+                                                                                :text new-text}})
+                                                              (potato.keyboard/destroy! editable)
+                                                              (potato.keyboard/reset-cursor! keyboard-controller)
+                                                              (om/set-state! owner :editing false)
+                                                              (potato.keyboard/really-focus (goog.dom/getElement "channel-input")))
+                                                            (at-magic-close!)
+                                                            true))
+                                         :act-on-magic true})
+            (potato.keyboard/set-event! editable potato.keyboard/ESC
+                                        {:callback (fn []
+                                                     (when-not (get-in (deref potato.state/global)
+                                                                       [:channels cid :has-autocomplete-menu])
+                                                       (potato.keyboard/destroy! editable)
+                                                       (potato.keyboard/reset-cursor! keyboard-controller)
+                                                       (om/set-state! owner :editing false)
+                                                       (potato.keyboard/really-focus (goog.dom/getElement "channel-input")))
+                                                     (at-magic-close!)
+                                                     true)
+                                         :act-on-magic true})
+            (potato.keyboard/set-magic! editable "@" {:callback (fn [text event editable]
+                                                                  (at-magic-callback owner text event editable :user))})
+            (potato.keyboard/set-magic! editable ":" {:callback (fn [text event editable]
+                                                                  (at-magic-callback owner text event editable :emoji))}))))
+      om/IRenderState
+      (render-state [_ {:keys [update-time editing previous-from previous-date]}]
+        (let [user-entry (-> @potato.state/global :user-to-name-map (get (:from message)))]
+          (om.dom/li
+              #js {:id (str (:key-prefix opts) "-" (:id message))
+                   :className (clojure.string/join " "
+                                                   (remove nil?
+                                                           [(if (and
+                                                                 (== (:from message) previous-from)
+                                                                 (<  (.diff (js/moment (:created_date message)) (js/moment previous-date)) 60000))
+                                                              "chat-monologue")
+                                                            (if (:highlighted-p opts)
+                                                              "chat-highlighted")]))}
+              (let [image (:image-name user-entry)]
+                (if image
+                  (om.dom/img #js {:className "chat-author-picture"
+                                   :src image})
+                  ;; ELSE: Image information is not available yet, simply display an empty div
+                  (om.dom/div #js {:className "chat-author-picture"})))
+              (om.dom/figure #js {:className (str "chat-entry" (if (:unconfirmed message) " unconfirmed-message"))
+                                  :data-id   (:hash message)}
+                (om.dom/figcaption nil
+                  (om.dom/address #js {:className "chat-author"
+                                       :title (:nickname user-entry)}
+                                  (or (:description user-entry) ""))
+                  (display-time (:created_date message)))
+                (om/build message-quote message {:state {:update-time      update-time
+                                                         :editing          editing
+                                                         :editable         (not (:unconfirmed message))
+                                                         :editing-callback #(om/set-state! owner :editing %)}}))))))))

 (defn user-in-list [[uid name nickname active] owner]
   (reify


re-enable (get-lex)

re-enable (get-lex)

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -1,6 +1,7 @@
 (ns babel.generate
   (:refer-clojure :exclude [get-in deref resolve find parents])
   (:require
+   [babel.index :refer [get-lex]]
    [babel.over :as over :refer [show-bolt truncate truncate-expressions]]
    #?(:clj [clojure.tools.logging :as log])
    #?(:cljs [babel.logjs :as log])
@@ -116,8 +117,8 @@
                        (reduce intersection-with-identity non-empty-index-sets)
                        true
                        (do
-                         (log/warn (str "no index found for spec: " (spec-info spec)))
-                         (vals (:lexicon language-model))))]
+                         (log/warn (str "no index found for spec: " spec))
+                         (get-lex parent :head (:index language-model))))]
                  (log/debug (str "lightning-bolts: (optimizeme) size of subset of candidate heads: " (count subset) " with spec: " (strip-refs spec) " and parent:  " (get-in parent [:rule])))
                  (let [result (over/overh parent (lazy-shuffle subset))]
                    (log/debug (str "lightning-bolts: (optimizeme) surviving candidate heads: " (count result)))


+(log/debug)s

+(log/debug)s

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -103,8 +103,17 @@
 (defn add-all-comps [bolt-groups language-model total-depth truncate-children max-total-depth]
   (let [bolt-groups
         (filter #(not (empty? %))
-                bolt-groups)]
+                bolt-groups)
+        bolts (reduce concat bolt-groups)]
     (when (not (empty? bolt-groups))
+      (log/debug (str "bolt group count: " (count bolt-groups)))
+      (log/debug (str "total bolt count: " (count bolts)))
+      (log/debug (str "counts by group: [ "
+                      (string/join ","
+                                   (map (fn [group]
+                                          (count group))
+                                        bolt-groups))
+                      " ]"))
       (lazy-mapcat
        (fn [bolt]
          (log/debug (str "add-all-comps: adding comps to bolt: " (show-bolt bolt language-model)))
@@ -112,10 +121,15 @@
                                    (find-comp-paths-in (bolt-depth bolt))
                                    truncate-children max-total-depth))
        (do
-         (log/debug (str (string/join ","
-                                      (map (fn [bolt-group]
-                                             (str "count of bolt-group: " (count bolt-group)))
-                                           bolt-groups))))
+         (count
+          (map (fn [bolt-group]
+                 (log/debug
+                  (str "bolt-group:"))
+                 (count
+                  (map (fn [bolt]
+                         (log/debug (str " " (show-bolt bolt language-model))))
+                       bolt-group)))
+               bolt-groups))
          (reduce concat bolt-groups))))))

 ;; TODO: make this non-recursive by using mapcat.
@@ -237,7 +251,13 @@
                           (take max-generated-complements
                                 (lazy-cat filtered-lexical-complements phrasal-complements))
                           true
-                          (take max-generated-complements (lazy-cat phrasal-complements filtered-lexical-complements))))))))
+                          (do
+                            (log/debug (str "successfully generated some complements for bolt:"
+                                            (show-bolt bolt language-model)
+                                            " matching spec:"
+                                            (spec-info spec)))
+
+                            (take max-generated-complements (lazy-cat phrasal-complements filtered-lexical-complements)))))))))

 (defn spec-info [spec]
   "give a human-readable summary of _spec_."
@@ -253,7 +273,8 @@
       {:agr agr})
     (if-let [subcat1 (if (not (empty? (get-in spec [:synsem :subcat])))
                       (get-in spec [:synsem :subcat :1 :cat]))]
-     {:subcat1 subcat1}))))
+      {:subcat/:1/:cat subcat1
+       :subcat/:1/:agr (get-in spec [:synsem :subcat :1 :agr])}))))

 (defn lightning-bolts [language-model spec depth total-depth
                        & {:keys [max-total-depth]
@@ -285,7 +306,7 @@
                                  subset (filter #(not (fail? (unifyc filter-on-spec %)))
                                                 candidate-lexemes)]
                              (filter #(not (nil? %))
-                                     (do (log/debug (str "trying over parent:" (:rule parent)))
+                                     (do (log/debug (str "adding lexical heads to parent:" (:rule parent)))
                                          (log/debug (str " with lexemes:" (string/join ";" (sort (map morph subset)))))
                                          (log/debug (str " with spec:" (spec-info spec)))
                                          (if (not (empty? subset))


remove Italian-specific code

remove Italian-specific code

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -264,17 +264,11 @@
                   nil)))))

         bolt-child-synsem (strip-refs (get-in bolt (concat path [:synsem]) :top))
-        bolt-child-italiano (strip-refs (get-in bolt (concat path [:italiano]) :top))

         lexical-complements (lazy-shuffle
                                       (filter (fn [lexeme]
-                                                (and (not (= :fail (unify (strip-refs (get-in lexeme [:synsem] :top))
-                                                                          bolt-child-synsem)))
-                                                     ;; TODO: language-specific: allow
-                                                     ;; some way to have this optimization be expressed
-                                                     ;; in a language-specific way.
-                                                     (not (= :fail (unify (strip-refs (get-in lexeme [:italiano] :top))
-                                                                          (strip-refs bolt-child-italiano))))))
+                                                (and (not (fail? (unify (strip-refs (get-in lexeme [:synsem] :top))
+                                                                        bolt-child-synsem)))))
                                               complement-candidate-lexemes))]
     (filter #(not (fail? %))
             (mapfn (fn [complement]


make body of (defn generate-all) more concise

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -53,28 +53,26 @@
   (let [depth (or depth 0)
         max-depth (or max-depth max-total-depth)]
     (log/debug (str "generate-all:" depth "/" max-depth ":         " (strip-refs spec)))
-    (let [bolts-and-comps (filter #(not (some empty? (vals %)))
-                                  (bolts-with-comps spec model depth max-depth))
-          routes (mapcat (fn [each-bolt-and-comps]
+    (filter not-fail?
+            (map (fn [bolt-and-comps]
+                   (log/debug (str "doing defaults on: " depth "/" max-depth ":" ((:morph-ps model) (get bolt-and-comps []))))
+                   (do-defaults
+                    (apply unify
+                           (let [bolt (get bolt-and-comps [])
+                                 bolt-and-comps (dissoc bolt-and-comps [])]
+                             (cons bolt
+                                   (map (fn [path]
+                                          (assoc-in bolt path (get bolt-and-comps path)))
+                                        (keys bolt-and-comps)))))
+                    model))
+                 (mapcat (fn [each-bolt-and-comps]
                            (let [trellis (apply combo/cartesian-product (vals each-bolt-and-comps))]
                              (map (fn [each-path-through-trellis]
                                     (zipmap (keys each-bolt-and-comps)
                                             each-path-through-trellis))
                                   trellis)))
-                         bolts-and-comps)]
-      (filter not-fail?
-              (map (fn [bolt-and-comps]
-                     (log/debug (str "doing defaults on: " depth "/" max-depth ":" ((:morph-ps model) (get bolt-and-comps []))))
-                     (do-defaults
-                      (apply unify
-                             (let [bolt (get bolt-and-comps [])
-                                   bolt-and-comps (dissoc bolt-and-comps [])]
-                               (cons bolt
-                                     (map (fn [path]
-                                            (assoc-in bolt path (get bolt-and-comps path)))
-                                          (keys bolt-and-comps)))))
-                      model))
-                   routes)))))
+                         (filter #(not (some empty? (vals %)))
+                                 (bolts-with-comps spec model depth max-depth)))))))

 (defn generate
   "Return one (by default) or _n_ (using :take _n_) expressions matching spec _spec_ given the model _model_."


re-add (copy)-ing of parent; removed earlier due to overzealous optimization

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -261,7 +261,7 @@
                                          (log/debug (str " with lexemes:" (string/join ";" (sort (map morph subset)))))
                                          (log/debug (str " with spec:" (spec-info spec)))
                                          (if (not (empty? subset))
-                                           (over/overh parent (map copy (shuffle subset)))
+                                           (over/overh (copy parent) (map copy (shuffle subset)))
                                            []))))))
                        parents)
           phrasal ;; 2. generate list of all phrases where the head child of each parent is itself a phrase.


+(defn comp-paths-to-complements []): write recursively to allow for exit-early on failure

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -172,10 +172,13 @@
       tree)))

 (defn comp-paths-to-complements [bolt comp-paths model depth max-depth]
-  (zipmap comp-paths
-          (map (fn [path]
-                 (filter not-fail? (comp-path-to-complements bolt path model depth max-depth)))
-               comp-paths)))
+  (if (not (empty? comp-paths))
+    (let [path (first comp-paths)
+          comps (filter not-fail? (comp-path-to-complements bolt path model depth max-depth))]
+      (if (or false (not (empty? comps)))
+        (merge
+         {path comps}
+         (comp-paths-to-complements bolt (rest comp-paths) model depth max-depth))))))

 (defn bolts-with-comps
   "return a lazy sequence of maps. Each member in this lazy sequence


more on merging

more on merging

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -163,7 +163,7 @@
                                  max-depth
                                  top-bolt)))))))

-(defn add-bolt-at-2 [bolt-at model depth max-depth]
+(defn add-bolt-at-2 [top-bolt bolt path bolt-at model depth max-depth]
   (mapfn #(do-defaults % model)
          (if (= false (get-in bolt-at [:phrasal]))
            [bolt-at]
@@ -189,7 +189,7 @@
         max-depth max-total-depth]
     (mapfn #(do-defaults % model)
            (flatten
-            (mapfn #(add-bolt-at-2 % model depth max-depth)
+            (mapfn #(add-bolt-at-2 % % [] % model depth max-depth)
                    (lightning-bolts model spec 0 max-total-depth))))))
 (defn generate-n
   "Returns all possible expressions generated by the given language model, constrained by the given spec.


whitespace

whitespace

--- src/babel/italiano.cljc
+++ src/babel/italiano.cljc
@@ -167,14 +167,16 @@

 (defn test-cm []
   (let [m (create-model "io" "mi" "tu" "ti" "vedere")]
-    (repeatedly #(->
-                  {:synsem {:cat :verb
-                            :infl :present
-                            :sem {:aspect :simple}
-                            :subcat []}
-                   :head {:phrasal true}}
-                  (generate m)
-                  morph
-                  println
-                  time))))
+    (repeatedly
+     #(->
+       {:synsem {:cat :verb
+                 :infl :present
+                 :sem {:aspect :simple}
+                 :subcat []}
+        :head {:phrasal true}}
+       (generate m)
+       morph
+       println
+       time))))

+


remove duplicate key from option map

remove duplicate key from option map

--- src/babel/italiano.cljc
+++ src/babel/italiano.cljc
@@ -69,7 +69,7 @@

 (defn generate
   [spec & [model
-           {:keys [max-total-depth model truncate-children]
+           {:keys [max-total-depth truncate-children]
             :or {max-total-depth generate/max-total-depth
                  truncate-children true}}]]
   (log/debug (str "generating with spec: " (strip-refs spec) " with max-total-depth: " max-total-depth))


Sort speakers by creation date

Sort speakers by creation date

--- src/auricle/subs.cljs
+++ src/auricle/subs.cljs
@@ -24,7 +24,9 @@
       (update :sleep count)))

 (defn format-speakers [speakers]
-  (map format-speaker speakers))
+  (->> speakers
+       (map format-speaker)
+       (sort-by :created >)))

 (reg-sub
  :speakers


Remove prn

Remove prn

--- src/aurora/btree.cljs
+++ src/aurora/btree.cljs
@@ -445,7 +445,6 @@
   (search [this current]
           (when (false? end?)
             (loop [current current]
-              (prn :current current (.key this))
               (let [max-key (.key (aget iterators (mod (- current 1) (alength iterators))))
                     min-key (.key (aget iterators current))]
                 (when-not (== min-key max-key)


cleanup: remove dead code

cleanup: remove dead code

--- src/babel/enrich.cljc
+++ src/babel/enrich.cljc
@@ -12,17 +12,7 @@

 ;; TODO: these rules are language-specific, so move all of this to italiano/writer (similar to what we did with French).
 (defn enrich [spec lexicon]
-  (let [against-pred (against-pred spec lexicon)]
-    (if true against-pred
-        ;; TODO: remove this else since it's never executed (since above we have "if true")
-        (let [against-comp (map (fn [spec]
-                                  (against-comp spec lexicon))
-                                (if (seq? against-pred)
-                                  (seq (set against-pred))
-                                  against-pred))]
-          (if (seq? against-comp)
-            (seq (set against-comp))
-            against-comp)))))
+  (against-pred spec lexicon))

 (defn against-pred [spec lexicon]
   (let [pred (get-in spec [:synsem :sem :pred] :top)]
@@ -38,18 +28,6 @@
                       (log/debug (str "matched head lexeme: " (strip-refs lexeme)))
                       (list result)))))
               (matching-head-lexemes spec lexicon)))))
-
-(defn against-comp [spec lexicon]
-  (let [pred-of-comp (get-in spec [:synsem :sem :subj :pred] :top)]
-    (if (= :top pred-of-comp)
-      spec
-      (mapcat (fn [lexeme]
-                (let [result (unify spec
-                                    {:comp {:synsem {:agr (strip-refs (get-in lexeme [:synsem :agr] :top))
-                                                     :sem (strip-refs (get-in lexeme [:synsem :sem] :top))}}})]
-                  (if (not (fail? result))
-                    (list result))))
-              (matching-comp-lexemes spec)))))

 (defn matching-head-lexemes [spec lexicon]
   (let [pred-of-head (get-in spec [:synsem :sem :pred] :top)]


fix repl warnings

fix repl warnings

--- src/clj/cljs/repl.clj
+++ src/clj/cljs/repl.clj
@@ -161,7 +161,9 @@
     (binding [ana/*cljs-ns* 'cljs.user
               *cljs-verbose* verbose
               ana/*cljs-warnings* (assoc ana/*cljs-warnings*
-                                    :undeclared warn-on-undeclared)
+                                    :undeclared-var warn-on-undeclared
+                                    :undeclared-ns warn-on-undeclared
+                                    :undeclared-ns-form warn-on-undeclared)
               ana/*cljs-static-fns* static-fns]
       (when analyze-path
         (analyze-source analyze-path))


fix typo in get-server-type

fix typo in get-server-type

--- src/clj/game/core.clj
+++ src/clj/game/core.clj
@@ -194,7 +194,7 @@
     nil))

 (defn zone->name [zone]
-  (or (central->name zone)
+  (or (central->name zone)
       (remote->name zone)))

 (defn is-remote? [zone]
@@ -563,7 +563,7 @@
 (defn update-all-ice [state side]
   (doseq [server (get-in @state [:corp :servers])]
     (update-ice-in-server state side (second server))))
-
+
 (defn rez-cost-bonus [state side n]
   (swap! state update-in [:bonus :cost] (fnil #(+ % n) 0)))

@@ -908,7 +908,7 @@
       "Archives" [:servers :archives]
       "New remote" [:servers (keyword (str "remote" (make-rid state)))]
       [:servers (->> (split server #" ") last (str "remote") keyword)])))
-
+
 (defn gain-run-credits [state side n]
   (swap! state update-in [:runner :run-credit] + n)
   (gain state :runner :credit n))
@@ -1023,7 +1023,7 @@
       (min max-access accesses) accesses)))

 (defn get-server-type [zone]
-  (or (#{:hq :rn :archives} zone) :remote))
+  (or (#{:hq :rd :archives} zone) :remote))

 (defmulti access (fn [state side server] (get-server-type (first server))))
 (defmulti choose-access (fn [cards server] (get-server-type (first server))))


Fix json meta data.

Fix json meta data.

--- src/cavm/h2.clj
+++ src/cavm/h2.clj
@@ -342,6 +342,15 @@
 (defentity codes
   (belongs-to features))

+(defn- normalize-meta [m-ent metadata]
+  (-> metadata
+      (clojure.walk/keywordize-keys)
+      (#(merge (:defaults m-ent) %))
+      (select-keys (:columns m-ent))))
+
+(defn- json-text [md]
+  (assoc md :text (json/write-str md :escape-slash false)))
+
 (defn- load-probe-meta [feature-list]
   (doseq [[pid feature] feature-list]
     (let [fmeta (normalize-meta features-meta feature)
@@ -376,16 +385,9 @@
   (let [[{cid :ID}] (select cohorts (where {:name cohort}))]
     cid))

-(defn- normalize-meta [m-ent metadata]
-  (-> metadata
-      (clojure.walk/keywordize-keys)
-      (#(merge (:defaults m-ent) %))
-      (select-keys (:columns m-ent))
-      (assoc :text (json/write-str metadata :escape-slash false))))
-
 ; Update meta entity record.
 (defn- merge-m-ent [m-ent {ename "name" :as metadata}]
-  (let [normmeta (normalize-meta m-ent metadata)
+  (let [normmeta (json-text (normalize-meta m-ent metadata))
         table (:table m-ent)
         [{id :ID}] (select table (fields :id) (where {:name ename}))]
     (if id


Load 'used' namespaces when evaluating ns forms in the REPL.

--- src/clj/cljs/repl.clj
+++ src/clj/cljs/repl.clj
@@ -65,7 +65,8 @@
              js (comp/emits ast)
              wrap-js (comp/emits (comp/analyze env (wrap form)))]
          (when (= (:op ast) :ns)
-           (load-dependencies repl-env (vals (:requires ast))))
+           (load-dependencies repl-env (into (vals (:requires ast))
+                                             (distinct (vals (:uses ast))))))
          (when *cljs-verbose*
            (print js))
          (let [ret (-evaluate repl-env filename (:line (meta form)) wrap-js)]


fix `cljs.test/testing so that it works as an stand alone expression. Change all the `cljs.test/is` macro helpers include the last value in the environment so that we can use it later.

--- src/clj/cljs/test.clj
+++ src/clj/cljs/test.clj
@@ -39,7 +39,7 @@
                      {:type :fail, :message ~msg,
                       :expected '~form, :actual (list '~'not (cons '~pred values#))}))]
        (if (:return env'#)
-         env'#
+         (assoc env'# :last-value result#)
          result#))))

 (defn assert-any
@@ -55,7 +55,7 @@
                    {:type :fail, :message ~msg,
                     :expected '~form, :actual value#}))]
      (if (:return env'#)
-       env'#
+       (assoc env'# :last-value value#)
        value#)))

 ;; =============================================================================
@@ -95,7 +95,7 @@
                      {:type :fail, :message ~msg,
                       :expected '~form, :actual (class object#)}))]
        (if (:return env'#)
-         env'#
+         (assoc env'# :last-value result#)
          result#))))

 (defmethod assert-expr 'thrown? [env menv msg form]
@@ -135,7 +135,7 @@
                          {:type :fail, :message ~msg,
                           :expected '~form, :actual e#}))]
            (if (:return env'#)
-             env'#
+             (assoc env'# :last-value e#)
              e#))))))

 (defmacro try-expr
@@ -175,11 +175,18 @@
 (defmacro testing
   "Adds a new string to the list of testing contexts.  May be nested,
   but must occur inside a test function (deftest)."
-  [env string & body]
-  `(fn [env#]
-     (reduce #(%2 %1)
-       (update-in env# [:testing-contexts] conj ~string)
-       [~@body])))
+  ([string & body]
+   (if (contains? (:locals &env) 'cljs$lang$test$body)
+     `(fn [env#]
+        (reduce #(%2 %1)
+          (update-in env# [:testing-contexts] conj ~string)
+          [~@body]))
+     `(:last-value
+       (reduce #(%2 %1)
+         (update-in (assoc (cljs.test/empty-env) :return true)
+           [:testing-contexts] conj ~string)
+         (let [~'cljs$lang$test$body nil]
+           [~@body]))))))

 ;; =============================================================================
 ;; Defining Tests


Before resolving an ability, check if the owner can pay for it.

--- src/clj/game/core.clj
+++ src/clj/game/core.clj
@@ -875,9 +875,12 @@
         ab (if (= ability (count abilities))
              {:msg "take 1 [Recurring Credits]" :req (req (> (:rec-counter card) 0))
               :effect (effect (add-prop card :rec-counter -1) (gain :credit 1))}
-             (get-in cdef [:abilities ability]))]
-    (when-let [activatemsg (:activatemsg ab)] (system-msg state side activatemsg))
-    (resolve-ability state side ab card targets)))
+             (get-in cdef [:abilities ability]))
+        cost (:cost ab)]
+    (when (or (nil? cost)
+              (apply can-pay? state side cost))
+        (when-let [activatemsg (:activatemsg ab)] (system-msg state side activatemsg))
+        (resolve-ability state side ab card targets))))

 (defn start-turn [state side args]
   (system-msg state side (str "started his or her turn"))


close stream when convert to array

close stream when convert to array

--- src/clj_http/util.clj
+++ src/clj_http/util.clj
@@ -57,10 +57,11 @@
       (.toByteArray baos))))

 (defn force-byte-array
-  "force b as byte array if it is an InputStream."
+  "force b as byte array if it is an InputStream, also close the stream"
   [b]
   (if (instance? java.io.InputStream b)
-    (IOUtils/toByteArray ^java.io.InputStream b)
+    (try (IOUtils/toByteArray ^java.io.InputStream b)
+         (finally (.close ^java.io.InputStream b)))
     b))

 (defn inflate


no need to split on digits or punctuation

--- src/crawler/utils.clj
+++ src/crawler/utils.clj
@@ -183,7 +183,7 @@
 (defn tokenize
   "Simplistic english tokenizer"
   [a-string]
-  (let [string-split (clojure.string/split a-string #"\s+|\d+|\p{P}")]
+  (let [string-split (clojure.string/split a-string #"\s+")]
     (filter
      #(not= % "")
      (map


Fully darken touch strip when not being used.

--- src/afterglow/controllers/ableton_push_2.clj
+++ src/afterglow/controllers/ableton_push_2.clj
@@ -427,6 +427,18 @@
                           :touch-strip-bar-starts-at-bottom :touch-strip-auto-return-inactive
                           :touch-strip-auto-return-to-center))

+(def touch-strip-mode-sysex
+  "The mode to which we should set the touch strip when we want to be
+  able to individually set LEDs, for example to turn them all off."
+  (build-touch-strip-mode :touch-strip-controlled-by-host :touch-strip-host-sends-sysex
+                          :touch-strip-auto-return-inactive :touch-strip-auto-return-to-center))
+
+(defn clear-all-touch-strip-leds
+  "Send a System Exclusive message which requests all touch strip LEDs
+  be turned off."
+  [controller]
+  (send-sysex controller (concat [0x19] (repeat 16 0))))
+
 (defn- clear-display-buffer
   "Clear the graphical display buffer in preparation for drawing an
   interface frame."
@@ -486,9 +498,12 @@
         (let [[value mode] next-strip
               message (ShortMessage.)]
           (when (not= mode last-mode)
-            (set-touch-strip-mode controller mode))
-          (.setMessage message ShortMessage/PITCH_BEND 0 (rem value 128) (quot value 128))
-          (midi/midi-send-msg (get-in controller [:port-out :receiver]) message -1)
+            (set-touch-strip-mode controller mode)
+            (if (= mode touch-strip-mode-sysex)  ; We want the touch strip fully dark
+              (clear-all-touch-strip-leds controller)))
+          (when (not= mode touch-strip-mode-sysex)  ; We are actually displaying values
+            (.setMessage message ShortMessage/PITCH_BEND 0 (rem value 128) (quot value 128))
+            (midi/midi-send-msg (get-in controller [:port-out :receiver]) message -1))
           (reset! (:last-touch-strip controller) next-strip))
         (do
           (set-touch-strip-mode controller touch-strip-mode-default)
@@ -1442,7 +1457,7 @@
     (clear-display-buffer controller)
     (reset! (:next-text-buttons controller) {})
     (reset! (:next-top-pads controller) empty-top-pads)
-    (reset! (:next-touch-strip controller) [0 touch-strip-mode-level])
+    (reset! (:next-touch-strip controller) [0 touch-strip-mode-sysex])

     (let [snapshot (rhythm/metro-snapshot (get-in controller [:show :metronome]))]
       (update-effect-list controller snapshot)


remove unneeded parentheses

remove unneeded parentheses

--- src/babel/english/lexicon.clj
+++ src/babel/english/lexicon.clj
@@ -1113,7 +1113,7 @@
                        :sem {:pred :tornare}}}
              {:synsem {:cat :verb
                        :sem {:pred :giveback-return}}
-              :english {:note "(give back)"}}]
+              :english {:note "give back"}}]

    "run" {:english {:past "ran"
                     :participle "running"


disable ‘altar’ until we can adequately translate it to English

--- src/babel/espanol/lexicon.clj
+++ src/babel/espanol/lexicon.clj
@@ -209,8 +209,9 @@
    "expresar" {:synsem {:cat :verb
                         :sem {:pred :express}}}

-   "faltar" {:synsem {:cat :verb
-                      :sem {:pred :to-be-missing}}}
+   ;; TODO: fix up so that it does not need to be disabled.
+;   "faltar" {:synsem {:cat :verb
+;                      :sem {:pred :to-be-missing}}}

    "formar" {:synsem {:cat :verb
                       :sem {:pred :form}}}


fix typo

fix typo

--- src/babel/espanol/lexicon.clj
+++ src/babel/espanol/lexicon.clj
@@ -127,7 +127,7 @@

    "convertir" {:espanol {:boot-stem "conviert"}
                 :synsem {:cat :verb
-                         :sem {:pred :convent}}}
+                         :sem {:pred :convert}}}

    "correr" {:synsem {:cat :verb
                       :sem {:pred :run}}}


added dormirse

added dormirse

--- src/babel/espanol/lexicon.clj
+++ src/babel/espanol/lexicon.clj
@@ -196,6 +196,22 @@
                        :pret-stem "durm"}
              :synsem {:cat :verb
                       :sem {:pred :sleep}}}
+
+   "dormirse"
+   (let [subject-semantics (ref {:human true})
+         subject-agr (ref :top)]
+     {:espanol {:boot-stem "duerm"}
+      :synsem {:cat :verb
+               :sem {:pred :fall-asleep
+                     :reflexive true
+                     :subj subject-semantics
+                     :obj subject-semantics}
+               :subcat {:1 {:agr subject-agr
+                            :sem subject-semantics}
+                        :2 {:agr subject-agr
+                            :pronoun true
+                            :reflexive true
+                            :sem subject-semantics}}}})

    "echar" {:synsem {:cat :verb
                      :sem {:pred :throw-out}}}


dataflow improved

dataflow improved

--- src/basilisk/tasks/collector/tsetmc/core.clj
+++ src/basilisk/tasks/collector/tsetmc/core.clj
@@ -1,48 +1,58 @@
 (ns basilisk.tasks.collector.tsetmc.core
-  (:require [clojure.core.async :as async]
+  (:require [clojure.core.async
+             :as async
+             :refer [<! >! <!! >!! go go-loop chan close! thread]]
             [clojure-csv.core :as csv]
             [clj-http.client :as http]))

 (def site-url {:fa {:index-csv "http://www.tsetmc.com/tsev2/data/MarketWatchInit.aspx?h=0&r=0"}})

-(def input-channel (async/chan 1000))
+(def in (chan 1000))

 (defrecord TradeSymbol [symbol name tsetmc-id tsetmc-name])

+(defn- parse-lines [string]
+  (clojure.string/split string #";"))

-(defn fetch-csv
-  "Fetch the CSV file from remote host and add each line to a channel"
-  [output-channel]
-  (async/go
-    (let [buffer (:body (http/get (:index-csv (:fa site-url))))
-          lines (clojure.string/split buffer  #";")]
-      (map #(async/>! output-channel %) lines))))
+(defn csv-fetcher
+  "Fetch the csv and return a channel containing the result."
+  []
+  (thread (:body (http/get (:index-csv (:fa site-url))))))
+
+(defn csv-parser
+  "Parse the csv string and put each record in a channel"
+  [in]
+  (let [out (chan 10000)]
+    (go-loop [data (<! in)]
+      (if (nil? data)
+        (close! data)
+        (>! out  (parse-lines data))))))
+
+(defn line-parser
+  "Parse each line and create a record from it and put it in a nre channel"
+  [in]
+  (let [out (chan 10000)]
+    (go-loop [line (<! in)]
+      (let [fields (clojure.string/split line #",")]
+        (if (= 23 (count fields))
+          (>! out (map->TradeSymbol
+                    {:symbol      (get fields 2)
+                     :name        (get fields 3)
+                     :tsetmc-id   (get fields 0)
+                     :tsetmc-name (get fields 1)}))))
+      (recur (<! in)))))

-(defn create-records
-  "Fetch each line of the CSV from the input-channel and create a record then push it
-  to the output channel."
-  [input-channel output-channel]
-  (async/go-loop []
-    (when-let [line (async/<! input-channel)]
-      (let [fields (clojure.string/split line #",")]
-        (if (= 23 (count fields))
-          (async/>! output-channel
-                    (map->TradeSymbol
-                     {:symbol      (get fields 2)
-                      :name        (get fields 3)
-                      :tsetmc-id   (get fields 0)
-                      :tsetmc-name (get fields 1)}))))
-      (recur))))
-
-(defn with-each-symbol []
-  (let [lines (take 5 (fetch-csv))]
-    (map create-records lines)))
+(defn printer
+  [in]
+  (go-loop [data (<! in)]
+    (println (str ">>" (:name data)))
+    (recur (<! in))))

 (defn collect-symbols
   []
-  (let [in (async/chan 10000)
-        rec-chan (async/chan 10000)]
-    (fetch-csv in)
-    (create-records in rec-chan)
-    (async/go-loop [data (async/<! rec-chan)] (println data))))
+  (let [csv (csv-fetcher)
+        lines (csv-parser csv)
+        records (line-parser lines)]
+                                        ;(printer records)
+    ))


Update views.clj

Update views.clj

--- src/briefcase/views.clj
+++ src/briefcase/views.clj
@@ -141,7 +141,8 @@
   [request]
   (let [data (yaml/parse-string (slurp "resources/content/background.yml"))]
     (main-layout request "yobriefca.se"
-      [:h1 "James Hughes"]
+      [:h1 "People"]
+      [:h2 "James Hughes"]
       [:ul
         (for [{ href :href name :name } (:links data)]
           [:li [:a { :href href } name]])]


Don't resync already synced Jenkins builds, only start where we left off

--- src/buildviz/jenkins/sync.clj
+++ src/buildviz/jenkins/sync.clj
@@ -72,7 +72,20 @@
        dorun
        (progress/done)))

+
 (def last-week (t/minus (.withTimeAtStartOfDay (l/local-now)) (t/weeks 1)))
+
+(defn- get-latest-synced-build-start [buildviz-url]
+  (let [response (client/get (format "%s/status" buildviz-url))
+        buildviz-status (j/parse-string (:body response) true)]
+    (when-let [latest-build-start (:latestBuildStart buildviz-status)]
+      (tc/from-long latest-build-start))))
+
+(defn- get-start-date [buildviz-url]
+  (if-let [latest-sync-build-start (get-latest-synced-build-start buildviz-url)]
+    latest-sync-build-start
+    last-week))
+

 (defn -main [& c-args]
   (let [args (parse-opts c-args cli-options)]
@@ -83,6 +96,6 @@

     (let [jenkins-url (first (:arguments args))
           buildviz-url (:buildviz-url (:options args))
-          sync-start-time last-week]
+          sync-start-time (get-start-date buildviz-url)]

       (sync-jobs jenkins-url buildviz-url sync-start-time))))


Fix compile error, move insert-xlogfile-line-db fn to before usage

--- src/demogorgon/nh.clj
+++ src/demogorgon/nh.clj
@@ -117,6 +117,12 @@
                                 (aget tokens 1)
                                 ""))) props)]
     (zipmap keys values)))
+
+(defn insert-xlogfile-line-db [line]
+  (let [data (parse-line line)]
+    (let [record (assoc data :death_uniq (.replaceAll (:death data) ", while .*$", ""))]
+      (sql/insert-records :xlogfile
+                        record))))

 (defn sanitize-nick [nick]
   (.replaceAll nick "[^\\p{Alnum}]" ""))
@@ -411,12 +417,6 @@
 (defn nh-stop [watcher]
   (.close (:watch-service @watcher)))

-(defn insert-xlogfile-line-db [line]
-  (let [data (parse-line line)]
-    (let [record (assoc data :death_uniq (.replaceAll (:death data) ", while .*$", ""))]
-      (sql/insert-records :xlogfile
-                        record))))
-
 (defn nh-init-db []
   (.info logger "re-initializing database..")
   (if (.exists (File. "/tmp/nh.db"))


CMR-364: Added granule search sorting by platform, instrument and sensor tests.

--- test/cmr/system_int_test/search/granule_sorting_search_test.clj
+++ test/cmr/system_int_test/search/granule_sorting_search_test.clj
@@ -167,3 +167,75 @@
                                                           :sort-key sort-key}))
            "end_date" [g5 g1 g12 g2 g6 g7 g3 g4 g8 g9 g10 g11]
            "-end_date" [g8 g4 g3 g7 g6 g2 g12 g1 g5 g9 g10 g11]))))
+
+(deftest granule-platform-sorting-test
+  (let [coll (d/ingest "PROV1" (dc/collection {}))
+        make-gran (fn [& platforms]
+                    (d/ingest "PROV1"
+                              (dg/granule coll
+                                          {:platform-refs (map dg/platform-ref platforms)})))
+        g1 (make-gran "c10" "c41")
+        g2 (make-gran "c20" "c51")
+        g3 (make-gran "c30")
+        g4 (make-gran "c40")
+        g5 (make-gran "c50")]
+    (index/flush-elastic-index)
+    (are [sort-key items]
+         (d/refs-match-order? items
+                              (search/find-refs :granule {:page-size 20
+                                                          :sort-key sort-key}))
+
+         ;; Descending sorts by the min value of a multi value fields
+         "platform" [g1 g2 g3 g4 g5]
+         ;; Descending sorts by the max value of a multi value fields
+         "-platform" [g2 g5 g1 g4 g3])))
+
+(deftest granule-instrument-sorting-test
+  (let [coll (d/ingest "PROV1" (dc/collection {}))
+        make-gran (fn [& instruments]
+                    (d/ingest "PROV1"
+                              (dg/granule
+                                coll
+                                {:platform-refs [(apply dg/platform-ref (d/unique-str "platform")
+                                                        (map dg/instrument-ref instruments))]})))
+        g1 (make-gran "c10" "c41")
+        g2 (make-gran "c20" "c51")
+        g3 (make-gran "c30")
+        g4 (make-gran "c40")
+        g5 (make-gran "c50")]
+    (index/flush-elastic-index)
+    (are [sort-key items]
+         (d/refs-match-order? items
+                              (search/find-refs :granule {:page-size 20
+                                                          :sort-key sort-key}))
+
+         ;; Descending sorts by the min value of a multi value fields
+         "instrument" [g1 g2 g3 g4 g5]
+         ;; Descending sorts by the max value of a multi value fields
+         "-instrument" [g2 g5 g1 g4 g3])))
+
+(deftest granule-sensor-sorting-test
+  (let [coll (d/ingest "PROV1" (dc/collection {}))
+        make-gran (fn [& sensors]
+                    (d/ingest "PROV1"
+                              (dg/granule
+                                coll
+                                {:platform-refs [(dg/platform-ref
+                                                   (d/unique-str "platform")
+                                                   (apply dg/instrument-ref (d/unique-str "instrument")
+                                                          (map dg/sensor-ref sensors)))]})))
+        g1 (make-gran "c10" "c41")
+        g2 (make-gran "c20" "c51")
+        g3 (make-gran "c30")
+        g4 (make-gran "c40")
+        g5 (make-gran "c50")]
+    (index/flush-elastic-index)
+    (are [sort-key items]
+         (d/refs-match-order? items
+                              (search/find-refs :granule {:page-size 20
+                                                          :sort-key sort-key}))
+
+         ;; Descending sorts by the min value of a multi value fields
+         "sensor" [g1 g2 g3 g4 g5]
+         ;; Descending sorts by the max value of a multi value fields
+         "-sensor" [g2 g5 g1 g4 g3])))


Improve funciton naming

Improve funciton naming

Making the funciton names more consistent so it's easier to read.

--- src/deepfns/core.cljc
+++ src/deepfns/core.cljc
@@ -4,20 +4,6 @@

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; fmap
-
-(declare deepfmap)
-
-(defn- fseq [f m]
-  (map (partial deepfmap f) m))
-
-(defn- fvec [f m]
-  (mapv (partial deepfmap f) m))
-
-(defn- flst [f m]
-  (into '() (map (partial deepfmap f) m)))
-
-(defn- fset [f m]
-  (into #{} (map (partial deepfmap f) m)))

 (defn- group-vals [ms k]
   (let [matches (map #(find % k) ms)]
@@ -29,7 +15,21 @@
     [k (apply (partial handler f)
          (group-vals ms k))]))

-(defn- fassc
+(declare deepfmap)
+
+(defn- fmap-seq [f m]
+  (map (partial deepfmap f) m))
+
+(defn- fmap-vec [f m]
+  (mapv (partial deepfmap f) m))
+
+(defn- fmap-lst [f m]
+  (into '() (map (partial deepfmap f) m)))
+
+(defn- fmap-set [f m]
+  (into #{} (map (partial deepfmap f) m)))
+
+(defn- fmap-map
   ([f m]
    (reduce (fn [acc [k v]]
              (assoc acc k (deepfmap f v)))
@@ -66,12 +66,12 @@
   ([f m]
    (cond
      ;; map deepfmap over all the entries until it thunks out
-     (list? m) (u/save-meta (reverse (flst f m)) m)
-     (vector? m) (u/save-meta (fvec f m) m)
-     (seq? m) (u/save-meta (fseq f m) m)
-     (set? m) (u/save-meta (fset f m) m)
+     (list? m) (u/save-meta (reverse (fmap-lst f m)) m)
+     (vector? m) (u/save-meta (fmap-vec f m) m)
+     (seq? m) (u/save-meta (fmap-seq f m) m)
+     (set? m) (u/save-meta (fmap-set f m) m)
      ;; map deepfmap over all the vals (nested too)
-     (associative? m) (u/save-meta (fassc f m) m)
+     (associative? m) (u/save-meta (fmap-map f m) m)
      ;; two base cases here:
      ;; compose fns
      (fn? m) (comp f m)
@@ -82,11 +82,11 @@
    ;; same thing here but we'll mutually walk ms
    (let [mcoll (cons m ms)]
      (cond
-       (list? m) (u/save-metas (map (partial flst f) mcoll) mcoll)
-       (vector? m) (u/save-metas (map (partial fvec f) mcoll) mcoll)
-       (seq? m) (u/save-metas (map (partial fseq f) mcoll) mcoll)
-       (set? m) (u/save-metas (map (partial fset f) mcoll) mcoll)
-       (associative? m) (u/save-metas (fassc f m ms) mcoll)
+       (list? m) (u/save-metas (map (partial fmap-lst f) mcoll) mcoll)
+       (vector? m) (u/save-metas (map (partial fmap-vec f) mcoll) mcoll)
+       (seq? m) (u/save-metas (map (partial fmap-seq f) mcoll) mcoll)
+       (set? m) (u/save-metas (map (partial fmap-set f) mcoll) mcoll)
+       (associative? m) (u/save-metas (fmap-map f m ms) mcoll)
        (fn? m) (map #(comp f %) mcoll)
        :else
        (apply f mcoll)))))
@@ -101,7 +101,7 @@

 (declare deepfapply)

-(defn- lst-fapply
+(defn- fapply-lst
   ([fs m]
    (apply list
      ;; converts to fs to symbols
@@ -115,13 +115,13 @@
       (mapcat #(apply map (partial deepfapply #?(:clj (eval %)
                                                  :cljs %)) m ms) fs))))

-(defn- seq-fapply
+(defn- fapply-seq
   ([fs m]
    (mapcat #(map (partial deepfapply %) m) fs))
   ([fs m ms]
    (mapcat #(apply map (partial deepfapply %) m ms) fs)))

-(defn- set-fapply
+(defn- fapply-set
   ([fs m]
    (set
      (mapcat #(map (partial deepfapply %) m) fs)))
@@ -129,7 +129,7 @@
    (set
      (mapcat #(apply map (partial deepfapply %) m ms) fs))))

-(defn- vec-fapply
+(defn- fapply-vec
   ([fs m]
    (apply vector
      (mapcat #(map (partial deepfapply %) m) fs)))
@@ -137,7 +137,7 @@
    (apply vector
      (mapcat #(apply map (partial deepfapply %) m ms) fs))))

-(defn- assc-fapply
+(defn- fapply-map
   ([fs m]
    (reduce-kv (fn [acc fk f]
                 (if-let [[_ mv] (find m fk)]
@@ -178,13 +178,13 @@
   ([fs m]
    (cond
      ;; map the fn for sequential/set types
-     (list? fs) (u/save-meta (lst-fapply fs m) m)
-     (seq? fs) (u/save-meta (seq-fapply fs m) m)
-     (vector? fs) (u/save-meta (vec-fapply fs m) m)
-     (set? fs) (u/save-meta (set-fapply fs m) m)
+     (list? fs) (u/save-meta (fapply-lst fs m) m)
+     (seq? fs) (u/save-meta (fapply-seq fs m) m)
+     (vector? fs) (u/save-meta (fapply-vec fs m) m)
+     (set? fs) (u/save-meta (fapply-set fs m) m)
      ;; match keys for maps and if found apply the fn (otherwise
      ;;  just leave it)
-     (map? fs) (u/save-meta (assc-fapply fs m) m)
+     (map? fs) (u/save-meta (fapply-map fs m) m)
      ;; base cases:
      ;; either use the fn
      (fn? fs) (fs m)
@@ -195,12 +195,12 @@
    (let [mcoll (cons m ms)]
      (cond
        ;; mapcat all the results for sequential/set types
-       (list? fs) (u/save-metas (lst-fapply fs m ms) mcoll)
-       (seq? fs) (u/save-metas (seq-fapply fs m ms) mcoll)
-       (vector? fs) (u/save-metas (vec-fapply fs m ms) mcoll)
-       (set? fs) (u/save-metas (set-fapply fs m ms) mcoll)
+       (list? fs) (u/save-metas (fapply-lst fs m ms) mcoll)
+       (seq? fs) (u/save-metas (fapply-seq fs m ms) mcoll)
+       (vector? fs) (u/save-metas (fapply-vec fs m ms) mcoll)
+       (set? fs) (u/save-metas (fapply-set fs m ms) mcoll)
        ;; match all keys for maps and apply the fn if ther was a match
-       (map? fs) (u/save-metas (assc-fapply fs m ms) mcoll)
+       (map? fs) (u/save-metas (fapply-map fs m ms) mcoll)
        ;; apply the fn to the args
        (fn? fs) (apply fs mcoll)
        :else
@@ -271,7 +271,7 @@

 (declare filterapply)

-(defn- assc-filterapply
+(defn- filterapply-map
   ([fs m]
    (reduce-kv (fn [acc fk f]
                 (if-let [[_ mv] (find m fk)]
@@ -308,22 +308,22 @@
        (filterapply f m))))
   ([fs m]
    (cond
-     (list? fs) (u/save-meta (lst-fapply fs m) m)
-     (seq? fs) (u/save-meta (seq-fapply fs m) m)
-     (vector? fs) (u/save-meta (vec-fapply fs m) m)
-     (set? fs) (u/save-meta (set-fapply fs m) m)
-     (map? fs) (u/save-meta (assc-filterapply fs m) m)
+     (list? fs) (u/save-meta (fapply-lst fs m) m)
+     (seq? fs) (u/save-meta (fapply-seq fs m) m)
+     (vector? fs) (u/save-meta (fapply-vec fs m) m)
+     (set? fs) (u/save-meta (fapply-set fs m) m)
+     (map? fs) (u/save-meta (filterapply-map fs m) m)
      (fn? fs) (fs m)
      :else
      ((constantly fs) m)))
   ([fs m & ms]
    (let [mcoll (cons m ms)]
      (cond
-       (list? fs) (u/save-metas (lst-fapply fs m ms) mcoll)
-       (seq? fs) (u/save-metas (seq-fapply fs m ms) mcoll)
-       (vector? fs) (u/save-metas (vec-fapply fs m ms) mcoll)
-       (set? fs) (u/save-metas (set-fapply fs m ms) mcoll)
-       (map? fs) (u/save-metas (assc-filterapply fs m ms) mcoll)
+       (list? fs) (u/save-metas (fapply-lst fs m ms) mcoll)
+       (seq? fs) (u/save-metas (fapply-seq fs m ms) mcoll)
+       (vector? fs) (u/save-metas (fapply-vec fs m ms) mcoll)
+       (set? fs) (u/save-metas (fapply-set fs m ms) mcoll)
+       (map? fs) (u/save-metas (filterapply-map fs m ms) mcoll)
        (fn? fs) (apply fs mcoll)
        :else
        (map (constantly fs) mcoll)))))
@@ -331,7 +331,7 @@

 (declare zip)

-(defn- vec-zip
+(defn- zip-vec
   ([fs m]
    (into (empty m) (map deepfmap #?(:clj (eval (vec fs))
                                     :cljs fs) m)))
@@ -343,7 +343,7 @@
          (into {}
            (map (partial filter #(not (contains? fs (key %))))
              args)))]
-  (defn- map-zip [fs & args]
+  (defn- zip-map [fs & args]
     (reduce-kv (fn [acc k v]
                  (if (fn? v)
                    (assoc acc k (apply (partial deepfmap v)
@@ -376,23 +376,23 @@
    (repeat x))
   ([fs x]
    (cond
-     (vector? fs) (u/save-meta (vec-zip fs x) x)
-     (seq? fs) (u/save-meta (reverse (vec-zip fs x)) x)
-     (map? fs) (u/save-meta (map-zip fs x) x)))
+     (vector? fs) (u/save-meta (zip-vec fs x) x)
+     (seq? fs) (u/save-meta (reverse (zip-vec fs x)) x)
+     (map? fs) (u/save-meta (zip-map fs x) x)))
   ([fs x y]
    (cond
-     (vector? fs) (u/save-metas (vec-zip fs x [y]) [x y])
-     (seq? fs) (u/save-metas (reverse (vec-zip fs x [y])) [x y])
-     (map? fs) (u/save-metas (map-zip fs x y) [x y])))
+     (vector? fs) (u/save-metas (zip-vec fs x [y]) [x y])
+     (seq? fs) (u/save-metas (reverse (zip-vec fs x [y])) [x y])
+     (map? fs) (u/save-metas (zip-map fs x y) [x y])))
   ([fs x y & args]
    (let [more-args (cons y args)
          all-args (cons x (cons y args))]
      (cond
-       (vector? fs) (-> (vec-zip fs x more-args)
+       (vector? fs) (-> (zip-vec fs x more-args)
                         (u/save-metas all-args))
-       (seq? fs) (-> (reverse (vec-zip fs x more-args))
+       (seq? fs) (-> (reverse (zip-vec fs x more-args))
                      (u/save-metas all-args))
-       (map? fs) (-> (apply (partial map-zip fs x y) args)
+       (map? fs) (-> (apply (partial zip-map fs x y) args)
                      (u/save-metas all-args))))))

@@ -415,14 +415,14 @@
        (map (partial eval-entries seed fs) (cons m ms))
        (eval-entries seed fs m)))))

-(defn- lst-transitive
+(defn- transitive-lst
   ([f]
    (fn [result m]
      (if-let [v (f m)]
        (conj result v)
        result))))

-(defn- assc-transitive
+(defn- transitive-map
   ([k f]
    (fn [result m]
      (if-some [v (f m)]
@@ -442,14 +442,14 @@
    (cond
      (map? f) (apply-entries {}
                   (map (fn [[k v]]
-                         (assc-transitive k (transitive v)))
+                         (transitive-map k (transitive v)))
                     f))
      (seq? f) (apply-entries '()
-                    (map (comp lst-transitive transitive) f))
+                    (map (comp transitive-lst transitive) f))
      (vector? f) (apply-entries []
-                      (map (comp lst-transitive transitive) f))
+                      (map (comp transitive-lst transitive) f))
      (set? f) (apply-entries #{}
-                   (map (comp lst-transitive transitive) f))
+                   (map (comp transitive-lst transitive) f))
      (fn? f) f
      (keyword? f) f
      :else


Don't break preferred slots for non-one day events

--- src/clj/herder/solver/run.clj
+++ src/clj/herder/solver/run.clj
@@ -47,7 +47,7 @@
                    (.setDependantEventCount (- (:event_count ev) count))
                    (.setNotAvailableDays non-availability)
                    (.setEventType converted-event-type))]
-             (if (and (nil? previous) (= converted-event-type EventType/ONE_DAY))
+             (if (or (not= converted-event-type EventType/ONE_DAY) (and (nil? previous) (= converted-event-type EventType/ONE_DAY)))
                (.setPreferredSlots new-event
                                    (if (-> slot nil? not)
                                      (for [day (p/periodic-seq firstDay (t/days 1))


refactor

refactor

--- src/clj/salava/gallery/db.clj
+++ src/clj/salava/gallery/db.clj
@@ -141,7 +141,7 @@
            )) badges))

-(defn aggregate-badge-versions [ctx badges]
+(defn process-badge-versions [ctx badges]
   (map (fn [b]
          (let [other-badge-ids (->> (get-badge-ids ctx "all" nil (:name b) (:issuer_content_name b) nil nil nil) (remove #(= (:badge_id b) %)))]
            (if (empty? other-badge-ids) b (assoc b :otherids other-badge-ids)))) badges))
@@ -150,7 +150,7 @@
   "Get badge-ids"
   [ctx country tags badge-name issuer-name order recipient-name tags-ids page_count]
   (let [badge-ids (get-badge-ids ctx country tags badge-name issuer-name order recipient-name tags-ids)
-        badges (some->> (select-badges ctx badge-ids order page_count) (aggregate-badge-versions ctx) (badge-checker) (remove nil?)) #_(remove nil? (badge-checker (select-badges ctx badge-ids order page_count)))]
+        badges (some->> (select-badges ctx badge-ids order page_count) (process-badge-versions ctx) (badge-checker) (remove nil?)) #_(remove nil? (badge-checker (select-badges ctx badge-ids order page_count)))]
     {:badges badges
      :tags (select-tags ctx badge-ids)
      :badge_count (badge-count (if-not (= (count badge-ids) (count badges)) badge-ids badges) page_count) }))


remove link back home from board view

remove link back home from board view

--- src/cljs/go_client/views.cljs
+++ src/cljs/go_client/views.cljs
@@ -21,11 +21,6 @@
   [re-com/title
    :label "This is the About Page."
    :level :level1])
-
-(defn link-to-home-page []
-  [re-com/hyperlink-href
-   :label "go to Home Page"
-   :href "#/"])

 (defn about-panel []
   [re-com/v-box
@@ -75,8 +70,7 @@
       [re-com/v-box
        :gap "1em"
        :children [[current-game-title @game-title]
-                  [game-board @game-id @placed-stones @empty-vertices @playable-stones]
-                  [link-to-home-page]]])))
+                  [game-board @game-id @placed-stones @empty-vertices @playable-stones]]])))

 (defn development-panel []
   [re-com/v-box


Minor fiddling before moving to resource manager

--- src/cljs/my_project/core.cljs
+++ src/cljs/my_project/core.cljs
@@ -329,8 +329,12 @@
           (put! time-chan dt)))
       (animate))))

+
+(def app-div (by-id "app"))
+
 (defn main []
   (do
+    ; (dommy/clear! app-div)
     (om/root
       frame-rate-component
       {:in-chan (tap time-chan-mult (chan)) }
@@ -343,12 +347,7 @@

     (let [rm (rmhtml/mk-resource-manager "resources")
           _ (clear-resources! rm)
-          img-chan (load-img! rm "tiles")
           rend (create-render-target! rm "shit" 300 300) ]
-      (go
-        (let [img (<! img-chan)]
-          (log-js (rman/width img))
-          (log-js (rman/height img))))
       ))

   ; {{{


increase layout size

increase layout size

--- src/clojure/defgraph/core.clj
+++ src/clojure/defgraph/core.clj
@@ -48,6 +48,7 @@
         (.beginUpdate model)
         (let [layout (mxOrganicLayout. mx)]
           (doto layout
+            (.setFineTuning false)
             (.setBorderLineCostFactor 10)
             (.setEdgeLengthCostFactor 0.001)
             (.setEdgeDistanceCostFactor 1500)


remove debugging println

remove debugging println

--- src/com/rpl/specter/impl.cljc
+++ src/com/rpl/specter/impl.cljc
@@ -388,7 +388,6 @@
                              ])
                             num-params-seq)
                      (apply concat))
-        _ (println "CLOSURE:" closure)
         params-needed-path (closed-code closure (paramspath* make-paths num-params impls))]
     (if (= num-params 0)
       (bind-params params-needed-path nil 0)


break up long line

break up long line

--- src/clj_money/models/storage/sql_storage.clj
+++ src/clj_money/models/storage/sql_storage.clj
@@ -280,7 +280,8 @@
                   (map keyword %)
                   (keyword %)))
           (reduce (fn [records# table#]
-                    (let [found-records# (~exec-fn (sql-fn# table#))
+                    (let [sql# (sql-fn# table#)
+                          found-records# (~exec-fn sql#)
                           updated-records# (concat records# found-records#)]
                       (if (limit-reached? updated-records# ~options)
                         (reduced updated-records#)


Refactor thread flow for gosync

Refactor thread flow for gosync

--- src/buildviz/gosync.clj
+++ src/buildviz/gosync.clj
@@ -126,7 +126,7 @@
     (assoc job :inputs inputs)))

-(defn select-stages [stages filter-groups]
+(defn select-stages [filter-groups stages]
   (if (seq filter-groups)
     (filter #(contains? filter-groups (:group %)) stages)
     stages))
@@ -203,20 +203,19 @@
   (print ".")
   (flush))

-(defn put-to-buildviz [builds]
-  (doseq [{job-name :jobName build-no :buildNo build :build junit-xml :junit-xml} builds]
-    (dot)
-    (log/info (format "Syncing %s %s: build" job-name build-no build))
-    (put-build job-name build-no  build)
-    (when (some? junit-xml)
-      (try
-        (put-junit-xml job-name build-no junit-xml)
-        (catch Exception e
-          (if-let [data (ex-data e)]
-            (do
-              (log/errorf "Unable to sync testresults for %s %s (status %s): %s" job-name build-no (:status data) (:body data))
-              (log/info "Offending XML content is:\n" junit-xml))
-            (log/errorf e "Unable to sync testresults for %s %s" job-name build-no)))))))
+(defn put-to-buildviz [{job-name :jobName build-no :buildNo build :build junit-xml :junit-xml}]
+  (dot)
+  (log/info (format "Syncing %s %s: build" job-name build-no build))
+  (put-build job-name build-no  build)
+  (when (some? junit-xml)
+    (try
+      (put-junit-xml job-name build-no junit-xml)
+      (catch Exception e
+        (if-let [data (ex-data e)]
+          (do
+            (log/errorf "Unable to sync testresults for %s %s (status %s): %s" job-name build-no (:status data) (:body data))
+            (log/info "Offending XML content is:\n" junit-xml))
+          (log/errorf e "Unable to sync testresults for %s %s" job-name build-no))))))

 ;; build load start date

@@ -237,6 +236,24 @@

 ;; run

+(defn- emit-start [load-builds-from accumulate-stages-for-pipelines pipeline-stages]
+  (println "Looking at pipeline groups" (distinct (map :group pipeline-stages)))
+  (println "Syncing all builds starting from" (tf/unparse (:date-time tf/formatters) load-builds-from))
+  (when (some? accumulate-stages-for-pipelines)
+    (println "Aggregating jobs for stages of" accumulate-stages-for-pipelines))
+
+  (println "Finding all builds for syncing...")
+
+  pipeline-stages)
+
+(defn- emit-count-items [builds]
+  (println (format "Found %s builds to be synced, starting" (count builds)))
+  builds)
+
+(defn- emit-end [builds]
+  (println)
+  (println (format "Done, wrote %s build entries" (count builds))))
+
 (defn -main [& c-args]
   (def args (parse-opts c-args cli-options))

@@ -252,27 +269,18 @@

   (let [load-builds-from (get-start-date (:load-builds-from (:options args)))
         accumulate-stages-for-pipelines (set (:aggregate-jobs-for-pipelines (:options args)))
-        selected-pipeline-group-names (set (drop 1 (:arguments args)))
-        pipeline-stages (goapi/get-stages go-url)
-        selected-pipeline-stages (select-stages pipeline-stages selected-pipeline-group-names)]
-    (println "Looking at pipeline groups" (distinct (map :group selected-pipeline-stages)))
-    (println "Syncing all builds starting from" (tf/unparse (:date-time tf/formatters) load-builds-from))
-    (when (some? accumulate-stages-for-pipelines)
-      (println "Aggregating jobs for stages of" accumulate-stages-for-pipelines))
-
-    (println "Finding all builds for syncing...")
-
-    (let [builds-to-be-synced (->> selected-pipeline-stages
-                                 (mapcat (partial job-instances-for-stage load-builds-from accumulate-stages-for-pipelines))
-                                 (sort-by :scheduledDateTime))]
-    (println (format "Found %s builds to be synced, starting" (count builds-to-be-synced)))
-
-    (let [builds-with-full-information (->> builds-to-be-synced
-                                            (map augment-job-with-inputs)
-                                            (map job-data-for-instance)
-                                            (filter #(some? (:build %)))
-                                            (map augment-job-instance-with-junit-xml))]
-      (put-to-buildviz (map make-build-instance builds-with-full-information))
-
-      (println)
-      (println (format "Done, wrote %s build entries" (count builds-with-full-information)))))))
+        selected-pipeline-group-names (set (drop 1 (:arguments args)))]
+
+    (->> (goapi/get-stages go-url)
+         (select-stages selected-pipeline-group-names)
+         (emit-start load-builds-from accumulate-stages-for-pipelines)
+         (mapcat (partial job-instances-for-stage load-builds-from accumulate-stages-for-pipelines))
+         (sort-by :scheduledDateTime)
+         emit-count-items
+         (map augment-job-with-inputs)
+         (map job-data-for-instance)
+         (filter #(some? (:build %)))
+         (map augment-job-instance-with-junit-xml)
+         (map make-build-instance)
+         (map put-to-buildviz)
+         emit-end)))


Fix bad request on initial login, close #32

--- src/discuss/core.cljs
+++ src/discuss/core.cljs
@@ -19,8 +19,8 @@
 (defn ^:export main []
   (lib/log (str "Loaded " config/project " " config/version "-" config/build-commit))
   (om/add-root! parser/reconciler views/MainView (gdom/getElement (lib/prefix-name "main")))
-  (comlib/init!)
-  (rint/request-references))
+  (rint/request-references)
+  (comlib/init!))
 (main)

 (defn on-js-reload []


Prefix file name with *pwd*, since .getPath can't magically get the path of a random file on the filesystem.

--- src/cake/tasks/eval.clj
+++ src/cake/tasks/eval.clj
@@ -33,7 +33,7 @@
 (deftask run #{compile}
   "Execute a script in the project jvm."
   {[script] :run}
-  (bake [script (.getPath (file script))]
+  (bake [script (str *pwd* "/" script)]
         (load-file script)))

 (deftask repl #{compile}


Added net-actx-info helper func.

Added net-actx-info helper func.

--- src/cbfg/world/net.cljs
+++ src/cbfg/world/net.cljs
@@ -200,10 +200,12 @@
              "</div>"]]
       [@addrs h])))

+(defn net-actx-info [vis net-actx-id]
+  (first (filter (fn [[actx actx-info]] (= (last actx) net-actx-id))
+                 (:actxs vis))))
+
 (defn render-net [vis net-actx-id output-el-id prev-addrs]
-  (let [net-state (:loop-state (second (first (filter (fn [[actx actx-info]]
-                                                        (= (last actx) net-actx-id))
-                                                      (:actxs vis)))))
+  (let [net-state (:loop-state (second (net-actx-info vis net-actx-id)))
         [addrs h] (render-net-html net-state @prev-addrs)]
     (when (not= @prev-addrs addrs)
       (reset! prev-addrs addrs)


Deleted accidental print statement

Deleted accidental print statement

--- src/wombats/game/processor.clj
+++ src/wombats/game/processor.clj
@@ -103,7 +103,6 @@
         response-string (new String (.array response) "UTF-8")
         object (json/read-str response-string)]

-    (prn object)
     (future object)))

 (defn- get-lamdba-channels