add choose-n to chance fns

add choose-n to chance fns

--- src/overtone/algo/chance.clj
+++ src/overtone/algo/chance.clj
@@ -6,9 +6,14 @@
    [overtone.algo.scaling]))

 (defn choose
-  "Choose a random element from a collection."
+  "Choose a random element from col."
   [col]
   (nth col (rand-int (count col))))
+
+(defn choose-n
+  "Choose n random elements from col."
+  [n col]
+  (take n (shuffle col)))

 (defn weighted-choose
   "Returns an element from list vals based on the corresponding probabilities


make ionian rotation logic slightly clearer

--- src/overtone/music/pitch.clj
+++ src/overtone/music/pitch.clj
@@ -207,10 +207,10 @@

 (def SCALE
   (let [ionian-sequence [2 2 1 2 2 2 1]
-        ionian-len    (count ionian-sequence)
-        rotate-ionian (fn [offset]
-                        (drop offset (take (+ ionian-len offset)
-                                           (cycle ionian-sequence))))]
+        ionian-len      (count ionian-sequence)
+        rotate-ionian   (fn [offset]
+                          (take ionian-len
+                                (drop offset (cycle ionian-sequence))))]
   {:diatonic          ionian-sequence
    :ionian            (rotate-ionian 0)
    :major             (rotate-ionian 0)


Rename find-note-name to find-pitch-class-name and implement find-note-name to return a fully qualified MIDI keyword such as :Bb4. find-note-name is now the reverse of note.

--- src/overtone/music/pitch.clj
+++ src/overtone/music/pitch.clj
@@ -590,9 +590,26 @@
   [scale]
   (find-name scale SCALE))

+(defn find-pitch-class-name
+  "Given a midi number representing a note, returns the name of the note
+  independent of octave.
+
+  (find-pitch-class-name 62) ;=> :D
+  (find-pitch-class-name 74) ;=> :D
+  (find-pitch-class-name 75) ;=> :Eb"
+  [note]
+  (REVERSE-NOTES (mod note 12)))
+
 (defn find-note-name
   [note]
-  (REVERSE-NOTES (mod note 12)))
+  "Given a midi number representing a note, returns a keyword
+  representing the note including octave number. Reverse of the fn note.
+
+  (find-note-name 45) ;=> A2
+  (find-note-name 57) ;=> A3
+  (find-note-name 58) ;=> Bb3"
+  (let [octave (dec (int (/ note 12)))]
+    (keyword (str (name (find-pitch-class-name note)) octave))))

 (defn- fold-note
   "Folds note intervals into a 2 octave range so that chords using
@@ -644,7 +661,7 @@
     (if (< note (count notes) )
       (let [mod-notes (select-root notes note)
             chord  (find-chord-with-low-root mod-notes)
-            root (find-note-name (first (sort mod-notes)))]
+            root (find-pitch-class-name (first (sort mod-notes)))]
        (if chord
          {:root root :chord-type chord}
          (recur (inc note))))


Throw an error if inst or definst are used when the server is not connected

--- src/overtone/studio/inst.clj
+++ src/overtone/studio/inst.clj
@@ -146,6 +146,7 @@

 (defmacro inst
   [sname & args]
+  (ensure-connected!)
   `(let [[sname# params# ugens# constants# n-chans# inst-bus#] (pre-inst ~sname ~@args)
          new-inst# (get @instruments* sname#)
          container-group# (or (:group new-inst#)


memoize stat-data and prefer local data

memoize stat-data and prefer local data

--- src/paulkrake/datacenter.clj
+++ src/paulkrake/datacenter.clj
@@ -99,6 +99,7 @@
     (into {} x)))

 (defn stat-data-remote [saison spieltag-nr]
+  ;;(println "stat-data-remote" saison spieltag-nr)
   (as-> (season-by-competition saison) x
     (get x "id")
     (matches-by-season x spieltag-nr)
@@ -115,19 +116,26 @@
                    (vector home away hg ag)))
          x)))

-(defn stat-data-local [p-saison p-spieltag-nr f]
-  (as-> (line-seq (clojure.java.io/reader f)) x
+(defn stat-data-file [saison]
+  (let [f (clojure.java.io/file (format "resources/stat-%s.txt" (str saison)))]
+    (if (.exists f) f)))
+
+(defn stat-data-local [p-saison p-spieltag-nr]
+  ;;(println "stat-data-local" p-saison p-spieltag-nr)
+  (as-> (line-seq (clojure.java.io/reader (stat-data-file p-saison))) x
     (map clojure.edn/read-string x)
-    (filter (fn [{:keys [saison spieltagtag] :as m}]
+    (filter (fn [{:keys [saison spieltag] :as m}]
               (and (= (str p-saison) saison)
                    (= p-spieltag-nr spieltag))) x)
-    (map :data x)))
+    (map :data x)
+    (first x)))

-(defn stat-data [saison spieltag-nr]
-  (let [f (clojure.java.io/file (str "resources/stat-%s.txt" (str saison)))]
-    (if (not (.exists f))
-      (stat-data-remote saison spieltag-nr)
-      (stat-data-local saison spieltag-nr f))))
+(defn stat-data-unmemoized [saison spieltag-nr]
+  (as-> (stat-data-file saison) x
+    (if (not (nil? x)) (stat-data-local saison spieltag-nr))
+    (if (nil? x) (stat-data-remote saison spieltag-nr) x)))
+
+(def stat-data (memoize stat-data-unmemoized))

 (defn teams [saison spieltag-nr]
   (as-> (stat-data saison spieltag-nr) x


forbid -f + -g combo

forbid -f + -g combo

--- src/nml/core.clj
+++ src/nml/core.clj
@@ -40,6 +40,7 @@
 (def msgs
   {:bad-format    "Bad output format."
    :create+in     "-i/--in not valid with -c/--create."
+   :get+format    "-f/--format not valid with -g/--get."
    :get+set       "-g/--get and -s/--set may not be mixed."
    :multi-format  "-f/--format may be specified only once."
    :multi-in      "-i/--in may be specified only once."
@@ -243,6 +244,7 @@
     (if (:help options) (usage summary))
     (if (:version options) (do (println version) (System/exit 0)))
     (if (and gets sets) (fail (msgs :get+set)))
+    (if (and gets (:format options)) (fail (msgs :get+format)))
     (if (and sets (:no-prefix options)) (fail (msgs :set+no-prefix)))
     (if (and (:create options) (:in options)) (fail (msgs :create+in)))
     (let [fmt (let [f (:format options)] (if f (formats f) fmt-namelist))


This is too complicated

This is too complicated

--- src/onix/web.clj
+++ src/onix/web.clj
@@ -74,11 +74,6 @@
    :headers {"Content-Type" content-type}
    :body data})

-;(defn error-response
-;  [msg & [status]]
-;  (let [s (or status 404)]
-;    {:status s :body (cheshire/generate-string {:message msg :status s}) :headers headers}))
-
 (defn status
   []
   (let [dynamo-ok (persistence/dynamo-health-check)]
@@ -103,38 +98,61 @@
    (cheshire/generate-string)
    (response json-content-type)))

+(defn- jsonify-values
+  [map]
+  (let [name (:name map)
+        m (dissoc map :name)
+        n (reduce (fn [r [k v]] (assoc r k (cheshire/parse-string v))) {} m)]
+    (assoc n :name name)))
+
 (defn- get-application
   "Returns the application with the given name, or '404' if it doesn't exist."
   [application-name]
   (if-let [application (persistence/get-application application-name)]
     (->
      application
+     (jsonify-values)
+     (doto (prn))
      (cheshire/generate-string)
      (response json-content-type))
     (error-response (str "Application named: '" application-name "' does not exist.") 404)))

 (defn- put-application-metadata-item
-  "Creates or updates a piece of metadata for the specified application. Returns 400 for bad request
-   e.g. application doesn't exist or no metadata supplied."
   [application-name key req]
   (if-let [application (persistence/get-application application-name)]
-    (if-let [data (slurp (:body req))]
-      (if (not (empty? data))
+    (let [body (slurp (:body req))
+          json (cheshire/parse-string body true)]
+      (if-let [value (:value json)]
         (do (->
              application
-             (assoc (keyword key) data)
+             (doto (prn))
+             (assoc (keyword key) (cheshire/generate-string value))
              (persistence/create-application))
-            (response data text-plain-type))
-        (error-response (str "Can't put empty metadata value.") 400)))
-    (error-response (str "Can't put data for key '" key "' because the application '" application-name "' does not exist.") 400))
-  )
+            (response json json-content-type))
+        (error-response (str "No value supplied. Please supply json with key 'value' and arbitrary json as the value.") 400)))
+    (error-response (str "Can't put data for key '" key "' because the application '" application-name "' does not exist.") 400)))
+
+;; (defn- put-application-metadata-item
+;;   "Creates or updates a piece of metadata for the specified application. Returns 400 for bad request
+;;    e.g. application doesn't exist or no metadata supplied."
+;;   [application-name key req]
+;;   (if-let [application (persistence/get-application application-name)]
+;;     (if-let [data (slurp (:body req))]
+;;       (if (not (empty? data))
+;;         (do (->
+;;              application
+;;              (assoc (keyword key) data)
+;;              (persistence/create-application))
+;;             (response data text-plain-type))
+;;         (error-response (str "Can't put empty metadata value.") 400)))
+;;     (error-response (str "Can't put data for key '" key "' because the application '" application-name "' does not exist.") 400)))

 (defn- get-application-metadata-item
   "Get a piece of metadata for an application. Returns 404 if either the application or the metadata is not found"
   [application-name key]
   (if-let [application (persistence/get-application application-name)]
     (if-let [value ((keyword key) application)]
-      (response value text-plain-type)
+      (response {:value (cheshire/parse-string value)} json-content-type)
       (error-response (str "Can't find metadata '" key "' for application '" application-name "'.") 404))
     (error-response (str "Can't find application '" application-name "'.") 404)))


More endpoints-tests

More endpoints-tests

--- backend/test/akvo/lumen/endpoints_test.clj
+++ backend/test/akvo/lumen/endpoints_test.clj
@@ -2,6 +2,7 @@
   {:functional true}
   (:require [akvo.lumen.fixtures :refer [*system* system-fixture *tenant-conn* tenant-conn-fixture *error-tracker* error-tracker-fixture]]
             [akvo.lumen.protocols :as p]
+            [clojure.string :as str]
             [cheshire.core :as json]
             [clojure.java.io :as io]
             [clojure.test :refer :all]
@@ -15,7 +16,7 @@
 (def tenant-host "http://t1.lumen.local:3030")

 (defn api-url [api-url & args]
-  (str  "/api" api-url (when args (str "/" (apply str args)))))
+  (str  "/api" api-url (when args (str "/" (str/join "/"  args)))))

 (defn with-body [method uri body & [query-params]]
   (cond->
@@ -48,6 +49,71 @@
        :headers {"host" "t1.lumen.local:3030" "content-type" "application/json"}
        :uri uri}
     query-params (assoc :query-params query-params)))
+
+(defn job-execution-dataset-id [h job-id]
+  (dh/with-retry {:retry-if (fn [v e] (not v))
+                                         :max-retries 20
+                                         :delay-ms 100}
+                           (let [job (-> (h (get* (api-url "/job_executions" job-id)))
+                                         :body (json/parse-string keyword))
+                                 status (:status job)]
+                             (when (= "OK" status)
+                               (:datasetId job)))))
+
+(def dataset-link-columns [{:key false,
+                            :type "text",
+                            :title "Name",
+                            :multipleId nil,
+                            :hidden false,
+                            :multipleType nil,
+                            :columnName "c1",
+                            :direction nil,
+                            :sort nil}
+                           {:key false,
+                            :type "number",
+                            :title "Age",
+                            :multipleId nil,
+                            :hidden false,
+                            :multipleType nil,
+                            :columnName "c2",
+                            :direction nil,
+                            :sort nil}
+                           {:key false,
+                            :type "number",
+                            :title "Score",
+                            :multipleId nil,
+                            :hidden false,
+                            :multipleType nil,
+                            :columnName "c3",
+                            :direction nil,
+                            :sort nil}
+                           {:key false,
+                            :type "number",
+                            :title "Temperature",
+                            :multipleId nil,
+                            :hidden false,
+                            :multipleType nil,
+                            :columnName "c4",
+                            :direction nil,
+                            :sort nil}
+                           {:key false,
+                            :type "number",
+                            :title "Humidity",
+                            :multipleId nil,
+                            :hidden false,
+                            :multipleType nil,
+                            :columnName "c5",
+                            :direction nil,
+                            :sort nil}
+                           {:key false,
+                            :type "text",
+                            :title "Cat",
+                            :multipleId nil,
+                            :hidden false,
+                            :multipleType nil,
+                            :columnName "c6",
+                            :direction nil,
+                            :sort nil}])

 (deftest handler-test
   (let [h (:handler (:akvo.lumen.component.handler/handler *system*))]
@@ -99,75 +165,13 @@
                             (json/parse-string keyword)
                             :importId)
               _           (is (some? import-id))
-              dataset-id (dh/with-retry {:retry-if (fn [v e] (not v))
-                                         :max-retries 20
-                                         :delay-ms 100}
-                           (let [job (-> (h (get* (api-url "/job_executions" import-id)))
-                                         :body (json/parse-string keyword))
-                                 status (:status job)]
-                             (when (= "OK" status)
-                               (:datasetId job))))]
+              dataset-id (job-execution-dataset-id h import-id)]
           (let [dataset (-> (h (get* (api-url "/datasets" dataset-id)))
                             :body (json/parse-string keyword))]
             (is (= {:transformations []
-                    :columns
-                    [{:key false,
-                      :type "text",
-                      :title "Name",
-                      :multipleId nil,
-                      :hidden false,
-                      :multipleType nil,
-                      :columnName "c1",
-                      :direction nil,
-                      :sort nil}
-                     {:key false,
-                      :type "number",
-                      :title "Age",
-                      :multipleId nil,
-                      :hidden false,
-                      :multipleType nil,
-                      :columnName "c2",
-                      :direction nil,
-                      :sort nil}
-                     {:key false,
-                      :type "number",
-                      :title "Score",
-                      :multipleId nil,
-                      :hidden false,
-                      :multipleType nil,
-                      :columnName "c3",
-                      :direction nil,
-                      :sort nil}
-                     {:key false,
-                      :type "number",
-                      :title "Temperature",
-                      :multipleId nil,
-                      :hidden false,
-                      :multipleType nil,
-                      :columnName "c4",
-                      :direction nil,
-                      :sort nil}
-                     {:key false,
-                      :type "number",
-                      :title "Humidity",
-                      :multipleId nil,
-                      :hidden false,
-                      :multipleType nil,
-                      :columnName "c5",
-                      :direction nil,
-                      :sort nil}
-                     {:key false,
-                      :type "text",
-                      :title "Cat",
-                      :multipleId nil,
-                      :hidden false,
-                      :multipleType nil,
-                      :columnName "c6",
-                      :direction nil,
-                      :sort nil}]
+                    :columns dataset-link-columns
                     :name title
-                    ;;                :modified 1551089874635,
-                    ;;                :author nil,
+                    ;;:author nil,
                     :rows
                     [["Bob" 22.0 2.0 4.0 7.0 "A"]
                      ["Jane" 34.0 4.0 8.0 2.0 "B"]
@@ -180,7 +184,24 @@
                     :kind "LINK"
                     :guessColumnTypes true
                     :hasColumnHeaders true}
-                   (select-keys (:source dataset) [:url :kind :guessColumnTypes :hasColumnHeaders]))))
+                   (select-keys (:source dataset) [:url :kind :guessColumnTypes :hasColumnHeaders])))
+
+            (let [meta-dataset (-> (h (get* (api-url "/datasets" dataset-id "meta")))
+                                   :body (json/parse-string keyword))]
+              (is (= {:id dataset-id
+                      :name title
+                      :status "OK"
+                      :transformations []
+                      :columns dataset-link-columns}
+                     (select-keys meta-dataset [:id :name :status :transformations :columns]))))
+            (let [update-dataset (-> (h (post* (api-url "/datasets" dataset-id "update") (:source dataset)))
+                                     :body (json/parse-string keyword))
+                  dataset-id (job-execution-dataset-id h (:updateId update-dataset))]
+              (is (some? dataset-id))
+
+              (is (< (:modified dataset ) (-> (h (get* (api-url "/datasets" dataset-id)))
+                                              :body (json/parse-string keyword)
+                                              :modified)))))

           (is (= title (-> (h (get* (api-url "/library")))


get-files bug

get-files bug

--- joplin.core/src/joplin/core.clj
+++ joplin.core/src/joplin/core.clj
@@ -51,9 +51,9 @@
 (defn get-full-migrator-id [id]
   (str (f/unparse (f/formatter "YYYYMMddHHmmss") (t/now)) "-" id))

-(defn- get-migration-files [path]
+(defn- get-files [path]
   (let [folder (io/file path)
-        classpath-folder (->> (string/split path "/")
+        classpath-folder (->> (string/split path #"/")
                               rest (interpose "/") (apply str))]
     (if (.isDirectory folder)
       ;; If it's a folder just read the file from there
@@ -70,7 +70,7 @@
                   rest
                   (interpose ".")
                   (apply str))]
-      (->> (get-migration-files path)
+      (->> (get-files path)
            (map #(re-matches #"(.*)(\.clj)$" %))
            (keep second)
            (map #(string/replace % "_" "-"))


Depend on specific snapshot version so lein won't fail

--- worker/project.clj
+++ worker/project.clj
@@ -11,7 +11,7 @@
   :dependencies [[org.clojure/clojure "1.5.1"]
                  [patavi.common "0.2.4"]
                  [me.raynes/fs "1.4.5"]
-                 [org.rosuda/REngine "1.7.1-SNAPSHOT"]]
+                 [org.rosuda/REngine "1.7.1-20130821.152906-1"]]
   :env {:rserve-logs "log/rserve.log"
         :expire-broker-after 5
         :heartbeat-interval 1000


Refactor run-system function in core

Refactor run-system function in core

It's now a macro that makes the start, stop and restart operations
customizable.

--- clstreams/src/clstreams/core.clj
+++ clstreams/src/clstreams/core.clj
@@ -5,42 +5,51 @@
             [signal.handler :as signal]
             [clstreams.pipelines]))

-(defn run-system
-  [system-var]
-  (let [next-step (promise)
-        orig-handlers
-        (->
-         {}
-         (into (for [sgn [:term :int]]
-                 [sgn
-                  (signal/with-handler sgn
-                    (log/debugf "Received SIG%s" (-> sgn name .toUpperCase))
-                    (deliver next-step :end))]))
-         (into (for [sgn [:hup]]
-                 [sgn
-                  (signal/with-handler sgn
-                    (log/debugf "Received SIG%s" (-> sgn name .toUpperCase))
-                    (deliver next-step :restart))])))]
+(defn trap-signals [action-promise]
+  (->
+   {}
+   (into (for [sgn [:term :int]]
+           [sgn
+            (signal/with-handler sgn
+              (log/debugf "Received SIG%s" (-> sgn name .toUpperCase))
+              (deliver action-promise :end))]))
+   (into (for [sgn [:hup]]
+           [sgn
+            (signal/with-handler sgn
+              (log/debugf "Received SIG%s" (-> sgn name .toUpperCase))
+              (deliver action-promise :restart))]))))

-    (alter-var-root system-var component/start)
+(defn untrap-signals [orig-handlers]
+  (doseq [[sgn orig-handler] orig-handlers]
+    (sun.misc.Signal/handle (signal/->signal :int) orig-handler)))

-    (let [ns @next-step]
+(defmacro run-and-handle-signals
+  [start-expr stop-expr restart-expr]
+  `(let [next-step# (promise)
+         orig-handlers# (trap-signals next-step#)]

-      (doseq [[sgn orig-handler] orig-handlers]
-        (sun.misc.Signal/handle (signal/->signal :int) orig-handler))
+     ~start-expr

-      (alter-var-root system-var component/stop)
+     (let [ns# @next-step#]

-      (case ns
-        :end (System/exit 0)
-        :restart (recur system-var)))))
+       (untrap-signals orig-handlers#)
+
+       ~stop-expr
+
+       (case ns#
+         :end (System/exit 0)
+         :restart ~restart-expr))))

 (def system nil)

 (defn -main
-  [func-name & args]
-  (let [system-init-fn (eval (symbol func-name))]
+  [& _]
+  (let [[func-name & args] *command-line-args*
+        system-init-fn (eval (symbol func-name))]
     (alter-var-root #'system
-                    (constantly (apply system-init-fn args))))
-  (run-system #'system))
+                    (constantly (apply system-init-fn args)))
+    (run-and-handle-signals
+     (alter-var-root #'system component/start)
+     (alter-var-root #'system component/stop)
+     (recur []))))


Make mobile "more threads" arrows clickable

--- src/retouch/views/swipe.cljs
+++ src/retouch/views/swipe.cljs
@@ -29,7 +29,10 @@
            :display "inline-block"
            :vertical-align "top"}]]])]))

