as with generation, default-fn should be specified per-rule, not per-model

--- src/babel/parse.cljc
+++ src/babel/parse.cljc
@@ -36,20 +36,19 @@
         (if (= cache-value :none) nil
             cache-value)))))

-(defn over [grammar left right morph default-fn]
+(defn over [grammar left right morph]
   "opportunity for additional logging before calling the real (over)"
   (log/trace (str "parse/over: grammar size: " (count grammar)))
   (log/debug (str "parse/over: "
                   "left: " (vec (set (map morph left)))
                   "; right: " (vec (set (map morph right)))))

-  (log/debug (str "over: rules: " (string/join ","
-                                               (map :rule grammar)) " with default-fn:" default-fn))
-  (if default-fn
-    (->>
-     (over/over grammar left right)
-     (map default-fn))
-    (over/over grammar left right)))
+  (map (fn [result]
+         (let [default-fn (:default-fn result)]
+           (if default-fn
+             (default-fn result)
+             result)))
+       (over/over grammar left right)))

 (defn square-cross-product [x]
   (mapcat (fn [each-x]
@@ -179,8 +178,7 @@
                                                       (:morph model))
                                            ;; fallback to (:morph model) if
                                            ;; (:morph-ps is not available)
-                                           trees (over (:grammar model) left-signs right-signs morph-ps
-                                                       (:default-fn model))
+                                           trees (over (:grammar model) left-signs right-signs morph-ps)
                                            truncated-trees
                                            (if parse-with-truncate
                                              (map-fn (fn [parent]


improve readability of log message

improve readability of log message

--- src/babel/writer.clj
+++ src/babel/writer.clj
@@ -218,7 +218,7 @@
                        (fo sentence)))]
         (if (nil? sentence)
           (let [warn-mesg (str "No sentence could be generated in language: " language " with spec:"
-                               spec)]
+                               (strip-refs spec))]
             (log/error warn-mesg)
             (throw (Exception. (str warn-mesg)))))
         (if (empty? surface)


Make dir work on aliases

Make dir work on aliases

--- ClojureScript/replete/src/replete/repl.cljs
+++ ClojureScript/replete/src/replete/repl.cljs
@@ -477,14 +477,23 @@
                       (print-error e)
                       (reset! current-ns ns-name))))))))))))

