few perf improvements, it's still 100x slower than how it should be, I can't figure it out why

--- src/blind/reader.clj
+++ src/blind/reader.clj
@@ -97,26 +97,26 @@

 (defn- whitespace?
   "Checks whether a given character is whitespace"
-  [^Character ch]
+  [ch]
   (if ch
-    (or (Character/isWhitespace ch) (= \, ch))))
+    (or (Character/isWhitespace ^char ch) (identical? \, ch))))

 (defn- numeric?
   "Checks whether a given character is numeric"
-  [^Character ch]
+  [ch]
   (if ch
-    (Character/isDigit ch)))
+    (Character/isDigit ^char ch)))

 (defn- comment-prefix?
   "Checks whether the character begins a comment."
   [ch]
-  (= \; ^char ch))
+  (identical? \; ^char ch))

 (defn- number-literal?
   "Checks whether the reader is at the start of a number literal"
-  [reader ^Character initch]
+  [reader initch]
   (or (numeric? initch)
-      (and (or (= \+ initch) (= \- initch))
+      (and (or (identical? \+ ^char initch) (identical? \- ^char initch))
            (numeric? (peek-char reader)))))

 (declare read macros dispatch-macros)
@@ -130,21 +130,20 @@
   [rdr & msg]
   (throw (ex-info (apply str msg)
                   (merge {:type :reader-exception}
-                         (if (satisfies? IndexingReader rdr)
+                         (if (instance? IndexingPushbackReader (class rdr))
                            {:line (get-line-number rdr)
                             :column (get-column-number rdr)})))))

 (defn macro-terminating? [ch]
-  (and (not= \# ch)
-       (not= \' ch)
+  (and (not (identical? \# ^char ch))
+       (not (identical? \' ^char ch))
        ;;(not= ch \:) ;; why?
        (macros ch)))

 (defn ^String read-token
   [rdr initch]
-  (if (not initch)
+  (if-not initch
     (reader-error rdr "EOF while reading")
-
     (loop [sb (doto (StringBuilder.) (.append initch))
            ch (peek-char rdr)]
       (if (or (nil? ch)
@@ -292,23 +291,23 @@

 (defn ^PersistentVector read-delimited-list
   [delim rdr recursive?]
-  (let [first-line (if (satisfies? IndexingReader rdr)
+  (let [first-line (if (instance? IndexingPushbackReader (class rdr))
                      (get-line-number rdr))]
-   (loop [a (transient [])]
-     (let [ch (read-past whitespace? rdr)]
-       (when-not ch
-         (reader-error rdr "EOF while reading"
-                       (if first-line
-                         (str ", starting at line" first-line))))
-       (if (= delim ch)
-         (persistent! a)
-         (if-let [macrofn (macros ch)]
-           (let [mret (macrofn rdr ch)]
-             (recur (if-not (= mret rdr) (conj! a mret) a)))
-           (do
-             (unread rdr ch)
-             (let [o (read rdr true nil recursive?)]
-               (recur (if-not (= o rdr) (conj! a o) a))))))))))
+    (loop [a (transient [])]
+      (let [ch (read-past whitespace? rdr)]
+        (when-not ch
+          (reader-error rdr "EOF while reading"
+                        (if first-line
+                          (str ", starting at line" first-line))))
+        (if (identical? ^char delim ^char  ch)
+          (persistent! a)
+          (if-let [macrofn (macros ch)]
+            (let [mret (macrofn rdr ch)]
+              (recur (if-not (= mret rdr) (conj! a mret) a)))
+            (do
+              (unread rdr ch)
+              (let [o (read rdr true nil recursive?)]
+                (recur (if-not (= o rdr) (conj! a o) a))))))))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; data structure readers
@@ -332,7 +331,7 @@

 (defn read-list
   [rdr _]
-  (let [[line column] (if (satisfies? IndexingReader rdr)
+  (let [[line column] (if (instance? IndexingPushbackReader (class rdr))
                         [(get-line-number rdr) (dec (get-column-number rdr))])
         the-list (read-delimited-list \) rdr true)]
     (if (empty? the-list)
@@ -477,7 +476,7 @@

 (defn read-meta
   [rdr _]
-  (let [[line column] (if (satisfies? IndexingReader rdr)
+  (let [[line column] (if (instance? IndexingPushbackReader (class rdr))
                         [(get-line-number rdr) (dec (get-column-number rdr))])
         m (desugar-meta (read rdr true nil true))]
     (when-not (map? m)
@@ -647,7 +646,7 @@
         (recur (next s) (-> key-vals
                             (conj! (key e))
                             (conj! (val e)))))
-      (persistent! key-vals))))
+      (seq (persistent! key-vals)))))

 (defn- register-gensym [sym]
   (if-not gensym-env
@@ -708,7 +707,7 @@
       (instance? IRecord form) form
       (map? form) (list 'clojure.core/apply 'clojure.core/hash-map
                         (list 'clojure.core/seq (cons 'clojure.core/concat (expand-list
-                                                                            (seq (flatten-map form))))))
+                                                                            (flatten-map form)))))
       (vector? form) (list 'clojure.core/apply 'clojure.core/vector
                            (list 'clojure.core/seq (cons 'clojure.core/concat
                                                          (expand-list (seq form)))))
@@ -798,7 +797,7 @@
         (throw e)
         (throw (ex-info (.getCause e)
                         (merge {:type :reader-exception}
-                               (if (satisfies? IndexingReader reader)
+                               (if (instance? IndexingPushbackReader (class reader))
                                  {:line (get-line-number reader)
                                   :column (get-column-number reader)}))
                         e))))))


blind: replace read-var with a wrapping-reader

--- src/blind/reader.clj
+++ src/blind/reader.clj
@@ -592,10 +592,6 @@
   (read rdr true nil true)
   rdr)

-(defn read-var
-  [rdr _]
-  (cons 'var (cons (read rdr true nil true) nil)))
-
 (def ^:private ^:dynamic arg-env nil)

 (defn- garg [n]
@@ -840,7 +836,7 @@
 (defn dispatch-macros [ch]
   (case ch
     \^ read-meta                ;deprecated
-    \' read-var
+    \' (wrapping-reader 'var)
     \( read-fn
     \= read-eval
     \{ read-set


draw-tile instead of draw-rect

draw-tile instead of draw-rect

--- src/cas/client.cljs
+++ src/cas/client.cljs
@@ -30,18 +30,18 @@
   (set! (.-fillStyle ctx) (apply hex-color color))
   (.fillRect ctx x y width height))

-(defn draw-ten-rect! [ctx color x y]
+(defn draw-tile! [ctx color x y]
   (draw-rect! ctx color x y 10 10))

 (defn draw-world! [world {:keys [ctx]}]
   (let [on-cell (fn [x y it]
-                  (draw-rect! ctx (:color it) (* x 10) (* y 10) 10 10))
+                  (draw-tile! ctx (:color it) (* x 10) (* y 10)))
         on-row (fn [y row]
                  (dorun (map-indexed #(on-cell %1 y %2) row)))]
     (dorun (map-indexed on-row world))))

 (defn draw-player! [{:keys [pos]} {:keys [ctx]}]
-  (draw-rect! ctx [0 0 0] (* (:x pos) 10) (* (:y pos) 10) 10 10))
+  (draw-tile! ctx [0 0 0] (* (:x pos) 10) (* (:y pos) 10)))

 (defn render-state! []
   (let [canvas (.getElementById js/document "game")]


Initial push.

Initial push.

--- src/csv_emailer/core.clj
+++ src/csv_emailer/core.clj
@@ -30,9 +30,9 @@
                          :body [{:type "text/html"
                                 :content
                                  (clojure.string/replace
-                                 (slurp "resources/template.html")
-                                 #"\[CODE\]"
-                                 code)}])]
+                                  (slurp "resources/template.html")
+                                  #"\[CODE\]"
+                                  code)}])]
     (try
       (println (str "Sending message to: " addr))
       (email/send-message outgoing mail-info-full))


Tighten up background renderer.

Tighten up background renderer.

--- src/canvas/main.cljs
+++ src/canvas/main.cljs
@@ -61,10 +61,8 @@
 ;; Object Definitions
 ;;-----------------------------------------------------------------------------

-(defrecord Rect [x y width height color])
-(defrecord Line [x1 y1 x2 y2 color])
-(defrecord Frame [x y width height color frame-width])
-
+(defrecord GameBackground [])
+(defrecord GameNet [])
 (defrecord GameStartScreen [])
 (defrecord Paddle [x y width height vy color])
 (defrecord Ball [x y radius vx vy fill-color oob?])
@@ -76,6 +74,32 @@

 (defprotocol IDrawable
   (draw! [_ ctx]))
+
+(extend-type GameBackground
+  IDrawable
+  (draw! [_ ctx]
+    (.save ctx)
+    (aset ctx "lineWidth" "0.5")
+    (aset ctx "fillStyle" "black")
+    (.fillRect ctx 0 0 SCALE-W SCALE-H)
+    (aset ctx "lineWidth" "2")
+    (aset ctx "strokeStyle" "#333")
+    (.strokeRect ctx 0 0 SCALE-W SCALE-H)
+    (.restore ctx)))
+
+(extend-type GameNet
+  IDrawable
+  (draw! [- ctx]
+    (.save ctx)
+    (aset ctx "lineWidth" "1")
+    (aset ctx "strokeStyle" SCORE_COLOR)
+    (.setLineDash ctx (array 1 2))
+    (.beginPath ctx)
+    (.moveTo ctx (/ SCALE-W 2) 0)
+    (.lineTo ctx (/ SCALE-W 2) SCALE-H)
+    (.stroke ctx)
+    (.closePath ctx)
+    (.restore ctx)))

 (extend-type GameStartScreen
   IDrawable
@@ -103,20 +127,6 @@
     (.fillText ctx "[ Escape ] to quit." (/ SCALE-W 2) 430)
     (.restore ctx)))

-(extend-type Line
-  IDrawable
-  (draw! [{:keys [x1 y1 x2 y2 color] :as line} ctx]
-    (.save ctx)
-    (aset ctx "lineWidth" "1")
-    (aset ctx "strokeStyle" color)
-    (.setLineDash ctx (array 1 2))
-    (.beginPath ctx)
-    (.moveTo ctx x1 y1)
-    (.lineTo ctx x2 y2)
-    (.stroke ctx)
-    (.closePath ctx)
-    (.restore ctx)))
-
 (extend-type Score
   IDrawable
   (draw! [{:keys [score x y font color align]} ctx]
@@ -146,25 +156,6 @@
     (.closePath ctx)
     (.restore ctx)))

-(extend-type Rect
-  IDrawable
-  (draw! [{:keys [color x y width height]} ctx]
-    (.save ctx)
-    (aset ctx "lineWidth" "0.5")
-    (aset ctx "fillStyle" color)
-    (aset ctx "strokeStyle" "black")
-    (.fillRect ctx x y width height)
-    (.strokeRect ctx x y width height)
-    (.restore ctx)))
-
-(extend-type Frame
-  IDrawable
-  (draw! [{:keys [color x y width height frame-width]} ctx]
-    (.save ctx)
-    (aset ctx "lineWidth" (str frame-width))
-    (aset ctx "strokeStyle" color)
-    (.strokeRect ctx x y width height)
-    (.restore ctx)))

 ;;-----------------------------------------------------------------------------
 ;; Moveable Objects
@@ -199,23 +190,17 @@
   IControllable
   (control! [{:keys [y vy height] :as paddle} event]
     (condp = event
-      :up
-      (if (> (- y vy) 0) (assoc paddle :y (- y vy)) paddle)
-
-      :down
-      (if (< (+ y vy height) SCALE-H ) (assoc paddle :y (+ y vy)) paddle)
-
-      :else
-      paddle)))
+      :up   (if (> (- y vy) 0) (assoc paddle :y (- y vy)) paddle)
+      :down (if (< (+ y vy height) SCALE-H ) (assoc paddle :y (+ y vy)) paddle)
+      :else paddle)))

 ;;-----------------------------------------------------------------------------
 ;; Game State
 ;;-----------------------------------------------------------------------------

-(def resets
-  {:background (Rect. 0 0 SCALE-W SCALE-H "black")
-   :border     (Frame. 0 0 SCALE-W SCALE-H "#333" 2)
-   :net        (Line. (/ SCALE-W 2) 0 (/ SCALE-W 2) SCALE-H SCORE_COLOR)
+(def objects
+  {:background (GameBackground.)
+   :net        (GameNet.)
    :game-start (GameStartScreen.)
    :score-1    (Score. 0 (- (/ SCALE-W 2) 75) 60 SCORE_FONT SCORE_COLOR "right")
    :score-2    (Score. 0 (+ (/ SCALE-W 2) 75) 60 SCORE_FONT SCORE_COLOR "left")
@@ -224,7 +209,7 @@
    :ball       (Ball. 400 225 13 3 2 BALL_COLOR false)})

 (defonce state
-  (atom (merge resets
+  (atom (merge objects
                {:mode :game-start ;; game-start game-over playing
                 :pause? false
                 :current-paddle :paddle-1})))
@@ -239,7 +224,6 @@
   ;; Always
   (.clearRect ctx 0 0 SCALE-W SCALE-H)
   (draw! (:background @state) ctx)
-  (draw! (:border @state) ctx)
   ;;
   ;; While playing and game-over
   (when (contains? #{:playing :gameover} (:mode @state))
@@ -341,7 +325,7 @@

         (= :space event)
         (swap! state #(if (= (:mode %) :game-start)
-                        (merge % resets {:mode :playing})
+                        (merge % objects {:mode :playing})
                         (assoc % :pause? (not (:pause? %)))))

         :else


Fix supervisor unit tets

Fix supervisor unit tets

--- storm-core/test/clj/backtype/storm/supervisor_test.clj
+++ storm-core/test/clj/backtype/storm/supervisor_test.clj
@@ -461,6 +461,7 @@
                 _ (.mkdirs (io/file storm-local "workers" mock-worker-id))
                 mock-supervisor {:conf {STORM-CLUSTER-MODE :distributed
                                         STORM-LOCAL-DIR storm-local
+                                        STORM-WORKERS-ARTIFACTS-DIR (str storm-local "/workers-artifacts")
                                         SUPERVISOR-RUN-WORKER-AS-USER true
                                         WORKER-CHILDOPTS string-opts}}]
             (stubbing [read-supervisor-storm-conf {TOPOLOGY-WORKER-CHILDOPTS
@@ -491,6 +492,7 @@
                 exp-script (exp-script-fn list-opts topo-list-opts)
                 mock-supervisor {:conf {STORM-CLUSTER-MODE :distributed
                                         STORM-LOCAL-DIR storm-local
+                                        STORM-WORKERS-ARTIFACTS-DIR (str storm-local "/workers-artifacts")
                                         SUPERVISOR-RUN-WORKER-AS-USER true
                                         WORKER-CHILDOPTS list-opts}}]
             (stubbing [read-supervisor-storm-conf {TOPOLOGY-WORKER-CHILDOPTS


Fix leaks. Despite my best to clean up after myself I was getting leaks when running large batches of samples. Hence switched to single buffers shared buffers for reuse. So there are no allocations made inside the tight loop gathering stats on frames. This should ensure we leak less. At the cost of ugly reuse.

--- src/clojure/core.clj
+++ src/clojure/core.clj
@@ -40,6 +40,21 @@
 (def MFCC_FREQ_BANDS    13)
 (def DEFAULT_BLOCK_SIZE 512)

+(defn- c-double [len]
+  (let [xtract-vs (xtract/new_double-array len)]
+    (doall
+     (map-indexed
+      (fn [idx f] (xtract/double_array_setitem xtract-vs idx (double 0.0)))
+      (range 0 len)))
+    xtract-vs))
+
+(defonce wav-buffer (c-double DEFAULT_BLOCK_SIZE))
+(defonce full-window (xtract/xtract_init_window DEFAULT_BLOCK_SIZE xtract-hann))
+(defonce spectrum-buffer (c-double DEFAULT_BLOCK_SIZE))
+(defonce peaks-buffer  (c-double DEFAULT_BLOCK_SIZE))
+(defonce arg-buffer    (c-double 5))
+(defonce windowed-buffer (c-double DEFAULT_BLOCK_SIZE))
+(defonce mel-filters (xtract/create_filterbank MFCC_FREQ_BANDS DEFAULT_BLOCK_SIZE))
 (defn raise-errors [result]
   (when result
     (cond
@@ -66,22 +81,24 @@
       vs))
     xtract-vs))

-(defn- c-double [len]
-  (let [xtract-vs (xtract/new_double-array len)]
+(defn- copy-c-double [vs d]
+  (let [len (count vs)]
     (doall
      (map-indexed
-      (fn [idx f] (xtract/double_array_setitem xtract-vs idx (double 0.0)))
-      (range 0 len)))
-    xtract-vs))
-
-(defn- xtract-args [& args] (xtract/doublea_to_voidp (clojure->c-double args)))
+      (fn [idx v] (xtract/double_array_setitem d idx v))
+      vs))
+    d))
+
+
+(defn- xtract-args [& args]
+  (copy-c-double args arg-buffer)
+  (xtract/doublea_to_voidp arg-buffer))

 (defn with-result
   ([xtract-fn] (with-result (double-array [0]) xtract-fn))
   ([r xtract-fn]
    (xtract-fn r)
-   (first (vec r))
-   ))
+   (first (vec r))))

 (defn mean [vs]
   (let [result (double-array 1)
@@ -157,43 +174,38 @@
 (defn extract-spectrum
   "Extract frequency domain spectrum from time domain signal"
   ([windowed-data block-size sample-ratio spectrum-type]
-   (extract-spectrum windowed-data block-size sample-ratio spectrum-type 0.0 0.0))
+   (extract-spectrum windowed-data block-size sample-ratio spectrum-type 0.0 1.0))
   ([windowed-data block-size sample-ratio spectrum-type db-component normalised]

-   (let [spectrum (c-double block-size)]
-     (raise-errors
-      (xtract/xtract_spectrum windowed-data
-                              block-size (xtract-args sample-ratio
-                                                      spectrum-type
-                                                      db-component
-                                                      normalised)
-                              spectrum))
-     spectrum)))
+   (raise-errors
+    (xtract/xtract_spectrum windowed-data
+                            block-size (xtract-args sample-ratio
+                                                    spectrum-type
+                                                    db-component
+                                                    normalised)
+                            spectrum-buffer))
+   spectrum-buffer))

 (defn extract-fft-spectrum [wave-data block-size sample-rate full-window]
-  (let [windowed (c-double block-size)]
-    ;;NOTE: I'm not convienced the full-window parameter is being used.
+  ;;NOTE: I'm not convienced the full-window parameter is being used.
+  (raise-errors
+   (xtract/xtract_windowed wave-data block-size (xtract/doublea_to_voidp full-window) windowed-buffer))
+  (raise-errors
+   (xtract/xtract_init_fft block-size xtract-spectrum))
+  (let [spectrum-buffer (extract-spectrum windowed-buffer block-size (/ sample-rate block-size) xtract-spectrum-magnitude)]
     (raise-errors
-     (xtract/xtract_windowed wave-data block-size (xtract/doublea_to_voidp full-window) windowed))
-    (raise-errors
-     (xtract/xtract_init_fft block-size xtract-spectrum))
-    (let [spectrum (extract-spectrum windowed block-size (/ sample-rate block-size) xtract-spectrum-magnitude)]
-      (raise-errors
-       (xtract/xtract_free_fft))
-      (raise-errors
-       (xtract/delete_double_array windowed))
-      spectrum)))
+     (xtract/xtract_free_fft))
+    spectrum-buffer))

 (defn extract-peaks
   "Extract the amplitude and frequency of spectral peaks from a magnitude spectrum"
   [coefficients block-size sample-ratio peak-threshold]
-  (let [peaks (c-double block-size)]
-    (raise-errors
-     (xtract/xtract_peak_spectrum coefficients
-                                  (/ block-size 2)
-                                  (xtract-args sample-ratio peak-threshold)
-                                  peaks))
-    peaks))
+  (raise-errors
+   (xtract/xtract_peak_spectrum coefficients
+                                (/ block-size 2)
+                                (xtract-args sample-ratio peak-threshold)
+                                peaks-buffer))
+  peaks-buffer)

 (defn extract-rms-amp
   "Extract the RMS amplitude of an input vector"
@@ -211,7 +223,6 @@
         (raise-errors r)
         (first cents)))))

-
 (defn block-stats
   ([sample-path] (block-stats sample-path DEFAULT_BLOCK_SIZE))
   ([sample-path block-size]
@@ -223,8 +234,7 @@
          s           (ssample/read-sound sample-path)
          data-chunks (ssample/chunks s SAMPLE_RATE)
          ;;data (partition block-size half-block-size (mapcat (fn [bit] bit) (flatten (flatten data-chunks))))         ;;seperate
-         data (partition block-size (mapcat (fn [bit] bit) (flatten (flatten data-chunks))))
-         mel-filters  (xtract/create_filterbank  MFCC_FREQ_BANDS block-size)]
+         data (partition block-size (mapcat (fn [bit] bit) (flatten (flatten data-chunks))))]

      (raise-errors
       (xtract/xtract_init_mfcc half-block-size
@@ -235,108 +245,76 @@
                                MFCC_FREQ_BANDS
                                (xtract_mel_filter/.getFilters mel-filters)))

-     ;;public static int xtract_init_bark(int N, double sr, SWIGTYPE_p_int band_limits) {
-     ;;(xtract/xtract_init_bark block-size SAMPLERATE bark-band-limits)
-     ;;(println (xtract/int_array_getitem bark-band-limits 0))
-
-     (let [full-window (xtract/xtract_init_window block-size xtract-hann)
-           half-window (xtract/xtract_init_window half-block-size xtract-hann)]
-
-       (raise-errors
-        (xtract/xtract_init_wavelet_f0_state))
-
-       (let [stats
-             (map-indexed
-              (fn [idx v]
-                (let [wav-data (clojure->c-double v)
-                      f0       (extract-fundemental-frequency wav-data block-size SAMPLE_RATE)
-                      cents    (frequency->cents f0)
-                      midi     (if (> f0 0.0)
-                                 (Integer/parseInt (format "%.0f" (/ cents 100)))
-                                 0)
-
-                      spectrum               (extract-fft-spectrum wav-data block-size SAMPLE_RATE full-window)
-                      peaks                  (extract-peaks spectrum block-size SAMPLE_RATE_RATIO 10.0)
-                      spectral-inharmonicity (extract-spectral-inharmonicity peaks block-size f0)
-
-                      rms                    (extract-rms-amp wav-data block-size SAMPLE_RATE_RATIO)
-
-                      spectral-irregularity (double-array [0])
-                      spectral-centroid     (double-array [0])
-                      spectral-variance     (double-array [0])
-
-                      ;;TODO
-                      noiseness             (double-array [0])
-                      loudness              (double-array [0])
-                      tonality              (double-array [0])]
+     (raise-errors  (xtract/xtract_init_wavelet_f0_state))
+
+     (let [stats
+           (map-indexed
+            (fn [idx v]
+              (let [wav-data (copy-c-double v wav-buffer)
+                    f0       (extract-fundemental-frequency wav-data block-size SAMPLE_RATE)
+                    cents    (frequency->cents f0)
+                    midi     (if (> f0 0.0)
+                               (Integer/parseInt (format "%.0f" (/ cents 100)))
+                               0)
+
+                    spectrum               (extract-fft-spectrum wav-data block-size SAMPLE_RATE full-window)
+                    peaks                  (extract-peaks spectrum block-size SAMPLE_RATE_RATIO 10.0)
+                    spectral-inharmonicity (extract-spectral-inharmonicity peaks block-size f0)
+
+                    rms                    (extract-rms-amp wav-data block-size SAMPLE_RATE_RATIO)
+
+                    spectral-irregularity (double-array [0])
+                    spectral-centroid     (double-array [0])
+                    spectral-variance     (double-array [0])
+
+                    ;;TODO
+                    noiseness             (double-array [0])
+                    loudness              (double-array [0])
+                    tonality              (double-array [0])]
+
+                (raise-errors
+                 (xtract/xtract_spectral_centroid spectrum block-size nil spectral-centroid))
+                (raise-errors
+                 (xtract/xtract_irregularity_j    spectrum half-block-size nil spectral-irregularity))
+
+                (let [spectral-skewness      (double-array [0])
+                      spectral-std-deviation (double-array [0])
+                      spectral-mean          (double-array [0])
+                      spectral-kurtosis      (double-array [0])]

                   (raise-errors
-                   (xtract/xtract_spectral_centroid spectrum block-size (xtract-args 0.0) spectral-centroid))
+                   (xtract/xtract_spectral_mean spectrum block-size nil spectral-mean))
                   (raise-errors
-                   (xtract/xtract_irregularity_j    spectrum half-block-size nil spectral-irregularity))
-
-                  (let [spectral-skewness      (double-array [0])
-                        spectral-std-deviation (double-array [0])
-                        spectral-mean          (double-array [0])
-                        spectral-kurtosis      (double-array [0])]
-
+                   (xtract/xtract_variance spectrum block-size (xtract-args (first spectral-mean)) spectral-variance))
+                  (raise-errors
+                   (xtract/xtract_spectral_standard_deviation spectrum block-size (xtract-args (first spectral-variance)) spectral-std-deviation))
+
+                  (let [argv (xtract-args (first spectral-mean) (first spectral-std-deviation))]
                     (raise-errors
-                     (xtract/xtract_spectral_mean spectrum block-size nil spectral-mean))
+                     (xtract/xtract_spectral_skewness spectrum block-size argv spectral-skewness))
                     (raise-errors
-                     (xtract/xtract_variance spectrum block-size (xtract-args (first spectral-mean)) spectral-variance))
-                    (raise-errors
-                     (xtract/xtract_spectral_standard_deviation spectrum block-size (xtract-args (first spectral-variance)) spectral-std-deviation))
-
-                    (let [argv (xtract-args (first spectral-mean) (first spectral-std-deviation))]
-                      (raise-errors
-                       (xtract/xtract_spectral_skewness spectrum block-size argv spectral-skewness))
-                      (raise-errors
-                       (xtract/xtract_spectral_kurtosis spectrum block-size argv spectral-kurtosis)))
-
-                    ;;(xtract/xtract_noisiness     wav-data block-size (xtract-args NUM_HARMONICS ) noiseness)
-
-                    (let [_ 10
-                          ;;bark-cofficents (clojure->c-double (range 0 xtract-bark-bands))
-                          ]
-
-                      ;;(xtract/xtract_bark_coefficients spectrum half-block-size (xtract-args ) bark-cofficents)
-                      ;;(xtract/xtract_loudness      wav-data block-size (apply xtract-args argv) loudness)
-                      )
-
-                    ;;TODO
-                    ;;(xtract/xtract_tonality      wav-data block-size (xtract-args ) tonality)
-
-                    ;;TODO: More memory, probably slower... Re-using variables faster but sad
-                    (xtract/delete_double_array wav-data)
-                    (xtract/delete_double_array spectrum)
-                    (xtract/delete_double_array peaks)
-
-                    {
-                     (format "%.6f" (/  (* idx half-block-size) SAMPLE_RATE))
-
-                     {:spectral-inharmonicity spectral-inharmonicity
-                      :spectral-irregularity  (first spectral-irregularity)
-                      :spectral-centroid      (first spectral-centroid)
-                      :spectral-skewness      (first spectral-skewness)
-                      :spectral-kurtosis      (first spectral-kurtosis)
-                      :rms-amplitude          (first rms)
-
-                      :todo {:noisiness (first noiseness)
-                             :loudness (first loudness)
-                             :tonality (first tonality)}
-                      :midi midi
-                      :f0 f0}
-                     }
-                    )))
-              data)]
-
-         (xtract/xtract_free_window full-window)
-         (xtract/xtract_free_window half-window)
-         (xtract/destroy_filterbank mel-filters)
-
-         (vec (flatten stats))
-         )))))
-
+                     (xtract/xtract_spectral_kurtosis spectrum block-size argv spectral-kurtosis)))
+
+                  {
+                   (format "%.6f" (/  (* idx half-block-size) SAMPLE_RATE))
+
+                   {:spectral-inharmonicity spectral-inharmonicity
+                    :spectral-irregularity  (first spectral-irregularity)
+                    :spectral-centroid      (first spectral-centroid)
+                    :spectral-skewness      (first spectral-skewness)
+                    :spectral-kurtosis      (first spectral-kurtosis)
+                    :rms-amplitude          (first rms)
+
+                    :todo {:noisiness (first noiseness)
+                           :loudness (first loudness)
+                           :tonality (first tonality)}
+                    :midi midi
+                    :f0 f0}
+                   }
+                  )))
+            data)]
+
+       (vec (flatten stats))))))

 (defn global-stats-reduce [fields]
   (fn [acc frame]
@@ -357,6 +335,11 @@
 (defn max-for [field frame-stats]
   (apply max (map (fn [f] (get (first (vals f)) field))  frame-stats)))

+(defn min-for [field frame-stats]
+  (let [vals (map (fn [f] (get (first (vals f)) field)) frame-stats)]
+    (when (seq vals)
+      (apply min vals))))
+
 (defn global-stats [frame-stats]
   (let [n (count frame-stats)
         fields (-> frame-stats first vals first (dissoc :todo) keys)
@@ -365,42 +348,73 @@
         f0-frames (remove (fn [frame] (let [stats (first (vals frame))]
                                         (= (:f0 stats) 0.0)
                                        )) frame-stats)
-        n-f0s (count f0-frames)
+        n-f0s     (count f0-frames)
         f0-totals (reduce (global-stats-reduce fields) {} f0-frames)]

-    (let [means
-          (-> {}
-              (assoc :rms-amplitude          (/ (:rms-amplitude totals) n))
-              (assoc :spectral-centroid      (/ (:spectral-centroid totals) n))
-              (assoc :spectral-irregularity  (/ (:spectral-irregularity totals) n))
-              (assoc :spectral-kurtosis      (/ (:spectral-kurtosis totals) n))
-              (assoc :spectral-skewness      (/ (:spectral-skewness totals) n))
-
-              ;;Only over non 0 frequencies
-              (assoc :spectral-inharmonicity (/ (:spectral-inharmonicity f0-totals) n-f0s))
-              (assoc :midi (/ (:midi f0-totals) n-f0s))
-              (assoc :f0   (/ (:f0 f0-totals) n-f0s)))
-
-          maxs {:spectral-centroid (max-for :spectral-centroid frame-stats)}]
-      {:mean means
-       :max maxs}
-  )))
+    (if (> n 0)
+      (let [means
+            (-> {}
+                (assoc :rms-amplitude          (/ (:rms-amplitude totals) n))
+                (assoc :spectral-centroid      (/ (:spectral-centroid totals) n))
+                (assoc :spectral-irregularity  (/ (:spectral-irregularity totals) n))
+                (assoc :spectral-kurtosis      (/ (:spectral-kurtosis totals) n))
+                (assoc :spectral-skewness      (/ (:spectral-skewness totals) n)))
+
+
+                ;;Only over non 0 frequencies
+
+            non-0-means
+            (if (> n-f0s 0)
+              (-> {}
+                  (assoc :spectral-inharmonicity (/ (:spectral-inharmonicity f0-totals) n-f0s))
+                  (assoc :midi (/ (:midi f0-totals) n-f0s))
+                  (assoc :f0   (/ (:f0 f0-totals) n-f0s)))
+              {})
+
+            means (merge means non-0-means)
+
+            mins {:spectral-inharmonicity (min-for :spectral-inharmonicity f0-frames)
+                  :midi (min-for :midi f0-frames)
+                  :f0   (min-for :f0  f0-frames)}
+
+            maxs {:rms-amplitude         (max-for :rms-amplitude frame-stats)
+                  :spectral-centroid     (max-for :spectral-centroid frame-stats)
+                  :spectral-irregularity (max-for :spectral-irregularity frame-stats)
+                  :spectral-kurtosis      (max-for :spectral-kurtosis frame-stats)
+                  :spectral-skewness      (max-for :spectral-skewness frame-stats)
+
+                  :spectral-inharmonicity (max-for :spectral-inharmonicity frame-stats)
+                  :midi (max-for :midi frame-stats)
+                  :f0   (max-for :f0  frame-stats)}]
+        {:mean means
+         :max maxs
+         :min mins})
+      {:means {} :max {}})))

 (comment

-  (def all-wavs (filter #(.endsWith (.getName %) ".wav") (file-seq (io/file "/Users/josephwilk/Workspace/music/samples"))))
-  (doseq [w (take 1000 all-wavs)]
-    (try
-      (let [wav (.getPath w) ;; "test/fixtures/test.wav" ;;(.getPath wav)
-            _ (println wav)
-            b-stats (block-stats wav 512)
-            g-stats (global-stats b-stats)
+  (do
+    (def all-wavs (filter #(.endsWith (.getName %) ".wav") (file-seq (io/file "/Users/josephwilk/Workspace/music/samples"))))
+
+    (spit "sop.json" "")
+
+    (doseq [w
+            all-wavs
+            ;;          ["/Users/josephwilk/Workspace/music/samples/CHILLSTEP/DCS_WAV_LOOPS/DCS_MUSIC_LOOPS/DCS_70_C_Cloud.wav"]
             ]
-        (println {:file wav :stats g-stats})
-        )
-
-      (catch Exception e true)
-      ))
+      (try
+        (let [wav (.getPath w) ;; "test/fixtures/test.wav" ;;(.getPath wav)
+              _ (println wav)
+              b-stats (block-stats wav 512)
+              g-stats (global-stats b-stats)
+              ]
+
+          (spit "sop.json" {:file wav :stats g-stats} :append true)
+          (spit "sop.json" "\n" :append true)
+          )
+
+        (catch Exception e (println e))
+        )))

   (dotimes [i 1]
     (let [block-stats (block-stats "test/fixtures/test.wav")]
@@ -414,7 +428,6 @@
         sub (features-from-subframes [1 2 4 8 10 12 14 16]
                                      (/ 8 2)
                                      xtract-hann)]
-
     (println (str "Mean:" m))
     (println (str "Var:" v))
     (println (str "Spectrum: " (pr-str spec)))


indention

indention

--- src/ca_recipe/tnywb/controller.clj
+++ src/ca_recipe/tnywb/controller.clj
@@ -1,6 +1,15 @@
 (ns ca-recipe.tnywb.controller
   (:import (com.mblinn.oo.tinyweb HttpRequest HttpRequest$Builder)))
-(defn test-controller [http-request] {:name (.getBody http-request)})
+
+(defn test-controller
+  [http-request]
+  {:name (.getBody http-request)})
+
 (def test-builder (HttpRequest$Builder/newBuilder))
-(def test-http-request (.. test-builder (body "Some text") (path "/say-hello") build)) (defn test-controller-with-map [http-request]
-                                                                                {:name (http-request :body)})
+
+(def test-http-request
+  (.. test-builder (body "Some text") (path "/say-hello") build))
+
+(defn test-controller-with-map
+  [http-request]
+  {:name (http-request :body)})


remove placeholder message counts from sidebar

--- src/chat/client/views/sidebar.cljs
+++ src/chat/client/views/sidebar.cljs
@@ -83,7 +83,7 @@
                  (filter (fn [t] (store/is-subscribed-to-tag? (t :id))))
                  (take 5)
                  (map (fn [tag]
-                        (dom/div nil (om/build tag-view tag) (str "[" (rand-int 10) "]")))))))
+                        (dom/div nil (om/build tag-view tag)))))))

         (dom/h2 nil "Direct Messages")
         (apply dom/div #js {:className "users"}
@@ -92,8 +92,7 @@
                (remove (fn [user] (= (get-in @store/app-state [:session :user-id]) (user :id))))
                (map (fn [user]
                       (dom/div nil
-                        (om/build user-view user)
-                        (str "[" (rand-int 10) "]"))))))
+                        (om/build user-view user))))))

         (dom/h2 nil "Recommended")
         (apply dom/div #js {:className "recommended"}


enable supervisor port to be configurable

--- src/clj/backtype/storm/testing.clj
+++ src/clj/backtype/storm/testing.clj
@@ -96,7 +96,7 @@
 ;; local dir is always overridden in maps
 ;; can customize the supervisors (except for ports) by passing in map for :supervisors parameter
 ;; if need to customize amt of ports more, can use add-supervisor calls afterwards
-(defnk mk-local-storm-cluster [:supervisors 2 :ports-per-supervisor 3 :daemon-conf {} :inimbus nil]
+(defnk mk-local-storm-cluster [:supervisors 2 :ports-per-supervisor 3 :daemon-conf {} :inimbus nil :supervisor-slot-port-min 1]
   (let [zk-tmp (local-temp-path)
         [zk-port zk-handle] (zk/mk-inprocess-zookeeper zk-tmp)
         daemon-conf (merge (read-storm-config)
@@ -110,7 +110,7 @@
                             STORM-ZOOKEEPER-PORT zk-port
                             STORM-ZOOKEEPER-SERVERS ["localhost"]})
         nimbus-tmp (local-temp-path)
-        port-counter (mk-counter)
+        port-counter (mk-counter supervisor-slot-port-min)
         nimbus (nimbus/service-handler
                 (assoc daemon-conf STORM-LOCAL-DIR nimbus-tmp)
                 (if inimbus inimbus (nimbus/standalone-nimbus)))


Fix character encodings for the data read from the csv. Remove columns from the response.

--- src/clj/my_money/routes/upload.clj
+++ src/clj/my_money/routes/upload.clj
@@ -5,6 +5,8 @@

 (defroutes upload-routes
   (POST "/upload" [file]
-    (let [data (read-csv (slurp (:tempfile file)))]
+    (let [data (read-csv (slurp (:tempfile file) :encoding "ISO-8859-1"))]
       (-> (response/ok (-> data
+                           (remove-column-by-name "Arvopäivä")
+                           (remove-column-by-name "Laji")
                            (remove-column-by-name "Arkistointitunnus")))))))


Reenable scrolling on room page.

Reenable scrolling on room page.

--- src/cljs/openslack/views/room.cljs
+++ src/cljs/openslack/views/room.cljs
@@ -4,6 +4,7 @@
             [shodan.console :as console :include-macros true]
             [cuerdas.core :as str]
             [openslack.state :as st]
+            [openslack.browser :as browser]
             [openslack.views.messages :as msg]
             [openslack.text :refer [enrich-text]]
             [openslack.chat :as chat]))
@@ -125,6 +126,10 @@
     om/IDisplayName
     (display-name [_] "Room")

+    om/IDidUpdate
+    (did-update [this _ _]
+      (browser/scroll-to-bottom ".messages-container"))
+
     om/IRender
     (render [_]
       (let [roomname (get-in state [:page :room])


Calculate averages for a hash-mapful of values.

--- src/cljs/town_client/analyser.cljs
+++ src/cljs/town_client/analyser.cljs
@@ -22,3 +22,24 @@
                                               (map js->clj
                                                    (vals
                                                     (:results data)))))))))))