-(defn arrow-view [direction]
+(defn arrow-view
+  "Show an arrow, pointing in the direction given by `direction`;
+  either `:left` or `:right`."
+  [direction]
   (let [[w h] [30 120]
         x1 (case direction :left 5 :right w)
         x2 (case direction :left w :right 5)]
@@ -73,6 +76,15 @@

                         (set! (.-scrollLeft (@state :container)) target-x)))

+        scroll-page! (fn [n-pages]
+                       (let [container (@state :container)
+                             scroll-x (.-scrollLeft container)
+                             page-width (.-offsetWidth container)
+                             current-page (js/Math.floor (/ scroll-x page-width))]
+                         (set! (.-scrollLeft container) (* page-width (+ n-pages current-page)))))
+        scroll-next! (fn [] (scroll-page! 1))
+        scroll-prev! (fn [] (scroll-page! -1))
+
         touch-end! (fn [e]
                      (swap! state assoc :dragging? false))

@@ -112,8 +124,12 @@
              (for [[idx panel-item] (map-indexed vector panel-items)]
                ^{:key (:id panel-item)}
                [:div.panel
+                [panel-view panel-item]
                 (when (not= idx 0)
-                  [:div.arrow-prev [arrow-view :left]])
-                [panel-view panel-item]
+                  [:div.arrow-prev
+                   {:on-click (fn [_] (scroll-prev!))}
+                   [arrow-view :left]])
                 (when (not= idx (dec (count panel-items)))
-                  [:div.arrow-next [arrow-view :right]])]))]])})))
+                  [:div.arrow-next
+                   {:on-click (fn [_] (scroll-next!))}
+                   [arrow-view :right]])]))]])})))


Deref once to ensure consistency

Deref once to ensure consistency

--- src/onyx/peer/virtual_peer.clj
+++ src/onyx/peer/virtual_peer.clj
@@ -75,11 +75,12 @@
         low-water-ratio (/ low-water-pct 100)
         high-water-ratio (/ high-water-pct 100)]
     (while (not (Thread/interrupted))
-      (let [ratio (/ (count buf) (.n buf))]
-        (cond (and (not @on?) (> ratio high-water-ratio))
+      (let [ratio (/ (count buf) (.n buf))
+            on-val @on]
+        (cond (and (not on-val) (> ratio high-water-ratio))
               (do (reset! on? true)
                   (>!! outbox-ch (create-log-entry :backpressure-on {:peer id})))
-              (and @on? (< ratio low-water-ratio))
+              (and on-val (< ratio low-water-ratio))
               (do (reset! on? false)
                   (>!! outbox-ch (create-log-entry :backpressure-off {:peer id})))))
       (Thread/sleep check-interval))))


No longer checkpoint trigger state objects Trigger checkpointing should only checkpoint the serializable state