+(defn- resolve-ns
+  "Resolves a namespace symbol to a namespace by first checking to see if it
+  is a namespace alias."
+  [ns-sym]
+  (or (get-in @st [::ana/namespaces ana/*cljs-ns* :requires ns-sym])
+      (get-in @st [::ana/namespaces ana/*cljs-ns* :require-macros ns-sym])
+      ns-sym))
+
 (defn- dir*
   [nsname]
-  (print
-    (with-out-str
-      (run! prn
-        (distinct (sort (concat
-                          (public-syms nsname)
-                          (public-syms (add-macros-suffix nsname)))))))))
+  (let [ns (resolve-ns nsname)]
+    (print
+      (with-out-str
+        (run! prn
+          (distinct (sort (concat
+                            (public-syms ns)
+                            (public-syms (add-macros-suffix ns))))))))))

 (defn- apropos*
   [str-or-pattern]


ARM: bcm2835: remove useless variables from Makefile.boot

Neither params_phys-y nor initrd_phys-y are needed when booting with a
Device Tree. Those values are passed through the Device Tree blob. So
get rid of those variable definitions from Makefile.boot.

Signed-off-by: Thomas Petazzoni <a5d87d2bd7c424ee5cbdb4e978635bf653d5a005@free-electrons.com>
Signed-off-by: Stephen Warren <5ef2a23ba3aff51d1cfc8c113c1ec34b608b3b13@wwwdotorg.org>


Decrease word count

Decrease word count

--- markov-clj/src/markov_clj/markov.clj
+++ markov-clj/src/markov_clj/markov.clj
@@ -58,7 +58,7 @@
   (let [seed (choose-seed database)]
     (loop [{word :word :as prefix-map} {:word :head :prefix seed}
            words [(last seed)]]
-      (if (or (= :tail word) (< 20 (count words)))
+      (if (or (= :tail word) (< 15 (count words)))
         words
         (recur (next-word database prefix-map) (conj words word))))))

@@ -73,5 +73,3 @@
                                   (interpose " " ,,)
                                   (apply str ,,)))]
     (repeatedly generation-fn)))
-
-(println "\n" (first (generate (parse-corpus (slurp "resources/koleman_tweets.txt")) 1)))


add hard-drop with spacebar

add hard-drop with spacebar

--- src/client/core.cljs
+++ src/client/core.cljs
@@ -121,6 +121,13 @@
   [piece x y board]
   (every? #(coord-fits? % x y board) (:coords piece)))

+(defn get-drop-pos
+  "Get the future drop position of the given piece."
+  [piece x y board]
+  (let [collide? (fn [cy] (not (piece-fits? piece x cy board)))
+        cy (first (filter collide? (iterate inc y)))]
+    (dec cy)))
+
 ;;------------------------------------------------------------
 ;; PAINTING (for showing the game on a canvas)
 ;;------------------------------------------------------------
@@ -195,6 +202,16 @@
         n (- (count board) (count cleared-board))
         new-board (into (vec (repeat n empty-row)) cleared-board)]
     (swap! state assoc :board new-board)))
+
+(defn lock-piece!
+  "Lock the current piece into the board."
+  []
+  (let [[x y] (:position @state)
+        piece (:piece @state)
+        board (:board @state)]
+    (swap! state assoc :board (write-piece-to-board piece x y board))
+    (try-collapse!)
+    (spawn-piece!)))

 (defn go-go-gravity!
   "Starts the gravity routine."
@@ -208,10 +225,7 @@
             ny (inc y)]
         (if (piece-fits? piece x ny board)
           (swap! state assoc-in [:position 1] ny)
-          (do
-            (swap! state assoc :board (write-piece-to-board piece x y board))
-            (try-collapse!)
-            (spawn-piece!))))
+          (lock-piece!)))
       (recur))))

 ;;------------------------------------------------------------
@@ -245,6 +259,16 @@
     (if (piece-fits? new-piece x y board)
       (swap! state assoc :piece new-piece))))

+(defn hard-drop!
+  "Hard drop the current piece."
+  []
+  (let [[x y] (:position @state)
+        piece (:piece @state)
+        board (:board @state)
+        ny (get-drop-pos piece x y board)]
+    (swap! state assoc :position [x ny])
+    (lock-piece!)))
+
 (defn add-key-events
   "Add all the key inputs."
   []
@@ -255,6 +279,7 @@
            (= code (:down key-codes))  (do (try-move!  0  1) (.preventDefault e))
            (= code (:left key-codes))  (do (try-move! -1  0) (.preventDefault e))
            (= code (:right key-codes)) (do (try-move!  1  0) (.preventDefault e))
+           (= code (:space key-codes)) (do (hard-drop!)      (.preventDefault e))
            (= code (:up key-codes))    (do (try-rotate!)     (.preventDefault e)))))))

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


Wrap a line at 80 characters

Wrap a line at 80 characters

--- src/cljam/io/wig.clj
+++ src/cljam/io/wig.clj
@@ -58,7 +58,8 @@
   (update m :chr chr/normalize-chromosome-key))

 (defn- fields->map
-  "Convert vector [\"key1=value1\" \"key2=value2\" ...] to map {:key1 \"value1\" :key2 \"value2\" ...}."
+  "Convert vector [\"key1=value1\" \"key2=value2\" ...] to map
+  {:key1 \"value1\" :key2 \"value2\" ...}."
   [fields]
   (into {}
         (map (fn [field]
@@ -84,17 +85,29 @@
                  (case (first fields)
                    ; declaration line of variableStep
                    "variableStep"
-                   (let [{:keys [chrom span] :or {span 1}} (->> fields rest fields->map)
+                   (let [{:keys [chrom span]
+                          :or {span 1}} (->> fields rest fields->map)
                          span (as-long span)]
-                     (deserialize (rest lines) {:format :variable-step, :chr chrom, :pre-start nil, :span span, :step nil}))
+                     (deserialize (rest lines)
+                                  {:format :variable-step
+                                   :chr chrom
+                                   :pre-start nil
+                                   :span span
+                                   :step nil}))

                    ; declaration line of fixedStep
                    "fixedStep"
-                   (let [{:keys [chrom start span step] :or {span 1, step 1}} (->> fields rest fields->map)
+                   (let [{:keys [chrom start span step]
+                          :or {span 1, step 1}} (->> fields rest fields->map)
                          step (as-long step)
                          pre-start (- (as-long start) step)
                          span (as-long span)]
-                     (deserialize (rest lines) {:format :fixed-step, :chr chrom, :pre-start pre-start, :span span, :step step}))
+                     (deserialize (rest lines)
+                                  {:format :fixed-step
+                                   :chr chrom
+                                   :pre-start pre-start
+                                   :span span
+                                   :step step}))

                    ; data line
                    (let [m (case (:format current-track)
@@ -104,19 +117,35 @@
                                    start (as-long start)
                                    end (dec (+ start span))
                                    value (str->wiggle-track-data value)]
-                               {:format :variable-step, :chr chr, :start start, :end end, :value value})
+                               {:format :variable-step
+                                :chr chr
+                                :start start
+                                :end end
+                                :value value})

                              :fixed-step
                              (let [{:keys [chr pre-start span step]} current-track
                                    start (+ pre-start step)
                                    end (dec (+ start span))
                                    value (-> fields first str->wiggle-track-data)]
-                               {:format :fixed-step, :chr chr, :start start, :end end, :value value})
-
-                             (throw (IllegalArgumentException. "Invalid wiggle format")))]
+                               {:format :fixed-step
+                                :chr chr
+                                :start start
+                                :end end
+                                :value value})
+
+                             (throw
+                               (IllegalArgumentException.
+                                 "Invalid wiggle format")))]
                      (cons m (deserialize (rest lines)
-                                          (update current-track :pre-start (fn [_] (:start m)))))))))))]
-    (deserialize lines {:format nil, :chr nil, :pre-start nil, :span nil :step nil})))
+                                          (assoc current-track
+                                                 :pre-start
+                                                 (:start m))))))))))]
+    (deserialize lines {:format nil
+                        :chr nil
+                        :pre-start nil
+                        :span nil
+                        :step nil})))

 (defn- serialize-wigs
   "Serialize a sequence of WIG fields into a lazy sequence of string."
@@ -124,7 +153,10 @@
   {:pre [;; These fields are required.
          (map (fn [wig] (every? some? ((apply juxt wig-fields) wig))) wigs)
          ;; There are two options for formatting wiggle data.
-         (map (fn [{:keys [format]} wig] (or (= format :fixed-step) (= format :variable-step))) wigs)]}
+         (map (fn [{:keys [format]} wig]
+                (or (= format :fixed-step)
+                    (= format :variable-step)))
+              wigs)]}
   (letfn [(same-track? [first-wig wig]
             (and (= (:format first-wig) (:format wig))
                  (= (- (:end first-wig) (:start first-wig))
@@ -132,31 +164,44 @@
           (serialize [wigs]
             (lazy-seq
              (when (some? (first wigs))
-               (let [[track rest-wigs] (split-with (partial same-track? (first wigs)) wigs)
+               (let [[track rest-wigs] (split-with (partial same-track?
+                                                            (first wigs))
+                                                   wigs)
                      track (case (-> track first :format)
                              :variable-step
                              (let [{:keys [chr start end]} (first track)
                                    span (inc (- end start))
-                                   declaration-line (->> (cond-> ["variableStep" (str "chrom=" chr)]
-                                                           (not= span 1) (conj (str "span=" span)))
+                                   declaration-line (->> (cond-> ["variableStep"
+                                                                  (str "chrom=" chr)]
+                                                           (not= span 1)
+                                                           (conj (str "span=" span)))
                                                          (cstr/join \space))
                                    data-lines (->> track
-                                                   (map (fn [{:keys [start value]}] (cstr/join \space [start value])))
+                                                   (map (fn [{:keys [start value]}]
+                                                          (cstr/join \space
+                                                                     [start value])))
                                                    (cstr/join \newline))]
-                               (cstr/join \newline [declaration-line data-lines]))
+                               (cstr/join \newline
+                                          [declaration-line data-lines]))

                              :fixed-step
                              (let [{:keys [chr start end]} (first track)
                                    step (- (-> track rest first :start) start)
                                    span (inc (- end start))
-                                   declaration-line (->> (cond-> ["fixedStep" (str "chrom=" chr) (str "start=" start)]
-                                                           (not= step 1) (conj (str "step=" step))
-                                                           (not= span 1) (conj (str "span=" span)))
+                                   declaration-line (->> (cond-> ["fixedStep"
+                                                                  (str "chrom=" chr)
+                                                                  (str "start=" start)]
+                                                           (not= step 1)
+                                                           (conj (str "step=" step))
+
+                                                           (not= span 1)
+                                                           (conj (str "span=" span)))
                                                          (cstr/join \space))
                                    data-lines (->> track
                                                    (map (fn [{:keys [value]}] value))
                                                    (cstr/join \newline))]
-                               (cstr/join \newline [declaration-line data-lines])))]
+                               (cstr/join \newline
+                                          [declaration-line data-lines])))]
                  (cons track (serialize rest-wigs))))))]
     (serialize wigs)))


fix typo in args comment

fix typo in args comment

--- src/clojush/args.clj
+++ src/clojush/args.clj
@@ -144,13 +144,13 @@
           :uniform-addition-rate 0.01
           ;; The probability that any instruction will have a new one added before or after it during
           ;; uniform addition.
-
+
           :uniform-addition-and-deletion-rate 0.01
           ;; The probability, per gene, for additions in the first phase, and deletions in the second
           ;; phase, of uniform-addition-and-deletion.
-
+
           :uniform-combination-and-deletion-rate 0.01
-          ;; The probability, per gene, for combinations in the first phase, and deletions in
+          ;; The probability, per gene, for combinations in the first phase, and deletions in
           ;; the second phase, of uniform-combination-and-deletion.

           :uniform-silence-mutation-rate 0.1
@@ -185,27 +185,27 @@
           ;; Specifies the genome instructions to use for autoconstruction. The default value of
           ;; :all will use all genome instructions. See load-push-argmap in this file (args.clj)
           ;; for other options.
-
+
           :autoconstructive-improve-or-diversify false
           ;; If true, the during autoconstruction a child will be allowed to survive even if it
-          ;; fails the diversification test, if it has lower errors than both of its parents
+          ;; fails the diversification test, if it has lower errors than both of its parents
           ;; on at least one case.
-
+
           :autoconstructive-clone-probability 0.0
           ;; Specifies the probability that a clone will be produced rather than the result of
           ;; actual autoconstruction, when :autoconstructive is true.
-
+
           :autoconstructive-entropy 0.0
           ;; The rate for random gene deletions after autoconstruction.
-
+
           :autoconstructive-diffmeans-children 10
           ;; When using :autoconstructive-diversification-test :diffmeans-diversifying?, specifies
           ;; how many children of each child to generate and test. See genetic-operators.clj.
-
+
           :autoconstructive-si-children 8
           ;; When using a "size and instruction" diversification test, specifies how many
           ;; children to generate and test. See genetic-operators.clj.
-
+
           :autoconstructive-fotd false
           ;; If true, autoconstruction will be performed using the 'flavor of the day' code in
           ;; genetic_operators.clj, which may change without fanfare. Other autoconstruction-related
@@ -240,7 +240,7 @@
           :track-instruction-maps false
           ;; If true, each Plush instruction map will have a UUID attached to it. If the
           ;; gene has a "parent gene", it will also have the UUID of its parent.
-
+
           ;;----------------------------------------
           ;; Arguments related to parent selection
           ;;----------------------------------------
@@ -262,7 +262,7 @@
           :lexicase-leakage 0.1
           ;; If using leaky lexicase selection, the probability that a selection event will return
           ;; a random (tourny 1) individual from the entire population.
-
+
           :lexicase-slippage 0
           ;; If using lexicase or leaky lexicase selection, the probability that each step of the
           ;; lexicase selection process will "slip" and return a random candidate from the current
@@ -282,7 +282,7 @@
           ;; :max-error), :e-over-e-plus-1 (e/(e+1) = 1 - 1/(e+1))

           :max-error 1000
-          ;; If :normalization is set to :max-error, will use this number for normalization.
+          ;; If :normalization is set to :divide-by-max-error, will use this number for normalization.

           :meta-error-categories []
           ;; A vector containing meta-error categories that can be used for parent selection, but
@@ -299,32 +299,32 @@
           :print-selection-counts false
           ;; If true, keeps track of and prints the number of times each individual was selected
           ;; to be a parent
-
+
           :self-mate-avoidance-limit 0
           ;; If non-zero, then when multiple parents are required for a genetic operator, an
           ;; effort will be made to select parents not equal to the first parent. The value
           ;; of this parameter is the number of re-selections that will be performed to try
           ;; to find a different parent, before using the same parent if the limit is exceeded.
-
+
           :age-mediated-parent-selection false
           ;; If truthy, should be a vector of [pmin pmax]. In this case, then with probability
           ;; pmin, parent selection will consider only individuals with the minimum age in
           ;; the population; with probability pmax, all individuals will be considered; with
-          ;; probability (- 1.0 pmin pmax) an age cutoff will be chosen uniformly from
-          ;; those present in the population, and only individuals with the cutoff age or
+          ;; probability (- 1.0 pmin pmax) an age cutoff will be chosen uniformly from
+          ;; those present in the population, and only individuals with the cutoff age or
           ;; lower will be considered.
           ;;
           ;; NOTE: It doesn't make any sense to use this unless you have multiple ages in the
           ;; population, as you migh have, for example, from using the genesis operator or
           ;; autoconstruction.
-
+
           :age-combining-function :average
           ;; For genetic operators that involve multiple parents, the function used to combine
           ;; the incremented ages of the parents to produce the age of the child.
-
+
           :random-screen false
           ;; If truthy, should be a map with values for :criterion, :probability and possibly
-          ;; :reversible. In this case, then with probability :probability, each parent
+          ;; :reversible. In this case, then with probability :probability, each parent
           ;; selection event will consider only individuals with :grain-size equal to or less
           ;; than a :grain-size chosen randomly from those present in the population. The
           ;; :criterion (see genetic-operators.clj for options) determines how :grain-size is
@@ -413,7 +413,7 @@

           :print-homology-data false
           ;; If true, prints the homology statistics.
-
+
           :exit-on-success true
           ;; When true, will exit the run when there is an individual with a zero-error vector

@@ -479,7 +479,7 @@
     (swap! push-argmap assoc :epigenetic-markers [:close :silent])
     (doseq [instr (case (:autoconstructive-genome-instructions @push-argmap)
                     :all (registered-for-stacks [:integer :boolean :exec :genome :float :tag])
-                    :gene-oriented (concat (registered-for-stacks
+                    :gene-oriented (concat (registered-for-stacks
                                              [:integer :boolean :exec :float :tag])
                                            '(genome_pop
                                               genome_dup
@@ -509,7 +509,7 @@
                                               genome_parent2
                                               autoconstructive_integer_rand
                                               autoconstructive_boolean_rand))
-                    :uniform (concat (registered-for-stacks
+                    :uniform (concat (registered-for-stacks
                                        [:integer :boolean :exec :float :tag])
                                      '(genome_pop
                                         genome_dup
@@ -545,45 +545,45 @@
                                         genome_uniform_crossover)))]
       (when (not (some #{instr} (:atom-generators @push-argmap)))
         (swap! push-argmap assoc :atom-generators (conj (:atom-generators @push-argmap) instr))))
-    (swap! push-argmap assoc
-           :atom-generators (conj (:atom-generators @push-argmap)
+    (swap! push-argmap assoc
+           :atom-generators (conj (:atom-generators @push-argmap)
                                   (fn [] (lrand))))
-    (swap! push-argmap assoc
-           :atom-generators (conj (:atom-generators @push-argmap)
+    (swap! push-argmap assoc
+           :atom-generators (conj (:atom-generators @push-argmap)
                                   (fn [] (lrand-int 100))))
-    (swap! push-argmap assoc
-           :atom-generators (conj (:atom-generators @push-argmap)
+    (swap! push-argmap assoc
+           :atom-generators (conj (:atom-generators @push-argmap)
                                   (fn [] (lrand-nth [true false]))))
-    (swap! push-argmap assoc
-           :atom-generators (conj (:atom-generators @push-argmap)
+    (swap! push-argmap assoc
+           :atom-generators (conj (:atom-generators @push-argmap)
                                   (tag-instruction-erc [:integer :boolean :exec :float] 10000)))
-    (swap! push-argmap assoc
-           :atom-generators (conj (:atom-generators @push-argmap)
+    (swap! push-argmap assoc
+           :atom-generators (conj (:atom-generators @push-argmap)
                                   (untag-instruction-erc 10000)))
-    (swap! push-argmap assoc
-           :atom-generators (conj (:atom-generators @push-argmap)
+    (swap! push-argmap assoc
+           :atom-generators (conj (:atom-generators @push-argmap)
                                   (tagged-instruction-erc 10000)))
     (dotimes [n (:autoconstructive-integer-rand-enrichment @push-argmap)]
-      (swap! push-argmap assoc
+      (swap! push-argmap assoc
              :atom-generators (conj (:atom-generators @push-argmap) 'autoconstructive_integer_rand)))
     (if (neg? (:autoconstructive-integer-rand-enrichment @push-argmap))
       (swap! push-argmap assoc :atom-generators (remove #(= % 'autoconstructive_integer_rand)
                                                         (:atom-generators @push-argmap))))
     (dotimes [n (:autoconstructive-boolean-rand-enrichment @push-argmap)]
-      (swap! push-argmap assoc
+      (swap! push-argmap assoc
              :atom-generators (conj (:atom-generators @push-argmap) 'autoconstructive_boolean_rand)))
     (if (neg? (:autoconstructive-boolean-rand-enrichment @push-argmap))
-      (swap! push-argmap assoc
+      (swap! push-argmap assoc
              :atom-generators (remove #(= % 'autoconstructive_boolean_rand)
                                       (:atom-generators @push-argmap))))
-    (swap! push-argmap assoc
+    (swap! push-argmap assoc
            :replace-child-that-exceeds-size-limit-with :empty)))

 (defn reset-globals
   "Resets all Clojush globals according to values in @push-argmap. If an argmap argument is provided then it is loaded
   into @push-argmap first."
   ([]
-   (doseq [[gname gatom] (filter (fn [[a _]] (.startsWith (name a) "global-"))
+   (doseq [[gname gatom] (filter (fn [[a _]] (.startsWith (name a) "global-"))
                                  (ns-publics 'clojush.globals))]
      (if (contains? @push-argmap (keyword (.substring (name gname) (count "global-"))))
        (reset! @gatom (get @push-argmap (keyword (.substring (str gname) (count "global-")))))
@@ -591,4 +591,3 @@
   ([argmap]
    (load-push-argmap argmap)
    (reset-globals)))
-


core.async: Use `onto-chan` instead of `put-stuff-and-close`.

--- test/com/nomistech/clojure_the_language/core_async_mapping_etc_test.clj
+++ test/com/nomistech/clojure_the_language/core_async_mapping_etc_test.clj
@@ -150,36 +150,32 @@

   (let [values-from-who-knows-where (->> [0 1 nil 3 nil]
                                          (map nil->sentynil))]
-
-    (letfn [(put-stuff-and-close [c]
-              (a/go (doseq [i values-from-who-knows-where] (a/>! c i))
-                    (a/close! c)))]

-      (fact "Removing nil"
+    (fact "Removing nil"

-        (fact "In Clojure 1.6"
-          (let [wrapped-ch  (a/chan)
-                wrapping-ch (a/remove> sentynil? wrapped-ch)]
-            (put-stuff-and-close wrapping-ch)
-            (chan->seq wrapped-ch))
-          => [0 1 3])
+      (fact "In Clojure 1.6"
+        (let [wrapped-ch  (a/chan)
+              wrapping-ch (a/remove> sentynil? wrapped-ch)]
+          (a/onto-chan wrapping-ch values-from-who-knows-where)
+          (chan->seq wrapped-ch))
+        => [0 1 3])

-        (fact "In Clojure 1.7"
-          (let [c (a/chan 1 (remove sentynil?))]
-            (put-stuff-and-close c)
-            (chan->seq c))
-          => [0 1 3]))
+      (fact "In Clojure 1.7"
+        (let [c (a/chan 1 (remove sentynil?))]
+          (a/onto-chan c values-from-who-knows-where)
+          (chan->seq c))
+        => [0 1 3]))

-      (fact "Preserving nil"
+    (fact "Preserving nil"

-        (letfn [(chan->seq-with-sentynil->nil [c]
-                  (lazy-seq
-                   (when-let [v (a/<!! c)]
-                     (cons (sentynil->nil v)
-                           (chan->seq-with-sentynil->nil c)))))]
+      (letfn [(chan->seq-with-sentynil->nil [c]
+                (lazy-seq
+                 (when-let [v (a/<!! c)]
+                   (cons (sentynil->nil v)
+                         (chan->seq-with-sentynil->nil c)))))]

-          (fact "In Clojure 1.6 & Clojure 1.7"
-            (let [c (a/chan)]
-              (put-stuff-and-close c)
-              (chan->seq-with-sentynil->nil c))
-            => [0 1 nil 3 nil]))))))
+        (fact "In Clojure 1.6 & Clojure 1.7"
+          (let [c (a/chan)]
+            (a/onto-chan c values-from-who-knows-where)
+            (chan->seq-with-sentynil->nil c))
+          => [0 1 nil 3 nil])))))


Shutdown agents after running tasks in main function

--- src/control/main.clj
+++ src/control/main.clj
@@ -67,7 +67,8 @@
 (defn- run-control [ & args]
   (do
     (load-control-file)
-    (do-begin args)))
+    (do-begin args)
+    (shutdown-agents)))

 (defn- handle-conn
   [^java.net.Socket socket]


Document api/list-namespaces

Document api/list-namespaces

--- src/grimoire/api.clj
+++ src/grimoire/api.clj
@@ -38,6 +38,9 @@
   dispatch)

 (defmulti list-namespaces
+  "Succeeds with a result Seq[Namespace] representing all Clojure namespaces in
+  the specified Version. Could succeed with an empty result. Fails if the
+  specified Version does not exist or if another Failure is encountered."

   {:arglists '[[config version-thing]]}
   dispatch)


I'll want this

I'll want this

--- src/grimoire/api.clj
+++ src/grimoire/api.clj
@@ -7,6 +7,7 @@
   (:require [grimoire.util :as util]
             [clojure.java.io :as io]
             [clojure.string :as string]
+            [cheshire.core :as json]
             [clj-semver.core :as semver]))

 (defn isa? [t o]


build in provides support transform-commonjs

--- src/jsx_fun/core.clj
+++ src/jsx_fun/core.clj
@@ -45,27 +45,28 @@
          (object-array [src options]))
        "code"))))

-(defn transform-commonjs
-  [filename src]
-  (let [js      [(SourceFile/fromCode filename src)]
-        options (set-options {:lang-in :es5 :pretty-print true}
-                  (CompilerOptions.))
-        comp    (doto (cl/make-closure-compiler)
-                  (.init '() js options))
-        root    (.parse comp (first js))]
-    (.process
-      (ProcessCommonJSModules. comp
-        (ES6ModuleLoader. comp "./")
-        false)
-      nil root)
-    (.toSource comp root)))
-
 (defn provides [^String src]
   (last
     (string/split
       (some #(when (re-find #"@providesModule" %) %)
         (string/split src #"\n"))
       #"\s+")))
+
+(defn transform-commonjs
+  ([src] (transform-commonjs (provides src) src))
+  ([provides src]
+   (let [js [(SourceFile/fromCode provides src)]
+         options (set-options {:lang-in :es5 :pretty-print true}
+                   (CompilerOptions.))
+         comp (doto (cl/make-closure-compiler)
+                (.init '() js options))
+         root (.parse comp (first js))]
+     (.process
+       (ProcessCommonJSModules. comp
+         (ES6ModuleLoader. comp "./")
+         false)
+       nil root)
+     (.toSource comp root))))

 (defn node-visitor []
   (reify
@@ -80,8 +81,8 @@
   [dir]
   (filter
     #(let [name (.getName ^File %)]
-      (and (.endsWith name ".js")
-        (not= \. (first name))))
+       (and (.endsWith name ".js")
+         (not= \. (first name))))
     (file-seq dir)))

 (defn deps-graph
@@ -121,12 +122,10 @@
   ;; we will have to extract this from @providesModule
   (println
     (transform-commonjs
-      "ScrollResponder.js"
       (transform-jsx (slurp (io/file "resources/ScrollResponder.js")))))

   (println
     (transform-commonjs
-      "StatusBarIOS"
       (transform-jsx (slurp (io/file "resources/StatusBarIOS.ios.js")))))

   (provides


correctly (?) implemented k-means algorithm

--- src/k_means/core.clj
+++ src/k_means/core.clj
@@ -51,6 +51,15 @@
   [c v]
     (for [i c :let [d (distance i v)]] d))

+(defn make-vector-rand
+  "create a vector containing n cols populated with random data"
+  ([n] (make-vector-rand n []))
+  ([n c]
+  (cond
+    (<= n 0) c
+    :else
+      (recur (dec n) (conj c [(rand-int 5000) (rand-int 5000)])))))
+
 (defn make-vector
   "create a vector containing n cols"
   ([n] (make-vector n []))
@@ -62,14 +71,15 @@

 (defn cluster
   "take a vector and cluster it via distance"
-  [g l c]
-  (cond
-    (nil? g) (recur (make-vector (count c)) l c)
-    (not-empty l)
-      (let [i (min-index (min-distance c (first l)))]
-        (recur (assoc g i (conj (nth g i) (first l))) (rest l) c))
-    :else
-    g))
+  ([g l c] (cluster g l c (make-vector (count c))))
+  ([g l c a]
+    (cond
+      (nil? g) (recur (make-vector (count c)) l c (make-vector (count c)))
+      (not-empty l)
+        (let [i (min-index (min-distance c (first l)))]
+          (recur g (rest l) c (assoc a i (conj (nth a i) (first l)))))
+      :else
+      a)))

 (defn min-vector
   "Chooses the smallest vector in a set of vectors"
@@ -82,7 +92,7 @@
     (k-means l k (choose-initial-centroids l k) (make-vector k) max-iterations))
   ([l k c g max-iterations]
     (let [t c g (cluster g l c) c (mean-centroids g)]
-      (println t c (= t c))
+      (println c)
       ; (println (still-moving? t c))
       (cond
         (> 0 max-iterations) g
@@ -93,4 +103,4 @@
 (defn -main
   "Main function for k-means"
   [& args]
-  (let [c (k-means [[1 2] [3 2] [6 3] [1 8] [9 10] [1 4] [56 67] [44 53] [43 54] [43 64] [76 56]] 3 100)] (println c)))
+  (let [c (k-means (make-vector-rand 5000) 5 100)] (println c)))


cleaned up a bit

cleaned up a bit

--- src/moomoo/core.cljs
+++ src/moomoo/core.cljs
@@ -55,10 +55,11 @@
         (println (string/join ["Saving file as: " absolute-file-path]))
         (.pipe stream (.createWriteStream fs absolute-file-path))))))

+(.on io "connection" connection)
+(.use app (.static express "public"))
+(.get app "/" #(. %2 (sendFile "public/index.html")))
+
 (defn -main []
-  (.on io "connection" connection)
-  (.use app (.static express "public"))
-  (.get app "/" #(. %2 (sendFile "public/index.html")))
   (println (string/join ["Listening on port " port]))
   (.listen server port))


rendering valid moves after red move

rendering valid moves after red move

--- src/nonaga/draw.cljs
+++ src/nonaga/draw.cljs
@@ -1,6 +1,7 @@
 (ns nonaga.draw
   (:use [nonaga.react :only [circle svg create-class render-component]])
-  (:require [nonaga.core :as n])
+  (:require [nonaga.core :as n]
+            [nonaga.rules.ball :as b])
   (:use-macros [dommy.macros :only [sel1]]))

 (defn hex->svg [[hex-x hex-y]]
@@ -35,17 +36,30 @@
 (defn draw [shape coords]
   (map (comp shape hex->svg) coords))

+(def light-colors
+  {"red" "pink"
+   "blue" "lightblue"})
+
+(defn draw-valid-marble-moves [state]
+  (let [[type & event-data] (:event state)]
+    (when (= :marble-move type)
+      (let [[color selected] event-data]
+        (draw (partial marble (light-colors (name color)))
+              (b/valid-destinations state selected))))))
+
 (def board
   (create-class
     "getInitialState"
-    (fn [] n/initial-game)
+    (fn [] (assoc n/initial-game :event [:marble-move :red [1 4]]))
     "render"
     (fn []
       (this-as this
-               (svg {}
-                 (draw ring (:rings (.-state this)))
-                 (draw (partial marble "red") (:whites (.-state this)))
-                 (draw (partial marble "blue") (:blacks (.-state this))))))))
+         (let [state (aget this "state")]
+           (svg {}
+             (draw ring (:rings state))
+             (draw (partial marble "red") (:whites state))
+             (draw (partial marble "blue") (:blacks state))
+             (draw-valid-marble-moves state)))))))

 (defn start []
   (render-component (board) (sel1 :#content)))


make note about disruptor wait strategy issue

--- src/clj/backtype/storm/disruptor.clj
+++ src/clj/backtype/storm/disruptor.clj
@@ -21,6 +21,11 @@
    :spin (fn [] (BusySpinWaitStrategy.))
     })

+
+;; NOTE: can't use :block strategy, as sometimes the consumer stays blocked even when there's an item on the queue.
+;; This would manifest itself in Trident when doing 1 batch at a time processing, and the ack_init message
+;; wouldn't make it to the acker until the batch timed out and another tuple was played into the queue,
+;; unblocking the consumer
 (defnk disruptor-queue [buffer-size :claim-strategy :multi-threaded :wait-strategy :sleep]
   (DisruptorQueue. ((CLAIM-STRATEGY claim-strategy) buffer-size)
                    ((WAIT-STRATEGY wait-strategy))


we don't need args | sg/fs | #35

we don't need args | sg/fs | #35

--- src/clj/conference_rating/server.clj
+++ src/clj/conference_rating/server.clj
@@ -47,10 +47,8 @@

 (defn -main [& args]
    (let [port (Integer/parseInt (or (env :port) "3000"))
-         {:keys [options arguments errors summary]} (cli/parse-opts args cli-options)
-         okta-active (= "--okta-active" (first args))]
+         {:keys [options _ errors summary]} (cli/parse-opts args cli-options)]
      (cond
        (:help options) (exit 0 (usage summary))
-       (not= (count arguments) 1) (exit 1 (usage summary))
        errors (exit 1 (error-msg errors)))
      (start-server port (:okta-active options) (:environment options))))


Removed try/catch block.

Removed try/catch block.

--- src/pointer/core.clj
+++ src/pointer/core.clj
@@ -24,16 +24,14 @@
   (letfn [(lineish [loc] (-> loc zip/node meta :line))
           (left-lineish [arrow-loc]     (-> arrow-loc zip/left          lineish))
           (right-lineish [arrow-loc]    (-> arrow-loc zip/right         lineish))
-          (previous-lineish [arrow-loc] (-> arrow-loc zip/prev zip/left lineish))
+          (previous-lineish [arrow-loc] (some-> arrow-loc zip/prev zip/left lineish))
           ;; Note that the preceding function only works when the form before the arrow has no :line

           (best-lineish [arrow-loc]
-            (try
-              ( (some-fn left-lineish right-lineish #(inc (previous-lineish %))) arrow-loc)
-            (catch Throwable ex
-              ;; `previous-lineish` returned nil: use the fallback-line-number
-              nil)))]
-
+                        ((some-fn left-lineish
+                                  right-lineish
+                                  #(some-> % (previous-lineish) (inc)))
+                         arrow-loc))]
     (if-let [lineish (best-lineish arrow-loc)]
       (reset! fallback-line-number lineish)
       (swap! fallback-line-number inc))))


Fixed typo of typo fix :-/

Fixed typo of typo fix :-/

--- src/leiningen/ancient/utils/test.clj
+++ src/leiningen/ancient/utils/test.clj
@@ -23,7 +23,7 @@
   (if-let [task (get-in project [:aliases "test-ancient"])]
     (let [r (run-test-task! project task)]
       (when-not r
-        (main/info "Tests failed (use ':no-tests' if you want to suppess testing)."))
+        (main/info "Tests failed (use ':no-tests' if you want to suppress testing)."))
       r)
     (do
       (main/info "No regression test task given.")


Both cases added

Both cases added

--- src/leiningen/new/figwheel/core.cljs
+++ src/leiningen/new/figwheel/core.cljs
@@ -1,11 +1,14 @@
 (ns {{name}}.core
-    (:require [om.core :as om :include-macros true]
-              [om.dom :as dom :include-macros true]
-              [figwheel.client :as fw]))
+    (:require [figwheel.client :as fw] {{#om?}}
+              [om.core :as om :include-macros true]
+              [om.dom :as dom :include-macros true] {{/om?}} {{#reagent?}}
+              [reagent.core :as reagent :refer [atom]] {{/reagent?}}
+              ))

 (enable-console-print!)

-(def app-state (atom {:text "Hello world!"}))
+(defonce app-state (atom {:text "Hello world!"}))
+{{#om?}}

 (om/root
   (fn [app owner]
@@ -14,6 +17,13 @@
         (dom/h1 nil (:text app)))))
   app-state
   {:target (. js/document (getElementById "app"))})
+{{/om?}}{{#reagent?}}
+(defn hello-world []
+  [:h1 (:text @app-state)])
+
+(reagent/render-component [hello-world]
+                          (. js/document (getElementById "app")))
+{{/reagent?}}

 (fw/start {
   :on-jsload (fn []


Fix paren.

Fix paren.

--- src/onyx/log/commands/submit_job.clj
+++ src/onyx/log/commands/submit_job.clj
@@ -75,8 +75,8 @@
                 peers (get (job->peers new) (:job allocation))]
             (when (> (count peers) (get peer-counts (:job allocation)))
               (let [peers-to-drop (drop-peers new (:job allocation) (- (count peers) (get peer-counts (:job allocation))))]
-                (when (some #{(:id peer-args)} (into #{} peers-to-drop)))))
-            [{:fn :volunteer-for-task :args {:id (:id peer-args)}}])
+                (when (some #{(:id peer-args)} (into #{} peers-to-drop))
+                  [{:fn :volunteer-for-task :args {:id (:id peer-args)}}]))))
           [{:fn :volunteer-for-task :args {:id (:id peer-args)}}])))

 (defmethod extensions/fire-side-effects! :submit-job


[hotfix][tests] Remove unused argument from db/flink-db.

--- flink-jepsen/src/jepsen/flink/db.clj
+++ flink-jepsen/src/jepsen/flink/db.clj
@@ -97,7 +97,7 @@
   (if (cu/exists? log-dir) (cu/ls-full log-dir) []))

 (defn flink-db
-  [test]
+  []
   (reify db/DB
     (setup! [_ test node]
       (c/su
@@ -131,7 +131,7 @@
   []
   (let [zk (zk/db deb-zookeeper-package)
         hadoop (hadoop/db hadoop-dist-url)
-        flink (flink-db test)]
+        flink (flink-db)]
     (combined-db [hadoop zk flink])))

 (defn exec-flink!
@@ -192,7 +192,7 @@
   (let [zk (zk/db deb-zookeeper-package)
         hadoop (hadoop/db hadoop-dist-url)
         mesos (mesos/db deb-mesos-package deb-marathon-package)
-        flink (flink-db test)]
+        flink (flink-db)]
     (combined-db [hadoop zk mesos flink])))

 (defn submit-job-with-retry!


riemann-pool: actually fire off futures to fill the pool.

This fixes :block-start true, which would never initialize the pool.

--- src/riemann/pool.clj
+++ src/riemann/pool.clj
@@ -84,8 +84,10 @@
                 open
                 close
                 regenerate-interval)
-         openers (map (fn open-pool [_] (future (grow pool)))
-                      (range size))]
+         openers (doall
+                   (map (fn open-pool [_]
+                          (future (grow pool)))
+                        (range size)))]
      (when block-start
        (doseq [worker openers] @worker))
      pool)))


Return new aggregate version when command succeeded.

--- src/rill/handler.clj
+++ src/rill/handler.clj
@@ -51,7 +51,7 @@
     (log/debug [:try-command command])
     (let [result (if-let [events (apply aggregate/handle-command primary-aggregate command rest-aggregates)]
                    (if (commit-events event-store id version events)
-                     [:ok events]
+                     [:ok events (+ version (count events))]
                      [:conflict])
                    [:rejected])]
       (log/debug [result])


update

update

--- src/service/core.clj
+++ src/service/core.clj
@@ -16,11 +16,6 @@
             (catch Exception e
               (log/warn "no PORT environment variable set, using default")
               default-port)))
-
-(defn app [req]
-  {:status  200
-   :headers {"Content-Type" "text/html"}
-   :body    "hello HTTP!"})

 (defn home []
   {:status 200


CTH-336 avoid ttl_expired messages looping

Here we check the sender of the expired message, and if the sender
is the broker we just log and drop the message, rather than trying
to tell ourselves that the message we tried to send to a client
didn't get there.

--- src/puppetlabs/cthun/broker/core.clj
+++ src/puppetlabs/cthun/broker/core.clj
@@ -123,15 +123,20 @@
   [broker :- Broker capsule :- Capsule]
   (log/warn "Message " capsule " has expired. Replying with a ttl_expired.")
   (let [message (:message capsule)
-        response_data {:id (:id message)}
-        response (-> (message/make-message)
-                     (assoc :message_type "http://puppetlabs.com/ttl_expired"
-                            :targets      [(:sender message)]
-                            :sender       "cth:///server")
-                     (message/set-expiry 3 :seconds)
-                     (message/set-json-data response_data))]
-    (s/validate p/TTLExpiredMessage response_data)
-    (accept-message-for-delivery broker (capsule/wrap response))))
+        sender  (:sender message)]
+    (if (= "cth:///server" sender)
+      (do
+        (log/error "Server generated message expired.  Dropping")
+        capsule)
+      (let [response_data {:id (:id message)}
+            response (-> (message/make-message)
+                         (assoc :message_type "http://puppetlabs.com/ttl_expired"
+                                :targets      [sender]
+                                :sender       "cth:///server")
+                         (message/set-expiry 3 :seconds)
+                         (message/set-json-data response_data))]
+        (s/validate p/TTLExpiredMessage response_data)
+        (accept-message-for-delivery broker (capsule/wrap response))))))

 (s/defn ^:always-validate handle-delivery-failure
   "If the message is not expired schedule for a future delivery by


Show inputs with workflow submission errors

--- src/cljs/org/broadinstitute/firecloud_ui/page/workspace/monitor/submission_details.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/workspace/monitor/submission_details.cljs
@@ -1,15 +1,15 @@
 (ns org.broadinstitute.firecloud-ui.page.workspace.monitor.submission-details
-  (:require
-    [dmohs.react :as react]
-    [org.broadinstitute.firecloud-ui.common :as common]
-    [org.broadinstitute.firecloud-ui.common.components :as comps]
-    [org.broadinstitute.firecloud-ui.common.icons :as icons]
-    [org.broadinstitute.firecloud-ui.common.style :as style]
-    [org.broadinstitute.firecloud-ui.common.table :as table]
-    [org.broadinstitute.firecloud-ui.page.workspace.monitor.common :as moncommon]
-    [org.broadinstitute.firecloud-ui.page.workspace.monitor.workflow-details :as workflow-details]
-    [org.broadinstitute.firecloud-ui.endpoints :as endpoints]
-    ))
+    (:require
+      [dmohs.react :as react]
+      [org.broadinstitute.firecloud-ui.common :as common]
+      [org.broadinstitute.firecloud-ui.common.components :as comps]
+      [org.broadinstitute.firecloud-ui.common.icons :as icons]
+      [org.broadinstitute.firecloud-ui.common.style :as style]
+      [org.broadinstitute.firecloud-ui.common.table :as table]
+      [org.broadinstitute.firecloud-ui.page.workspace.monitor.common :as moncommon]
+      [org.broadinstitute.firecloud-ui.page.workspace.monitor.workflow-details :as workflow-details]
+      [org.broadinstitute.firecloud-ui.endpoints :as endpoints]
+      [org.broadinstitute.firecloud-ui.utils :as utils]))

 (defn- color-for-submission [submission]
@@ -81,6 +81,15 @@
         (merge (select-keys props [:workspace-id :submission-id])
                {:workflow-id (get-in @state [:selected-workflow :id])}))]])})

+(defn- getErrorsFromInputResolutions [inputResolutions]
+  (let [errors (filter (fn [m] (contains? m "error")) inputResolutions)
+        keyedErrors (map utils/keywordize-keys errors)]
+       (map (fn [k] (:error k)) keyedErrors)))
+
+(defn- getErrorInputsFromInputResolutions [inputResolutions]
+  (let [errors (filter (fn [m] (contains? m "error")) inputResolutions)
+        keyedErrors (map utils/keywordize-keys errors)]
+       (map (fn [k] (:inputName k)) keyedErrors)))

 (react/defc WorkflowFailuresTable
   {:render
@@ -92,6 +101,12 @@
                                (str (:type entity) " " (:name entity)))
                   :content-renderer (fn [entity]
                                       (str (:name entity) " (" (:type entity) ")"))}
+                 {:header "Input" :starting-width 300 :sort-by count
+                  :content-renderer (fn [input-list]
+                                        [:div {}
+                                         (map (fn [error]
+                                                  [:div {} error])
+                                              input-list)])}
                  {:header "Errors" :starting-width 500 :sort-by count
                   :content-renderer (fn [error-list]
                                       [:div {}
@@ -101,7 +116,8 @@
        :data (:workflows props)
        :->row (fn [row]
                 [{:type (row "entityType") :name (row "entityName")}
-                 (row "errors")])}])})
+                 (getErrorInputsFromInputResolutions (row "inputResolutions"))
+                 (getErrorsFromInputResolutions (row "inputResolutions"))])}])})

 (react/defc AbortButton


CMR-1294: Added table name to index in drop statement

--- metadata-db-app/src/migrations/012_add_granule_index_with_revision_date.clj
+++ metadata-db-app/src/migrations/012_add_granule_index_with_revision_date.clj
@@ -11,7 +11,7 @@
     (try
     	(h/sql (format "create index %s_crddr on %s (concept_id, revision_id, deleted, delete_time, revision_date)"
                    t t))
-    	(h/sql "drop index crdi")
+    	(h/sql (format "drop index %s_crdi" t))
     (catch Exception e))))

 (defn down


cleanup

cleanup

--- src/splash/core.cljs
+++ src/splash/core.cljs
@@ -210,7 +210,7 @@
                 hh (/ h 2)
                 qh (/ h 4)]
             (sprite/set-pos! test-text 0 ;-200
-                                        (+ (* 0.5 qh) (- (* 0.1 qh (Math/sin (* 0.1 n))) qh))
+                             (+ (* 0.5 qh) (- (* 0.1 qh (Math/sin (* 0.1 n))) qh))
                              ))
           (<! (events/next-frame))
           (recur (inc n))))
@@ -263,7 +263,7 @@
         (doseq [s sprs] (resources/fadein s :duration 15))

         (go (loop [n 2000 c 0]
-              (when true ;(pos? n)
+              (when true                ;(pos? n)
                 (<! (events/next-frame))

                 (let [w (.-innerWidth js/window)


Only redraw the build timings graph on window resize.

--- src-cljs/frontend/components/build_timings.cljs
+++ src-cljs/frontend/components/build_timings.cljs
@@ -6,7 +6,9 @@
             [frontend.models.build :as build]
             [frontend.models.project :as project-model]
             [frontend.routes :as routes]
-            [frontend.components.common :as common])
+            [frontend.components.common :as common]
+            [goog.events :as gevents]
+            [frontend.disposable :as disposable])
   (:require-macros [frontend.utils :refer [html]]))

 (def padding-right 20)
@@ -41,14 +43,20 @@
         (.range  #js [0 (timings-width)]))))

 (defn create-root-svg [number-of-containers]
-  (-> (.select js/d3 "#build-timings")
-        (.attr "width"  (+ (timings-width)
-                           left-axis-width
-                           padding-right))
+  (let [root (.select js/d3 "#build-timings")]
+    (-> root
+        (.attr "width" (+ (timings-width)
+                         left-axis-width
+                         padding-right))
         (.attr "height" (+ (timings-height number-of-containers)
-                           top-axis-height))
-      (.append "g") ;move everything over to see the axis
-        (.attr "transform" (gstring/format "translate(%d,%d)" left-axis-width top-axis-height))))
+                          top-axis-height)))
+    (-> root
+        (.select "g")
+        (.remove))
+
+    (-> root
+        (.append "g")
+        (.attr "transform" (gstring/format "translate(%d,%d)" left-axis-width top-axis-height)))))

 (defn create-y-axis [number-of-containers]
   (let [range-start (+ bar-height (/ container-bar-height 2))
@@ -201,14 +209,23 @@

     om/IInitState
     (init-state [_]
-      {:loading? true})
+      {:loading? true
+       :drawn? false
+       :resize-key (disposable/register
+                     (gevents/listen js/window "resize" #(om/set-state! owner [:drawn?] false))
+                     gevents/unlistenByKey)})
+
+    om/IWillUnmount
+    (will-unmount [_]
+      (disposable/dispose (om/get-state owner [:resize-key])))

     om/IDidUpdate
     (did-update [_ _ _]
       (if (project-model/show-build-timing? project plan)
-        (do
+        (when-not (om/get-state owner [:drawn?])
           (draw-chart! build)
-          (om/set-state! owner [:loading?] false))
+          (om/set-state! owner [:loading?] false)
+          (om/set-state! owner [:drawn?] true))
         (analytics/track-build-timing-upsell-impression {:org-name (:org_name plan)
                                                          :reponame (:reponame project)})))
     om/IRenderState


remove printlns

remove printlns

--- src/vignette/util/image_response.clj
+++ src/vignette/util/image_response.clj
@@ -64,7 +64,6 @@

 (defn add-content-disposition-header
   ([response-map image-map object]
-   (println (filename object))
    (if-let [filename (base-filename image-map object)]
      (let [target-filename
            (if-let [requested-path


Return null when optional is absent.

Return null when optional is absent.

--- core/src/main/clojure/stone/core.clj
+++ core/src/main/clojure/stone/core.clj
@@ -19,10 +19,10 @@
   ([id granularity latestTimestamp listeners dispatcher] (TimeSeries. id granularity latestTimestamp (map -wrap-as-listener listeners) dispatcher)))

 (defn beginning [^Reader reader]
-  (.get (.beginning reader)))
+  (.orNull (.beginning reader)))

 (defn end [^Reader reader]
-  (.get (.beginning reader)))
+  (.orNull (.beginning reader)))

 (defn lazy-pairs [^Iterator iter]
   (lazy-seq


adding ip support for generating machines

--- data/celestial/fixtures/populate.clj
+++ data/celestial/fixtures/populate.clj
@@ -34,11 +34,14 @@
   (a/add-action (assoc d/redis-deploy :name "restart-tomcat"))
   (a/add-action (assoc d/redis-deploy :name "flush-cache")))

+(def host
+  (g/fmap (partial apply str)
+    (g/tuple (g/elements ["zeus-" "atlas-" "romulus-" "remus-"]) g/nat)))
+
+(def ip (g/fmap #(str "192.168.1." %) (g/such-that #(<= (.length %) 3) (g/fmap str g/nat))))
+
 (def machines
-  (g/fmap (partial zipmap [:hostname])
-     (g/tuple
-       (g/fmap (partial apply str)
-          (g/tuple (g/elements ["zeus-" "atlas-" "romulus-" "remus-"]) g/nat)))))
+  (g/fmap (partial zipmap [:hostname :ip]) (g/tuple host ip)))

 (def host-env-gen
   (g/fmap (partial zipmap [:env :type])


Update finance.clj (#139)

Update finance.clj (#139)

* Update finance.clj

Added UAE Dirham currency List.

* Update finance.clj

--- resources/languages/en/rules/finance.clj
+++ resources/languages/en/rules/finance.clj
@@ -59,6 +59,12 @@
 {:dim :unit
  :unit "INR"}

+;Emirates Currency
+"AED"
+#"(?a)AED|AED(. )?|(D|d)irhams?"
+{:dim :unit
+ :unit "AED"}
+
 "unnamed currency"
 #"(?i)(buck|balle|pouloute)s?"
 {:dim :unit}


Fix funcatron.tron.spec-testing ns misspelling

--- test/funcatron/tron/spec_testing.clj
+++ test/funcatron/tron/spec_testing.clj
@@ -1,4 +1,4 @@
-(ns funcatron.tron.util-test
+(ns funcatron.tron.spec-testing
   (:require
     [clojure.test :refer [deftest testing are is run-tests]]
     [clojure.spec.test :as stest]))


few more tests for gzip middleware

few more tests for gzip middleware

--- test/picard/test/middleware/gzip.clj
+++ test/picard/test/middleware/gzip.clj
@@ -42,7 +42,15 @@
     (GET "/" {"accept-encoding" "gzip"})
     (let [[_ _ body] (second (first (exchange-events (last-exchange))))]
       (is (= "hello world" (ungzip-body body)))
+      (is (= "gzip" ((last-response-headers) "content-encoding")))
       (is (= 200 (last-response-status))))))
+
+(deftest doesnt-gzip-without-header
+  (with-app (gzip/encoder simple-test-app)
+    (GET "/" {})
+    (is (not (= "gzip" ((last-response-headers) "content-encoding"))))
+    (is (= "hello world" (last-response-body)))
+    (is (= 200 (last-response-status)))))

 (defn- chunked-test-app
   [downstream]
@@ -79,3 +87,16 @@
                (.write baos2 buf 0 bytes-read)
                (recur))
              (is (= "hello world!\n" (String. (.toByteArray baos2)))))))))))
+
+(defn- nonsupported-content-type-app
+  [downstream]
+  (defstream
+    (request [req]
+      (downstream :response [200 {"content-type" "application/crazy""content-length" "11"} "hello world"]))))
+
+(deftest doesnt-gzip-without-appropriate-content-type
+  (with-app (gzip/encoder nonsupported-content-type-app)
+    (GET "/" {"accept-encoding" "gzip"})
+    (is (not (= "gzip" ((last-response-headers) "content-encoding"))))
+    (is (= "hello world" (last-response-body)))
+    (is (= 200 (last-response-status)))))


perform search on page load in case the browser has cached the value in the text field

--- cljs-client/cljsinfo_client/cheatsheet.cljs
+++ cljs-client/cljsinfo_client/cheatsheet.cljs
@@ -148,6 +148,7 @@
   []
   (add-events)
   (on-resize)
+  (keydown-search-input2)

   ;; put focus on the search field initially
   (if-let [search-input-el (by-id search-input-id)]


Updated client side error pages to remove all 401s and only be 404s

--- src-cljs/frontend/components/errors.cljs
+++ src-cljs/frontend/components/errors.cljs
@@ -5,7 +5,8 @@
             [frontend.components.common :as common]
             [frontend.utils :as utils :include-macros true]
             [frontend.utils.github :as gh-utils]
-            [om.core :as om :include-macros true])
+            [om.core :as om :include-macros true]
+            [frontend.utils.github :refer  [auth-url]])
   (:require-macros [frontend.utils :refer [html]]))

 (defn error-page [app owner]
@@ -13,10 +14,9 @@
     om/IRender
     (render [_]
       (let [status (get-in app [:navigation-data :status])
-            logged-in? (get-in app state/user-path)
+            logged-in?  (get-in app state/user-path)
             orig-nav-point (get-in app [:original-navigation-point])
-            _ (utils/mlog "error-page render with orig-nav-point " orig-nav-point " and logged-in? " (boolean logged-in?))
-            maybe-login-page? (some #{orig-nav-point} [:dashboard :build])]
+            _ (utils/mlog "error-page render with orig-nav-point " orig-nav-point " and logged-in? " (boolean logged-in?))]
         (html
           [:div.page.error
            [:div.jumbotron
@@ -26,10 +26,8 @@
               (cond
                 (= status 500) [:img.error-img {:src  (utils/cdn-path "/img/outer/errors/500.svg")
                                                 :alt "500"}]
-                (or (= status 401) (and (not logged-in?) maybe-login-page?)) [:img.error-img {:src (utils/cdn-path "/img/outer/errors/401.svg")
-                                                                                :alt "401"}]
-                (= status 404) [:img.error-img {:src (utils/cdn-path "/img/outer/errors/404.svg")
-                                                :alt "404"}]
+                (or (= status 404) (= status 401)) [:img.error-img {:src (utils/cdn-path "/img/outer/errors/404.svg")
+                                                                    :alt "404"}]
                 :else [:span.error-zero])]]
             [:div.container
              [:p "Something doesn't look right ..."]
@@ -39,20 +37,18 @@
                                " or "
                                [:a {:href "mailto:sayhi@circleci.com"} "contact us"]
                                "." ]
-               (or (= status 401) (and (not logged-in?) maybe-login-page?)) [:p.error-message "You'll need to "
-                                                                             [:a {:href (gh-utils/auth-url)
-                                                                                :on-click #(raise! owner [:track-external-link-clicked
-                                                                                {:event "login_click"
-                                                                                :properties {:source "401"
-                                                                                :url js/window.location.pathname}
-                                                                                :path (gh-utils/auth-url)}])}
-                                                                              "login"]
-                                                                             " or "
-                                                                             [:a {:href "/signup"
-                                                                                :on-mouse-up #(analytics/track-signup-click)}
-                                                                              " signup" ] ]
-               (= status 404) [:p.error-message "Try heading back to our "
-                               [:a {:href "/"} "homepage"]
-                               " or checking out our "
-                               [:a {:href "http://blog.circleci.com/"} "blog"]]
+               (or (= status 404) (= status 401))
+               [:p.error-message "Try heading back to our "
+                [:a {:href "/"} "homepage"]
+               (if (not logged-in?)
+                  [:span ", " [:a {:href (auth-url)
+                              :on-click #(raise! owner  [:track-external-link-clicked  {:path  (auth-url)
+                                                                                :event "login_click"
+                                                                                :properties
+                                                                                {:source "header log-in"
+                                                                                :url js/window.location.pathname}}])}
+                          "logging in"]
+                   ", or "
+                   [:a {:href "/signup"} "signing up"]]
+                  '(" or checking out our " [:a {:href "http://blog.circleci.com/"} "blog"]))]
                :else "Something completely unexpected happened")]]])))))


Cleanup

Cleanup

--- src-frontend/cljs/cljs_webrepl/core.cljs
+++ src-frontend/cljs/cljs_webrepl/core.cljs
@@ -61,6 +61,10 @@
   (-> (with-out-str (fipp/pprint data))
       (str/trim-newline)))

+(defn unescape-string [data]
+  (-> (println-str data)
+      (str/trim-newline)))
+
 (defn trigger
   "Returns a reagent class that can be used to easily add triggers
   from the map in `props`, such as :component-did-mount.  See
@@ -183,8 +187,8 @@
          :cursor 0
          :input ""))

-(defn eval-input [state]
-  (let [expression (str/trim (:input @state))]
+(defn eval-input [state input]
+  (let [expression (str/trim input)]
     (when-not (str/blank? expression)
       (eval-str! expression)
       (swap! state assoc :ready? false :input "" :cursor 0))))
@@ -230,16 +234,15 @@
         "Copy Output"])
      [clipboard
       [:li.mdl-menu__item
-       {:data-clipboard-text (if (string? (:value result))
-                               (:value result)
-                               (pprint-str (:value result)))}
+       {:data-clipboard-text (pr-str (:value result))}
        "Copy Result"]]]]])

 (defn history-card-expression [props ns expression]
-  [:div.card-data.expression
-   [:div.codeMirror-lines {:style {:float :left}} [:code (str ns "=>")]]
+  [:div.mdl-card__title
    [:div
-    [editor/code  expression]]])
+    [:code.CodeMirror-lines (str ns "=>")]]
+   [:div
+    [editor/code expression]]])

 (defn history-card-output [props output]
   [:div
@@ -247,23 +250,41 @@
     [editor/text (str/trim-newline output)]]
    [:hr.border]])

+(defn render-value [value]
+  (cond
+    (string? value)
+    [editor/code (-> value unescape-string pprint-str)]
+
+    (map? value)
+    (case (:type value)
+      :hiccup (:content value)
+      [editor/code (pprint-str value)])
+
+    :default
+    [editor/code (pprint-str value)]))
+
+(defn render-error [error]
+  [:pre.error
+   (or (:stack error)
+       (if (and (:message error) (not= "ERROR" (:message error)))
+         (:message error)
+         (str (:cause error))
+         #_(or (str (:cause error)) (str error))))])
+
+
+(defn render-progress []
+  [mdl/upgrade
+   [:div.mdl-progress.mdl-js-progress.mdl-progress__indeterminate {:style {:width "100%"}}]])
+
 (defn history-card-result [props {:keys [success? value error] :as result}]
   [:div.card-data.result
    (if result
      (if success?
-       (if (string? value)
-         [editor/code (str "\"" value "\"")]
-         [editor/code (pprint-str value)])
-       [:div.error
-        (when-not (= "ERROR" (:message error))
-          [:div.error (:message error)])
-        (when (:cause error)
-          [:div.error (:cause error)])])
-     [mdl/upgrade
-      [:div.mdl-progress.mdl-js-progress.mdl-progress__indeterminate {:style {:width "100%"}}]])])
-
-(defn history-card
-  [{:keys [state columns] :as props} {:keys [ns expression result output] :as history-item}]
+       [render-value value]
+       [render-error error])
+     [render-progress])])
+
+(defn history-card [{:keys [state columns] :as props} {:keys [ns expression result output] :as history-item}]
   [:div
    {:class (str "mdl-cell " (card-size-class columns))}
    [:div.mdl-card.mdl-shadow--2dp
@@ -308,10 +329,6 @@
      [:div.flex-h
       [repl-input props]
       [run-button props]]]]])
-
-(defn input-ok? [{:keys [history]}]
-  (or (= (count history) 0)
-      (some? (-> history last second :result))))

 (defn history [props]


Set up profiling agent config.

Set up profiling agent config.

--- examples/movie-lens-recommender/project.clj
+++ examples/movie-lens-recommender/project.clj
@@ -8,16 +8,17 @@
   [[org.clojure/clojure "1.9.0"]
    [org.clojure/data.csv "0.1.4"]
    [org.clojure/tools.cli "0.3.5"]
-   [gorillalabs/sparkling "2.1.2"]
    [mvxcvi/merkle-db "0.1.0-SNAPSHOT"]
-   [ch.qos.logback/logback-classic "1.1.7"]
-   [org.slf4j/log4j-over-slf4j "1.7.25"] ]
+   [gorillalabs/sparkling "2.1.2"
+    :exclusions [org.objenesis/objenesis]]
+   [org.slf4j/log4j-over-slf4j "1.7.25"]
+   [ch.qos.logback/logback-classic "1.2.3"]]

   :main movie-lens.main

   :aot
   [clojure.tools.logging.impl
-   merkle-db.spark.table-partitioner
+   merkle-db.spark.key-partitioner
    merkle-db.spark.table-rdd
    movie-lens.main
    sparkling.destructuring
@@ -31,10 +32,20 @@
   :profiles
   {:provided
    {:dependencies
-    [[org.apache.spark/spark-core_2.11 "2.1.1"
+    [[org.apache.spark/spark-core_2.11 "2.2.1"
+      :exclusions [commons-codec
+                   commons-net
+                   log4j
+                   org.apache.commons/commons-compress
+                   org.scala-lang/scala-reflect
+                   org.slf4j/slf4j-log4j12]]
+     [org.apache.spark/spark-mllib_2.11 "2.2.1"
       :exclusions [log4j org.slf4j/slf4j-log4j12]]
-     [org.apache.spark/spark-mllib_2.11 "2.1.1"
-      :exclusions [log4j org.slf4j/slf4j-log4j12]]]}
+     [com.thoughtworks.paranamer/paranamer "2.6"]]}
+
+   :profiler-agent
+   {:jvm-opts
+    ["-javaagent:riemann-jvm-profiler.jar=prefix=movie-lens,host=localhost,localhost-pid?=true"]}

    :uberjar
    {:aot :all}})


fix bad apostrophes

fix bad apostrophes

--- src/pc/views/blog/private_docs_early_access.clj
+++ src/pc/views/blog/private_docs_early_access.clj
@@ -56,7 +56,7 @@

     [:article
      [:h3 "What kind of feedback should I share?"]
-     [:p "There's a lot left to build for team features and private docs, but we think we’re off to a good start.
+     [:p "There's a lot left to build for team features and private docs, but we think we're off to a good start.
          We'd love to hear your feedback on everything that's working well and anything that could be improved.
          The earlier we find bugs and design flaws, the easier they will be to fix."]]

@@ -74,8 +74,8 @@

     [:article
      [:h3 "How will team features work going forward?"]
-     [:p "Soon we’ll be offering these features to teams using a premium subscription model.
+     [:p "Soon we'll be offering these features to teams using a premium subscription model.
          We believe Precursor provides simplicity to an otherwise complicated market, and we want our pricing model to reflect that.
-         We’re aiming to start these plans at $10 per user, per month.
-         Please let us know how you feel about this price, we’re excited to hear your feedback!"]]
+         We're aiming to start these plans at $10 per user, per month.
+         Please let us know how you feel about this price, we're excited to hear your feedback!"]]
     )})


:sparkles: Deselect shapes after deletion.

--- frontend/src/uxbox/main/data/workspace.cljs
+++ frontend/src/uxbox/main/data/workspace.cljs
@@ -847,7 +847,8 @@

             shapes (map lookup selected)
             shape? #(not= (:type %) :frame)]
-        (rx/of (delete-shapes selected))))))
+        (rx/of (delete-shapes selected)
+               deselect-all)))))

 ;; --- Rename Shape


use return-to correctly (#1854)

use return-to correctly (#1854)

--- src-cljs/frontend/utils/google.cljs
+++ src-cljs/frontend/utils/google.cljs
@@ -1,16 +1,8 @@
 (ns frontend.utils.google
-  (:require
-   [frontend.utils :as utils]
-   [cemerick.url :refer [url]]))
+  (:require [cemerick.url :refer [url]]))

 (defn auth-url []
-  (let [auth-host (aget js/window "renderContext" "auth_host")
-        state (merge {"return-to" (str js/window.location.pathname
-                                       js/window.location.hash)
-                      "token" (utils/oauth-csrf-token)}
-                     (when (not= auth-host js/window.location.host)
-                       {"delegate" (str js/window.location.protocol "//" js/window.location.host)}))
-        state-str (.stringify js/JSON (clj->js state))]
-    (-> (url (str js/window.location.protocol "//" js/window.location.host "/google-login"))
-        (assoc :query {"state" state-str})
-        str)))
+  (-> (url (str js/window.location.protocol "//" js/window.location.host "/google-login"))
+      (assoc :query {"return-to" (str js/window.location.pathname
+                                      js/window.location.hash)})
+      str))


add no-debug

add no-debug

--- examples/leinproj/clj/stormlocal.clj
+++ examples/leinproj/clj/stormlocal.clj
@@ -45,7 +45,7 @@
              ["-s" "--spec" "REQUIRED: Storm Topology spec clj file"]
              ["-j" "--jar" "REQUIRED: Storm Topology code jar file"]
              ["-c" "--config" "Storm Environment config FILE" :default "config.json"]
-             ["-d" "--debug" "Enable Storm Topology debugging" :default true]
+             ["-d" "--[no-]debug" "Enable Storm Topology debugging" :default true]
              ["-e" "--env" "Environment, e.g. prod or local" :default "local"]
              ["-t" "--time" "Amount of time to keep cluster running in milliseconds" :default 5000
                                                                                :parse-fn #(Integer/parseInt %)]


Add panel to ‘controls’ example.

Add panel to ‘controls’ example.

--- examples/controls/src/controls.cljs
+++ examples/controls/src/controls.cljs
@@ -11,32 +11,37 @@
   (om/component
     (html
       (f/with-options {:form {:horizontal false}}
-                      (f/panel
-                        "Supported controls"
-                        (f/form
-                          {:on-submit #(js/alert "Submitted")}
-                          (f/text "Text" "A placeholder" data [:text])
-                          (f/password "Password" "A placeholder" data [:password])
-                          (f/textarea {:rows 8} "Textarea" "A placeholder" data [:textarea])
-                          (f/select "Select" data [:select]
-                                    [[:option1 "Option 1"] [:option2 "Option 2"] [:option3 "Option 3"] [:option2 "Option 3"]])
-                          (f/button "Button" #(js/alert "Click"))
-                          (f/button-primary "Primary button" #(js/alert "Click"))
-                          (f/button-default "Default button" #(js/alert "Click"))
-                          (f/checkbox "Checkbox" data [:checkbox])
-                          (f/radio "Radio" data [:radio])
-                          ;datetime, datetime-local, date, month, time, week, number, email, url, search, tel, and color
-                          (f/datetime-local "Datetime local" "A placeholder" data [:datetime-local])
-                          (f/date "Date" "A placeholder" data [:date])
-                          (f/month "Month" "A placeholder" data [:month])
-                          (f/time "Time" "A placeholder" data [:time])
-                          (f/week "Week" "A placeholder" data [:week])
-                          (f/number "Number" "A placeholder" data [:number])
-                          (f/email "Email" "A placeholder" data [:email])
-                          (f/url "Url" "A placeholder" data [:url])
-                          (f/search "Search" "A placeholder" data [:search])
-                          (f/tel "Tel" "A placeholder" data [:tel])
-                          (f/color "Color" "A placeholder" data [:color])))))))
+                      [:div
+                       [:h1 "Supported controls"]
+                       (f/panel
+                         "Panel"
+                         [:div "Contents 1"]
+                         [:div "Contents 2"]
+                         [:div "Contents 3"])
+                       (f/form
+                         {:on-submit #(js/alert "Submitted")}
+                         (f/text "Text" "A placeholder" data [:text])
+                         (f/password "Password" "A placeholder" data [:password])
+                         (f/textarea {:rows 8} "Textarea" "A placeholder" data [:textarea])
+                         (f/select "Select" data [:select]
+                                   [[:option1 "Option 1"] [:option2 "Option 2"] [:option3 "Option 3"] [:option2 "Option 3"]])
+                         (f/button "Button" #(js/alert "Click"))
+                         (f/button-primary "Primary button" #(js/alert "Click"))
+                         (f/button-default "Default button" #(js/alert "Click"))
+                         (f/checkbox "Checkbox" data [:checkbox])
+                         (f/radio "Radio" data [:radio])
+                         ;datetime, datetime-local, date, month, time, week, number, email, url, search, tel, and color
+                         (f/datetime-local "Datetime local" "A placeholder" data [:datetime-local])
+                         (f/date "Date" "A placeholder" data [:date])
+                         (f/month "Month" "A placeholder" data [:month])
+                         (f/time "Time" "A placeholder" data [:time])
+                         (f/week "Week" "A placeholder" data [:week])
+                         (f/number "Number" "A placeholder" data [:number])
+                         (f/email "Email" "A placeholder" data [:email])
+                         (f/url "Url" "A placeholder" data [:url])
+                         (f/search "Search" "A placeholder" data [:search])
+                         (f/tel "Tel" "A placeholder" data [:tel])
+                         (f/color "Color" "A placeholder" data [:color]))]))))

 (defn main-view
   [app-state _owner]


Add missing spec-tools dependency to reitit-middleware. Fixes #355

--- modules/reitit-middleware/project.clj
+++ modules/reitit-middleware/project.clj
@@ -11,4 +11,5 @@
                    :inherit [:deploy-repositories :managed-dependencies]}
   :dependencies [[metosin/reitit-ring]
                  [lambdaisland/deep-diff]
-                 [metosin/muuntaja]])
+                 [metosin/muuntaja]
+                 [metosin/spec-tools]])


8 for the right answer to original problem

--- dojo/advent_rc/clojure-md5/src/clojure_md5/core.clj
+++ dojo/advent_rc/clojure-md5/src/clojure_md5/core.clj
@@ -24,7 +24,7 @@
 (defn do_md5 []
   (join
     (map char_5
-         (take 2
+         (take 8
                (filter is_00000?
                        (map md5_for_int
                             (range)))))))


Comment out upmapcat

Comment out upmapcat

--- src/atom_finder/util/30_fs_util.clj
+++ src/atom_finder/util/30_fs_util.clj
@@ -61,6 +61,8 @@
     (str/replace-first s home-dir "")
     s))

+;; Should we use claypoole.lazy instead?
+;; https://github.com/TheClimateCorporation/claypoole#lazy
 (require '[com.climate.claypoole :as cp])
 (s/defn pmap-dir-c-files
   "Apply a function to the filename of every c file in a directory"


Add iam:GetRolePolicy to Shibboleth-PowerUser

--- src/aws_overlord/tasks/security.clj
+++ src/aws_overlord/tasks/security.clj
@@ -54,6 +54,7 @@
                            "iam:GetAccountSummary"
                            "iam:GetInstanceProfile"
                            "iam:GetLoginProfile"
+                           "iam:GetRolePolicy"
                            ; FIXME: PutRolePolicy allows privilege escalation!
                            "iam:PutRolePolicy"]}
                 {"Effect" "Allow"


use environ to get postmark api token

use environ to get postmark api token

--- src/clj/clojurelive_web/mailers.clj
+++ src/clj/clojurelive_web/mailers.clj
@@ -1,7 +1,8 @@
 (ns clojurelive-web.mailers
-  (:require [postmark.core :refer [postmark]]))
+  (:require [postmark.core :refer [postmark]]
+            [environ.core :refer [env]]))

-(def api-token (get (System/getenv) "POSTMARK_API_TOKEN"))
+(def api-token (env :postmark-api-token))

 (def send-message (postmark api-token "matthew@clojurelive.com"))


Make add-series! polymorphic, closes #9

Make add-series! polymorphic, closes #9

--- src/clj/com/hypirion/clj_xchart.clj
+++ src/clj/com/hypirion/clj_xchart.clj
@@ -51,6 +51,12 @@
   [f coll]
   (reduce-map (fn [xf] (fn [m k v] (xf m k (f v)))) coll))

+(defprotocol Chart
+  "Protocol for charts, which extends the XChart charts with
+  additional polymorphic Clojure functions."
+  (add-series! [chart series-name data]
+    "A method to add new series to the provided chart"))
+
 (def colors
   "All the default java.awt colors as keywords. You can use this map
   to iterate over the keys, in case you'd like to compare different
@@ -382,33 +388,27 @@
         (assoc-in-nonexisting [:chart :title :font] font))
     style-map))

-(defn add-series!
-  "Adds an XY or category series to an already existing chart. It is preferable
-  to provide all series upfront to avoid mutable operations on a chart.
-
-  For bubble-charts, use `add-bubble-series!`. For pie charts, just use
-  (.addSeries chart name val)."
-  ;; TODO: Make this polymorphic over chart types
-  [chart s-name data]
-  (if (sequential? data)
-    (apply add-raw-series chart s-name data)
-    (let [{:keys [x y error-bars style]} data
-          {:keys [marker-color marker-type
-                  line-color line-style line-width
-                  fill-color show-in-legend?
-                  xy-render-style]} style]
-      (doto-cond
-       (if error-bars
-         (add-raw-series chart s-name x y error-bars)
-         (add-raw-series chart s-name x y))
-       xy-render-style (.setXYSeriesRenderStyle (xy-render-styles xy-render-style))
-       marker-color (.setMarkerColor (colors marker-color marker-color))
-       marker-type (.setMarker (markers marker-type marker-type))
-       line-color (.setLineColor (colors line-color line-color))
-       line-style (.setLineStyle (strokes line-style line-style))
-       line-width (.setLineWidth (float line-width))
-       fill-color (.setFillColor (colors fill-color fill-color))
-       (not (nil? show-in-legend?)) (.setShowInLegend (boolean show-in-legend?))))))
+(extend-type XYChart
+  Chart
+  (add-series! [chart s-name data]
+    (if (sequential? data)
+      (apply add-raw-series chart s-name data)
+      (let [{:keys [x y error-bars style]} data
+            {:keys [marker-color marker-type
+                    line-color line-style line-width
+                    fill-color show-in-legend? render-style]} style]
+        (doto-cond
+         (if error-bars
+           (add-raw-series chart s-name x y error-bars)
+           (add-raw-series chart s-name x y))
+         render-style (.setXYSeriesRenderStyle (xy-render-styles render-style))
+         marker-color (.setMarkerColor (colors marker-color marker-color))
+         marker-type (.setMarker (markers marker-type marker-type))
+         line-color (.setLineColor (colors line-color line-color))
+         line-style (.setLineStyle (strokes line-style line-style))
+         line-width (.setLineWidth (float line-width))
+         fill-color (.setFillColor (colors fill-color fill-color))
+         (not (nil? show-in-legend?)) (.setShowInLegend (boolean show-in-legend?)))))))

 (defn xy-chart
   "Returns an xy-chart. See the tutorial for more information about
@@ -428,11 +428,7 @@
       theme (.setTheme (themes theme theme))
       render-style (.setDefaultSeriesRenderStyle (xy-render-styles render-style)))
      (doseq [[s-name data] series]
-       (if-let [render-style (-> data :style :render-style)]
-         (add-series! chart s-name
-                      (assoc-in data [:style :xy-render-style]
-                                render-style))
-         (add-series! chart s-name data)))
+       (add-series! chart s-name data))
      (doto (.getStyler chart)
        (set-default-style! styling)
        (set-axes-style! styling))
@@ -441,6 +437,28 @@
       title (.setTitle title)
       (-> styling :x-axis :title) (.setXAxisTitle (-> styling :x-axis :title))
       (-> styling :y-axis :title) (.setYAxisTitle (-> styling :y-axis :title))))))
+
+(extend-type CategoryChart
+  Chart
+  (add-series! [chart s-name data]
+    (if (sequential? data)
+      (apply add-raw-series chart s-name data)
+      (let [{:keys [x y error-bars style]} data
+            {:keys [marker-color marker-type
+                    line-color line-style line-width
+                    fill-color show-in-legend? render-style]} style]
+        (doto-cond
+         (if error-bars
+           (add-raw-series chart s-name x y error-bars)
+           (add-raw-series chart s-name x y))
+         render-style (.setChartCategorySeriesRenderStyle (category-render-styles render-style))
+         marker-color (.setMarkerColor (colors marker-color marker-color))
+         marker-type (.setMarker (markers marker-type marker-type))
+         line-color (.setLineColor (colors line-color line-color))
+         line-style (.setLineStyle (strokes line-style line-style))
+         line-width (.setLineWidth (float line-width))
+         fill-color (.setFillColor (colors fill-color fill-color))
+         (not (nil? show-in-legend?)) (.setShowInLegend (boolean show-in-legend?)))))))

 (defn category-chart*
   "Returns a raw category chart. Prefer `category-chart` unless you
@@ -458,10 +476,7 @@
    (let [chart (CategoryChart. width height)
          styling (attach-default-font styling)]
      (doseq [[s-name data] series]
-       (let [render-style (-> data :style :render-style)]
-         (doto-cond (add-series! chart s-name data)
-          render-style (.setChartCategorySeriesRenderStyle
-                        (category-render-styles render-style)))))
+       (add-series! chart s-name data))
      (doto-cond
       (.getStyler chart)
       theme (.setTheme (themes theme theme))
@@ -547,24 +562,24 @@
                                 extra-categories)]
      (category-chart* normalized-seq styling))))

-(defn add-bubble-series!
-  "Adds an additional bubble series to the provided bubble chart. It is
-  preferable to provide all series upfront instead of mutating the underlying
-  chart. For other chart types, see the add-series! function."
-  [chart s-name data]
-  (if (sequential? data)
-    (apply add-raw-series chart s-name data)
-    (let [{:keys [x y bubble style]} data
-          {:keys [marker-color marker-type
-                  line-color line-style line-width
-                  fill-color show-in-legend?]} style]
-      (doto-cond
-       (add-raw-series chart s-name x y bubble)
-       line-color (.setLineColor (colors line-color line-color))
-       line-style (.setLineStyle (strokes line-style line-style))
-       line-width (.setLineWidth (float line-width))
-       fill-color (.setFillColor (colors fill-color fill-color))
-       (not (nil? show-in-legend?)) (.setShowInLegend (boolean show-in-legend?))))))
+(extend-type BubbleChart
+  Chart
+  (add-series! [chart s-name data]
+    (if (sequential? data)
+      (apply add-raw-series chart s-name data)
+      (let [{:keys [x y bubble style]} data
+            {:keys [marker-color marker-type
+                    line-color line-style line-width
+                    fill-color show-in-legend? render-style]} style]
+        (doto-cond
+         (add-raw-series chart s-name x y bubble)
+         ;; NOTE: Add render style when squares are added to the impl?
+         render-style (.setBubbleSeriesRenderStyle (bubble-render-styles render-style))
+         line-color (.setLineColor (colors line-color line-color))
+         line-style (.setLineStyle (strokes line-style line-style))
+         line-width (.setLineWidth (float line-width))
+         fill-color (.setFillColor (colors fill-color fill-color))
+         (not (nil? show-in-legend?)) (.setShowInLegend (boolean show-in-legend?)))))))

 (defn bubble-chart*
   "Returns a raw bubble chart. Bubble charts are hard to make right,
@@ -581,9 +596,7 @@
    (let [chart (BubbleChart. width height)
          styling (attach-default-font styling)]
      (doseq [[s-name data] series]
-       (let [render-style (-> data :style :render-style)]
-         (doto-cond (add-bubble-series! chart s-name data)
-          render-style (.setBubbleSeriesRenderStyle (bubble-render-styles render-style)))))
+       (add-series! chart s-name data))
      (doto-cond
       (.getStyler chart)
       theme (.setTheme (themes theme theme))
@@ -605,6 +618,19 @@
     styling
     (assoc styling :annotation-distance
            (- 1.0 (/ (:donut-thickness styling 0.33) 2)))))
+
+(extend-type PieChart
+  Chart
+  (add-series! [chart s-name data]
+    (if (number? data)
+      (.addSeries chart s-name data)
+      (let [{:keys [render-style fill-color show-in-legend?]} (:style num)
+            val (:value num)]
+        (doto-cond
+         (.addSeries chart s-name val)
+         render-style (.setChartPieSeriesRenderStyle (pie-render-styles render-style))
+         fill-color (.setFillColor (colors fill-color fill-color))
+         (not (nil? show-in-legend?)) (.setShowInLegend (boolean show-in-legend?)))))))

 (defn pie-chart
   "Returns a pie chart. The series map is in this case just a mapping
@@ -629,16 +655,8 @@
          ;; Need to rebind this one. We could probably omit it from the keys
          ;; entry at the top, if it's not used for documentation purposes.
          annotation-distance (:annotation-distance styling)]
-     (doseq [[s-name num] series]
-       (if (number? num)
-         (.addSeries chart s-name num)
-         (let [{:keys [render-style fill-color show-in-legend?]} (:style num)
-               val (:value num)]
-           (doto-cond
-            (.addSeries chart s-name val)
-            render-style (.setChartPieSeriesRenderStyle (pie-render-styles render-style))
-            fill-color (.setFillColor (colors fill-color fill-color))
-            (not (nil? show-in-legend?)) (.setShowInLegend (boolean show-in-legend?))))))
+     (doseq [[s-name data] series]
+       (add-series! chart s-name data))
      (doto-cond
       (.getStyler chart)
       theme (.setTheme (themes theme theme))


split out register-consumer fn for easily adding metrics defined outside of marcy

--- src/clj/marceline/storm/metrics.clj
+++ src/clj/marceline/storm/metrics.clj
@@ -4,6 +4,17 @@
             [backtype.storm.config :refer (TOPOLOGY-METRICS-CONSUMER-REGISTER)])
   (:gen-class))

+(defn register-consumer
+  [conf class-or-classname & [parallelism arg]]
+  (merge-with
+   concat
+   conf
+   {TOPOLOGY-METRICS-CONSUMER-REGISTER
+    [{"class" (condp isa? (class class-or-classname)
+                java.lang.Class (.getName class-or-classname)
+                java.lang.String class-or-classname)
+      "parallelism.hint" parallelism
+      "argument" arg}]}))

 (defmacro defmetricsconsumer
   [name & [opts & impl :as all]]
@@ -35,13 +46,7 @@
            ~@cleanup-impl)
          (def ~name
            (fn [conf# & [arg#]]
-             (merge-with
-              concat
-              conf#
-              {~TOPOLOGY-METRICS-CONSUMER-REGISTER
-               [{"class" ~classname
-                 "parallelism.hint" ~parallelism
-                 "argument" arg#}]})))))))
+             (register-consumer conf# ~classname ~parallelism arg#)))))))

 ;; I don't see the value of this argument
 ;; it's passed during `prepare`, which


Correctd some protocol argument orders

Correctd some protocol argument orders

--- src/clj_bots/pin_ctrl/protocols.clj
+++ src/clj_bots/pin_ctrl/protocols.clj
@@ -54,10 +54,10 @@
   (set-mode! [board pin-n mode] "Set the mode of the pin, as long as it's supported by the pin's board."))

 (defprotocol PReadablePin
-  (read-value [board mode pin-n] "Read the binary or analog value of a pin with given mode. For gpio this should be :high or :low; for ain should be numeric between 0 and 1"))
+  (read-value [board pin-n mode] "Read the binary or analog value of a pin with given mode. For gpio this should be :high or :low; for ain should be numeric between 0 and 1"))

 (defprotocol PWriteablePin
-  (write-value! [board mode pin-n val] "Set the binary or analog value of a pin; for analog, should be the raw, non-normalized value."))
+  (write-value! [board pin-n mode val] "Set the binary or analog value of a pin; for analog, should be the raw, non-normalized value."))

 (defprotocol PEdgeDetectablePin
   "Edge detection allows efficient detection of GPIO state changes (such as from a button press).


remove ol from p

remove ol from p

--- src/cljs/ikea_clojure_cup/core.cljs
+++ src/cljs/ikea_clojure_cup/core.cljs
@@ -21,11 +21,11 @@
    [regions/region-modal]
    [:h2 (str "About the " common/long-name)]
    [:p common/welcome-note]
-   [:p "There are 3 possible outcomes:"
-    [:ol.list-inside
+   [:p "There are 3 possible outcomes:"]
+   [:ol.list-inside
      [:li "It fits!  You'll fit ALL of the packages for your products in your car!"]
      [:li "It kinda fits!  You'll fit SOME of the packages in your car but may have to get creative or say goodbye to others."]
-     [:li "It does not fit!  You'll fit NONE of the packages for your products in your car."]]]
+     [:li "It does not fit!  You'll fit NONE of the packages for your products in your car."]]
    [bootstrap/button {:bs-size :lg :bs-style :danger :href "/" :on-click tool/start-over} "Try it!"]])

 (defn- nav


fixed issues in deckbuilder

fixed issues in deckbuilder

--- src/cljs/netrunner/deckbuilder.cljs
+++ src/cljs/netrunner/deckbuilder.cljs
@@ -68,7 +68,6 @@

 (defn new-deck [side owner]
   (om/set-state! owner :deck {:name "New deck" :cards [] :identity (-> side side-identities first)})
-  (om/set-state! owner :side side)
   (edit-deck owner))

 (defn end-edit [owner]
@@ -248,8 +247,8 @@
                [:div
                 (if (:edit state)
                   [:div.button-bar
-                   [:button {:on-click #(end-edit owner)} "Cancel"]
-                   [:button {:on-click #(save-deck cursor owner)} "Save"]]
+                   [:button {:on-click #(save-deck cursor owner)} "Save"]
+                   [:button {:on-click #(end-edit owner)} "Cancel"]]
                   [:div.button-bar
                    [:button {:on-click #(edit-deck owner)} "Edit"]
                    [:button {:on-click #(handle-delete cursor owner)} "Delete"]
@@ -314,7 +313,7 @@
              [:h3 "Identity"]
              [:select.identity {:value (get-in state [:deck :identity :title])
                                 :on-change #(om/set-state! owner [:deck :identity] (get-card (.. % -target -value)))}
-              (for [card (side-identities (:side state))]
+              (for [card (side-identities (get-in state [:deck :identity :side]))]
                 [:option (:title card)])]]
             (om/build card-lookup cursor {:state state})
             [:h3 "Decklist"


Fix application header

Fix application header

Signed-off-by: Christian Romney <78cb0763aa1664e7dd86fd558ae466f67ab17826@pointslope.com>

--- src/cljs/trumpet/ui/components.cljs
+++ src/cljs/trumpet/ui/components.cljs
@@ -139,9 +139,9 @@
 (defn application-header
   "Renders the title of the application"
   [state]
-  [:div.page-header]
-  [:h1.title
-   [:span "Scale, Transposition, and Fingering Chart"]])
+  [:div.page-header
+   [:h1.title
+    [:span "Scale, Transposition, and Fingering Chart"]]])

 (defn application-footer
   "Renders the application copyright notice."


Fix mistakes in import-key and verify

Fix mistakes in import-key and verify

--- src/clojure_fabric/crypto_suite.clj
+++ src/clojure_fabric/crypto_suite.clj
@@ -28,7 +28,7 @@
            [javax.crypto Cipher SecretKeyFactory]
            [javax.crypto.spec SecretKeySpec]
            [java.security Key KeyStore KeyFactory KeyPairGenerator SecureRandom
-            Security MessageDigest Signature]
+            Security MessageDigest Signature PublicKey]
            [java.security.spec ECPoint ECParameterSpec ECPublicKeySpec ECPrivateKeySpec])
   (:refer-clojure :exclude [hash]))

@@ -59,6 +59,8 @@
 ;;;
 ;;; Interface
 ;;;
+;;; 'opts' is CryptoSuite
+;;;
 (defrecord CryptoSuite [security-provider key-algorithm curve-name hash-algorithm])
 (defn make-crypto-suite
   [{:keys [security-provider key-algorithm curve-name hash-algorithm]
@@ -199,7 +201,7 @@
                                                       (.getH parameter-spec) (.getSeed parameter-spec)))]
         (case type
           :public (.generatePublic kf spec)
-          :private (.generatePublic kf spec)))
+          :private (.generatePrivate kf spec)))
       (throw (Exception. (format "Key size(%d) does not match with the chosen curve(%d)" key-size curve-size))))))
 ;; (b64/decode (.getBytes "BOg4fylDlzNxMFFTvtQBRsakfxaBJBPJf25sx8Iaim8v3h0ml9mnNCrUVJjBAeXyeGAX69NbAxbaAkNHT+6gJtU="))
 ;; (def x (Arrays/copyOfRange *1 1 65))
@@ -286,10 +288,10 @@
   Returns
         Result(Object):Signature object"
   [^bytes digest priv-key {:keys [algorithm]}]
-  (let [signature (Signature/getInstance (name algorithm))]
-    (.initSign signature priv-key)
-    (.update signature digest)
-    (.sign signature)))
+  (let [signer (Signature/getInstance (name algorithm))]
+    (.initSign signer priv-key)
+    (.update signer digest)
+    (.sign signer)))

 ;;; verify
 (defn verify
@@ -300,11 +302,12 @@
         digest (byte[]) original digest that was signed
   Returns
         (bool): verification successful or not"
-  [pub-key signature ^bytes digest {:keys [algorithm]}]
-  (let [signature (Signature/getInstance (name algorithm))]
-    (.initVerify signature pub-key) ;; Reflection warning! - pub-key type is unknown :(
-    (.update signature digest)
-    (.verify signature)))
+  [pub-key-byte signature ^bytes digest {:keys [algorithm curve type security-provider] :as opts}]
+  (let [^PublicKey pub-key (import-key pub-key-byte opts)
+        signer (Signature/getInstance (name algorithm))]
+    (.initVerify signer pub-key)
+    (.update signer digest)
+    (.verify signer signature)))

 #_
 (comment


Exploration: mark state as done when finished

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

--- src/conexp/fca/exploration/repl.clj
+++ src/conexp/fca/exploration/repl.clj
@@ -77,9 +77,9 @@
                                     (constantly true)
                                     "counterexample> ")
                                state)]
-      (if result
-        (recur result)
-        (vec (map (fn [f] (f state)) result-fns))))))
+      (if (:done result)
+        (vec (map (fn [f] (f state)) result-fns))
+        (recur result)))))

 (defn counterexample-via-repl
   "Starts a repl for counterexamples, which must be specified completely."
@@ -211,7 +211,7 @@
 (define-repl-fn quit
   "Quit the REPL, if the given counterexample is valid."
   (if (valid-counterexample? state attributes impl)
-    nil
+    (assoc state :done true)
     state))

 (define-repl-fn done


Check for memory leaks

Check for memory leaks

--- test/testcursor.cljs
+++ test/testcursor.cljs
@@ -309,7 +309,8 @@
 (deftest cursor-values
   (let [test-atom (atom {:a {:b {:c {:d 1}}}})
         test-cursor (r/cursor [:a :b :c :d] test-atom)
-        test-cursor2 (r/cursor [] test-atom)] ;; nasty edge case
+        test-cursor2 (r/cursor [] test-atom)
+        runs (running)] ;; nasty edge case

     ;; get the initial values
     (is (= (get-in @test-atom [:a :b :c :d])
@@ -339,13 +340,16 @@
     (swap! test-cursor2 assoc :z 3)
     (is (= @test-cursor2 {:z 3}))
     (is (= (get-in @test-atom [])
-           {:z 3}))))
+           {:z 3}))
+
+    (is (= runs (running)))))

 (deftest atom-behaviors
   (let [test-atom (atom {:a {:b {:c {:d 1}}}})
         test-cursor (r/cursor [:a :b :c :d] test-atom)
-        witness (atom nil)]
+        witness (atom nil)
+        runs (running)]
     ;; per the description, reset! should return the new values
     (is (= {}
            (reset! test-cursor {})))
@@ -365,8 +369,10 @@
     (is (= @(:ref @witness) @test-cursor))
     (is (= (:old @witness) "old"))
     (is (= (:new @witness) "new"))
+
     ;; can we remove the watch?
     (remove-watch test-cursor :w)
     (reset! test-cursor "removed")
     (is (= (:new @witness) "new")) ;; shouldn't have changed
+    (is (= (running) runs))
     ))