+
+(defn map-summer [keys]
+  (fn [mapx mapy]
+    (into {} (map
+     #(vector % (+ (mapx %) (mapy %)))
+       keys))))
+
+(defn totals [data]
+  (let [reducer (map-summer [:a :b])]
+    (reduce reducer data)))
+
+(defn divide [divisor [k v]]
+  [k (/ v divisor)])
+
+(defn averages [data]
+  (into {} (map (partial (divide (count data)))
+                (totals data))))
+
+(defn scale-key [data-key]
+  (keyword (clojure.string/replace data-key "scale_" "")))
+


handle less rigorous structural markup, no ids etc

--- src/crison/main.clj
+++ src/crison/main.clj
@@ -1,41 +1,70 @@
 (ns crison.main
   (:require [clojure.edn :refer [read-string]]
+            [environ.core :refer [env]]
             [clojure.test :refer :all]
             ;[taoensso.truss :as truss :refer (have have! have?)]
-            [webdriver.core :refer :all]
-            [webdriver.form :refer :all])
+            [webdriver.core :as wc]
+            [webdriver.form :as wf])
   (:gen-class))

-(System/setProperty "phantomjs.binary.path" "/Users/rossputin/Downloads/phantomjs-2.1.1-macosx/bin/phantomjs")
+(System/setProperty "phantomjs.binary.path" (env :phantom-path))