--- src/onyx/peer/window_state.clj
+++ src/onyx/peer/window_state.clj
@@ -174,10 +174,18 @@
               fire-extents)))

   (state [this]
-    (list state trigger-states))
+    (list state (mapv :state trigger-states)))

   (recover-state [this [state trigger-states]]
-    (assoc this :state state :trigger-states trigger-states))
+    (assert (= (count trigger-states) (count (:trigger-states this))))
+    (-> this
+        (assoc :state state)
+        (update :trigger-states
+                (fn [ts]
+                  (mapv (fn [t ts]
+                          (assoc t :state ts))
+                        ts
+                        trigger-states)))))

   (triggers [this]
     (reduce (fn [t [trigger-index trigger-state]]


Fixes #343.

Fixes #343.

--- src/onyx/plugin/core_async.clj
+++ src/onyx/plugin/core_async.clj
@@ -11,6 +11,9 @@
   (when-not (:core.async/chan event)
     (throw (ex-info ":core.async/chan not found - add it using a :before-task-start lifecycle"
                     {:event-map-keys (keys event)})))
+  (let [task (:onyx.core/task-map event)]
+    (when-not (= (:onyx/max-peers task) 1)
+      (throw (ex-info ":onyx/max-peers must be set to 1 in the task map for core.async readers" {:task-map task}))))
   (let [pipeline (:onyx.core/pipeline event)]
     {:core.async/pending-messages (:pending-messages pipeline)
      :core.async/drained (:drained pipeline)
@@ -27,6 +30,9 @@
   (when-not (:core.async/chan event)
     (throw (ex-info ":core.async/chan not found - add it using a :before-task-start lifecycle"
                     {:event-map-keys (keys event)})))
+  (let [task (:onyx.core/task-map event)]
+    (when-not (= (:onyx/max-peers task) 1)
+      (throw (ex-info ":onyx/max-peers must be set to 1 in the task map for core.async writers" {:task-map task}))))
   {})

 (def reader-calls


Fixes #254.

Fixes #254.

--- src/onyx/plugin/core_async.clj
+++ src/onyx/plugin/core_async.clj
@@ -43,6 +43,11 @@
   (read-batch [_ {:keys [core.async/chan] :as event}]
     (let [pending (count @pending-messages)
           max-segments (min (- max-pending pending) batch-size)
+          ;; We reuse a single timeout channel. This allows us to
+          ;; continually block against one thread that is continually
+          ;; expiring. This property lets us take variable amounts of
+          ;; time when reading each segment and still allows us to return
+          ;; within the predefined batch timeout limit.
           timeout-ch (timeout batch-timeout)
           batch (if (pos? max-segments)
                   (loop [segments [] cnt 0]


instr-control: when setting params in set-params function, use sound-control/sound-param function to get values of parameters (to handle bus values, etc)

--- src/overtime/instr_control.clj
+++ src/overtime/instr_control.clj
@@ -38,8 +38,9 @@

 (defn set-params
   [type key log-level & params]
-  (log/logp log-level "Set params for" type key "to" params)
-  (apply ot/ctl (synth-instance type key) params))
+  (let [sound-params (flatten (for [[key val] (partition 2 params)] [key (snd/sound-param key val)]))]
+    (log/logp log-level "Set params for" type key "to" sound-params)
+    (apply ot/ctl (synth-instance type key) sound-params)))

 (defn set-params-at [time type key & params] (apply-by time (ot/at time (apply set-params type key :info params))))


Use update-in to lower the base, because that's what it's there for.

--- src/overtunes/songs/at_all.clj
+++ src/overtunes/songs/at_all.clj
@@ -33,7 +33,7 @@
 (def II (with-base (triad ionian 1)))
 (def V (with-base (triad ionian 4)))

-(def progression [I I II II II V I (assoc V :base (lower (:base V)))])
+(def progression [I I II II II V I (update-in V [:base] lower)])

 (defn rythm-n-bass# [timing [chord & chords]]
   (do


Some clean-up of prop conversion

Some clean-up of prop conversion

--- src/reagent/impl/template.cljs
+++ src/reagent/impl/template.cljs
@@ -24,14 +24,6 @@
   (or (hiccup-tag? x)
       (ifn? x)))

-(defn to-js-val [v]
-  (cond
-   (or (string? v) (number? v)) v
-   (implements? INamed v) (name v)
-   (coll? v) (clj->js v)
-   (ifn? v) (fn [& args] (apply v args))
-   :else v))
-

 ;;; Props conversion

@@ -44,8 +36,7 @@
     (aget o k)))

 (defn cached-prop-name [k]
-  (if (or (string? k)
-          (not (implements? INamed k)))
+  (if-not (implements? INamed k)
     k
     (if-let [k' (obj-get prop-name-cache (name k))]
       k'
@@ -53,37 +44,38 @@
             (util/dash-to-camel k)))))

 (defn convert-prop-value [x]
-  (cond (string? x) x
-        (number? x) x
+  (cond (or (string? x) (number? x) (fn? x)) x
+        (implements? INamed x) (name x)
         (map? x) (reduce-kv (fn [o k v]
                               (doto o
                                 (aset (cached-prop-name k)
-                                      (to-js-val v))))
+                                      (convert-prop-value v))))
                             #js{} x)
-        :else (to-js-val x)))
-
-(defn set-id-class [props id-class]
-  (when-some [id (.' id-class :id)]
-    (let [pid (.' props :id)]
-      (.! props :id (if (some? pid) pid id))))
-  (when-some [class (.' id-class :className)]
-    (let [old (.' props :className)]
-      (.! props :className (if (some? old)
-                             (str class " " old)
-                             class)))))
+        (coll? x) (clj->js x)
+        (ifn? x) (fn [& args] (apply x args))
+        true (clj->js x)))
+
+(defn set-id-class [props id class]
+  (let [p (if (nil? props) #js{} props)]
+    (when (and (some? id) (nil? (.' p :id)))
+      (.! p :id id))
+    (when (some? class)
+      (let [old (.' p :className)]
+        (.! p :className (if (some? old)
+                           (str class " " old)
+                           class))))
+    p))

 (defn convert-props [props id-class]
-  (if (and (empty? props) (not (.' id-class :hasIdClass)))
-    nil
-    (let [objprops
-          (reduce-kv (fn [o k v]
-                       (doto o
-                         (aset (cached-prop-name k)
-                               (convert-prop-value v))))
-                     #js{} props)]
-      (when (.' id-class :hasIdClass)
-        (set-id-class objprops id-class))
-      objprops)))
+  (let [id (.' id-class :id)
+        class (.' id-class :className)
+        no-id-class (and (nil? id) (nil? class))]
+    (if (and no-id-class (empty? props))
+      nil
+      (let [objprops (convert-prop-value props)]
+        (if no-id-class
+          objprops
+          (set-id-class objprops id class))))))

 ;;; Specialization for input components
@@ -155,7 +147,6 @@
                  (string/replace class #"\." " "))]
     (assert tag (str "Unknown tag: '" hiccup-tag "'"))
     #js{:name tag
-        :hasIdClass (or (some? id) (some? class'))
         :id id
         :className class'}))


Fixed problem where removing a character info panel screwed up iteration over child info panels.

--- src-browser/simplestrat/renderstate.cljs
+++ src-browser/simplestrat/renderstate.cljs
@@ -383,16 +383,17 @@
   ;; have a corresponding character
   (let [roster (get-in renderstate [:teamGUIs team])
         {:keys [container panels]} roster
-        numchildren (.getNumChildren container)]
+        numchildren (.getNumChildren container)
+        panelinstances (doall (map #(.getChildAt container %) (range numchildren)))]
     ;;(js/console.log (clj->js characters))
-    (doseq [childindex (range numchildren)
-            :let [childcontainer (.getChildAt container childindex)
-                  childid (.-name childcontainer)]]
+    (doseq [childpanel panelinstances
+            :let [childid (.-name childpanel)]]
       ;;(js/console.log childcontainer)
       ;;(js/console.log childid)
       (when (not-any? #(= childid (:uniqueid %)) characters)
         ;;(js/console.log "removing")
-        (.removeChild container childcontainer)))
+        (.removeChild container childpanel)))
+    ;; TODO remove info panel from the "panels" field of the roster as well!
     renderstate))

 (defn syncpanelstoteamcharacters


public dns refactored

public dns refactored

--- src/terraboot/public_dns.clj
+++ src/terraboot/public_dns.clj
@@ -1,9 +1,10 @@
 (ns terraboot.public-dns
   (:require [terraboot.core :as core]
-            [terraboot.utils :as utils]))
+            [terraboot.utils :as utils]
+            [clojure.string :as string :refer [join replace]]))

-(defn public-route53-record [dns-zone dns-zone-id prefix spec]
-  (let [name (str prefix "." dns-zone)]
+(defn public-route53-record [root-dns dns-zone-id prefix spec]
+  (let [name (str prefix "." root-dns)]
     (core/resource "aws_route53_record" (core/safe-name name)
                    (merge
                     {:zone_id dns-zone-id
@@ -12,9 +13,24 @@
                     (if (:alias spec) {} {:ttl "300"})
                     spec))))

+(defn public-dns-zone
+  [environment-dns environment-dns-identifier]
+  (core/resource "aws_route53_zone" environment-dns-identifier
+                 {:name environment-dns
+                  :comment (str "public routes for " environment-dns)}))
+
 (defn vpc-public-dns
-  [dns-zone dns-zone-id vpc-name]
-  (let [route53-record (partial public-route53-record dns-zone dns-zone-id)
-        vpc-output-of (core/output-of-fn (core/vpc-unique-fn vpc-name))]
+  [{:keys [root-dns root-dns-zone-id environment project vpc-name]}]
+  (let [environment-dns (string/join "." [environment project root-dns])
+        environment-dns-identifier (string/replace environment-dns #"\." "_")]
     (utils/merge-in
-     (route53-record "vpn" {:records [(vpc-output-of "aws_eip" "vpn" "public_ip")]}))))
+     (public-dns-zone environment-dns environment-dns-identifier)
+     (public-route53-record root-dns
+                            root-dns-zone-id
+                            (string/join "." [environment project])
+                            {:type "NS"
+                             :records (mapv #(core/output-of "aws_route53_zone" environment-dns-identifier (string/join  "." ["name_server" %])) (range 0 4))})
+     (public-route53-record environment-dns
+                            (core/id-of "aws_route53_zone" environment-dns-identifier)
+                            "vpn"
+                            {:records [(core/output-of "aws_eip" (str vpc-name "-vpn") "public_ip")]}))))


refactor async-context handling to accept graph & processor (e.g. eager-vertex-processor) as args, add stop! method to IGraphExecutor, rename IVertex proto methods, use lazy instantiation for vertex input-channel, add simple-collect helper fn

--- src/thi/ng/fabric/async.cljc
+++ src/thi/ng/fabric/async.cljc
@@ -1,12 +1,12 @@
 (ns thi.ng.fabric.async
   (:require
    [clojure.core.async :as a :refer [go go-loop chan close! <! >! alts! timeout]]
-   [taoensso.timbre :refer [info warn error]]))
+   [taoensso.timbre :refer [debug warn error]]))

 (defprotocol IVertex
   (connect-to! [_ v sig-fn edge-opts])
-  (disconnect-from! [_ v])
-  (disconnect! [_])
+  (disconnect-vertex! [_ v])
+  (close-input! [_])
   (input-channel [_])
   (collect! [_])
   (score-collect [_])
@@ -20,11 +20,15 @@
   (vertices [_]))

 (defprotocol IGraphExecutor
-  (execute! [_ vertices]))
-
-(defn default-collect
-  [vertex]
-  (swap! (:state vertex) #(update % ::val into (::uncollected %))))
+  (execute! [_])
+  (stop! [_]))
+
+(defn simple-collect
+  [collect-fn]
+  (fn [vertex]
+    (swap! (:state vertex) #(update % ::val collect-fn (::uncollected %)))))
+
+(def default-collect (simple-collect into))

 (defn signal-forward
   [state _] (::val state))
@@ -48,26 +52,33 @@

 (defrecord Vertex [id state last-sig-state in outs]
   clojure.lang.IDeref
-  (deref [_] (::val @state))
+  (deref
+    [_] (::val @state))
   IVertex
-  (collect! [_] ((::collect-fn @state) _))
-  (score-collect [_] ((::score-collect-fn @state) _))
+  (collect!
+    [_] ((::collect-fn @state) _))
+  (score-collect
+    [_] ((::score-collect-fn @state) _))
   (connect-to!
     [_ v sig-fn opts]
-    (info (format "%d connecting to %d (%s)" id (:id v) (pr-str opts)))
+    (debug (format "%d connecting to %d (%s)" id (:id v) (pr-str opts)))
     (swap! outs assoc v [sig-fn opts]) _)
-  (disconnect-from!
+  (disconnect-vertex!
     [_ v]
-    (info (format "%d disconnecting from %d" id (:id v)))
+    (debug (format "%d disconnecting from %d" id (:id v)))
     (swap! outs dissoc v)
     _)
-  (disconnect! [_]
-    (info (format "%d disconnecting..." id))
-    (close! in)
+  (close-input! [_]
+    (if @in
+      (do (debug (str id " closing..."))
+          (close! @in)
+          (reset! in nil))
+      (warn (str id " already closed")))
     _)
   (input-channel
-    [_] in)
-  (score-signal [_] ((::score-signal-fn @state) _))
+    [_] (or @in (reset! in (chan))))
+  (score-signal
+    [_] ((::score-signal-fn @state) _))
   (signal!
     [_]
     (let [state @state]
@@ -78,16 +89,15 @@
             (let [signal (f state opts)]
               (if-not (nil? signal)
                 (>! (input-channel v) [id signal])
-                (warn (format "signal fn for %d return nil, skipping..." (:id v)))))
+                (warn (format "signal fn for %d returned nil, skipping..." (:id v)))))
             (recur (next outs)))))
       _))
   (receive-signal
     [_ src sig]
     (swap! state
-           (fn [state]
-             (-> state
-                 (update ::uncollected conj sig)
-                 (assoc-in [::signal-map src] sig))))
+           #(-> %
+                (update ::uncollected conj sig)
+                (assoc-in [::signal-map src] sig)))
     _))

 #?(:clj
@@ -107,7 +117,7 @@
 (def default-context-opts
   {:collect-thresh 0
    :signal-thresh  0
-   :timeout        5
+   :timeout        100
    :max-ops        1e6})

 (defn vertex
@@ -116,7 +126,7 @@
    {:id             id
     :state          (atom (merge default-vertex-state state))
     :last-sig-state (atom nil)
-    :in             (chan)
+    :in             (atom nil)
     :outs           (atom {})}))

 (defrecord Graph [state]
@@ -141,13 +151,14 @@
 (defn compute-graph
   [] (Graph. (atom {:vertices {} :next-id 0})))

-(defn eager-async-vertex
-  [{:keys [id in state] :as vertex} ctx]
-  (let [{:keys [collect-thresh signal-thresh ctrl]} @ctx]
+(defn eager-vertex-processor
+  [{:keys [id state] :as vertex} ctx]
+  (let [{:keys [collect-thresh signal-thresh ctrl]} ctx
+        in (input-channel vertex)]
     (go-loop []
       (let [[src-id sig] (<! in)]
         (if sig
-          (do (info id "receive from" src-id sig)
+          (do (debug (format "%d receive from %d: %s" id src-id (pr-str sig)))
               (receive-signal vertex src-id sig)
               (when (should-collect? vertex collect-thresh)
                 (when (>! ctrl [:collect id])
@@ -157,7 +168,7 @@
                     (>! ctrl [:signal id])
                     (signal! vertex))))
               (recur))
-          (info id "stopped"))))
+          (debug (str id " stopped")))))
     vertex))

 (defn execution-result
@@ -169,79 +180,91 @@
        (merge opts)
        (deliver p)))

+(defn stop-execution
+  [ctrl vertices]
+  (close! ctrl)
+  (run! close-input! vertices))
+
 (defn async-context
   [opts]
-  (let [ctrl     (chan)
-        ctx      (merge default-context-opts {:ctrl ctrl} opts)
-        c-thresh (:collect-thresh ctx)
-        s-thresh (:signal-thresh ctx)
-        max-ops  (:max-ops ctx)
-        max-t    (:timeout ctx)]
+  (let [ctrl      (chan)
+        ctx       (merge default-context-opts {:ctrl ctrl} opts)
+        processor (:processor ctx)
+        c-thresh  (:collect-thresh ctx)
+        s-thresh  (:signal-thresh ctx)
+        max-ops   (:max-ops ctx)
+        max-t     (:timeout ctx)
+        result    (promise)]
     (reify
       clojure.lang.IDeref
       (deref [_] ctx)
       IGraphExecutor
-      (execute! [_ g]
-        (let [t0  (System/nanoTime)
-              res (promise)]
-          (go
-            (loop [verts (vertices g)]
-              (when-let [v (first verts)]
-                (when (should-collect? v c-thresh)
-                  (collect! v))
-                (when (should-signal? v s-thresh)
-                  (signal! v))
-                (recur (next verts))))
-            (loop [colls 0 sigs 0]
-              (if (<= (+ colls sigs) max-ops)
-                (let [t (timeout max-t)
-                      [[evt v ex] port] (alts! [ctrl t])]
-                  (if (= port t)
-                    (execution-result :converged res colls sigs t0)
-                    (case evt
-                      :collect (recur (inc colls) sigs)
-                      :signal  (recur colls (inc sigs))
-                      :error   (do (warn ex "@ vertex" v)
-                                   (execution-result
-                                    :error res colls sigs t0
-                                    {:reason           :error
-                                     :reason-exception ex
-                                     :reason-vertex    v}))
-                      (do (info "wrong event" evt v)
-                          (execution-result
-                           :interrupted res colls sigs t0
-                           {:reason        :unknown
-                            :reason-event  evt
-                            :reason-vertex v})))))
-                (execution-result :terminated res colls sigs t0))))
-          res)))))
+      (stop!
+        [_]
+        (stop-execution ctrl (vertices (:graph ctx)))
+        result)
+      (execute! [_]
+        (if-not (realized? result)
+          (let [t0  (System/nanoTime)]
+            (go
+              (loop [verts (vertices (:graph ctx))]
+                (when-let [v (first verts)]
+                  (processor v ctx)
+                  (when (should-collect? v c-thresh)
+                    (collect! v))
+                  (when (should-signal? v s-thresh)
+                    (signal! v))
+                  (recur (next verts))))
+              (loop [colls 0 sigs 0]
+                (if (<= (+ colls sigs) max-ops)
+                  (let [t (timeout max-t)
+                        [[evt v ex] port] (alts! [ctrl t])]
+                    (if (= port t)
+                      (do (stop! _)
+                          (execution-result :converged result colls sigs t0))
+                      (case evt
+                        :collect (recur (inc colls) sigs)
+                        :signal  (recur colls (inc sigs))
+                        :error   (do (warn ex "@ vertex" v)
+                                     (stop! _)
+                                     (execution-result
+                                      :error result colls sigs t0
+                                      {:reason           :error
+                                       :reason-event     evt
+                                       :reason-exception ex
+                                       :reason-vertex    v}))
+                        (do (warn "execution interrupted")
+                            (execution-result
+                             :interrupted result colls sigs t0
+                             {:reason        :unknown
+                              :reason-event  evt
+                              :reason-vertex v})))))
+                  (execution-result :terminated result colls sigs t0))))
+            result)
+          (throw (IllegalStateException. "Context already executed once")))))))

 (def g (compute-graph))
-(def ctx (async-context {}))
+(def ctx (async-context {:graph g :processor eager-vertex-processor}))

 (defn signal-sssp
   [state dist] (if-let [v (::val state)] (+ dist v)))

-(defn collect-sssp
-  [vertex]
-  (swap! (:state vertex)
-         (fn [{:keys [val] :as state}]
-           (update state ::val
-                   (if val
-                     (fn [_] (reduce min _ (::uncollected state)))
-                     (fn [_] (reduce min (::uncollected state))))))))
-
-(def a (eager-async-vertex (add-vertex! g {::val 0   ::collect-fn collect-sssp}) ctx))
-(def b (eager-async-vertex (add-vertex! g {::val nil ::collect-fn collect-sssp}) ctx))
-(def c (eager-async-vertex (add-vertex! g {::val nil ::collect-fn collect-sssp}) ctx))
-(def d (eager-async-vertex (add-vertex! g {::val nil ::collect-fn collect-sssp}) ctx))
+(def collect-sssp
+  (simple-collect
+   (fn [val uncollected]
+     (if val (reduce min val uncollected) (reduce min uncollected)))))
+
+(def a (add-vertex! g {::val 0   ::collect-fn collect-sssp}))
+(def b (add-vertex! g {::val nil ::collect-fn collect-sssp}))
+(def c (add-vertex! g {::val nil ::collect-fn collect-sssp}))
+(def d (add-vertex! g {::val nil ::collect-fn collect-sssp}))

 (connect-to! a b signal-sssp 1)
 (connect-to! a c signal-sssp 3)
 (connect-to! b c signal-sssp 1)
 (connect-to! c d signal-sssp 1)

-(prn @(execute! ctx g))
+;;(prn @(execute! ctx))

 (prn @a)
 (prn @b)
@@ -250,8 +273,8 @@

 (comment
-  (disconnect! a)
-  (disconnect! b)
-  (disconnect! c)
-  (disconnect! d)
+  (close-input! a)
+  (close-input! b)
+  (close-input! c)
+  (close-input! d)
   )


notes

notes

--- src/clj/backtype/storm/daemon/nimbus.clj
+++ src/clj/backtype/storm/daemon/nimbus.clj
@@ -794,8 +794,10 @@
         (let [storm-cluster-state (:storm-cluster-state nimbus)
               assigned (assigned-slots storm-cluster-state)
               supervisor-infos (all-supervisor-info storm-cluster-state)
+              ;; TODO: need to get the port info about supervisors...
+              ;; in standalone just look at metadata, otherwise just say N/A?
               supervisor-summaries (dofor [[id info] supervisor-infos]
-                                          (let [ports (set (:worker-ports info))
+                                          (let [ports (set (:meta info))
                                                 ]
                                             (SupervisorSummary. (:hostname info)
                                                                 (:uptime-secs info)


Enable snippet for cljs for `quadratic-vertex` as it is supported by p5js. Issue #255.

--- src/cljc/quil/snippets/shape/vertex.cljc
+++ src/cljc/quil/snippets/shape/vertex.cljc
@@ -110,27 +110,26 @@
   (q/curve-vertex 0 0 0)
   (q/end-shape :close))

-#?(:clj
-   (defsnippet quadratic-vertex
-     "quadratic-vertex"
-     {:renderer :p3d}
-
-     (q/camera 50 200 50 50 0 0 0 0 -1)
-     (q/line 0 0 0 0 0 100)
-     (q/line 0 0 0 0 100 0)
-     (q/line 0 0 0 100 0 0)
-     (q/begin-shape)
-     (q/vertex 0 0)
-     (q/quadratic-vertex 30 50 10 100)
-     (q/quadratic-vertex 50 -50 90 100)
-     (q/quadratic-vertex 80 50 100 0)
-     (q/end-shape :close)
-     (q/begin-shape)
-     (q/vertex 0 0 0)
-     (q/quadratic-vertex 30 0 50 10 0 100)
-     (q/quadratic-vertex 50 0 -50 90 0 100)
-     (q/quadratic-vertex 80 0 50 100 0 0)
-     (q/end-shape :close)))
+(defsnippet quadratic-vertex
+  "quadratic-vertex"
+  {:renderer :p3d}
+
+  (q/camera 50 200 50 50 0 0 0 0 -1)
+  (q/line 0 0 0 0 0 100)
+  (q/line 0 0 0 0 100 0)
+  (q/line 0 0 0 100 0 0)
+  (q/begin-shape)
+  (q/vertex 0 0)
+  (q/quadratic-vertex 30 50 10 100)
+  (q/quadratic-vertex 50 -50 90 100)
+  (q/quadratic-vertex 80 50 100 0)
+  (q/end-shape :close)
+  (q/begin-shape)
+  (q/vertex 0 0 0)
+  (q/quadratic-vertex 30 0 50 10 0 100)
+  (q/quadratic-vertex 50 0 -50 90 0 100)
+  (q/quadratic-vertex 80 0 50 100 0 0)
+  (q/end-shape :close))

 #?(:clj
    (defsnippet texture


increase default precision--can set precision in excel

--- src/clojure/zensols/model/classifier.clj
+++ src/clojure/zensols/model/classifier.clj
@@ -97,7 +97,7 @@
 (def ^:dynamic excel-results-precision
   "An integer specifying the length of the mantissa when creating the results
   spreadsheet in [[excel-results]]."
-  3)
+  5)

 (defn initialize
   "Initialize model resource locations.


Added :three-gens-same-inputs-diff-diffs diversification test.

--- src/clojush/pushgp/genetic_operators.clj
+++ src/clojush/pushgp/genetic_operators.clj
@@ -817,6 +817,23 @@
     (and (> (reduce min diffs) 0)
          (apply distinct? diffs))))

+(defn three-gens-same-inputs-diff-diffs-diversifying?
+  "Returns true iff genome g passes the diversification test."
+  [g argmap]
+  (let [make-child #(produce-child-genome-by-autoconstruction % g g false argmap)
+        diff #(expressed-difference %1 %2 argmap)
+        c1 (make-child g)
+        c2 (make-child g)
+        gc1 (make-child c1)
+        gc2 (make-child c2)
+        c1-diff (diff g c1)
+        c2-diff (diff g c2)
+        gc1-diff (diff c1 gc1)
+        gc2-diff (diff c2 gc2)
+        diffs [c1-diff c2-diff gc1-diff gc2-diff]]
+    (and (> (reduce min diffs) 0)
+         (apply distinct? diffs))))
+
 (defn three-gens-some-diff-diffs-diversifying?
   "Returns true iff genome g passes the diversification test."
   [g argmap]
@@ -920,6 +937,7 @@
   ((case (:autoconstructive-diversification-test argmap)
      :gecco2016 gecco2016-diversifying?
      :three-gens-diff-diffs three-gens-diff-diffs-diversifying?
+     :three-gens-same-inputs-diff-diffs three-gens-same-inputs-diff-diffs-diversifying?
      :three-gens-some-diff-diffs three-gens-some-diff-diffs-diversifying?
      :size-and-instruction size-and-instruction-diversifying?
      :three-gens-size-and-instruction three-gens-size-and-instruction-diversifying?
@@ -1050,3 +1068,4 @@
         :is-random-replacement
         (if use-child false true)))))

+


jstavel/edeposit#454 doplnil jsem vytvoreni finalniho zip balicku.

--- src/edeposit/amqp/kramerius/handlers.clj
+++ src/edeposit/amqp/kramerius/handlers.clj
@@ -10,6 +10,7 @@
             [clj-time.core :as t]
             [edeposit.amqp.kramerius.xml.mods :as mods]
             [edeposit.amqp.kramerius.xml.foxml :as f]
+            [clojure.java.shell :as shell]
             )
   (:import [org.apache.commons.codec.binary Base64])
   )
@@ -136,6 +137,14 @@
         (xml/emit foxml out))
       [uuid workdir])))

+(defn make-zip-package
+  [[uuid workdir]]
+  (let [out-file (io/file workdir (str uuid ".zip"))]
+    (shell/sh "zip" "-r" (.toString out-file) uuid :dir (.toString workdir))
+    [out-file workdir]
+    )
+  )
+
 (defn parse-and-export [metadata ^bytes payload]
   (let [msg (json/read-str (String. payload) :key-fn keyword)
         data-file (fs/temp-file "kramerius-amqp-" ".foxml")


Add pod support to the `collection` task

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -816,14 +816,14 @@
   "Handles common rendering task orchestration

   `paths-fn` takes a fileset as its only argument"
-  [{:keys [task-name paths-fn renderer tracer rm-originals]}]
+  [{:keys [task-name paths-fn renderer tracer rm-originals pod]}]
   (assert-renderer renderer)
   (content-task
    {:render-form-fn (fn [meta] `(io.perun.render/render ~renderer ~meta))
     :paths-fn paths-fn
     :task-name task-name
     :tracer tracer
-    :pod render-pod
+    :pod (or pod render-pod)
     :rm-originals rm-originals}))

 (def ^:private +render-defaults+
@@ -932,7 +932,7 @@
   to the `:io.perun/trace` metadata. `grouper` is a function that takes a seq
   of entries and returns a map of paths to render data (see docstring for
   `assortment` for more info)"
-  [{:keys [task-name comparator filterer sortby grouper meta renderer tracer] :as options*}]
+  [{:keys [task-name comparator filterer sortby grouper meta renderer tracer pod] :as options*}]
   (cond (not (fn? comparator))
         (u/fail (str task-name " task :comparator option should implement Fn\n"))
         (not (ifn? filterer))
@@ -953,7 +953,8 @@
           (render-task {:task-name task-name
                         :paths-fn #(grouped-paths task-name % options)
                         :renderer renderer
-                        :tracer tracer}))))
+                        :tracer tracer
+                        :pod pod}))))

 (def ^:private +assortment-defaults+
   {:out-dir "public"
@@ -1023,13 +1024,16 @@
    s sortby     SORTBY     code  "sort entries by function"
    c comparator COMPARATOR code  "sort by comparator function"
    p page       PAGE       str   "collection result page path"
-   m meta       META       edn   "metadata to set on each collection entry"]
+   m meta       META       edn   "metadata to set on each collection entry"
+   P pod        NAME       str   "name of the pod to run renderer in"]
   (let [p (or page "index.html")
+        pod-name (:pod *opts*)
         options (merge +collection-defaults+
                        (dissoc *opts* :page)
                        {:task-name "collection"
                         :tracer :io.perun/collection
-                        :grouper #(-> {p {:entries %}})})]
+                        :grouper #(-> {p {:entries %}})
+                        :pod (if pod-name (future (-> pod-name pod/get-pods first)))})]
     (assortment-task options)))

 (def ^:private +tags-defaults+


Fix a unbalanced paren

Fix a unbalanced paren

--- src/mdr2/rdf.clj
+++ src/mdr2/rdf.clj
@@ -45,7 +45,7 @@
     [:dtb:revisionDate revisionDate]
     [:dtb:revisionDescription revisionDescription]
     [:dtb:totalTime totalTime]
-    [:dtb:audioFormat audioFormat]]]))
+    [:dtb:audioFormat audioFormat]]])

 (defn rdf
   "Create rdf for a given production"


Add missing play icon.

Add missing play icon.


Fix health checks

Fix health checks

--- src/nube/app.clj
+++ src/nube/app.clj
@@ -112,7 +112,7 @@
     (stop-container host id)))

 (defn health-check-host [host port]
-  (mark-host-health host
+  (mark-host-health (str host ":" port)
    (loop [n 10]
      (when (pos? n)
        (if (= 200 (:status @(http/get (str "http://" host ":" port "/") {:timeout 5000})))
@@ -124,7 +124,8 @@
 (defn health-check-instances []
   (doseq [l (vals (:instances @router))]
     (doseq [i l]
-      (health-check-host i 80))))
+      (let [[host port] (ssplit i)]
+        (health-check-host host port)))))

 (defn pull-docker-image [host image]
   (let [[image tag] (ssplit image)]
@@ -133,7 +134,8 @@
 (defn kill-app-instance [app host port]
   (println "Killing instance at" (str host ":" port))
   (stop-container-by-port host port)
-  (remove-app-instance app (str host ":" port)))
+  (remove-app-instance app (str host ":" port))
+  (mark-host-health (str host ":" port) true))

 (defn deploy-app-instance [app host port internal-port image]
   (println "Pulling new tags for" image)


(PDB-2950) Restore pg :min-required-version override

Lost in a98d9fc09ebf50c622df88ccb2f7e9e958a9ed7e

--- src/puppetlabs/puppetdb/cli/services.clj
+++ src/puppetlabs/puppetdb/cli/services.clj
@@ -310,11 +310,13 @@
   the current database is not supported."
   [db-conn-pool config]
   (jdbc/with-db-connection db-conn-pool
-    (let [current (:version @sutils/db-metadata)]
-      (when (neg? (compare current scf-store/oldest-supported-db))
+    (let [current (:version @sutils/db-metadata)
+          oldest (get-in config [:database :min-required-version]
+                           scf-store/oldest-supported-db)]
+      (when (neg? (compare current oldest))
         (throw+ {:type ::unsupported-database
                  :current current
-                 :oldest scf-store/oldest-supported-db}))
+                 :oldest oldest}))
       @sutils/db-metadata
       (let [migrated? (migrate! db-conn-pool)]
         (indexes! config)


Avoid check if the job doesnt exist yet.

--- src/onyx/api.clj
+++ src/onyx/api.clj
@@ -86,9 +86,9 @@
       (let [position (<!! ch)
             entry (extensions/read-log-entry (:log client) position)
             new-replica (extensions/apply-log-entry entry replica)
-            tasks (get (:tasks replica) job-id)
-            complete-tasks (get (:completions replica) job-id)]
-        (when-not (= (into #{} tasks) (into #{} complete-tasks))
+            tasks (get (:tasks new-replica) job-id)
+            complete-tasks (get (:completions new-replica) job-id)]
+        (when (or (nil? tasks) (not= (into #{} tasks) (into #{} complete-tasks)))
           (recur new-replica))))))

 (defn start-peers!


Replaced JQuery "delegate" with "on"

Replaced JQuery "delegate" with "on"

--- src/wishlistd/cljs/main.cljs
+++ src/wishlistd/cljs/main.cljs
@@ -1,7 +1,7 @@
 (ns wishlistd.client.main
   (:require [crate.core :as crate]
             [fetch.remotes :as remotes])
-  (:use [jayq.core :only [$ remove append empty find val delegate data]])
+  (:use [jayq.core :only [$ remove append empty find val data on]])
   (:use-macros [crate.macros :only [defpartial]]
                [fetch.macros :only [letrem]]))

@@ -164,12 +164,12 @@

 ; DELEGATES

-(delegate $body "#create-wishlist" :click
+(on $body :click "#create-wishlist" nil
   (fn [e]
     (create-wishlist-rem)))

 ; When wishlist title is changed and not empty, update the title on remote.
-(delegate $header wishlist-title :change
+(on $header :change wishlist-title nil
   (fn [e]
     (this-as me
       (when-not (empty? (val ($ me)))
@@ -179,7 +179,7 @@
 ; object), check whether or not this is the last wish on the page and
 ; update or create accordingly. Also remove wishes with empty descriptions
 ; unless they are children of a li.last.
-(delegate $content ".description" :change
+(on $content :change ".description" nil
   (fn [e]
     (this-as me
       (let [$me ($ me)
@@ -194,7 +194,7 @@
               (update-wish-rem parent))))))))

 ; URL is simpler, we just check whether or not it is changed, and update.
-(delegate $content ".url" :change
+(on $content :change ".url" nil
   (fn [e]
     (this-as me
       (let [$parent (.parent ($ me))]
@@ -202,7 +202,7 @@
           (update-wish-rem $parent))))))

 ; Only delete if the wish is not "last".
-(delegate $content ".delete" :click
+(on $content :click ".delete" nil
   (fn [e]
     (this-as me
       (let [$parent (.parent ($ me))]
@@ -210,17 +210,17 @@
           (remove $parent)
           (delete-wish-rem $parent))))))

-(delegate $body "#icon-about" :click
+(on $body :click "#icon-about" nil
   (fn [e]
     (when (empty? ($ info-box))
       (show-info!))))

-(delegate $body "#info-close,#info-container" :click
+(on $body :click "#info-close,#info-container" nil
   (fn [e]
     (hide-info!)))

 ; Don't allow refresh unless a wishlist is chosen.
-(delegate $body "#icon-refresh" :click
+(on $body :click "#icon-refresh" nil
   (fn [e]
     (let [code (get-path)]
       (when-not (empty? code)


value-change?! cljs

value-change?! cljs

--- src/wishlistd/cljs/main.cljs
+++ src/wishlistd/cljs/main.cljs
@@ -64,6 +64,13 @@
    :wishes (wishes-from-html)
    :code   (get-path)})

+(defn value-changed?! [$this]
+  (if (= (data $this :old-val) (val $this))
+    false
+    (do
+      (data $this :old-val (val $this))
+      true)))
+
 ; REMOTES

 (defn create-wishlist-rem []


Change store test to use more normal-looking data.

--- clstreams/test/clstreams/store_test.clj
+++ clstreams/test/clstreams/store_test.clj
@@ -26,11 +26,11 @@

 (deftest test-lookup-processor
   (let [store (-> (make-store)
-                  (sut/store-assoc! "a" "AA")
-                  (sut/store-assoc! "b" "BB")
-                  (sut/store-assoc! "c" "CC"))
-        data [["a" "1"] ["b" "2"] ["c" "3"]]]
+                  (sut/store-assoc! :a "AA")
+                  (sut/store-assoc! :b "BB")
+                  (sut/store-assoc! :c "CC"))
+        data [[:a 1] [:b 2] [:c 3]]]
     (is (= (drv/through-kstreams-processor
             (sut/lookup-processor store)
             data)
-           [["a" ["1" "AA"]] ["b" ["2" "BB"]] ["c" ["3" "CC"]]]))))
+           [[:a [1 "AA"]] [:b [2 "BB"]] [:c [3 "CC"]]]))))


even better wrapping

even better wrapping

--- env/dev/cljs/reagent_slider/dev.cljs
+++ env/dev/cljs/reagent_slider/dev.cljs
@@ -14,31 +14,35 @@
                   5 "6 mos"
                   6 "1 year"})

-(defn wrapper-component [model cback]
+(defn wrapper-component [internal-value external-value opts]
   [core/tooltipped-range-component
-   {:min 0
-    :max (dec (count index->time))
-    :value [(:min @model) (:max @model)]
-    :marks index->time
-    :onAfterChange (fn [_] (cback))
-    :onChange (fn [[v1 v2]]
-                (reset! model {:min (min v1 v2)
-                               :max (max v1 v2)}))
-    :tipFormatter #(index->time %)}])
+   (merge
+    {:value [(:min @internal-value) (:max @internal-value)]
+     :onAfterChange (fn [_] (reset! external-value @internal-value))
+     :onChange (fn [[v1 v2]]
+                 (reset! internal-value {:min (min v1 v2)
+                                         :max (max v1 v2)}))}
+    opts)])

 (defn boot-demo-app []

   (let [model (reagent/atom {:min 2 :max 3})
-        active-model (reagent/atom @model)
-        update! #(reset! active-model @model)]
+        slider-model (reagent/atom @model)]

     (reagent/render [:div {:style {:width 290}}
                      [:button {:on-click #(do
-                                            (reset! model {:min 1 :max 5})
-                                            (update!))} "switch!"]
-                     [wrapper-component model update!]](.getElementById js/document "app"))
+                                            (reset! slider-model {:min 1 :max 5})
+                                            (reset! model @slider-model))} "switch!"]
+                     [wrapper-component
+                      slider-model
+                      model
+                      {:min 0
+                       :max (dec (count index->time))
+                       :marks index->time
+                       :tipFormatter #(index->time %)}]]
+                    (.getElementById js/document "app"))

-    (add-watch active-model :watcher (fn [_ _ _ _] (println @active-model)))))
+    (add-watch model :watcher (fn [_ _ _ _] (println @model)))))

 (figwheel/watch-and-reload
   :websocket-url "ws://localhost:3450/figwheel-ws"


Logging: Remove DummyLogger.

Logging: Remove DummyLogger.

--- src/pepa/log.clj
+++ src/pepa/log.clj
@@ -3,15 +3,16 @@
             clojure.tools.logging))

 ;;; Logger is a special component. Instead of being available via
-;;; `component/using' we inject it into every component already in the
-;;; system. That wasy ::logger is available in every component and can
+;;; `component/using' we automatically inject it into every component
+;;; in the system. That wasy ::logger is available everywhere and can
 ;;; be used like:
 ;;;
 ;;; (log/info some-component ...)
 ;;;
 ;;; That allows us to log the name of the logging component & access
 ;;; its state. It also frees us from explicitly declaring ::logger as
-;;; a dependency in every component we want to log something.
+;;; a dependency of every component from which we want to log
+;;; something.

 (defprotocol ILogger
   (-log
@@ -22,17 +23,11 @@
     throwable and a message."))

 (defrecord CTLLogger [config])
-(defrecord DummyLogger [config])

 (defn make-ctl-logger
   "Creates a logger which logs via clojure.tools.logging."
   []
   (map->CTLLogger {}))
-
-(defn make-dummy-logger
-  "Creates a dummy logger which discards all input."
-  []
-  (map->DummyLogger {}))

 (defn wrap-logging
   ([system logger]
@@ -76,7 +71,7 @@
 ;;; Extend Logger

 (defn ^:private component-name [c]
-  (.getSimpleName (class c)))
+  (some-> c class .getSimpleName))

 (extend-type CTLLogger
   ILogger
@@ -86,6 +81,4 @@
     ([logger component level message]
      (clojure.tools.logging/log (component-name component) level nil message))))

-(extend-type DummyLogger
-  ILogger
-  (-log [& _]))
+


:fire: Remove unused jobs code (obsolete).

--- backend/src/uxbox/util/jobs.clj
+++ backend/src/uxbox/util/jobs.clj
@@ -1,38 +0,0 @@
-;; This Source Code Form is subject to the terms of the Mozilla Public
-;; License, v. 2.0. If a copy of the MPL was not distributed with this
-;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
-;;
-;; Copyright (c) 2016-2019 Andrey Antukh <niwi@niwi.nz>
-
-(ns uxbox.util.jobs
-  "Scheduled jobs facilities."
-  (:require
-   [clojure.tools.logging :as log]
-   [clojure.spec.alpha :as s]
-   [promesa.core :as p]
-   [vertx.timers :as vt]
-   [vertx.util :as vu]))
-
-(defn schedule!
-  [vsm f {:keys [::interval] :as options}]
-  (s/assert var? f)
-  (let [system (vu/resolve-system vsm)
-        state  (atom nil)
-        taskfn (fn wrapped-task []
-                 (-> (p/do! (@f options))
-                     (p/catch (fn [err]
-                                (log/error err "Error on executing the task")
-                                nil))
-                     (p/then (fn [_]
-                               (let [tid (vt/schedule-once! vsm interval wrapped-task)]
-                                 (reset! state tid)
-                                 nil)))))
-        tid  (vt/schedule-once! vsm interval taskfn)]
-    (reset! state tid)
-    (reify
-      java.lang.AutoCloseable
-      (close [this]
-        (locking this
-          (when-let [timer-id (deref state)]
-            (.cancelTimer system timer-id)
-            (reset! state nil)))))))


binding to all interfaces by default

binding to all interfaces by default

--- server/src/server/testserve.clj
+++ server/src/server/testserve.clj
@@ -33,7 +33,7 @@
 (defn start
   "Starts the server and sets running instance"
   [] (let [port  (Integer. (env :port 8080))
-           host  (env :host "localhost")
+           host  (env :host "0.0.0.0")
            srv   (thrift/nonblocking-server
                    push-service port
                    :bind        host


[#12709] Fix handling errors on eth_gasPrice

--- src/status_im/signing/gas.cljs
+++ src/status_im/signing/gas.cljs
@@ -296,8 +296,8 @@
     (fn []
       (json-rpc/call
        {:method     "eth_gasPrice"
-        :on-success #(success-callback %)
-        :on-error   #(error-callback %)})))))
+        :on-success success-callback
+        :on-error   (or error-callback #(log/warn "eth_gasPrice error" %))})))))

 (def london-block-gas-limit (money/bignumber 30000000))


figwheel.main: sometimes cljs.repl-caught throws because it can't parse the stack trace

--- figwheel-main/src/figwheel/main.cljc
+++ figwheel-main/src/figwheel/main.cljc
@@ -1004,7 +1004,15 @@
   (let [root-source-info (some-> err ex-data :root-source-info)]
     (if (and (instance? clojure.lang.IExceptionInfo err)
              (#{:js-eval-error :js-eval-exception} (:type (ex-data err))))
-      (cljs.repl/repl-caught err repl-env repl-options)
+      (try
+        (cljs.repl/repl-caught err repl-env repl-options)
+        (catch Throwable e
+          (let [{:keys [value stacktrace] :as data} (ex-data err)]
+            (when value
+              (println value))
+            (when stacktrace
+              (println stacktrace))
+            (log/debug (with-out-str (pprint data))))))
       (let [except-data (fig-ex/add-excerpt (fig-ex/parse-exception err))]
         ;; TODO strange ANSI color error when printing this inside rebel-readline
         (println (binding [ansip/*use-color* (if (resolve 'rebel-readline.cljs.repl/repl*)


Use when-selected in the description of rooms

--- desktop/src-common/escape_game/core.clj
+++ desktop/src-common/escape_game/core.clj
@@ -87,14 +87,10 @@
              (defentity "box" "images/box.png" 50 50 48 48
                :action (pickup-action-fn))
              (defentity "door" "images/door2.png" 250 81 128 256
-               :action (fn [ent screen entities]
-                         (cond (:open ent)
-                               (switch-to-room (:current-room screen) :room05)
-                               :else
-                               (if (selected? screen "key")
-                                 (do (change-texture ent "images/door2open.png")
-                                   (assoc ent :open true))
-                                 [ent]))))
+               :action (when-selected "key"
+                                      (change-texture ent "images/door2open.png")
+                                      (assoc ent :action (fn [ent screen entities]
+                                                           (switch-to-room (:current-room screen) :room05)))))
              (arrow :right :room02)]

             :room02
@@ -102,11 +98,9 @@
              (hide (defentity "key" "images/key.png" 170 40 50 63
                      :action (pickup-action-fn)))
              (defentity "portrait" "images/portrait.png" 150 220 96 158
-               :action (fn [ent screen entities]
-                               (if (selected? screen "knife")
-                                 [(show (some (named "broken-portrait") entities))
-                                  (show (some (named "key") entities))]
-                                 [ent])))
+               :action (when-selected "knife"
+                                      [(show (some (named "broken-portrait") entities))
+                                       (show (some (named "key") entities))]))
              (hide (defentity "broken-portrait" "images/broken-portrait.png" 150 220 96 158))
              (hide (defentity "hammer" "images/hammer.png" 460 20 80 80
                      :action (pickup-action-fn)))
@@ -125,23 +119,18 @@
              (hide (defentity "knife" "images/knife.png" 380 80 64 64
                      :action (pickup-action-fn)))
              (hide (defentity "fire" "images/fire.png" 380 80 64 64
-                     :action (fn [ent screen entities]
-                               (if (selected? screen "box")
-                                 (do (consume "box" screen)
-                                     (show (some (named "knife") entities)))
-                                 [ent]))))
+                     :action (when-selected "box"
+                                            (consume "box" screen)
+                                            (show (some (named "knife") entities)))))
              (hide (defentity "fireplace-logs" "images/logs.png" 380 80 61 61
-                     :action (fn [ent screen entities]
-                               (if (selected? screen "lighter")
-                                 (show (some (named "fire") entities))
-                                 [ent]))))
+                     :action (when-selected "lighter"
+                                            (show (some (named "fire") entities)))))
              (defentity "fireplace" "images/fireplace.png" 250 81 303 253
-               :action (fn [ent screen entities]
-                         (if (selected? screen "logs")
-                           (do (debug "PREPARING FIREPLACE")
-                               (consume "logs" screen)
-                               [(dissoc ent :action) (show (some (named "fireplace-logs") entities))])
-                           [ent])))
+               :action (when-selected "logs"
+                                      (debug "PREPARING FIREPLACE")
+                                      (consume "logs" screen)
+                                      [(dissoc ent :action)
+                                       (show (some (named "fireplace-logs") entities))]))
              (defentity "lighter" "images/lighter.png" 278 214 61 61
                :action (pickup-action-fn))
              (arrow :left :room02)
@@ -154,11 +143,9 @@
              (defentity "bucket" "images/bucket.png" 70 40 48 48
                       :action (pickup-action-fn))
              (defentity "tree" "images/tree.png" 450 30 240 336
-               :action (fn [ent screen entities]
-                         (if (selected? screen "axe")
-                           (do (debug "CUTTING TREE!")
-                               (show (some (named "logs") entities)))
-                           [ent])))
+               :action (when-selected "axe"
+                                      (debug "CUTTING TREE!")
+                                      (show (some (named "logs") entities))))
              (arrow :left :room03)]

             :room05
@@ -166,30 +153,25 @@
              (hide (defentity "paper" "images/paper.png" 120 20 50 63
                      :action (pickup-action-fn)))
              (hide (defentity "bucket-in-table" "images/bucket.png" 470 130 50 63
-                     :action (fn [ent screen entities]
-                               (if (selected? screen "paper")
-                                 (do (consume "paper" screen)
-                                     (assoc ent
-                                            :action (fn [ent screen entities]
-                                                      (if (selected? screen "lighter")
-                                                        [(dissoc ent :action) (show (some (named "ladder") entities)) (show (some (named "smoke-in-bucket") entities))]
-                                                        ent))))
-                                 [ent]))))
+                     :action (when-selected "paper"
+                                            (consume "paper" screen)
+                                            (assoc ent
+                                                   :action (when-selected "lighter"
+                                                                          [(dissoc ent :action)
+                                                                           (show (some (named "ladder") entities))
+                                                                           (show (some (named "smoke-in-bucket") entities))])))))
              (hide (defentity "smoke-in-bucket" "images/smoke.png" 470 181 48 48))
              (defentity "table" "images/table.png" 360 5 320 200
-               :action (fn [ent screen entities]
-                         (if (selected? screen "bucket")
-                           (do (consume "bucket" screen)
-                               [(dissoc ent :action) (show (some (named "bucket-in-table") entities))])
-                           ent)))
+               :action (when-selected "bucket"
+                                      (consume "bucket" screen)
+                                      [(dissoc ent :action)
+                                       (show (some (named "bucket-in-table") entities))]))
              (hide (defentity "ladder" "images/ladder.png" 160 30 60 770
                      :action (fn [ent screen entities]
                                (switch-to-room (:current-room screen) :room06))))
              (defentity "vase" "images/vase.png" 120 30 50 63
-               :action (fn [ent screen entities]
-                         (if (selected? screen "hammer")
-                           (show (some (named "paper") entities))
-                           ent)))
+               :action (when-selected "hammer"
+                                      (show (some (named "paper") entities))))
              (arrow :left :room01)]

             :room06


Add a link back to the GitHub project

Add a link back to the GitHub project

--- src/test_app.clj
+++ src/test_app.clj
@@ -21,7 +21,8 @@
     :h1 [title]
     body
     :hr
-    :&copy " 2011 Howard M. Lewis Ship"
+    :&copy " 2011 Howard M. Lewis Ship "
+    :a.btn {:href "https://github.com/hlship/cascade"} ["Cascade at GitHub"]
     ]])

 (defn alert-message [level body]


Updated packed macros to conform to later style changes.

--- src/clojure/uncomplicate/neanderthal/internal/host/cblas.clj
+++ src/clojure/uncomplicate/neanderthal/internal/host/cblas.clj
@@ -917,21 +917,19 @@
    `(if ~left
       (let [reg# (region ~a)
             layout# (.layout (navigator ~a))
+            nav-b# (navigator ~b)
+            stor-b# (storage ~b)
+            uplo# (.uplo reg#)
+            diag# (.diag reg#)
             n-a# (.ncols ~a)
             buff-a# (.buffer ~a)
             ofst-a# (.offset ~a)
             buff-b# (.buffer ~b)
             ofst-b# (.offset ~b)
-            ld-b# (.stride ~b)
-            uplo# (.uplo reg#)
-            diag# (.diag reg#)]
-        (if (.isColumnMajor (navigator ~b))
-          (dotimes [j# (.ncols ~b)]
-            (~method layout# uplo# CBLAS/TRANSPOSE_NO_TRANS diag# n-a#
-             buff-a# ofst-a# buff-b# (+ ofst-b# (* j# ld-b#)) 1))
-          (dotimes [j# (.ncols ~b)]
-            (~method layout# uplo# CBLAS/TRANSPOSE_NO_TRANS diag# n-a#
-             buff-a# ofst-a# buff-b# (+ ofst-b# j#) ld-b#)))
+            stride-col-b# (if (.isColumnMajor (navigator ~b)) 1 (.stride ~b))]
+        (dotimes [j# (.ncols ~b)]
+          (~method layout# uplo# CBLAS/TRANSPOSE_NO_TRANS diag# n-a#
+           buff-a# ofst-a# buff-b# (+ ofst-b# (.index nav-b# stor-b# 0 j#)) stride-col-b#))
         ~b)
       (dragan-says-ex "Transforming a TP matrix by another matrix type is not supported. Copy TP to TR."
                       {:a (info ~a) :b (info ~b)})))
@@ -940,28 +938,20 @@

 (defmacro tp-sv [method a b]
   `(let [reg# (region ~a)
-         nav-a# (navigator ~a)
+         layout# (.layout (navigator ~a))
          nav-b# (navigator ~b)
-         layout# (.layout nav-b#)
+         stor-b# (storage ~b)
+         uplo# (.uplo reg#)
+         diag# (.diag reg#)
          n-a# (.ncols ~a)
          buff-a# (.buffer ~a)
          ofst-a# (.offset ~a)
          buff-b# (.buffer ~b)
          ofst-b# (.offset ~b)
-         ld-b# (.stride ~b)
-         uplo# (.uplo reg#)
-         diag# (.diag reg#)
-         trans# (if (= nav-a# nav-b#) CBLAS/TRANSPOSE_NO_TRANS CBLAS/TRANSPOSE_TRANS)
-         uplo# (if (= nav-a# nav-b#)
-                 (if (.isLower reg#) CBLAS/UPLO_LOWER CBLAS/UPLO_UPPER)
-                 (if (.isLower reg#) CBLAS/UPLO_UPPER CBLAS/UPLO_LOWER))]
-     (if (.isColumnMajor (navigator ~b))
-       (dotimes [j# (.ncols ~b)]
-         (~method layout# uplo# trans# diag# n-a#
-          buff-a# ofst-a# buff-b# (+ ofst-b# (* j# ld-b#)) 1))
-       (dotimes [j# (.ncols ~b)]
-         (~method layout# uplo# trans# diag# n-a#
-          buff-a# ofst-a# buff-b# (+ ofst-b# j#) ld-b#)))
+         stride-col-b# (if (.isColumnMajor (navigator ~b)) 1 (.stride ~b))]
+     (dotimes [j# (.ncols ~b)]
+       (~method layout# uplo# CBLAS/TRANSPOSE_NO_TRANS diag# n-a#
+        buff-a# ofst-a# buff-b# (+ ofst-b# (.index nav-b# stor-b# 0 j#)) stride-col-b#))
      ~b))

 ;; ============================ Symmetric Packed Matrix ================================
@@ -1009,37 +999,30 @@
       ~y))
   ([a]
    `(dragan-says-ex "In-place mv! is not supported by SY matrices. Now way around that." {:a (info ~a)})))
-;;TODO update with the similar nav-stor index technique as in GB/TB/SB mm
+
 (defmacro sp-mm
   ([method alpha a b beta c left]
    `(if ~left
       (let [reg# (region ~a)
             layout# (.layout (navigator ~a))
+            nav-b# (navigator ~b)
+            nav-c# (navigator ~c)
+            stor-b# (storage ~b)
+            stor-c# (storage ~c)
+            uplo# (.uplo reg#)
             n-a# (.ncols ~a)
             buff-a# (.buffer ~a)
             ofst-a# (.offset ~a)
             buff-b# (.buffer ~b)
             ofst-b# (.offset ~b)
-            ld-b# (.stride ~b)
             buff-c# (.buffer ~c)
             ofst-c# (.offset ~c)
-            ld-c# (.stride ~c)
-            uplo# (.uplo reg#)]
-        (if (.isColumnMajor (navigator ~b))
-          (if (.isColumnMajor (navigator ~c))
-            (dotimes [j# (.ncols ~b)]
-              (~method layout# uplo# n-a# ~alpha buff-a# ofst-a# buff-b# (+ ofst-b# (* j# ld-b#)) 1
-               ~beta buff-c# (+ ofst-c# (* j# ld-c#)) 1))
-            (dotimes [j# (.ncols ~b)]
-              (~method layout# uplo# n-a# ~alpha buff-a# ofst-a# buff-b# (+ ofst-b# (* j# ld-b#)) 1
-               ~beta buff-c# (+ ofst-c# j#) ld-c#)))
-          (if (.isColumnMajor (navigator ~c))
-            (dotimes [j# (.ncols ~b)]
-              (~method layout# uplo# n-a# ~alpha buff-a# ofst-a# buff-b# (+ ofst-b# j#) ld-b#
-               ~beta buff-c# (+ ofst-c# (* j# ld-c#)) 1))
-            (dotimes [j# (.ncols ~b)]
-              (~method layout# uplo# n-a# ~alpha buff-a# ofst-a# buff-b# (+ ofst-b# j#) ld-b#
-               ~beta buff-c# (+ ofst-c# j#) ld-c#))))
+            stride-col-b# (if (.isColumnMajor (navigator ~b)) 1 (.stride ~b))
+            stride-col-c# (if (.isColumnMajor (navigator ~c)) 1 (.stride ~c))]
+        (dotimes [j# (.ncols ~b)]
+          (~method layout# uplo# n-a#
+           ~alpha buff-a# ofst-a# buff-b# (+ ofst-b# (.index nav-b# stor-b# 0 j#)) stride-col-b#
+           ~beta buff-c# (+ ofst-c# (.index nav-c# stor-c# 0 j#)) stride-col-c#))
         ~c)
       (dragan-says-ex "Transforming a SP matrix by another matrix type is not supported. Copy SP to SY."
                       {:a (info ~a) :b (info ~b)})))


Twitterbuzz: Replace js-obj-seq and obj-map with js->clj

--- samples/twitterbuzz/src/twitterbuzz/core.cljs
+++ samples/twitterbuzz/src/twitterbuzz/core.cljs
@@ -3,16 +3,6 @@
             [goog.Timer :as timer]
             [goog.events :as events]
             [goog.dom :as dom]))
-
-;; From Chouser
-(defn js-obj-seq [o]
-  (for [k (js-keys o)] [(keyword k) (aget o k)]))
-
-(defn obj->map
-  "Convert a JavaScript object into a Clojure map. Can we have
-  something like this in core?"
-  [o]
-  (into {} (js-obj-seq o)))

 (def twitter-uri (goog.Uri. "http://twitter.com/search.json"))

@@ -29,11 +19,11 @@
         (recur (rest fns) tweets))))

 (defn my-callback [json]
-  (let [result-map (obj->map json)
+  (let [result-map (js->clj json :keywordize-keys true)
         new-max (:max_id result-map)
         old-max (:max-id @state) ;; the filter won't work if you inline this
         tweets (filter #(> (:id %) old-max)
-                       (map obj->map (:results result-map)))]
+                       (:results result-map))]
     (do  (swap! state (fn [old] (assoc old :max-id new-max)))
          (send-tweets (:functions @state) tweets))))


Comment out binary template test for now

--- test/puppetlabs/puppetdb/integration/file_with_binary_template.clj
+++ test/puppetlabs/puppetdb/integration/file_with_binary_template.clj
@@ -4,6 +4,9 @@
             [puppetlabs.trapperkeeper.app :as tk-app]
             [me.raynes.fs :as fs]))

+;; Commenting this whole test until puppet can at least support the workaround
+;; below
+(comment
 (deftest ^:integration file-with-binary-template
   (with-open [pg (int/setup-postgres)
               pdb (int/run-puppetdb pg {})
@@ -29,4 +32,4 @@
         (is (= {:certname "binary-file-agent"
                 :type "File"
                 :title file-resource-path}
-               (first (int/pql-query pdb "resources [certname, type, title] { tag = 'binary_file' }"))))))))
+               (first (int/pql-query pdb "resources [certname, type, title] { tag = 'binary_file' }")))))))))


more docs

more docs

--- src/wishwheel/images.clj
+++ src/wishwheel/images.clj
@@ -1,14 +1,19 @@
 (ns wishwheel.images
+  "Logic for saving images to the filesystem."
   (:require [clojure.java.io :as io]
             [clojure.string :as string])
   (:import java.io.File))

 (defn get-random-id [length]
+  "Generate a random alphanumeric identifier of with a given length."
   (let [alphanumeric "abcdefghijklmnopqrstuvwxyz1234567890"]
     (apply str (repeatedly length #(rand-nth alphanumeric)))))

 (defn random-file-name
+  "Given an existing filename, returns a randomly generated file name
+  using the same file extension. Files are located in:
+  resources/public/images/"
   [filename]
   (let [file-extension (last (string/split filename #"\."))
         directory "resources/public/images/"]


Fix ns declaration

Fix ns declaration

--- proto-repl-charts/src/proto_repl_charts/util.cljc
+++ proto-repl-charts/src/proto_repl_charts/util.cljc
@@ -1,5 +1,5 @@
 (ns proto-repl-charts.util
-  (require [clojure.string :as str]))
+  (:require [clojure.string :as str]))

 (defn error
   "Throws an exception containing a message joined from the msg-parts."


Further tests on results aggregation, to verify that one engine is privileged in case of duplicated entries

--- test/cloogling/core_test.clj
+++ test/cloogling/core_test.clj
@@ -127,6 +127,7 @@
   (expect [ "a" "b" "d" "c"]
           (map (fn [x] (:url x ))(get-aggregated-result google bing))
           )
+
   )
 ;; let's get edgy...

@@ -164,15 +165,15 @@
   )

-;; double-check that result from google is privileged in case of duplications
+;; double-check that result from google is privileged in case of duplication
 (let [ google [(->entry "a" "from google" "a") (->entry "b" "from google" "b")]
        bing [(->entry "a" "from bing" "a") (->entry "b" "from bing" "b") (->entry "c" "from bing" "b")]
        aggregated_result (get-aggregated-result google bing)]

   (expect 3 (count aggregated_result)  )
-  (expect "from google"(:title (first aggregated_result)))
-  (expect "from google"(:title (second aggregated_result)))
-  (expect "from bing"(:title (nth aggregated_result 2 )))
+  (expect "from google"(:title (nth aggregated_result 0)))
+  (expect "from google"(:title (nth aggregated_result 1)))
+  (expect "from bing"  (:title (nth aggregated_result 2)))
   )


Seven tests added into test-utils

Seven tests added into test-utils

--- test/clouseau/test_utils.clj
+++ test/clouseau/test_utils.clj
@@ -40,3 +40,58 @@
   (:require [clojure.test :refer :all]
             [clouseau.utils :refer :all]))

+;
+; Common functions used by tests.
+;
+
+(defn callable?
+    "Test if given function-name is bound to the real function."
+    [function-name]
+    (clojure.test/function? function-name))
+
+;
+; Tests for various function definitions
+;
+
+(deftest test-third-existence
+    "Check that the clouseau.utils/third definition exists."
+    (testing "if the clouseau.utils/third definition exists."
+        (is (callable? 'clouseau.utils/third))))
+
+
+(deftest test-substring-existence
+    "Check that the clouseau.utils/substring definition exists."
+    (testing "if the clouseau.utils/substring definition exists."
+        (is (callable? 'clouseau.utils/substring))))
+
+
+(deftest test-startsWith-existence
+    "Check that the clouseau.utils/startsWith definition exists."
+    (testing "if the clouseau.utils/startsWith definition exists."
+        (is (callable? 'clouseau.utils/startsWith))))
+
+
+(deftest test-endsWith-existence
+    "Check that the clouseau.utils/endsWith definition exists."
+    (testing "if the clouseau.utils/endsWith definition exists."
+        (is (callable? 'clouseau.utils/endsWith))))
+
+
+(deftest test-contains-existence
+    "Check that the clouseau.utils/contains definition exists."
+    (testing "if the clouseau.utils/contains definition exists."
+        (is (callable? 'clouseau.utils/contains))))
+
+
+(deftest test-replaceAll-existence
+    "Check that the clouseau.utils/replaceAll definition exists."
+    (testing "if the clouseau.utils/replaceAll definition exists."
+        (is (callable? 'clouseau.utils/replaceAll))))
+
+
+(deftest test-get-exception-message-existence
+    "Check that the clouseau.utils/get-exception-message definition exists."
+    (testing "if the clouseau.utils/get-exception-message definition exists."
+        (is (callable? 'clouseau.utils/get-exception-message))))
+
+


Used new naming goodness to make additional tests pass :)

--- test/datasplash/api_test.clj
+++ test/datasplash/api_test.clj
@@ -165,26 +165,23 @@
         (is (= res #{[:a [#{{:key :a, :lue 65} {:key :a, :val 42}} #{{:key :a, :uel 65} {:key :a, :lav 42}}]]
                      [:b [#{{:key :b, :val 56}} #{}]]}))))))

-;; hard to test
-
-;; (deftest cogroup-join-nil-test
-;;   (with-files [cogroup-join-nil-test]
-;;     (let [p (make-test-pipeline)
-;;           input1 (ds/generate-input [{:key :a :val 42} {:val 56} {:key :a :lue 65}] {:name :gen1} p)
-;;           input2 (ds/generate-input [{:key :a :lav 42} {:uel 65} {:key :c :foo 42}] {:name :gen2} p)
-;;           grouped (ds/cogroup-by {:name "cogroup-join-nil-test"}
-;;                                  [[input1 :key] [input2 :key]])
-;;           output (ds/write-edn-file cogroup-join-nil-test grouped)]
-;;       (ds/run-pipeline p)
-;;       (is "cogroup-join-nil-test" (.getName grouped))
-;;       (let [res (->> (read-file (first (glob-file cogroup-join-nil-test)))
-;;                      (map (fn [[k [i1 i2]]] [k [(into #{} i1) (into #{} i2)]]))
-;;                      (into #{}))]
-;;         (is (= res #{[:a [#{{:key :a, :lue 65} {:key :a, :val 42}} #{{:key :a, :lav 42}}]]
-;;                      [[#{{:val 56}} #{}]]
-;;                      [[#{} #{{:uel 65}}]]
-;;                      [:c [#{} #{{:key :c, :foo 42}}]]
-;;                      [:b [#{{:key :b, :val 56}} #{}]]}))))))
+(deftest cogroup-join-nil-test
+  (with-files [cogroup-join-nil-test]
+    (let [p (make-test-pipeline)
+          input1 (ds/generate-input [{:key :a :val 42} {:val 56} {:key :a :lue 65}] {:name :gen1} p)
+          input2 (ds/generate-input [{:key :a :lav 42} {:uel 65} {:key :c :foo 42}] {:name :gen2} p)
+          grouped (ds/cogroup-by {:name "cogroup-join-nil-test"}
+                                 [[input1 :key] [input2 :key]])
+          output (ds/write-edn-file cogroup-join-nil-test grouped)]
+      (ds/run-pipeline p)
+      (is "cogroup-join-nil-test" (.getName grouped))
+      (let [res (->> (read-file (first (glob-file cogroup-join-nil-test)))
+                     (map (fn [[k [i1 i2]]] [k [(into #{} i1) (into #{} i2)]]))
+                     (into #{}))]
+        (is (= res #{[:a [#{{:key :a, :lue 65} {:key :a, :val 42}} #{{:key :a, :lav 42}}]]
+                     [nil [#{{:val 56}} #{}]]
+                     [nil [#{} #{{:uel 65}}]]
+                     [:c [#{} #{{:key :c, :foo 42}}]]}))))))

 (deftest join-test
   (with-files [join-test]


test object destruction

test object destruction

--- test/deferst/system_test.clj
+++ test/deferst/system_test.clj
@@ -28,38 +28,59 @@
              true)))))

 (deftest single-item-system
-  (let [ff (fn [v] [v (fn [] (prn "destroying" v))])
+  (let [destructor-vals (atom [])
+        ff (fn [v] [v (fn [] (swap! destructor-vals conj v))])
         sb (s/system-builder [[:a ff {:a-arg [:foo]}]])
-        sys (s/start-system! sb {:foo 10})]
+        sys (s/start-system! sb {:foo 10})
+        _ (s/stop-system! sys)]

     (testing "single item system has the single object"
       (is (= @(s/system-map sys)
              {:foo 10
-              :a {:a-arg 10}})))))
+              :a {:a-arg 10}})))
+
+    (testing "single item was destroyed"
+      (is (= @destructor-vals
+             [{:a-arg 10}])))))

 (deftest dependent-item-system
-  (let [ff (fn [v] [v (fn [] (prn "destroying" v))])
+  (let [destructor-vals (atom [])
+        ff (fn [v] [v (fn [] (swap! destructor-vals conj v))])
         sb (s/system-builder [[:a ff {:a-arg [:foo]}]
                               [:b ff {:b-arg [:a :a-arg]}]])
-        sys (s/start-system! sb {:foo 10})]
+        sys (s/start-system! sb {:foo 10})
+        _ (s/stop-system! sys)]

     (testing "single item system has the single object"
       (is (= @(s/system-map sys)
              {:foo 10
               :a {:a-arg 10}
-              :b {:b-arg 10}})))))
+              :b {:b-arg 10}})))
+
+    (testing "dependent items were destroyed"
+      (is (= @destructor-vals
+             [{:b-arg 10}
+              {:a-arg 10}])))))

 (deftest composed-builders
-  (let [ff (fn [v] [v (fn [] (prn "destroying" v))])
+  (let [destructor-vals (atom [])
+        ff (fn [v] [v (fn [] (swap! destructor-vals conj v))])
         sb (s/system-builder [[:a ff {:a-arg [:foo]}]
                               [:b ff {:b-arg [:a :a-arg]}]])
         sb2 (s/system-builder sb [[:c ff {:c-a [:a :a-arg]
                                           :c-b [:b :b-arg]}]])
-        sys (s/start-system! sb2 {:foo 10})]
+        sys (s/start-system! sb2 {:foo 10})
+        _ (s/stop-system! sys)]

     (testing "single item system has the single object"
       (is (= @(s/system-map sys)
              {:foo 10
               :a {:a-arg 10}
               :b {:b-arg 10}
-              :c {:c-a 10 :c-b 10}})))))
+              :c {:c-a 10 :c-b 10}})))
+
+    (testing "items were destroyed"
+      (is (= @destructor-vals
+             [{:c-a 10 :c-b 10}
+              {:b-arg 10}
+              {:a-arg 10}])))))


slow tests

slow tests


add missing beefy modifications to dubstepbass - oops!

--- test/example/dubstepbass.clj
+++ test/example/dubstepbass.clj
@@ -49,6 +49,9 @@
             son (select (< (t-rand:kr :trig trig) 0.05) [son (* 4 (hpf son sweep))])

             ;;decimate
-            son (select (< (t-rand:kr :trig trig) 0.05) [son (round son 0.1)])]
+            son (select (< (t-rand:kr :trig trig) 0.05) [son (round son 0.1)])
+
+            son (tanh (* son 5))
+            son (+ son (* 0.3 (g-verb son 10 0.1 0.7)))]

         [son son]))


Выровнял код...

Выровнял код...

--- radiolamp-6P3S/src/r6p3s/ui/panel_with_table.cljs
+++ radiolamp-6P3S/src/r6p3s/ui/panel_with_table.cljs
@@ -18,9 +18,9 @@
                       responsive? true}
                :as   options}]
   (let [empty-cols? (empty? cols)
-        t-width (when empty-cols?
-                  (when-let [c (first rows)]
-                    (str (quot 100 (count c)) "%")))]
+        t-width     (when empty-cols?
+                      (when-let [c (first rows)]
+                        (str (quot 100 (count c)) "%")))]
     (panel/render
      (assoc options
             :after-body


Fix main.out switch, default to true when it is not a :prod build

--- resources/leiningen/new/lambone/common/build.boot
+++ resources/leiningen/new/lambone/common/build.boot
@@ -229,7 +229,7 @@
     (let [options (boot/options [flavor type])]
       (case flavor
         <% if any backend %>:backend (boot/build-backend options)<% endif %><% if any frontend %>
-        :frontend (boot/build-frontend options out-folder)<% endif %>))))
+        :frontend (boot/build-frontend options (or out-folder (not= type :prod)))<% endif %>))))

 (deftask dev
   "Start the development interactive environment.


Fix more manga-here data

Fix more manga-here data

--- resources/sites/manga-here.clj
+++ resources/sites/manga-here.clj
@@ -1,6 +1,6 @@
 {:image-selector [:section#viewer.read_img :a :img]
  :manga-list-format "%s/mangalist/"
- :comic-list-selector [div.list_manga ul li a.manga_info]
+ :comic-list-selector [:li :a.manga_info]

  :page-normalize-pattern #"(?:\d+\.html)?$"
  :page-normalize-format "%s/%s"
@@ -10,9 +10,9 @@
  :page-list-selector [:section.readpage_top :div :span :select.wid60 :option]

  :root-url "http://www.mangahere.co/"
- :manga-url-format "%s/manga/"
+ :manga-url-format "%smanga/"

- :manga-url-suffix-pattern #"(.*?)/c\d*/$"
+ :manga-url-suffix-pattern "(.*?)/$"

  :comic-link-name-normalize second
  :comic-link-url-normalize identity


Fix typos in names of local binds.

Fix typos in names of local binds.

--- src/clojure/uncomplicate/neanderthal/internal/device/clblast.clj
+++ src/clojure/uncomplicate/neanderthal/internal/device/clblast.clj
@@ -117,7 +117,7 @@
    `(if (and (< 0 (.dim ~x)) (< 0 (.dim ~y)))
       (with-check error
         (~method (.dim ~x)
-         (extract (.buffer ~x)) (.offset ~x) (.stri)
+         (extract (.buffer ~x)) (.offset ~x) (.stride ~y)
          (extract (.buffer ~y)) (.offset ~y) (.stride ~y)
          ~c ~s
          (extract ~queue) nil)
@@ -130,7 +130,7 @@
            ofst# (.offset ~x)
            strd# (.stride ~x)]
        (with-check error
-         (~method mem# ofst mem# (+ ofst# strd#) mem#
+         (~method mem# ofst# mem# (+ ofst# strd#) mem#
           (+ ofst# (* 2 strd#)) mem# (+ ofst# (* 3 strd#))
           (extract ~queue) nil)
          ~x))
@@ -155,7 +155,7 @@
            ofst# (.offset ~d1d2xy)
            strd# (.stride ~d1d2xy)]
        (with-check error
-         (~method mem# ofst mem# (+ ofst# strd#)
+         (~method mem# ofst# mem# (+ ofst# strd#)
           mem# (+ ofst# (* 2 strd#)) mem# (+ ofst# (* 3 strd#))
           (extract (.buffer ~param)) (.offset ~param)
           (extract ~queue) nil)


Collect to map in order to not rely on ordering


explicit refs to ISys protocol methods

explicit refs to ISys protocol methods

--- src/deferst.cljc
+++ src/deferst.cljc
@@ -65,18 +65,22 @@
         stop-name (make-name base-name "stop!")
         reload-name (make-name base-name "reload!")]
     `(do
-       (def ~name (create-system
-                   ~builder
-                   ~default-conf
-                   (symbol (name (ns-name *ns*)) (name '~name))))
+       (defonce ~name (deferst/create-system
+                       ~builder
+                       ~default-conf
+                       (symbol (name (ns-name *ns*)) (name '~name))))
        (defn ~start-name
-         ([] (start! ~name))
-         ([conf#] (start! ~name conf#)))
-       (defn ~system-map-name [] (system-map ~name))
-       (defn ~stop-name [] (stop! ~name))
+         ([] (deferst/start! ~name))
+         ([conf#] (deferst/start! ~name conf#)))
+       (defn ~system-map-name [] (deferst/system-map ~name))
+       (defn ~stop-name [] (deferst/stop! ~name))
        (defn ~reload-name []
-         (stop! ~name)
-         (tn/refresh :after (symbol (name (ns-name *ns*)) (name '~start-name)))))))
+         (deferst/stop! ~name)
+         (tn/refresh
+          :after
+          (symbol
+           (name (ns-name *ns*))
+           (name '~start-name)))))))

 (defmacro defsystem
   "macro which defs some vars around a system and provides