-(def driver (new-webdriver {:browser :phantomjs}))
+(def driver (wc/new-webdriver {:browser :phantomjs}))

-(defn title? [x] (is (= x (title driver))))
+(defn title [] (wc/title driver))

-(defn go [x] (to driver x))
+(defn title? [x] (is (= x (title)) x))

-(defn ? [x] (is (-> driver (find-element x) exists?)))
+(defn go [x] (wc/to driver x))
+
+(defn el [x] (-> driver (wc/find-element x)))
+
+;; currently a catchall from the multimethod
+(defn ? [x] (is (-> driver (wc/find-element x) wc/exists?) (str "Fail on : " x)))
+
+(defn text? [x]
+  (println (wc/text (-> driver (wc/find-element (dissoc x :text?)))))
+  (is (= (:text? x)
+        (wc/text (-> driver (wc/find-element (dissoc x :text?)))))))

 (defmulti decode (fn[x] (ffirst x)))

 (defmethod decode :url! [x] (go (:url! x)))

-(defmethod decode :click! [x] (-> driver (find-element {:id (:click! x)}) click))
+(defmethod decode :click! [x]
+  (let [e (:click! x)]
+    (if (string? e)
+      (-> driver (wc/find-element {:id e}) wc/click)
+      (-> driver (wc/find-element e) wc/click))))

-(defmethod decode :search! [x]
-  (quick-fill-submit
-    driver
-    (:search! x)))
+(defmethod decode :search! [x] (wf/quick-fill-submit driver (:search! x)))

 (defmethod decode :title [x] (title? (:title x)))

+(defmethod decode :text? [x] (text? x))
+
 (defmethod decode :default [x] (? x))

+(def screenshot-file (str "screenshot_test.png"))
+(defn take-screenshot
+  [driver]
+  (is (string? (wc/get-screenshot driver :base64)))
+  (is (> (count (wc/get-screenshot driver :bytes)) 0))
+  (is (= (class (wc/get-screenshot driver :file)) java.io.File))
+  (is (= (class (wc/get-screenshot driver :file screenshot-file)) java.io.File))
+  ;; the following will throw an exception if deletion fails, hence our test
+  ;(clojure.java.io/delete-file screenshot-file)
+  )
+
 (deftest counselling
+  (wc/resize driver {:width 1024 :height 800})
   (let [tests (read-string (slurp "resources/counselling-directory.edn"))]
-    (doseq [x tests] (decode x))))
+    (doseq [x tests] (decode x))
+    (take-screenshot driver)
+    ))

 (def test-file (clojure.java.io/writer "tests.txt"))
+
 (defn -main [& args]
   (binding [*test-out* test-file]
     (run-tests 'crison.main)))


[#1787]Refactor: Remove column-label and sql-without-aggregation opt

--- backend/src/akvo/lumen/lib/aggregation/bubble.clj
+++ backend/src/akvo/lumen/lib/aggregation/bubble.clj
@@ -1,15 +1,15 @@
 (ns akvo.lumen.lib.aggregation.bubble
   (:require [akvo.lumen.lib :as lib]
             [akvo.lumen.lib.dataset.utils :as utils]
-            [clojure.walk :refer (keywordize-keys)]
             [akvo.lumen.postgres.filter :as filter]
-            [clojure.java.jdbc :as jdbc]))
+            [clojure.java.jdbc :as jdbc]
+            [clojure.tools.logging :as log]
+            [clojure.walk :refer (keywordize-keys)]))

-(defn- run-query [tenant-conn table-name sql-text column-size-name filter-sql aggregation-method max-points column-label-name column-bucket-name]
-  (rest (jdbc/query tenant-conn
-                    [(format sql-text
-                             column-size-name table-name filter-sql aggregation-method max-points column-label-name column-bucket-name)]
-                    {:as-arrays? true})))
+(defn- run-query [tenant-conn table-name sql-text column-size-name filter-sql aggregation-method max-points column-bucket-name]
+  (let [sql-query (format sql-text column-size-name table-name filter-sql aggregation-method max-points column-bucket-name)]
+    (log/debug :sql-query sql-query)
+    (rest (jdbc/query tenant-conn [sql-query] {:as-arrays? true}))))

 (defn cast-to-decimal [column-string column-type]
   (case column-type
@@ -31,25 +31,25 @@
   [tenant-conn {:keys [columns table-name]} query]
   (let [filter-sql (filter/sql-str columns (get query "filters"))
         column-size (keywordize-keys (utils/find-column columns (get query "metricColumn")))
-        column-label (keywordize-keys (utils/find-column columns (get query "datapointLabelColumn")))
         column-bucket (keywordize-keys (utils/find-column columns (get query "bucketColumn")))
         max-points 2500
-        have-aggregation? (boolean column-bucket)
-        aggregation-method (if column-size
-                             (get query "metricAggregation")
-                             "count")
-        sql-text-with-aggregation (str "SELECT "
-                                       (sql-aggregation-subquery aggregation-method "%1$s" (or (:type column-size) (:type column-bucket)))
-                                       " AS size, "
-                                       "%7$s AS label FROM (SELECT * FROM %2$s WHERE %3$s ORDER BY random() LIMIT %5$s)z GROUP BY %7$s")
-        sql-text-without-aggregation "
-        SELECT * FROM (SELECT * FROM (SELECT %1$s AS size, %6$s AS label FROM %2$s WHERE %3$s)z ORDER BY random() LIMIT %5$s)zz ORDER BY zz.x"
-        sql-text (if have-aggregation? sql-text-with-aggregation sql-text-without-aggregation)
-      sql-response (run-query tenant-conn table-name sql-text (or (:columnName column-size) (get column-bucket "columnName")) filter-sql aggregation-method max-points (:columnName column-label) (:columnName column-bucket))]
+        aggregation-method (if column-size (get query "metricAggregation") "count")
+        sql-text (str "SELECT "
+                      (sql-aggregation-subquery aggregation-method "%1$s" (or (:type column-size) (:type column-bucket)))
+                      " AS size, "
+                      "%6$s AS label FROM (SELECT * FROM %2$s WHERE %3$s ORDER BY random() LIMIT %5$s)z GROUP BY %6$s")
+        sql-response (run-query tenant-conn table-name
+                                sql-text
+                                (or (:columnName column-size) (:columnName column-bucket))
+                                filter-sql
+                                aggregation-method
+                                max-points
+                                (:columnName column-bucket))]
     (lib/ok
      {"series" [{"key" (:title column-size)
                  "label" (:title column-size)
                  "data" (mapv (fn [[size-value label]] {"value" size-value}) sql-response)
                  "metadata"  {"type" (:type column-size)}}]
-      "common" {"metadata" {"type" (:type column-label) "sampled" (= (count sql-response) max-points)}
+      "common" {"metadata" {"type" nil
+                            "sampled" (= (count sql-response) max-points)}
                 "data" (mapv (fn [[size-value label]] {"label" label}) sql-response)}})))


Add links to index.

Add links to index.

--- src/flatland/handler.clj
+++ src/flatland/handler.clj
@@ -75,11 +75,14 @@

 (defn- render-index
   []
-  (render-with-template template (html (for [post (map #(get posts %) (keys posts))]
-                                         [:section {:class "post"}
-                                          [:h3
-                                           [:a {:href (str (:base-url config) "posts/" ())}] (:title post)]
-                                          [:p (:content post)]]))))
+  (render-with-template template
+                        (html (for [[name post]
+                                    (map #(find posts %) (keys posts))]
+                                [:section {:class "post"}
+                                 [:h3
+                                  [:a {:href (str (:base-url config) "posts/" name)}
+                                      (:title post)]]
+                                 [:p (:content post)]]))))

 (defroutes app
   (GET "/" [] (render-index))


typed clojure

typed clojure

--- vif-navigator-libs2/src/ru/vif/model/vif_xml_tools.clj
+++ vif-navigator-libs2/src/ru/vif/model/vif_xml_tools.clj
@@ -4,7 +4,7 @@
             [clojure.core.typed :as t]
             )
   (:import (java.util Date)
-           (clojure.lang Keyword IPersistentMap IPersistentSet)
+           (clojure.lang Keyword IPersistentMap IPersistentSet ISeq ASeq)
            (org.xmlpull.v1 XmlPullParser XmlPullParserFactory)
            (java.io StringReader)
            (java.text SimpleDateFormat)
@@ -51,7 +51,7 @@
 (t/non-nil-return org.xmlpull.v1.XmlPullParserFactory/newInstance :all)
 (t/non-nil-return org.xmlpull.v1.XmlPullParserFactory/newPullParser :all)

-(t/ann create-parser [ -> XmlPullParser])
+(t/ann create-parser [-> XmlPullParser])
 (defn create-parser
   "Создает XmlPullParser"
   ^{:private true}
@@ -134,18 +134,25 @@
     )
   )

+(t/ann ^:no-check take-while-some  (t/All [x]
+                              (t/IFn [(t/ASeq (t/U x nil))  -> (t/ASeq x )])
+                              ))
+(defn take-while-some [^ISeq seq]
+  (take-while some? seq)
+  )
+
 (t/ann parse-xml-entries [String -> parse-data])
 (defn parse-xml-entries
   "Разбирает xml и возврщает sequence записей vif-xml"
   [^String xml]

-  (let [^XmlPullParser parser (create-parser)
-        ^StringReader reader (StringReader. xml)
-        tmp (.setInput parser reader)
-        [event-entry & all-antries] (->> (repeatedly #(parse-one-simple-entry parser #{"event" "lastEvent"}))
-                                         (take-while some?)
-                                         )
-        ]
+  (t/let [^XmlPullParser parser :- XmlPullParser (create-parser)
+          ^StringReader reader :- StringReader (StringReader. xml)
+          tmp (.setInput parser reader)
+          [event-entry & all-antries] (->> (repeatedly (fn [] (parse-one-simple-entry parser #{"event" "lastEvent"})))
+                                           (take-while-some)
+                                           )
+          ]
     (parse-data.
       (get event-entry "lastEvent")
       (map create-vif-xml-entry all-antries)


simplify code - get rid of IDurable

simplify code - get rid of IDurable

--- src/duratom/core.clj
+++ src/duratom/core.clj
@@ -11,60 +11,52 @@
     `(ut/with-locking ~lock ~@body)
     `(do ~@body)))
 ;; ================================================================
-(defprotocol IDurable
-  (write_out [this])
-  (read_in [this])
-  (destroy [this]))
-

 (deftype Duratom
   [storage-backend underlying-atom lock release]
-  IDurable ;; 2 polymorphic levels here
-  (write_out [_]
-    (storage/commit storage-backend))
-  (read_in [this]
-    (storage/snapshot storage-backend))
-  (destroy [_]
+
+  storage/IStorageBackend
+  (cleanup [_]
     (storage/cleanup storage-backend)
     (release true)) ;; the only place where this is called with an argument

   IAtom
-  (swap [this f]
+  (swap [_ f]
     (ut/assert-not-released! release)
     (maybe-lock lock
       (let [result (swap! underlying-atom f)]
-        (write_out this)
+        (storage/commit storage-backend)
         result)))
-  (swap [this f arg]
+  (swap [_ f arg]
     (ut/assert-not-released! release)
     (maybe-lock lock
       (let [result (swap! underlying-atom f arg)]
-        (write_out this)
+        (storage/commit storage-backend)
         result)))
-  (swap [this f arg1 arg2]
+  (swap [_ f arg1 arg2]
     (ut/assert-not-released! release)
     (maybe-lock lock
       (let [result (swap! underlying-atom f arg1 arg2)]
-        (write_out this)
+        (storage/commit storage-backend)
         result)))
-  (swap [this f x y args]
+  (swap [_ f x y args]
     (ut/assert-not-released! release)
     (maybe-lock lock
       (let [result (swap! underlying-atom f x y args)]
-        (write_out this)
+        (storage/commit storage-backend)
         result)))
-  (compareAndSet [this oldv newv]
+  (compareAndSet [_ oldv newv]
     (ut/assert-not-released! release)
     (maybe-lock lock
       (let [result (compare-and-set! underlying-atom oldv newv)]
         (when result
-          (write_out this))
+          (storage/commit storage-backend))
         result)))
-  (reset [this newval]
+  (reset [_ newval]
     (ut/assert-not-released! release)
     (maybe-lock lock
       (let [result (reset! underlying-atom newval)]
-        (write_out this)
+        (storage/commit storage-backend)
         result)))
   IRef
   (setValidator [_ validator]
@@ -101,8 +93,9 @@
               (nil? lock))
           "The <lock> provided is neither a valid implementation of `java.util.concurrent.locks.Lock`, nor nil!")
   (let [raw-atom (atom nil)
-        duratom (Duratom. (make-backend (agent raw-atom)) raw-atom lock (ut/releaser))
-        storage-init (read_in duratom)]
+        backend (make-backend (agent raw-atom))
+        duratom (Duratom. backend raw-atom lock (ut/releaser))
+        storage-init (storage/snapshot backend)]
     (if (some? storage-init) ;; found stuff - sync it
       (do ;; reset the raw atom directly to avoid writing exactly what was read in
         (reset! raw-atom storage-init)


Added zone name checking

Added zone name checking

--- src/hphelper/scengen/generator.clj
+++ src/hphelper/scengen/generator.clj
@@ -222,6 +222,20 @@
              (shuffle (concat (apply concat (map sql/get-news-crisis (get-crisis-id-list scenRec)))
                               (sql/get-news-random 6))))))

+(defn- create-random-zone-name
+  "Creates a randome 3 letter zone name"
+  []
+  (apply str (take 3 (repeatedly (fn [] (char (+ (int \A) (rand-int 26))))))))
+
+(defn- check-zone-name
+  "Checks for zone name, and if missing creates a random sector name"
+  [{zone :zone :as scenRec}]
+  (if (and zone
+           (string? zone)
+           (= (count zone) 3))
+    scenRec
+    (assoc-in scenRec [:zone] (create-random-zone-name))))
+
 (defn add-character
   "Adds a high programmer character to the record under :hps"
   ([{hps :hps :as scenRec} {nam :name :as character}]
@@ -241,6 +255,7 @@
        (select-secret-society-missions)
        (select-secret-society-missions-unused)
        (select-minion-lists)
+       (check-zone-name)

        (select-news)

@@ -252,4 +267,4 @@
        (update-in [:indicies] normalise-all-indicies)
        )))

-(:directives (create-scenario))
+(:zone (create-scenario))


fix cross-clj links for symbols found in cljs files

--- src/main/cljs_api_gen/write.clj
+++ src/main/cljs_api_gen/write.clj
@@ -96,6 +96,15 @@
         name-enc (URLEncoder/encode name- "UTF-8")]
     (str "http://crossclj.info/fun/" ns- "/" name-enc ".html")))

+(defn crosscljs-link
+  [{:keys [full-name] :as item}]
+  (let [[ns- name-] (split-ns-and-name full-name)
+        filename (or (-> item :source :filename) "")
+        ns- (cond-> ns-
+              (re-find #"\.cljs$" filename) (str ".cljs"))
+        name-enc (URLEncoder/encode name- "UTF-8")]
+    (str "http://crossclj.info/fun/" ns- "/" name-enc ".html")))
+
 (defn crossclj-has-cljs?
   [full-name]
   (let [[ns- name-] (split-ns-and-name full-name)]
@@ -122,7 +131,7 @@
            (when (crossclj-has-cljs? cljs-full)
              {:source "crossclj"
               :symbol cljs-full
-              :link (crossclj-link cljs-full)})])]
+              :link (crosscljs-link item)})])]
     (cond-> item
       (seq links) (assoc :external-doc-links {:links links}))))


CLJS-1308: :analyze-path should be extended to take a vector of paths

If :analyze-path is a vector, run analyze-source
across its elements, otherwise handle as a scalar.

--- src/main/clojure/cljs/repl.cljc
+++ src/main/clojure/cljs/repl.cljc
@@ -827,7 +827,9 @@
              (binding [*repl-opts* opts]
                (try
                  (when analyze-path
-                   (analyze-source analyze-path opts))
+                   (if (vector? analyze-path)
+                     (run! #(analyze-source % opts) analyze-path)
+                     (analyze-source analyze-path opts)))
                  (init)
                  (catch Throwable e
                    (caught e repl-env opts)))


rename variable

rename variable

--- src/babel/espanol/writer.clj
+++ src/babel/espanol/writer.clj
@@ -34,7 +34,7 @@
                            (not (= :top (get-in lexeme [:synsem :sem :pred] :top)))))
                         lexeme-set))
               (vals @lexicon)))
-        root-verb-keys
+        root-verb-array
         (reduce concat
                 (map (fn [key]
                        (get root-verbs key))
@@ -42,8 +42,8 @@
     (write-lexicon "es" @lexicon)
     (log/info (str "done writing lexicon."))
     (log/info (str "generating examples with this many verbs:"
-                   (.size root-verb-keys)))
-    (.size (pmap (fn [verb]
+                   (.size root-verb-array)))
+    (.size (map (fn [verb]
                    (log/trace (str "verb: " (strip-refs verb)))
                    (let [root-form (get-in verb [:espanol :espanol])]
                      (log/info (str "generating with verb: '" root-form "'"))
@@ -102,6 +102,7 @@
                                        {:synsem {:sem {:aspect :perfect
                                                        :tense :past}}}
                                        )))))
-                 root-verb-keys))))
+                 root-verb-array))))

+


Change html extension string.

Change html extension string.

--- src/incise/parsers/html.clj
+++ src/incise/parsers/html.clj
@@ -12,7 +12,7 @@
         parse-meta (edn/read-string file-str)
         content (to-html (second (s/split file-str #"\}" 2)))]
     (map->Parse (assoc parse-meta
-                       :extension :html
+                       :extension "/index.html"
                        :content content))))

 (defn write-Parse


CLJ-1957 Add generator for bytes?

CLJ-1957 Add generator for bytes?

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

--- src/clj/clojure/spec/gen.clj
+++ src/clj/clojure/spec/gen.clj
@@ -7,7 +7,7 @@
 ;   You must not remove this notice, or any other, from this software.

 (ns clojure.spec.gen
-    (:refer-clojure :exclude [boolean cat hash-map list map not-empty set vector
+    (:refer-clojure :exclude [boolean bytes cat hash-map list map not-empty set vector
                               char double int keyword symbol string uuid delay]))

 (alias 'c 'clojure.core)
@@ -112,7 +112,7 @@
         (fn [s] (c/list 'lazy-prim s))
         syms)))

-(lazy-prims any any-printable boolean char char-alpha char-alphanumeric char-ascii double
+(lazy-prims any any-printable boolean bytes char char-alpha char-alphanumeric char-ascii double
             int keyword keyword-ns large-integer ratio simple-type simple-type-printable
             string string-ascii string-alphanumeric symbol symbol-ns uuid)

@@ -178,7 +178,8 @@
       empty? (elements [nil '() [] {} #{}])
       associative? (one-of [(map simple simple) (vector simple)])
       sequential? (one-of [(list simple) (vector simple)])
-      ratio? (such-that ratio? (ratio))})))
+      ratio? (such-that ratio? (ratio))
+      bytes? (bytes)})))

 (defn gen-for-pred
   "Given a predicate, returns a built-in generator if one exists."


Fix empty stream error

Fix empty stream error

--- src/clj/salava/social/db.clj
+++ src/clj/salava/social/db.clj
@@ -43,11 +43,12 @@
       (log/error "insert-event-owners!: failed to save event owners")
       (log/error (.toString ex)))))

+
 (defn get-all-events-add-viewed [ctx user_id]
   (let [events (get-all-events ctx user_id)]
-    (update-last-viewed ctx events user_id)
-    events
-    ))
+    (if-not (empty? events)
+      (update-last-viewed ctx events user_id))
+    events))

 (defn messages-viewed
  "Save information about viewing messages."


Fix interpolation.

Fix interpolation.

--- src/clj/triangulate/core.clj
+++ src/clj/triangulate/core.clj
@@ -33,7 +33,7 @@
                 (Math/cos lat1) (Math/cos lat2)))]
     (* radius-of-earth 2 (Math/asin (Math/sqrt a)))))

-(defn interpolate-coordinates [a b c d]
+(defn interpolate-coordinates [a b whole piece]
   (let [lat1 (:lat a)
         lon1 (:long a)
         lat2 (:lat b)
@@ -41,10 +41,10 @@
         lat-diff (- lat2 lat1)
         lon-diff (- lon2 lon1)
         theta (Math/atan (/ lon-diff lat-diff))
-        x1 (* (Math/cos theta) d)
-        y1 (* (Math/sin theta) d)
-        x2 (* (Math/cos theta) c)
-        y2 (* (Math/sin theta) c)
+        x1 (* (Math/cos theta) piece)
+        y1 (* (Math/sin theta) piece)
+        x2 (* (Math/cos theta) whole)
+        y2 (* (Math/sin theta) whole)
         x-ratio (* (/ x1 x2) lat-diff)
         y-ratio (* (/ y1 y2) lon-diff)]
     {:lat (+ lat1 x-ratio) :long (+ lon1 y-ratio)}))
@@ -56,22 +56,31 @@
        n
        (recur tail distance (+ k head) (inc n)))))

-(defn target-coordinates [src dst meters-away]
-  (let [coordinates (reverse (decode-polyline (polyline src dst)))
+(defn format-intx [intx extender]
+  (str "Intersection of "
+       (clojure.string/join " and " (:intersection/of intx))
+       "," extender))
+
+(defn target-coordinates [src dst gap extender]
+  (let [formatted-src (format-intx src extender)
+        formatted-dst (format-intx dst extender)
+        coordinates (reverse (decode-polyline (polyline formatted-src formatted-dst)))
         pairs (partition 2 1 coordinates)
         segments (map (fn [[a b]] (haversine a b)) pairs)
-        back-segment (take-segments segments meters-away)
+        back-segment (take-segments segments gap)
         front-segment (dec back-segment)
+        back-distance (reduce + (take back-segment segments))
         front-distance (reduce + (take front-segment segments))
         back-coordinate (nth coordinates back-segment)
         front-coordinate (nth coordinates front-segment)
-        front-to-target (- meters-away front-distance)]
-    (interpolate-coordinates front-coordinate back-coordinate front-to-target meters-away)))
+        front-to-back (- back-distance front-distance)
+        front-to-target (- gap front-distance)]
+    (interpolate-coordinates front-coordinate back-coordinate front-to-back front-to-target)))

 (defroutes routes
   (POST "/rush-hour/api/triangulate/edn" {:keys [body]}
-        (let [{:keys [src dst]} (read-string (slurp body))]
-          (pr-str {:coordinates (interpolate-coordinates)}))))
+        (let [{:keys [src dst gap extender]} (read-string (slurp body))]
+          (pr-str {:coordinates (target-coordinates src dst gap extender)}))))

 (def app (wrap-params #'routes))


add threading log fns

add threading log fns

--- src/cljs/clj_money/util.cljs
+++ src/cljs/clj_money/util.cljs
@@ -74,3 +74,18 @@
     (when (:icon options)
       (space))
     caption]))
+
+(defn log->
+  "Writes the specified information to the log and returns
+  the information as is. Intended for use with left-threading
+  functions"
+  [info message]
+  (.log js/console message (prn-str info))
+  info)
+
+(defn log->>
+  "Writes the specified information to the log and returns
+  the information as is. Intended for use with right-threading
+  functions"
+  [message info]
+  (log-> info message))


minor typo in require statement fixed

minor typo in require statement fixed

--- src/cljs/hellhound/core.cljs
+++ src/cljs/hellhound/core.cljs
@@ -1,16 +1,13 @@
 (ns hellhound.core
-  (:require [hellhound.connection.client :refer [send-fn!] ]))
+  (:require [hellhound.connection :refer [send-fn!] ]))

 (defn- send-to-server
   [data]
   (let [send @send-fn!]
     (if (nil? send)
-      (println "Not connected to server.")
-      (do
-        (println "Sent to server")
-        (println data)
-        (send data 5000)))))
+      (throw (js/Error. "Not connected to server."))
+      (send data 5000))))

 (defn dispatch->server
   "Dispatch the given event to server side application."


making timestamp local

making timestamp local

--- src/cljs/netrunner/news.cljs
+++ src/cljs/netrunner/news.cljs
@@ -19,7 +19,7 @@
         (for [d (:news cursor)]
           [:li.news-item
             [:div.date
-              (:date d)]
+              (-> (:date d) js/Date. js/moment (.format "dddd MMM Do - HH:mm"))]
             [:div.title
               (:title d)]])]
        ]])))


correct usage of n-or-all catalog integer argument

--- src/cljs_api_gen/catalog.clj
+++ src/cljs_api_gen/catalog.clj
@@ -44,7 +44,7 @@
         versions (if (= :all n-or-all)
                    versions-left
                    (try
-                     (take (Integer/parseInt n-or-all) versions-left)
+                     (take n-or-all versions-left)
                      (catch Exception e
                        versions-left)))]


be less fancy

be less fancy

--- src/clojure/flambo/tuple.clj
+++ src/clojure/flambo/tuple.clj
@@ -2,36 +2,16 @@
   (:refer-clojure :exclude [first second seq vec])
   (:require [serializable.fn :as sfn])
   (:import [scala Tuple2]))
-
-(defprotocol ClojureTuple2
-  (first [this])
-  (second [this])
-  (vec [this])
-  (seq [this]))
-
-(extend-type Tuple2
-  ClojureTuple2
-  (first [this]
-    (._1 this))
-  (second [this]
-    (._2 this))
-  (vec [this]
-    (let [v (transient [])]
-      (conj! v (first this))
-      (conj! v (second this))
-      (persistent! v)))
-  (seq [this]
-    (clojure.core/seq (vec this))))

 (defn tuple [k v]
   (Tuple2. k v))

 (defn key-val-fn [f]
   (sfn/fn [^Tuple2 t]
-    (f (first t) (second t))))
+    (f (._1 t) (._2 t))))

 (defn key-val-val-fn [f]
   (sfn/fn [^Tuple2 t]
-    (let [k (first t)
-          v ^Tuple2 (second t)]
-      (f k (first v) (second v)))))
+    (let [k (._1 t)
+          v ^Tuple2 (._2 t)]
+      (f k (._1 v) (._2 v)))))


Added improved code comments.

Added improved code comments.

--- src/cmr/opendap/ous/core.clj
+++ src/cmr/opendap/ous/core.clj
@@ -117,12 +117,21 @@
 ;;;   Stages for URL Generation   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;
-;;; The functions originally called as part of a `let` block in
-;;; `get-opendap-urls` have been split out into stages organized by dependency.
+;;; The various stage functions below were originally called as part of a `let`
+;;; block in `get-opendap-urls` but now have been split out into stages
+;;; organized by dependency.
+;;;
+;;; In particular:
+;;;
 ;;; Functions which depend only upon the parameters (or parsing of those
 ;;; parameters) are placed in the first stage. Functions which depend upon
 ;;; either the parameters or the results of the first stage are placed in the
 ;;; second stage, etc.
+;;;
+;;; The reason for this was to make it very clear when various functions
+;;; could be called as late as possible, and only call those which were
+;;; absolutely necessary at a given point. And the reason for _that_ was so
+;;; the code could be properly prepared for async execution.

 (defn stage1
   [search-endpoint user-token raw-params]
@@ -167,7 +176,7 @@
         pattern-info (service/extract-pattern-info (first services))
         query (bounding-info->opendap-query bounding-info bounding-box)]
     (log/trace "pattern-info:" pattern-info)
-    (log/debug "query:" query)
+    (log/debug "Generated OPeNDAP query:" query)
     (log/debug "Finishing stage 4 ...")
     [pattern-info query]))


Removed shake button

Removed shake button

since it doesn't work. We have to address this issue in another way.

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

--- src/conexp/graphics/draw.clj
+++ src/conexp/graphics/draw.clj
@@ -214,13 +214,7 @@
 				  (do-swing
 				   (with-swing-error-msg frame "An Error occured."
 				     (let [[r a g i] (get-force-parameters)]
-				       (improve-with-force scn i r a g)))))))
-  (let [#^JButton shaker (make-button buttons "Shake")]
-    (add-action-listener shaker (fn [evt]
-				  (do-swing
-				   (do-nodes [node scn]
-				     (move-node-by node 0 0)))))))
-
+				       (improve-with-force scn i r a g))))))))

 ;; zoom-move

@@ -401,11 +395,11 @@
 ;;; Constructor

 (defn make-lattice-editor
-  "Creates a lattice editor for lattice with initial layout."
-  [frame lattice layout-function]
+  "Creates a lattice editor with initial layout."
+  [frame layout]
   (let [#^JPanel main-panel (JPanel. (BorderLayout.)),

-	scn (draw-on-scene (layout-function lattice)),
+	scn (draw-on-scene layout),
 	canvas (get-canvas-from-scene scn),

 	#^JPanel canvas-panel (JPanel. (BorderLayout.)),
@@ -445,7 +439,7 @@
   ([lattice layout-function]
      (let [#^JFrame frame (JFrame. "conexp-clj Lattice")]
        (doto frame
-	 (.add (make-lattice-editor frame lattice layout-function))
+	 (.add (make-lattice-editor frame (layout-function lattice)))
 	 (.setSize (Dimension. 600 600))
 	 (.setVisible true)))))


back to working state

back to working state

--- src/mermaid_ldjam/core.cljs
+++ src/mermaid_ldjam/core.cljs
@@ -59,8 +59,8 @@
   (let [last-clicked (:last-clicked state)]
     (if (and (= (count last-clicked) 2) (get actions-map last-clicked))
       (let [new-state
-            (assoc :current-status state (:text (get actions-map last-clicked)))] new-state)
-        ;((first (:action (get actions-map last-clicked))) new-state :stone))
+            (assoc state :current-status (:text (get actions-map last-clicked)))]
+        ((first (:action (get actions-map last-clicked))) new-state :stone))
       state)))

 (defn update-state [state]


Avoid reflection when logging.

Avoid reflection when logging.

--- core/src/immutant/internal/util.clj
+++ core/src/immutant/internal/util.clj
@@ -132,23 +132,23 @@
 (defmacro warn
   "Logs as warn."
   [& msg]
-  `(let [[m# t#] (handle-log-args ~@msg)]
+  `(let [[^String m# ^Throwable t#] (handle-log-args ~@msg)]
     (.warn (logger ~*ns*) m# t#)))

 (defmacro error
   "Logs as error."
   [& msg]
-  `(let [[m# t#] (handle-log-args ~@msg)]
+  `(let [[^String m# ^Throwable t#] (handle-log-args ~@msg)]
      (.error (logger ~*ns*) m# t#)))

 (defmacro info
   "Logs as info."
   [& msg]
-  `(let [[m# t#] (handle-log-args ~@msg)]
+  `(let [[^String m# ^Throwable t#] (handle-log-args ~@msg)]
      (.info (logger ~*ns*) m# t#)))

 (defmacro debug
   "Logs as debug."
   [& msg]
-  `(let [[m# t#] (handle-log-args ~@msg)]
+  `(let [[^String m# ^Throwable t#] (handle-log-args ~@msg)]
      (.debug (logger ~*ns*) m# t#)))


Save traces and detail expansions to localstorage

fixes #54

--- src/day8/re_frame/trace.cljs
+++ src/day8/re_frame/trace.cljs
@@ -94,7 +94,8 @@
                 (real-schedule)))))

-(def traces (interop/ratom []))
+(def traces (interop/ratom (localstorage/get "traces" [])))
+
 (defn log-trace? [trace]
   (let [rendering? (= (:op-type trace) :render)]
     (if-not rendering?
@@ -191,7 +192,15 @@
         filter-items               (r/atom (localstorage/get "filter-items" []))
         filter-type                (r/atom :contains)
         input-error                (r/atom false)
-        trace-detail-expansions    (r/atom {:show-all? false :overrides {}})]
+        trace-detail-expansions    (r/atom (localstorage/get "trace-detail-expansion" {:show-all? false :overrides {}}))]
+    (add-watch traces
+               :update-traces
+               (fn [_ _ _ new-state]
+                 (localstorage/save! "traces" new-state)))
+    (add-watch trace-detail-expansions
+               :update-trace-detail-expansions
+               (fn [_ _ _ new-state]
+                 (localstorage/save! "trace-detail-expansion" new-state)))
     (add-watch filter-items
                :update-localstorage
                (fn [_ _ _ new-state]


twerk

twerk

--- src/hyper/terse.clj
+++ src/hyper/terse.clj
@@ -66,7 +66,7 @@
   (let [forms (html-recur body)]
     `~(if (= 1 (count forms))
           (first forms)
-          (concat ['om.dom/div (js-obj)] forms))))
+          (concat ['om.dom/div '(js-obj)] forms))))

 '(fun stuff)


fn to unescape html entities

fn to unescape html entities

--- src/discuss/utils/views.cljs
+++ src/discuss/utils/views.cljs
@@ -1,5 +1,6 @@
 (ns discuss.utils.views
-  (:require [om.core :as om :include-macros true]
+  (:require [goog.string :as gstring]
+            [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true]))

 (defn fa-icon
@@ -22,6 +23,12 @@
   "Creates DOM element with interpreted HTML."
   [string]
   (dom/span #js {:dangerouslySetInnerHTML #js {:__html string}}))
+
+(defn html->str
+  "Unescape HTML entities and return a string."
+  [escaped]
+  (when (string? escaped)
+    (gstring/unescapeEntities escaped)))

 (defn commit-component-state
   "Set local state of view, parse the value of the target of val."


test suite

test suite

--- src/flatgui/test.clj
+++ src/flatgui/test.clj
@@ -64,7 +64,11 @@
   (FGTestAppContainer/loadSourceCreateAndInit c-path c-ns c-name))

 (defn create-container [c-var]
-  (FGTestAppContainer/createAndInit c-var))
+  (if (coll? c-var)
+    (let [c (FGTestAppContainer/createAndInit (first c-var))]
+      ((second c-var) c)
+      c)
+    (FGTestAppContainer/createAndInit c-var)))

 (defn init-container [c]
   (FGTestAppContainer/init c))
@@ -90,6 +94,39 @@
   (wait-for-property-pred container target property (fn [v] (= expected-value v))))

 ;;
+;; Combining test into scenarios
+;;
+
+(def standard-interstep-delay-millis 100)
+
+(defn- gen-wait [clause] (list 'Thread/sleep (list '* clause standard-interstep-delay-millis)))
+
+(defn- ensure-size [s size] (map #(if (< % (count s)) (nth s %)) (range size)))
+
+(defn interleave-long [& colls]
+  (let [max-size (count (apply max-key count colls))]
+    (filter #(not (nil? %)) (apply interleave (map (fn [c] (ensure-size c max-size)) colls)))))
+
+(declare clause-processor)
+
+(defn clause-processor [clause]
+  (cond
+
+    (number? clause)
+    (gen-wait clause)
+
+    (and (seq? clause) (= 'inter (first clause)))
+    (map clause-processor (apply interleave-long (rest clause)))
+
+    :else clause))
+
+(defmacro defscenario [scenario-name container-var-coll & clauses]
+  (let [scenario (map clause-processor clauses)]
+    (list 'clojure.test/deftest scenario-name
+          (concat (list 'let ['containers (list 'mapv (list 'fn ['cv] (list 'flatgui.test/create-container 'cv)) container-var-coll)
+                              'container (list 'nth 'containers 0)]) scenario))))
+
+;;
 ;; Mouse
 ;;


Mmmm, more booleans

Mmmm, more booleans

--- src/overcode/introvert.cljs
+++ src/overcode/introvert.cljs
@@ -73,19 +73,18 @@
 (defn deep=
   "Compares JS values for equality by value instead of by reference."
   ([val1 val2 visited]
-   (cond
+   (or
     (identical? val1 val2)
-    true

-    (and (arr? val1) (arr? val2))
-    (and (= (count val1) (count val2))
+    (and (arr? val1) (arr? val2)
+         (= (count val1) (count val2))
          (every? true? (map #(deep= %1 %2 visited) val1 val2)))

-    (and (obj? val1) (obj? val2))
-    (and (= (obj-size val1) (obj-size val2))
+    (and (obj? val1) (obj? val2)
+         (= (obj-size val1) (obj-size val2))
          (every? true? (map #(deep= %1 %2 visited) (js/Object.keys val1) (js/Object.keys val2)))
          (every? #(deep= (aget val1 %) (aget val2 %) visited) (js/Object.keys val1)))

-    :else (= val1 val2)))
+    (= val1 val2)))

   ([val1 val2] (deep= val1 val2 (atom {}))))


use str helper fn

use str helper fn

--- src/overtone/repl/ugens.clj
+++ src/overtone/repl/ugens.clj
@@ -1,7 +1,8 @@
 (ns overtone.repl.ugens
   (:use [clojure.repl]
         [overtone.sc.machinery.ugen fn-gen specs]
-        [overtone.util lib doc]))
+        [overtone.util lib doc]
+        [overtone.helpers.string]))

 (defn- map-terms-to-regexps
   "convert a list of patterns/objects to a list of patterns by not modifying
@@ -9,9 +10,7 @@
   to regex patterns. Typically the other obects will be standard strings."
   [terms]
   (map (fn [term]
-         (if (= java.util.regex.Pattern (type term))
-           term
-           (re-pattern (str term))))
+         (str->regex term))
        terms))

 (defn- find-matching-ugen-specs


Remove the stray command options

Remove the stray command options

It seems to cause problem for mingw-make, even it's commented out.

--- make/makefile.boot
+++ make/makefile.boot
@@ -119,7 +119,6 @@
 		RIGOROUS="$(RIGOROUS)" WITH_FFI="$(WITH_FFI)" \
 		WITH_TCC="$(WITH_TCC)" STATIC="$(STATIC)" \
 		OPTIMIZE="$(OPTIMIZE)" TARGET=makefile CONFIG="$(CONFIG)"
-		#SYMBOLS="$(SYMBOLS)"

 # Synonym for `make -f makefile.boot makefile` which can also be used in the
 # generated makefile (without causing repeated regenerations)


Add print-method preference for Memory Store

--- src/io/cyanite/store.clj
+++ src/io/cyanite/store.clj
@@ -88,6 +88,8 @@
                          (:time metric)]
                         (constantly (select-keys metric [:max :min :sum :mean])))))))

+(prefer-method print-method clojure.lang.IPersistentMap clojure.lang.IDeref)
+
 (defmulti build-store (comp (fnil keyword "cassandra-v2") :type))

 (defmethod build-store :cassandra-v2


Click handler poc

Click handler poc

--- src/grid/render.cljs
+++ src/grid/render.cljs
@@ -8,10 +8,13 @@
   (apply d/tr {}
         (map (fn [key] (d/td {} (get data key))) (map :key header))))

+(defn handle-header-click [key]
+  (js/alert "Du klikket header"))
+
 (defn render-header [header]
   (d/thead {}
            (apply d/tr {}
-                 (map (fn [h] (d/th {:className (:className h)} (:title h))) header))))
+                 (map (fn [h] (d/th {:className (:className h) :onClick (:onClick h)} (:title h))) header))))

 (q/defcomponent Grid
   [meta data]
@@ -31,9 +34,9 @@
                           :email "frank.bolviken@gmail.com"
                           :country "Norway"}]})

-(def my-meta {:header [{:key :email :title "Email" :className "email"}
+(def my-meta {:header [{:key :email :title "Email" :className "email" :onClick (fn [event, reactId] (js/alert "Du klikket paa email"))}
                        {:key :name :title "Name"}
                        {:key :country :title "Country"}]})
-
+
 (q/render (Grid my-meta my-data)
           (.getElementById js/document "grid"))


Add the widget's current value when firing an input event.

--- src/fm/simrunner/gui/wiring.clj
+++ src/fm/simrunner/gui/wiring.clj
@@ -21,11 +21,17 @@
       (.addDocumentListener (reify
                               DocumentListener
                               (insertUpdate [this event]
-                                (on-event :input-changed input))
+                                (on-event :input-changed
+                                          input
+                                          (-> input :widget .getText)))
                               (removeUpdate [this event]
-                                (on-event :input-changed input))
+                                (on-event :input-changed
+                                          input
+                                          (-> input :widget .getText)))
                               (changedUpdate [this event]
-                                (on-event :input-changed input))))))
+                                (on-event :input-changed
+                                          input
+                                          (-> input :widget .getText)))))))

 (defmethod wire-input :checkbox-input [input on-event]
   (-> input
@@ -33,7 +39,9 @@
       (.addActionListener (reify
                             ActionListener
                             (actionPerformed [this event]
-                              (on-event :input-changed input))))))
+                              (on-event :input-changed
+                                        input
+                                        (-> input :widget .isSelected)))))))

 (defmethod wire-input :select-input [input on-event]
   (let [select-button (-> input :contents :select-button)]


Disable generators for newer?

Disable generators for newer?

Because of an upstream bug https://github.com/grimradical/clj-semver/issues/7

--- src/github_changelog/semver.clj
+++ src/github_changelog/semver.clj
@@ -40,7 +40,8 @@

 (s/def ::types #{:major :minor :patch :pre-release :build})

-(def newer? semver/newer?)
+;; TODO: https://github.com/grimradical/clj-semver/issues/7
+(def ^:no-gen newer? semver/newer?)

 (s/fdef newer?
   :args (s/cat :a ::version-or-string :b ::version-or-string)


Fix a whitespace mistake I introduced

Fix a whitespace mistake I introduced


Delete a function I started writing but never finished

--- src/foreclojure/problems.clj
+++ src/foreclojure/problems.clj
@@ -112,9 +112,6 @@
                (login-link "log in") " we can track your progress."))]
     (session/session-put! :code [id code])
     (flash-msg (str message " " gist-link) (str "/problem/" id))))
-
-(defn read-whole-string [s]
-  ())

 (def restricted-list '[use require in-ns future agent send send-off pmap pcalls])


omit unnecessary cons'ing of the identity parser

--- src/keypin/util.clj
+++ src/keypin/util.clj
@@ -68,11 +68,13 @@
   "Compose multiple parsers (where parser is arity-2 fn accepting key and parseable value) into one. Composition is
   applied right-to-left, as in `clojure.core/comp`."
   [& parsers]
-  (fn [the-key parseable-val]
-    (as-> (cons identity-parser parsers) $
-      (map partial $ (repeat the-key))
-      (apply comp $)
-      ($ parseable-val))))
+  (if (seq parsers)
+    (fn [the-key parseable-val]
+      (as-> parsers $
+        (map partial $ (repeat the-key))
+        (apply comp $)
+        ($ parseable-val)))
+    identity-parser))

 ;; ----- string value parsers -----


Bootstrap 2.3 whatever rubbish

Bootstrap 2.3 whatever rubbish

--- src/golden_kestrel/core.cljs
+++ src/golden_kestrel/core.cljs
@@ -41,57 +41,77 @@

 (defn embed-form [data owner]
   (let [change-data (partial update-app data)]
-    (dom/div
-      nil
-      (dom/div #js {:className "form-control"}
-               (dom/label nil "Badge type")
-               (dom/select #js {:ref "badgeType"
-                                :value (:badge-type data)
-                                :defaultValue (:badge-type data)
-                                :onChange (partial change-data :badge-type)}
-                           (dom/option #js {:value ""} "Default")
-                           (dom/option #js {:value "1"} "1")
-                           (dom/option #js {:value "4"} "4")
-                           (dom/option #js {:value "donut"} "Donut")
-                           (dom/option #js {:value "medium-donut"} "Medium donut")
-                           (dom/option #js {:value "large-donut"} "Large donut")))
-      (dom/div #js {:className "form-control"}
-               (dom/label nil "Popover")
-               (dom/select #js {:ref "popover"
-                                :value (:popover data)
-                                :defaultValue (if (= "" (:badge-details data))
-                                                (:popover data)
-                                                "")
-                                :onChange (partial change-data :popover)}
-                           (dom/option #js {:value ""} "None")
-                           (dom/option #js {:value "top"} "Top")
-                           (dom/option #js {:value "right"} "Right")
-                           (dom/option #js {:value "bottom"} "Bottom")
-                           (dom/option #js {:value "left"} "Left")))
-      (dom/div #js {:className "form-control"}
-               (dom/label nil "Details")
-               (dom/select #js {:ref "details"
-                                :value (:badge-details data)
-                                :defaultValue (if (= "" (:popover data))
-                                                (:badge-details data)
-                                                "")
-                                :onChange (partial change-data :badge-details)}
-                           (dom/option #js {:value ""} "None")
-                           (dom/option #js {:value "right"} "Right")))
-      (dom/div #js {:className "form-control"}
-               (dom/label nil "Hide no mentions?")
-               (dom/input #js {:ref "hideNoMentions"
-                               :type "checkbox"
-                               :checked (:hide-no-mentions data)
-                               :onChange (partial change-data :hide-no-mentions)}
-                          nil))
-      (dom/div #js {:className "form-control"}
-               (dom/label nil "DOI")
-               (dom/input #js {:ref "doi"
-                               :type "text"
-                               :size "40"
-                               :defaultValue (:doi data)
-                               :onChange (partial change-data :doi)} nil)))))
+    (dom/form
+      #js {:className "form-horizontal"}
+      (dom/div
+        #js {:className "control-group"}
+        (dom/label #js {:className "control-label"}
+                   "Badge type")
+        (dom/div
+          #js {:className "controls"}
+          (dom/select #js {:ref "badgeType"
+                           :value (:badge-type data)
+                           :defaultValue (:badge-type data)
+                           :onChange (partial change-data :badge-type)}
+                      (dom/option #js {:value ""} "Default")
+                      (dom/option #js {:value "1"} "1")
+                      (dom/option #js {:value "4"} "4")
+                      (dom/option #js {:value "donut"} "Donut")
+                      (dom/option #js {:value "medium-donut"} "Medium donut")
+                      (dom/option #js {:value "large-donut"} "Large donut"))))
+      (dom/div
+        #js {:className "control-group"}
+        (dom/label #js {:className "control-label"}
+                   "Popover")
+        (dom/div
+          #js {:className "controls"}
+          (dom/select #js {:ref "popover"
+                           :value (:popover data)
+                           :defaultValue (if (= "" (:badge-details data))
+                                           (:popover data)
+                                           "")
+                           :onChange (partial change-data :popover)}
+                      (dom/option #js {:value ""} "None")
+                      (dom/option #js {:value "top"} "Top")
+                      (dom/option #js {:value "right"} "Right")
+                      (dom/option #js {:value "bottom"} "Bottom")
+                      (dom/option #js {:value "left"} "Left"))))
+      (dom/div
+        #js {:className "control-group"}
+        (dom/label #js {:className "control-label"}
+                   "Details")
+        (dom/div
+          #js {:className "controls"}
+          (dom/select #js {:ref "details"
+                           :value (:badge-details data)
+                           :defaultValue (if (= "" (:popover data))
+                                           (:badge-details data)
+                                           "")
+                           :onChange (partial change-data :badge-details)}
+                      (dom/option #js {:value ""} "None")
+                      (dom/option #js {:value "right"} "Right"))))
+      (dom/div
+        #js {:className "control-group"}
+        (dom/label #js {:className "control-label"}
+                   "Hide no mentions?")
+        (dom/div
+          #js {:className "controls"}
+          (dom/input #js {:ref "hideNoMentions"
+                          :type "checkbox"
+                          :checked (:hide-no-mentions data)
+                          :onChange (partial change-data :hide-no-mentions)}
+                     nil)))
+      (dom/div
+        #js {:className "control-group"}
+        (dom/label #js {:className "control-label"}
+                   "DOI")
+        (dom/div
+          #js {:className "controls"}
+          (dom/input #js {:ref "doi"
+                          :type "text"
+                          :size "40"
+                          :defaultValue (:doi data)
+                          :onChange (partial change-data :doi)} nil))))))

 (defn find-or-create-element
   [root class-name]


add introspection query

add introspection query

--- src/graphql_clj/executor.clj
+++ src/graphql_clj/executor.clj
@@ -247,4 +247,97 @@
       (println (f)))
     f))

-;; (execute nil test-validated-schema test-resolver-fn test-validated-statement nil)
+;; (execute nil test-validated-schema test-resolver-fn test-validated-document nil)
+
+(def test-intro-str
+  "
+  query IntrospectionQuery {
+    __schema {
+      queryType { name }
+      mutationType { name }
+      types {
+        ...FullType
+      }
+      directives {
+        name
+        description
+        locations
+        args {
+          ...InputValue
+        }
+      }
+    }
+  }
+
+  fragment FullType on __Type {
+    kind
+    name
+    description
+    fields(includeDeprecated: true) {
+      name
+      description
+      args {
+        ...InputValue
+      }
+      type {
+        ...TypeRef
+      }
+      isDeprecated
+      deprecationReason
+    }
+    inputFields {
+      ...InputValue
+    }
+    interfaces {
+      ...TypeRef
+    }
+    enumValues(includeDeprecated: true) {
+      name
+      description
+      isDeprecated
+      deprecationReason
+    }
+    possibleTypes {
+      ...TypeRef
+    }
+  }
+
+  fragment InputValue on __InputValue {
+    name
+    description
+    type { ...TypeRef }
+    defaultValue
+  }
+
+  fragment TypeRef on __Type {
+    kind
+    name
+    ofType {
+      kind
+      name
+      ofType {
+        kind
+        name
+        ofType {
+          kind
+          name
+          ofType {
+            kind
+            name
+            ofType {
+              kind
+              name
+              ofType {
+                kind
+                name
+                ofType {
+                  kind
+                  name
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }")


WIP: improved input data process implementation.

--- src/igorle/core.cljs
+++ src/igorle/core.cljs
@@ -15,14 +15,16 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (defn- handle-input-data
-  [inputpub msgbus]
-  (let [c (a/chan 256)]
+  [client]
+  (let [c (a/chan 256)
+        pub (:inputpub client)
+        bus (:msgbus client)]
     (a/sub inputpub :socket/message c)
     (a/go-loop []
       (when-let [message (a/<! c)]
         (try
           (->> (postal/parse message)
-               (a/>! msgbus))
+               (a/>! bus))
           (catch js/Error e
             (log/error e)
             ;; TODO: put the error in a error channel


~p100


util/context.clj: fixed misspelling

util/context.clj: fixed misspelling

--- src/org/altlaw/util/context.clj
+++ src/org/altlaw/util/context.clj
@@ -20,14 +20,14 @@
 (defmulti #^{:private true} extract-context class)

 (defmethod extract-context java.util.Properties [props]
-  (extract-content-with #(.getProperty props %)))
+  (extract-context-with #(.getProperty props %)))

 (defmethod extract-context org.restlet.Context [context]
   (let [attrs (.getAttributes context)]
-    (extract-content-with #(.get attrs %))))
+    (extract-context-with #(.get attrs %))))

 (defmethod extract-context org.apache.hadoop.conf.Configuration [config]
-  (extract-content-with #(.get config %)))
+  (extract-context-with #(.get config %)))

 ;;; PUBLIC


Update email verification copy.

Update email verification copy.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -61,7 +61,7 @@
 (def reset-button-text "reset_password")

 (def verify-message "Please verify your email")
-(def verify-instructions "Welcome to Carrot! Carrot is a personalized news feed that keeps your team in sync with fewer interruptions.")
+(def verify-instructions "Welcome to Carrot! Carrot is a personalized news feed for your team. With Carrot, it's easy to stay in sync with fewer interruptions.")
 (def verify-instructions-2 "Please click the link below to verify your account:")
 (def verify-button-text "verify_email")


Support CORS in SSE endpoint too

Support CORS in SSE endpoint too

--- src/org/spootnik/fleet/http.clj
+++ src/org/spootnik/fleet/http.clj
@@ -13,7 +13,7 @@
             [org.spootnik.fleet.engine      :as engine]
             [org.spootnik.fleet.history     :as history]
             [org.httpkit.server             :as http]
-            [ring.middleware.cors           :refer [wrap-cors]]))
+            [ring.middleware.cors           :refer [wrap-cors cors-hdrs]]))

 (defn json-response
   [body]
@@ -22,62 +22,69 @@
    :body (generate-string body)})

 (defn api-routes
-  [scenarios engine]
+  [scenarios engine {:keys [origins] :or {origins []}}]

-  (routes
-   (GET "/scenarios" []
-        (json-response (api/all! scenarios)))
+  (let [patterns (mapv re-pattern origins)]
+    (routes
+     (GET "/scenarios" []
+          (json-response (api/all! scenarios)))

-   (POST "/scenarios" {scenario :body}
-         (json-response (api/upsert! scenarios scenario)))
+     (POST "/scenarios" {scenario :body}
+           (json-response (api/upsert! scenarios scenario)))

-   (PUT "/scenarios" []
-        (json-response (api/save! scenarios)))
+     (PUT "/scenarios" []
+          (json-response (api/save! scenarios)))

-   (GET "/scenarios/:script_name" [script_name]
-        (json-response (api/get! scenarios script_name)))
+     (GET "/scenarios/:script_name" [script_name]
+          (json-response (api/get! scenarios script_name)))

-   (DELETE "/scenarios/:script_name" [script_name]
-           (json-response (api/delete! scenarios script_name)))
+     (DELETE "/scenarios/:script_name" [script_name]
+             (json-response (api/delete! scenarios script_name)))

-   (GET "/scenarios/:script_name/history" [script_name]
-        (json-response (history/fetch scenarios script_name)))
+     (GET "/scenarios/:script_name/history" [script_name]
+          (json-response (history/fetch scenarios script_name)))

-   (GET "/scenarios/:script_name/executions" request
-        (let [script_name (-> request :params :script_name)
-              args        (if-let [args (-> request :params :args)]
-                            (if (sequential? args) args [args])
-                            [])
-              scenario    (api/get! scenarios script_name)
-              profile     (-> request :params :profile keyword)
-              ch          (async/chan 10)]
-          (http/with-channel request hchan
-            (future
-              (try
-                (doseq [msg (repeatedly #(async/<!! ch))
-                        :while msg
-                        :when msg]
-                  (history/update script_name msg)
-                  (http/send! hchan
-                              {:status 200
-                               :headers {"Content-Type" "text/event-stream"
-                                         "X-Accel-Buffering" "no"
-                                         "Cache-Control" "no-cache"}
-                               :body (format "data: %s\n\n"
-                                             (generate-string msg))}
-                              false))
-                (http/close hchan)
-                (catch Exception e
-                  (error e "cannot handle incoming message"))))
-            (engine/request engine
-                            (api/prepare scenario profile args)
-                            ch))))
+     (GET "/scenarios/:script_name/executions" request
+          (let [script_name (-> request :params :script_name)
+                args        (if-let [args (-> request :params :args)]
+                              (if (sequential? args) args [args])
+                              [])
+                scenario    (api/get! scenarios script_name)
+                profile     (-> request :params :profile keyword)
+                ch          (async/chan 10)
+                headers     {"Content-Type" "text/event-stream"
+                             "X-Accel-Buffering" "no"
+                             "Cache-Control" "no-cache"}
+                origin      (get-in request [:headers "origin"])
+                valid-cors  (and origin (some #(re-find % origin) patterns))
+                headers     (if valid-cors
+                              (merge (cors-hdrs (request :headers)) headers)
+                              headers)]
+            (http/with-channel request hchan
+              (future
+                (try
+                  (doseq [msg (repeatedly #(async/<!! ch))
+                          :while msg
+                          :when msg]
+                    (history/update script_name msg)
+                    (http/send! hchan
+                                {:status 200
+                                 :headers headers
+                                 :body (format "data: %s\n\n"
+                                               (generate-string msg))}
+                                false))
+                  (http/close hchan)
+                  (catch Exception e
+                    (error e "cannot handle incoming message"))))
+              (engine/request engine
+                              (api/prepare scenario profile args)
+                              ch))))

-   ;; defaults
-   (GET "/" []      (redirect "/index.html"))
-   (route/resources "/")
-   (route/not-found {:status 404 :body
-                     (generate-string {:status "no such resource"})})))
+     ;; defaults
+     (GET "/" []      (redirect "/index.html"))
+     (route/resources "/")
+     (route/not-found {:status 404 :body
+                       (generate-string {:status "no such resource"})}))))

 (defn wrap-error
   [handler]
@@ -98,7 +105,7 @@
 (defn start-http
   [scenarios engine opts]
   (api/load! scenarios)
-  (http/run-server (-> (api-routes scenarios engine)
+  (http/run-server (-> (api-routes scenarios engine opts)
                        (wrap-error)
                        (wrap-keyword-params)
                        (wrap-params)


working out match

working out match

--- src/ophion/aggregate.clj
+++ src/ophion/aggregate.clj
@@ -16,15 +16,11 @@
   (str "$" (name s)))

 (defn dedup
-  []
-  [{:$group {:_id "$gid" :dedup {:$first "$$ROOT"}}}
-   {:$replaceRoot {:newRoot "$dedup"}}])
-
-(defn dedup-on
-  [field]
-  (let [path (dollar field)]
-    [{:$group {:_id path :dedup {:$first "$$ROOT"}}}
-     {:$replaceRoot {:newRoot "$dedup"}}]))
+  ([] (dedup "gid"))
+  ([field]
+   (let [path (dollar field)]
+     [{:$group {:_id path :dedup {:$first "$$ROOT"}}}
+      {:$replaceRoot {:newRoot "$dedup"}}])))

     ;; {:$group {:_id dollar (keyword field) {:$first dollar} :_history {:$addToSet "$_history"}}}

@@ -102,20 +98,20 @@
     (to-edge edge-label)
     (to-vertex vertex-label where))))

-(defn from-dedup
+(defn from-unique
   ([edge-label vertex-label] (from-dedup edge-label vertex-label {}))
   ([edge-label vertex-label where]
    (concat
     (from-edge edge-label)
-    (dedup-on "from")
+    (dedup "from")
     (from-vertex vertex-label where))))

-(defn to-dedup
+(defn to-unique
   ([edge-label vertex-label] (to-dedup edge-label vertex-label {}))
   ([edge-label vertex-label where]
    (concat
     (to-edge edge-label)
-    (dedup-on "to")
+    (dedup "to")
     (to-vertex vertex-label where))))

 (defn values
@@ -200,9 +196,9 @@
    (fn [out q]
      (let [label (first q)
            query (concat
-                  [{:mark label}]
+                  [[:mark label]]
                   (rest q)
-                  [{:select [label]}])
+                  [[:select [label]]])
            aggregation (translate query)
            un (unwind label)
            group (group-set label)]
@@ -248,11 +244,10 @@
    :toVertex to-vertex
    :from from
    :to to
-   :fromDedup from-dedup
-   :toDedup to-dedup
+   :fromUnique from-unique
+   :toUnique to-unique
    :root root
    :dedup dedup
-   :dedupOn dedup-on
    :where where
    :match match
    :values values