agent validator finished

agent validator finished

--- src/Miscellaneous/validator.clj
+++ src/Miscellaneous/validator.clj
@@ -34,7 +34,44 @@
   (try (read-string x)
     (catch Exception e x)))

+(defn coerce-row
+  [_ row sink]
+  (let [cast-row (apply assoc row (mapcat (fn [k] [k (try-read-string (k row))]) int-rows))]
+    (send sink conj cast-row)
+    cast-row))

+(defn read-row
+  [rows caster sink]
+  (when-let [[item & items] (seq rows)]
+    (send caster coerce-row item sink)
+    (send *agent* read-row caster sink)
+    items))
+
+(defn int-val?
+  [x]
+  (or (int? x) (empty? x)))
+
+(defn validate
+  [row]
+  (or (nil? row)
+      (reduce #(and %1 (int-val? (%2 row)))
+              true  int-rows)))
+
+(defn agent-ints
+  [input-file]
+  (let [reader (agent (seque (with-header
+                               (lazy-read-csv input-file))))
+        caster (agent nil)
+        sink (agent [])]
+    (set-validator! caster validate)
+    (send reader read-row caster sink)
+    {:reader reader
+     :caster caster
+     :sink sink}))
+
+;(agent-ints data-file)
+
+(empty? "")

@@ -57,8 +94,24 @@
 (try (n) (catch Exception e n))
 (try (n) (catch Exception e (println n)))

+;you should look at apply in a more flexible way!
+(apply assoc {} (concat [:a 2] [:b 3]))
+(apply (partial assoc {}) (concat [:a 2] [:b 3]))
+
+;seque
+
+;Creates a queued seq on another (presumably lazy) seq s. The queued
+;seq will produce a concrete seq in the background, and can get up to
+;n items ahead of the consumer. n-or-q can be an integer n buffer
+;size, or an instance of java.util.concurrent BlockingQueue. Note
+;that reading from a seque can block if the reader gets ahead of the
+;producer.

+;what is "" ?
+
+(nil? "")
+(empty? "") ;is the same as:
+(not (seq ""))

-


Give dubstepbass more time to play

Give dubstepbass more time to play

--- test/example/dubstepbass.clj
+++ test/example/dubstepbass.clj
@@ -31,7 +31,7 @@
 ;; son.dup
 ;;}.play

-(demo 5
+(demo 30
       (let [trig (coin-gate 0.5 (impulse:kr 2))
             note (demand trig 0 (dseq (shuffle (map midi->hz (conj (range 24 45) 22))) INF))
             sweep (lin-exp (lf-saw (demand trig 0 (drand [1 2 2 3 4 5 6 8 16] INF))) -1 1 40 5000)


Let commands throwing exceptions not escape the command-loop.

--- src/containium/core.clj
+++ src/containium/core.clj
@@ -211,7 +211,7 @@
               "systems" systems
               "isolate" isolate
               ;; ---TODO: Fix printing of nREPL server.
-              "state" "Variable 'state' disabled for now, as printing nREPL server fails."
+              "state" state
               "boxes" boxes
               (println (str "Unknown variable '" var
                             "', please use 'spec', 'systems', 'isolate', 'state' or 'boxes'"))))))
@@ -245,7 +245,12 @@
         (case command
           "" (recur state boxes)
           "shutdown" (do (shutdown-state state) boxes)
-          (let [[new-state new-boxes] (handle-command command args spec systems isolate state boxes)]
+          (let [[new-state new-boxes]
+                (try
+                  (handle-command command args spec systems isolate state boxes)
+                  (catch Throwable t
+                    (println "Error handling command" command ":")
+                    (.printStackTrace t)))]
             (recur (or new-state state) (or new-boxes boxes))))))))


fix spelling

fix spelling

--- src/datasplash/core.clj
+++ src/datasplash/core.clj
@@ -636,7 +636,7 @@

 (defn dpartition-by
   {:doc (with-opts-docstr
-          "Partions the content of pacoll according to the PartitionFn.
+          "Partitions the content of pcoll according to the PartitionFn.
 See https://cloud.google.com/dataflow/java-sdk/JavaDoc/com/google/cloud/dataflow/sdk/transforms/Partition"
           named-schema)
    :added "0.1.0"}


cljs api: Use :successful? in create-document!.

--- src-cljs/pepa/api.cljs
+++ src-cljs/pepa/api.cljs
@@ -139,7 +139,7 @@
   (go
     (when-let [res (<! (xhr-request! "/documents" :post
                                      (document->api-document document)))]
-      (when (= 201 (:status res))
+      (when (:successful? res)
         (let [document (-> (:response/transit res)
                            (db-document->Document))]
           (om/update! (om/root-cursor data/state)


online summary is done

online summary is done

--- src/language/online_summary.clj
+++ src/language/online_summary.clj
@@ -10,7 +10,41 @@
    (let [new-n (inc n)
          delta (- x mean)
          delta-n (/ delta new-n)
-         ter])))
+         term-1 (* delta delta-n n)
+         new-mean (+ mean delta-n)]
+     {:n new-n
+      :mean new-mean
+      :s (+ s x)
+      :m2 (+ m2 term-1)})))
+
+(defn op-fields
+  "A utility function that calls a function on the values of a field from two maps"
+  [op field item1 item2]
+  (op (field item1) (field item2)))
+
+(defn combine-counts
+  ([] zero-counts)
+  ([xa xb]
+   (let [n (long (op-fields + :n xa xb))
+         delta (op-fields - :mean xb xa)
+         nxa*xb (*' (:n xa) (:n xb))]
+     {:n n
+      :mean (+ (:mean xa) (* delta (/ (:n xb) n)))
+      :s (op-fields + :s xa xb)
+      :m2 (+ (:m2 xa) (:m2 xb)
+             (* delta delta (/ nxa*xb n)))})))
+
+(defn stats-from-sums
+  [{:keys [n mean m2 s] :as sums}]
+  {:mean (double (/ s n))
+   :variance (/ m2 (dec n))})
+
+(defn summary-statistics
+  [coll]
+  (stats-from-sums
+   (r/fold combine-counts accum-counts coll)))
+
+(summary-statistics (repeatedly 10000000 rand))


don't emit var_arg @param if we aren't type-checking

--- src/main/clojure/cljs/core.cljc
+++ src/main/clojure/cljs/core.cljc
@@ -2839,11 +2839,15 @@
            (core/cond
              (multi-arity-fn? fdecl)
              (multi-arity-fn name
-               (update-in m [:jsdoc] conj "@param {...*} var_args") fdecl)
+               (if (comp/checking-types?)
+                 (update-in m [:jsdoc] conj "@param {...*} var_args")
+                 m) fdecl)

              (variadic-fn? fdecl)
              (variadic-fn name
-               (update-in m [:jsdoc] conj "@param {...*} var_args") fdecl)
+               (if (comp/checking-types?)
+                 (update-in m [:jsdoc] conj "@param {...*} var_args")
+                 m) fdecl)

              :else
              (core/list 'def (with-meta name m)


Add URI support for examples

Add URI support for examples

--- src/grimoire/things.clj
+++ src/grimoire/things.clj
@@ -370,7 +370,8 @@
     [([::version   {}] :seq)] "version"
     [([::platform  {}] :seq)] "platform"
     [([::namespace {}] :seq)] "namespace"
-    [([::def       {}] :seq)] "def"))
+    [([::def       {}] :seq)] "def"
+    [([::example   {}] :seq)] "ex"))

 (defn thing->full-uri
   "Function from a Thing to a String representing a unique Thing naming URI.


Функционал файлаплодера

Функционал файлаплодера

--- src/ixinfestor/core.clj
+++ src/ixinfestor/core.clj
@@ -306,3 +306,87 @@
 ;; END Common utils
 ;;..................................................................................................

+
+
+;;**************************************************************************************************
+;;* BEGIN files entity
+;;* tag: <files entity>
+;;*
+;;* description: Хранение файлов
+;;*
+;;**************************************************************************************************
+
+(def files-root-directory "files_root_directory")
+
+(defn save-file [tempfile dir filename]
+  (let [dir-filename (str dir filename)
+        full-path (str files-root-directory dir-filename)]
+    (clojure.java.io/make-parents full-path)
+    (with-open [in (clojure.java.io/input-stream tempfile)
+                out (clojure.java.io/output-stream full-path)]
+      (try
+        (do
+          (clojure.java.io/copy in out)
+          (.close in)
+          (.close out))
+        (catch Exception ex
+          (do
+            (.close in)
+            (.close out)
+            (throw ex) )))
+      dir-filename)))
+
+
+(defentity files
+  (pk :id))
+
+(defn files-save
+  "Сохранение files"
+  [file-row]
+  (com-save-for-id files file-row))
+
+(defn file-upload [file-row tempfile]
+  (transaction
+   (let [{id :id :as new-row} (-> file-row
+                                  (assoc :path "?TMP?")
+                                  files-save)
+         path (save-file tempfile
+                         (str (tf/unparse (tf/formatter-local "/yyyy/MM/dd/") (tl/local-now)) id "/")
+                         (file-row :filename))]
+     (-> new-row
+         (assoc :path path)
+         files-save))))
+
+(defn file-pred-images* [query* & [not?]]
+  (where query*
+         {:content_type [(if not? not-in in) ["image/gif"
+                                              "image/jpeg"
+                                              "image/pjpeg"
+                                              "image/png"
+                                              "image/svg+xml"
+                                              "image/tiff"]]}))
+
+
+;;связи для файлов
+
+(defentity files_rel
+  (belongs-to files))
+
+(defn file-upload-rel-on [entity files-rel-field {id :id :as entity-row} file-row tempfile]
+  (transaction
+   (let [file-row (file-upload file-row tempfile)]
+     (insert files_rel (values {:files_id (:id file-row) files-rel-field id})))))
+
+(defn files_rel-delete [files-rel-field {file-id :id} {rel-id :id}]
+  (delete files_rel (where (and (= :files_id file-id)
+                                (= files-rel-field rel-id)))))
+
+(defn files_rel-select-files-by-* [row files-rel-field]
+  ((com-defn-get-rows-by-rel* files :id :id files_rel :files_id files-rel-field) row))
+
+
+;; END files entity
+;;..................................................................................................
+
+
+


Add option for CORs capability; add require htws for access

--- src/aerobio/server.clj
+++ src/aerobio/server.clj
@@ -79,7 +79,8 @@
    ;; HTSeq
    [aerobio.htseq.common :as cmn]
    [aerobio.htseq.rnaseq :as htrs]
-   [aerobio.htseq.tnseq :as htts]
+   [aerobio.htseq.tnseq  :as htts]
+   [aerobio.htseq.wgseq  :as htws]
    ;; Program graph construction, execution, delivery
    [aerobio.pgmgraph :as pg]
    ;; REST actions
@@ -224,6 +225,13 @@
      #'my-routes
      (constantly
       (comp/routes
+       #_(ANY "/htseq/cmd" []
+            {:status 200
+             :headers {
+                       "Access-Control-Allow-Origin" "*"
+                       "Access-Control-Allow-Headers" "Content-Type"
+                       }
+             :body body})
        (GET  "/"      req (landing-pg-handler req))
        ;;
        (GET "/mlab/upld"   [:as reqmap & args] (upload-file args reqmap))


Further improve BPM detection and stability.

Also add some var definitions so people can tweak tolerance parameters
if they need to, although these seem to work pretty well. And fixed some
bugs I found in the allocation of the tempo tap buffer.

--- src/afterglow/midi.clj
+++ src/afterglow/midi.clj
@@ -10,14 +10,24 @@
            [java.util.regex Pattern]))

 (def ^:private max-clock-intervals
-  "How many MIDI clock pulses should be kept around for averaging?"
+  "How many MIDI clock pulses and interval averages should be kept
+  around for BPM calculation?"
   30)
+
+(def ^:private min-clock-intervals
+  "How many MIDI clock pulses are needed in order to start attempting
+  BPM calculation?"
+  12)
+
+(def ^:private max-clock-lag
+  "How many ms is too long to wait between MIDI clock pulses?"
+  150)

 (def ^:private max-tempo-taps
   "How many tempo taps should be kept around for averaging?"
   4)

-(def ^:private max-tempo-tap-interval
+(def ^:private max-tempo-tap-lag
   "How long is too long for a tap to be considered part of
   establishing a tempo?"
   2000)
@@ -314,7 +324,7 @@
   (let [timestamp (now)]
     (rhythm/metro-beat-phase metronome 0)      ; Regardless, mark the beat
     (if (and (some? (last @buffer))
-             (< (- timestamp (last @buffer)) max-tempo-tap-interval))
+             (< (- timestamp (last @buffer)) max-tempo-tap-lag))
       ;; We are considering this part of a series of taps.
       (do
         (swap! buffer conj timestamp)
@@ -324,14 +334,14 @@
                 mean (/ passed intervals)]
             (rhythm/metro-bpm metronome (double (/ 60000 mean))))))
       ;; This tap was isolated, but may start a new series.
-      (reset! buffer (conj (ring-buffer max-tempo-tap-interval) timestamp))))
+      (reset! buffer (conj (ring-buffer max-tempo-taps) timestamp))))
   nil)

 (defn create-tempo-tap-handler
   "Returns a function which implements a simple tempo-tap algorithm on
   the supplied metronome."
   [metronome]
-  (let [buffer (atom (ring-buffer max-tempo-tap-interval))]
+  (let [buffer (atom (ring-buffer max-tempo-taps))]
     (fn [] (tap-handler buffer metronome))))

 (defonce
@@ -356,6 +366,41 @@
       mechanism ever offers that), and :status, which is a
       human-oriented summmary of the status."))))

+(defn interval-to-bpm
+  "Given an interval between MIDI clock pulses in milliseconds,
+  calculate the implied beats per minute value, to the nearest
+  hundredth of a beat."
+  [interval]
+  (/ (math/round (double (/ 6000000 (* interval 24)))) 100.0))
+
+(defn bpm-to-interval
+  "Given a BPM, calculate the interval between MIDI clock pulses in
+  milliseconds."
+  [bpm]
+  (/ 2500.0 bpm))
+
+(defn std-dev
+  "Calculate the standard deviation of a set of samples."
+  ([samples]
+   (let [n (count samples)
+         mean (/ (reduce + samples) n)]
+     (std-dev samples n mean)))
+  ([samples n mean]
+   (let [intermediate (map #(Math/pow (- %1 mean) 2) samples)]
+     (Math/sqrt (/ (reduce + intermediate) n)))))
+
+(def abs-tolerance
+  "If we are going to adjust the BPM, the adjustment we are going to
+  make needs to represent at least this many milliseconds per MIDI
+  clock tick (to reduce jitter)."
+  0.005)
+
+(def dev-tolerance
+  "If we are going to adjust the BPM, the adjustment must be at least
+  this many times the standard deviation in observed clock pulse
+  timings, so we can avoid jitter due to unstable timing."
+  2.2)
+
 (defn- sync-handler
   "Called whenever a MIDI message is received for a synced metronome.
   If it is a clock pulse, update the ring buffer in which we are
@@ -372,11 +417,15 @@
                              intervals (dec (count @timestamps))
                              mean (/ passed intervals)]
                          (alter means conj mean)
-                         (when (= (count @means) max-clock-intervals)
-                           (let [mean-mean (/ (apply + @means) max-clock-intervals)
-                                 new-bpm (/ (math/round (double (/ 6000000 (* mean-mean 24)))) 100)]
-                             (when (>= (math/abs (- new-bpm (rhythm/metro-bpm metronome))) 0.1)
-                               (rhythm/metro-bpm metronome new-bpm)))))))
+                         (when (>= (count @means) min-clock-intervals)
+                           (let [num-means (count @means)
+                                 mean-mean (/ (apply + @means) num-means)
+                                 dev (std-dev @means num-means mean-mean)
+                                 implied (bpm-to-interval (rhythm/metro-bpm metronome))
+                                 adjustment (math/abs (- implied mean-mean))]
+                             (when (> adjustment (max abs-tolerance (* dev-tolerance dev)))
+                               (timbre/info "dev" dev "mean-mean" (float mean-mean) "adjustment" adjustment)
+                               (rhythm/metro-bpm metronome (interval-to-bpm mean-mean))))))))
      (:start :stop) (do (ref-set timestamps (ring-buffer max-clock-intervals)) ; Clock is being reset
                         (ref-set means (ring-buffer max-clock-intervals)))
      :control-change (when (and (some? @traktor-info) (< (:note msg) 5))  ; Traktor beat phase update


Less printlns.

Less printlns.

--- src/cbfg/npr-test.cljs
+++ src/cbfg/npr-test.cljs
@@ -14,20 +14,16 @@
 (defrecord TestNPRStreamRequest [stream-request]
   NPRStreamRequest
   (stream-request-snapshot-beg-msg [this snapshot]
-    (println "snapshot-beg-msg" snapshot)
     (merge stream-request {:status :part :sub-status :snapshot-beg
                            :snapshot snapshot}))
   (stream-request-snapshot-end-msg [this snapshot]
-    (println "snapshot-end-msg" snapshot)
     (merge stream-request {:status :part :sub-status :snapshot-end
                            :snapshot snapshot}))
   (stream-request-snapshot-item-msg [this snapshot item]
-    (println "snapshot-item-msg" snapshot item)
     (merge stream-request {:status :part :sub-status :snapshot-item
                            :snapshot snapshot
                            :item item}))
   (stream-request-rollback-msg [this rollback-info]
-    (println "snapshot-rollback-msg" rollback-info)
     (merge stream-request {:status :rollback
                            :rollback-info rollback-info}))
   (stream-request-start-sq [this]
@@ -42,16 +38,13 @@
 (defrecord TestNPRServer [server]
   NPRServer
   (server-take-snapshot [this actx stream-request prev-snapshot]
-    (println "server-take-snapshot" stream-request prev-snapshot)
     (let [start-sq (max (cbfg.npr/stream-request-start-sq stream-request)
                         (if prev-snapshot
                           (cbfg.npr/snapshot-next-sq prev-snapshot)
                           -1))]
-      (println "server-take-snapshot start-sq" start-sq)
       (when (< start-sq (count (:items @server)))
         (let [items (nthnext (:items @server) start-sq)]
           (when (> (count items) 0)
-            (println "server-take-snapshot2 start-sq" start-sq "items" items)
             (TestNPRSnapshot. {:items items
                                :next-sq (+ start-sq (count items))})))))))

@@ -61,23 +54,19 @@
     (TestNPRStreamRequest. (merge token {:op :stream-request
                                          :start-sq (count (:items @catom))})))
   (client-rollback [client actx stream-request rollback-msg]
-    (println "client-rollback" stream-request rollback-msg)
     (swap! client #(update-in % [:hist] conj {:stream-request stream-request
                                               :rollback-msg rollback-msg}))
     nil)
   (client-snapshot-beg [client actx stream-request snapshot-beg]
-    (println "client-snapshot-beg" stream-request snapshot-beg)
     (swap! client #(update-in % [:hist] conj {:stream-request stream-request
                                               :snapshot-beg snapshot-beg}))
     nil)
   (client-snapshot-end [client actx stream-request snapshot-beg snapshot-end]
-    (println "client-snapshot-end" stream-request snapshot-end)
     (swap! client #(update-in % [:hist] conj {:stream-request stream-request
                                               :snapshot-beg snapshot-beg
                                               :snapshot-end snapshot-end}))
     nil)
   (client-snapshot-item [client actx stream-request snapshot-beg snapshot-item]
-    (println "client-snapshot-item" stream-request snapshot-item)
     (swap! client #(update-in % [:hist] conj {:stream-request stream-request
                                               :snapshot-beg snapshot-beg
                                               :snapshot-item snapshot-item}))
@@ -101,8 +90,8 @@
                                                     server-to-client-ch)
                         cresult (atake tn cs)
                         sresult (atake tn ss)]
-                    (do (println cresult)
-                        (println sresult)
+                    (do (println "client result" cresult)
+                        (println "server result" sresult)
                         (println server)
                         (println client)
                         true)))


Move prog-ch take inside let block.

Move prog-ch take inside let block.

--- src/cbfg/world/t1.cljs
+++ src/cbfg/world/t1.cljs
@@ -139,6 +139,7 @@
 (defn process-events [vis event-delay event-ch step-ch render-ch]
   (go-loop [num-events 0]
     (when-let [[actx [verb step & args]] (<! event-ch)]
+      (println :event-ch (last actx) verb step)
       (let [deltas ((get (get vis-event-handlers verb) step) vis actx args)
             event-str (str num-events ": " (last actx) " " verb " " step " " args)]
         (when (and (not (zero? @event-delay)) (some #(not (:after %)) deltas))
@@ -170,22 +171,23 @@
                 :event-ch event-ch
                 :make-timeout-ch make-timeout-ch}]
             world (conj w "world-0")  ; No act for world actx init to avoid recursion.
-            vis (atom {:actxs {world {:children {} ; child-actx -> true,
-                                      :wait-chs {} ; ch -> [:ghost|:take|:put optional-ch-name],
-                                      :collapsed true
-                                      ; :loop-state last-loop-bindings,
-                                      }}
-                       :chs {} ; {ch -> {:id (gen-id), :msgs {msg -> true},
-                               ;         :first-taker-actx actx-or-nil}}.
-                       :gen-id gen-id})]
+            vis (atom
+                 {:actxs {world {:children {} ; child-actx -> true,
+                                 :wait-chs {} ; ch -> [:ghost|:take|:put optional-ch-name],
+                                 :collapsed true
+                                 ; :loop-state last-loop-bindings,
+                                 }}
+                  :chs {} ; {ch -> {:id (gen-id), :msgs {msg -> true},
+                          ;         :first-taker-actx actx-or-nil}}.
+                  :gen-id gen-id})]
         (process-events vis event-delay event-ch step-ch render-ch)
         (let [prog (get-el-value "prog")
               prog-js (str "with (cbfg.world.t1) {" prog "}")
               prog-res (try (js/eval prog-js) (catch js/Object ex ex))]
-          (println :prog-res prog-res))
-        (<! prog-ch)
-        (close! event-ch)
-        (recur (inc num-worlds))))))
+          (println :prog-res prog-res)
+          (<! prog-ch)
+          (close! event-ch)
+          (recur (inc num-worlds)))))))

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


Renamed to ss-ts.

Renamed to ss-ts.

--- src/cbfg/world/t1.cljs
+++ src/cbfg/world/t1.cljs
@@ -21,8 +21,8 @@
 (def prog-base    (atom {}))  ; Stable parts of prog, even during time-travel.
 (def prog-curr    (atom {}))  ; The current prog-frame.
 (def prog-hover   (atom nil)) ; A past prog-frame while hovering over prog-history.
-(def prog-history (atom []))  ; Each event is [ts label prog-frame].
-(def prog-ss      (atom {}))  ; ts => agw-snapshot.
+(def prog-history (atom []))  ; Each event is [ss-ts label prog-frame].
+(def prog-ss      (atom {}))  ; ss-ts => agw-snapshot.

 (defn prog-init [world]
   (reset! prog-base {:world world
@@ -36,12 +36,12 @@
   (reset! prog-history []))

 (defn prog-event [world label prog-frame-fn]
-  (let [prog-next (swap! prog-curr prog-frame-fn)
-        ts (count @prog-history)]
+  (let [prog-next (swap! prog-curr prog-frame-fn)]
     ; Only snapshot when we're quiescent.
     (when (<= (.-length cljs.core.async.impl.dispatch/tasks) 0)
-      (swap! prog-history #(conj % [ts label prog-next]))
-      (swap! prog-ss #(assoc % ts (ago-snapshot (actx-agw world)))))))
+      (let [ss-ts (count @prog-history)]
+        (swap! prog-history #(conj % [ss-ts label prog-next]))
+        (swap! prog-ss #(assoc % ss-ts (ago-snapshot (actx-agw world))))))))

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


add todo comment

add todo comment

--- src/chat/server/db.clj
+++ src/chat/server/db.clj
@@ -642,6 +642,7 @@

 (defn search-threads-as
   [user-id text]
+  ; TODO: add pagination
   (->> (d/q '[:find [?t-id ...]
               :in $ ?txt
               :where


fix The Source

fix The Source

Add missing code so Corp can now advance agendas when this is installed.

--- src/clj/game/cards.clj
+++ src/clj/game/cards.clj
@@ -3870,5 +3870,6 @@
    "The Source"
    {:effect (effect (update-all-advancement-costs))
     :leave-play (effect (update-all-advancement-costs))
-    :events {:agenda-scored (effect (trash card)) :agenda-stolen (effect (trash card))
+    :events {:agenda-scored {:effect (effect (trash card))}
+             :agenda-stolen {:effect (effect (trash card))}
              :pre-advancement-cost {:effect (effect (advancement-cost-bonus 1))}}}})


Remove unused imports

Remove unused imports

--- src/clj/inky/entry.clj
+++ src/clj/inky/entry.clj
@@ -10,11 +10,8 @@
          reload]
         [ring.middleware.session.cookie :only (cookie-store)]
         [ring.util.response :only (response content-type redirect)])
-  (:require [ring.adapter.jetty :as jetty]
-            [ring.util.response :as resp]
-            [aleph.http :as ah]
+  (:require [aleph.http :as ah]
             [inky.env :as env]
-            [inky.entry :as entry]
             [compojure.core :refer (defroutes GET)]
             [hiccup.page :as hp]
             [clojure.string :as str]


Add type hints to avoid reflection

Add type hints to avoid reflection

--- src/clygments/core.clj
+++ src/clygments/core.clj
@@ -6,7 +6,7 @@
            [java.util HashMap]
            [clojure.lang Keyword PersistentArrayMap PersistentHashMap]))

-(def ^:private python
+(def ^:private ^PythonInterpreter python
   (doto (PythonInterpreter.)
     (.exec "
 from pygments import highlight
@@ -40,12 +40,11 @@
     if lexer and formatter:
         return highlight(code, lexer, formatter)")))

-(def ^:private
-  py-run-fn
+(def ^:private ^PyObject py-run-fn
   (.eval python "run"))

-(def ^:private
-  py-none (.eval ^PythonInterpreter python "None"))
+(def ^:private ^PyObject py-none
+  (.eval python "None"))

 (defmulti ^:private clj->jy type)

@@ -66,7 +65,7 @@
 (defmethod clj->jy Character [c] (PyUnicode. (str c)))
 (defmethod clj->jy Keyword [k] (PyUnicode. (name k)))

-(defn- map->jy
+(defn- ^PyObject map->jy
   ([m]
    (map->jy m identity))
   ([m keyfn]
@@ -78,7 +77,7 @@
 (defmethod clj->jy PersistentHashMap [m] (map->jy m))
 (defmethod clj->jy PersistentArrayMap [m] (map->jy m))

-(defn- keyword->lowercase-pystring
+(defn- ^PyUnicode keyword->lowercase-pystring
   [kw]
   (-> kw name str/lower-case (PyUnicode.)))

@@ -89,19 +88,18 @@
    {:pre [(string? code)]}
    (let [py-code (PyUnicode. ^String code)
          py-lexer-name (if (some? lang)
-                         (keyword->lowercase-pystring lang)
+                         ^PyObject (keyword->lowercase-pystring lang)
                          py-none)
          py-formatter-name (keyword->lowercase-pystring output)

          py-opts (map->jy opts
                           (fn [k]
                             (-> k name (str/replace #"-" "") str/lower-case)))
-
          res (.__call__ py-run-fn
-                        (into-array PyObject [py-code
-                                              py-lexer-name
-                                              py-formatter-name
-                                              py-opts]))]
+                        py-code
+                        py-lexer-name
+                        py-formatter-name
+                        py-opts)]

      (when (and res (.__nonzero__ res))
        ;; This won't work with non-text formatters such as :gif, but it's


bundle.clj: fn to test if a plugin is available (STARTING or ACTIVE).

--- ccw.core/src/clj/ccw/bundle.clj
+++ ccw.core/src/clj/ccw/bundle.clj
@@ -28,7 +28,9 @@
 ;}

  (def ^:private start-states #{(Bundle/STARTING) (Bundle/ACTIVE)})
-
+ (defn available? [bundle]
+  (and bundle (start-states (.getState bundle))))
+
  (defn bundle
    "Return the bundle object associated with the bundle-symbolic-name (a String)"
    ^Bundle [bundle-symbolic-name]
@@ -65,7 +67,7 @@
    ;; TODO: not good??, maybe we will not catch the right bundle (the same the OSGi framework would use ...)
    (try
      (let [b (bundle bundle-symbolic-name)]
-       (when-not (start-states (.getState b))
+       (when-not (available? b)
          (.start b))
        b)
      (catch BundleException e


fix(ccw.launch): guarantees a valid and unique name for launch configurations

--- ccw.core/src/clj/ccw/launch.clj
+++ ccw.core/src/clj/ccw/launch.clj
@@ -167,11 +167,18 @@
     (set-attribute! working-copy k v))
   working-copy)

+(defn valid&unique-name
+  "Create a valid and unique name for the launch configuration"
+  [s]
+  (-> (DebugPlugin/getDefault)
+     .getLaunchManager
+     (.generateLaunchConfigurationName s)))
+
 (defn- new-working-copy
   "Create a launch configuration working copy with given name and type-id"
   [& {:keys #{name type-id} :or {type-id :java}}]
-  (let [name (or name (.toString (java.util.UUID/randomUUID)))
-        manager (-> (DebugPlugin/getDefault) .getLaunchManager)
+  (let [name (valid&unique-name (or name (.toString (java.util.UUID/randomUUID))))
+        manager (.getLaunchManager (DebugPlugin/getDefault))
         type (.getLaunchConfigurationType manager (launch-configuration-types type-id type-id))]
     (.newInstance type nil name)))

@@ -181,7 +188,6 @@
   (let [m (merge (default-launch) m)
         wc (new-working-copy :name (:name m) :type-id (:type-id m))
         attrs (dissoc m :name :type-id)
-
         wc (set-attributes! wc attrs)]
     wc))


Add :internal-name case to fn->name-tests

--- test/oxcart/pattern_test.clj
+++ test/oxcart/pattern_test.clj
@@ -64,6 +64,7 @@
   (is (p/fn->name (:init foo)))
   (is (p/fn->name (:init bar)))
   (is (p/fn->name fail))
+  (is (= "bar" (p/fn->name {:op :fn :internal-name "bar"})))
   (is-not (p/fn->name addition)))


whitespace

whitespace

--- src/babel/francais/lexicon.cljc
+++ src/babel/francais/lexicon.cljc
@@ -483,11 +483,11 @@
   "mettre" {:synsem {:cat :verb
                      :passato "mis"
                      :present {:1sing "mets"
-                                    :2sing "mets"
-                                    :3sing "met"
-                                    :1plur "mettons"
-                                    :2plur "mettez"
-                                    :3plur "mettent"}
+                               :2sing "mets"
+                               :3sing "met"
+                               :1plur "mettons"
+                               :2plur "mettez"
+                               :3plur "mettent"}

                      :sem {:pred :put}}}
   "nous"


+adjunct-prepositional-phrase

+adjunct-prepositional-phrase

--- src/babel/italiano/grammar.cljc
+++ src/babel/italiano/grammar.cljc
@@ -205,6 +205,10 @@
                            {:rule "prepositional-phrase"
                             :synsem {:cat :prep}})

+                   (unifyc h21
+                           {:rule "adjunct-prepositional-phrase"
+                            :synsem {:cat :prep}})
+
                    (unifyc c10
                            root-is-head-root
                            {:head {:phrasal true ;; only a vp-aux may be the head child, not simply a lexical auxiliary verb.


s/'()/[]/

s/'()/[]/

--- src/babel/italiano/grammar.cljc
+++ src/babel/italiano/grammar.cljc
@@ -170,7 +170,7 @@
   (merge
    (unify
     h21
-    {:head {:synsem {:subcat {:2 {:subcat {:2 '()}}}}}})
+    {:head {:synsem {:subcat {:2 {:subcat {:2 []}}}}}})
    {:comment "h21a"
     :schema-symbol 'h21a}))

@@ -198,8 +198,8 @@
    {:comment "c00"
     :schema-symbol 'c00 ;; used by over-each-parent to know where to put children.
     :first :comp
-    :comp {:synsem {:subcat '()}}
-    :head {:synsem {:subcat '()}}}))
+    :comp {:synsem {:subcat []}}
+    :head {:synsem {:subcat []}}}))

 (defonce h00
   (unify-check
@@ -207,8 +207,8 @@
    {:comment "h00"
     :schema-symbol 'h00 ;; used by over-each-parent to know where to put children.
     :first :head
-    :comp {:synsem {:subcat '()}}
-    :head {:synsem {:subcat '()}}}))
+    :comp {:synsem {:subcat []}}
+    :head {:synsem {:subcat []}}}))

 ;; </TODO: move most of the content to babel.ug>
 ;; -- END SCHEMA DEFINITIONS
@@ -286,7 +286,7 @@
                                        :cat :noun
                                        :propernoun is-propernoun?
                                        :sem {:number number-agreement
-                                             :mod '()}}
+                                             :mod []}}
                               :head {:phrasal false
                                      :synsem {:propernoun is-propernoun?}}
                               :comp {:phrasal false}})) ;; rathole prevention ;; TODO: see if this can be removed.
@@ -545,17 +545,17 @@
                                 modified
                                 (let [sem (atom :top)
                                       essere (atom :top)] ;; TODO: use (default) to set this for all {:cat :verb} rules.
-                                  {:synsem {:subcat '()
+                                  {:synsem {:subcat []
                                             :essere essere
                                             :cat :verb
                                             :sem sem}
                                    :comp {:synsem {:cat :prep
-                                                   :subcat '()}}
+                                                   :subcat []}}
                                    :head {:modified false
                                           :essere essere
                                           :synsem {:cat :verb
                                                    :sem sem
-                                                   :subcat '()}}
+                                                   :subcat []}}
                                    :rule "s-modified-modifier-first"}))

                    (unify-check h00
@@ -563,17 +563,17 @@
                                 modified
                                 (let [sem (atom :top)
                                       essere (atom :top)]  ;; TODO: use (default) to set this for all {:cat :verb} rules.
-                                  {:synsem {:subcat '()
+                                  {:synsem {:subcat []
                                             :cat :verb
                                             :essere essere
                                             :sem sem}
                                    :comp {:synsem {:cat :prep
-                                                   :subcat '()}}
+                                                   :subcat []}}
                                    :head {:modified false
                                           :synsem {:cat :verb
                                                    :essere essere
                                                    :sem sem
-                                                   :subcat '()}}
+                                                   :subcat []}}
                                    :rule "s-modified-modifier-last"}))))

 (defn aux-is-head-feature [phrase]


add {:synsem {:sem {:human true}}} for "io","noi","tu" and "voi"

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -1248,7 +1248,8 @@
                  :agr {:gender :fem
                        :person :1st
                        :number :sing}
-                 :sem {:pred :I}
+                 :sem {:pred :I
+                       :human true}
                  :subcat '()}}

        {:synsem {:cat :noun
@@ -1257,7 +1258,8 @@
                  :agr {:gender :masc
                        :person :1st
                        :number :sing}
-                 :sem {:pred :I}
+                 :sem {:pred :I
+                       :human true}
                  :subcat '()}}]
       "la"
    ;; as with "lo", do we need both of these "lo" entries? try to get by with just one.
@@ -1592,7 +1594,8 @@
              :agr {:gender :fem
                    :person :1st
                    :number :plur}
-             :sem {:pred :noi}
+              :sem {:pred :noi
+                    :human true}
              :subcat '()}}
     {:synsem {:cat :noun
               :pronoun true
@@ -1600,7 +1603,8 @@
              :agr {:gender :masc
                    :person :1st
                    :number :plur}
-              :sem {:pred :noi}
+              :sem {:pred :noi
+                    :human true}
               :subcat '()}}]

    "osservare" {:synsem {:cat :verb
@@ -1953,7 +1957,8 @@
               :agr {:person :2nd
                     :gender :fem
                     :number :sing}
-              :sem {:pred :tu}
+              :sem {:pred :tu
+                    :human true}
               :subcat '()}}
     {:synsem {:cat :noun
               :pronoun true
@@ -1961,7 +1966,8 @@
               :agr {:person :2nd
                     :gender :masc
                     :number :sing}
-              :sem {:pred :tu}
+              :sem {:pred :tu
+                    :human true}
               :subcat '()}}]
    "un"
        {:synsem {:cat :det
@@ -2076,7 +2082,8 @@
               :agr {:person :2nd
                     :gender :fem
                     :number :plur}
-              :sem {:pred :voi}
+              :sem {:pred :voi
+                    :human true}
               :subcat '()}}

     {:synsem {:cat cat-of-pronoun
@@ -2085,7 +2092,8 @@
               :agr {:person :2nd
                     :gender :masc
                     :number :plur}
-              :sem {:pred :voi}
+              :sem {:pred :voi
+                    :human true}
               :subcat '()}}]

     "volere" {:synsem {:cat :verb


+clojure.repl/doc

+clojure.repl/doc

--- src/babel/italiano/workbook.clj
+++ src/babel/italiano/workbook.clj
@@ -18,6 +18,7 @@
    [clojail.testers :refer :all]
    [clojure.core :exclude [get-in]]
    [clojure.core :as core] ;; This allows us to use core's get-in by doing "(core/get-in ..)"
+   [clojure.repl :refer [doc]]
    [clojure.set :as set]
    [clojure.string :as string]
    [clojure.tools.logging :as log]


RS + MG #16 Remove some whitespace

RS + MG #16 Remove some whitespace

--- src/objective8/handlers/api.clj
+++ src/objective8/handlers/api.clj
@@ -219,7 +219,7 @@
       (successful-post-response resource-location stored-invitation))
   (catch NumberFormatException e
     (log/info "Invalid route: " e)
-    (invalid-response "Objective id must be an integer"))
+    (invalid-response "Objective id must be an integer"))
   (catch Exception e
     (log/info "Error when posting an invitation: " e)
     (invalid-response "Invalid invitation post request for this objective"))))


ns form

ns form

--- src/otp_api_proxy/test_data.clj
+++ src/otp_api_proxy/test_data.clj
@@ -1,3 +1,5 @@
+(ns otp-api-proxy.test-data)
+
 (def
   otp-response-1
 {:orig-content-encoding nil,


not a very good solution, but inputs are reset when anything in the scene changes (bad)

--- src/play_clj/core_listeners.clj
+++ src/play_clj/core_listeners.clj
@@ -192,12 +192,12 @@
         (.setWorldSize (. camera viewportWidth) (. camera viewportHeight)))))
   ([{:keys [^Stage renderer ui-listeners]} [entities]]
    (doseq [^Actor a (.getActors renderer)]
-     (.remove a))
+     #_(.remove a))
    (doseq [e (vals entities) ]
      (let [object (:object e)]
        (when (isa? (type object) Actor)
-
-         (.addActor renderer object)
+         (when-not (.hasParent object)
+           (.addActor renderer object))
          (doseq [[_ listener] ui-listeners]
            (.addListener ^Actor object listener)))))
    (remove-input! renderer)


Finished checking data definition schema

--- src/cfpb/qu/data/definition.clj
+++ src/cfpb/qu/data/definition.clj
@@ -7,17 +7,42 @@
             [cheshire.core :as json]
             [cheshire.factory :as factory]))

+(def InfoS {(s/required-key :name) s/String
+            (s/optional-key :description) s/String
+            (s/optional-key :url) s/String
+            s/Keyword s/Any
+            })
+
+(def TypeS (s/enum "string" "integer" "date" "dollars" "number"))
+
 (def IndexS (s/either s/String [s/String]))

-(def TableSliceS {(s/required-key :type) (s/eq "table")
+(defn ref-col-count-eq?
+  "Make sure that if you have multiple columns in a reference that you
+  have the same number of columns in the id."
+  [ref]
+  (if (coll? (:column ref))
+    (= (count (:column ref)) (count (:id ref)))
+    (not (coll? (:id ref)))))
+
+(def ReferenceS (s/both (s/pred ref-col-count-eq?)
+                        {(s/required-key :column) (s/either s/String [s/String])
+                         (s/required-key :concept) s/String
+                         (s/optional-key :id) (s/either s/String [s/String])
+                         (s/required-key :value) s/String
+                         }))
+
+(def TableSliceS {(s/optional-key :info) {s/Keyword s/String}
+                  (s/required-key :type) (s/eq "table")
                   (s/required-key :table) s/String
                   (s/required-key :dimensions) [s/String]
                   (s/required-key :metrics) [s/String]
                   (s/optional-key :indexes) [IndexS]
-                  (s/optional-key :references) s/Any ;; TODO
+                  (s/optional-key :references) {s/Keyword ReferenceS}
                   })

-(def DerivedSliceS {(s/required-key :type) (s/eq "derived")
+(def DerivedSliceS {(s/optional-key :info) {s/Keyword s/String}
+                    (s/required-key :type) (s/eq "derived")
                     (s/required-key :slice) s/String
                     (s/required-key :dimensions) [s/String]
                     (s/required-key :metrics) [s/String] ;; TODO remove metrics from here
@@ -27,10 +52,27 @@

 (def SliceS (s/either TableSliceS DerivedSliceS))

-(def DataDefinitionS {(s/required-key :info) {s/Keyword s/Any} ;; TODO
+(def SimpleConceptS {(s/optional-key :description) s/String
+                     (s/optional-key :type) TypeS})
+(def TableConceptS (merge SimpleConceptS
+                          {(s/required-key :table) s/String
+                           (s/required-key :properties) {s/Keyword
+                                                         {(s/required-key :type) TypeS
+                                                          s/Keyword s/String}}}))
+(def ConceptS (s/either SimpleConceptS TableConceptS))
+
+(def ColumnS {(s/optional-key :name) s/String
+              (s/optional-key :skip) boolean
+              (s/optional-key :type) TypeS
+              (s/optional-key :format) s/String})
+
+(def TableS {:sources [s/String]
+             :columns {s/Keyword ColumnS}})
+
+(def DataDefinitionS {(s/required-key :info) InfoS
                       (s/required-key :slices) {s/Keyword SliceS}
-                      (s/optional-key :concepts) {s/Keyword s/Any} ;; TODO
-                      (s/required-key :tables) {s/Keyword s/Any} ;; TODO
+                      (s/optional-key :concepts) {s/Keyword ConceptS}
+                      (s/required-key :tables) {s/Keyword TableS}
                       })

 (defn read-definition
@@ -60,3 +102,5 @@
   (apply concat ((juxt dimensions metrics) definition slice)))

 ;; (read-definition (io/resource "datasets/integration_test/definition.json"))
+;; (read-definition (io/resource "datasets/hmda/definition.json"))
+;; (s/explain DataDefinitionS)


saving.

saving.

--- src/clj/forma/trends/filter.clj
+++ src/clj/forma/trends/filter.clj
@@ -231,9 +231,10 @@
   exception to avoid returning empty vector"
   [start-index end-index base-seq]
   {:pre [(> start-index 0)]}
-  (let [base-vec (vec base-seq)]
+  (let [base-vec (vec base-seq)
+        len (count base-vec)]
     (for [x (range start-index (inc end-index))]
-      (subvec base-vec 0 x))))
+      (subvec base-vec 0 (max len x)))))

 (defn make-clean
   "Wrapper for `make-reliable`, `deseasonalize` and any future data cleaning
@@ -273,4 +274,3 @@
   {:pre [(and (< 0 (count model-ts))
               (< 0 (count ts)))]}
   [(vec (take (count model-ts) ts))])
-


Added dummy/identity deseasonalization

Added dummy/identity deseasonalization

--- src/clj/forma/trends/filter.clj
+++ src/clj/forma/trends/filter.clj
@@ -17,6 +17,10 @@
     ;; 12: frequency of 32-day MODIS data"
   [freq n]
   (i/matrix (take n (cycle (i/identity-matrix freq)))))
+
+(defn dummy-deseasonalize
+  [freq ts]
+  ts)

 (defn deseasonalize
   "accepts a timeseries `ts` with frequency `freq` and returns a
@@ -224,7 +228,7 @@
   "Interpolate over bad values and remove seasonal component using reliability."
   [freq good-set bad-set spectral-ts reli-ts]
   (-> (make-reliable good-set bad-set spectral-ts reli-ts)
-      (deseasonalize freq)))
+      (dummy-deseasonalize freq)))

 (defn reliable?
   "Checks whether the share of reliable pixels exceeds a supplied minimum.


fix sql parser

fix sql parser

--- src/cljc/dbquery/sql_utils.cljc
+++ src/cljc/dbquery/sql_utils.cljc
@@ -79,11 +79,11 @@
           open (if (= (s/upper-case begin) "BEGIN") 1 0)]
       #?(:cljs (loop [open open
                       regex (js/RegExp. "(begin|end)\\W", "gi")]
-                 (let [[_ [match] index] (.exec regex sub-text)
+                 (let [[_ match :as r] (.exec regex sub-text)
                        open (if (= (s/lower-case match) "end") (dec open) (inc open))]
                    (if (> open 0)
                      (recur open regex)
-                     (+ 1 offset (.indexOf sub-text ";" index)))))
+                     (+ 1 offset (.indexOf sub-text ";" (.-index r))))))
          :clj (loop [matcher (re-matcher #"(?i)(begin|end)\W" sub-text)
                      open open]
                 (when (.find matcher)


add the possibility to check or uncheck

add the possibility to check or uncheck

--- src/cljs/clojure_rest/core.cljs
+++ src/cljs/clojure_rest/core.cljs
@@ -72,22 +72,26 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (defn render-task
-  [on-remove task]
+  [on-remove on-check task]
   [:li.checklist__task
-   [:input {:type "checkbox" :default-checked (:done task)}]
+   [:input {:type "checkbox"
+            :default-checked (:done task)
+            :on-click on-check}]
    (:name task)
    [:a.checklist__task--remove {:href "#" :on-click on-remove}]
   ])

 (defn render-tasks
   [{:keys [tasks] :as card}]
-  [:div.checklist
-   [:ul
-    (map
-      (fn [idx t]
-        ^{:key t} [render-task #(update-card! (api/remove-task-at card idx)) t])
-      (range) tasks)
-    ]])
+  (let [on-remove #(update-card! (api/remove-task-at card %))
+        on-check #(update-card! (update-in card [:tasks % :done] not))]
+    [:div.checklist
+    [:ul
+     (map
+       (fn [idx t]
+         ^{:key t} [render-task #(on-remove idx) #(on-check idx) t])
+       (range) tasks)
+     ]]))

 (defn render-add-task
   "Render the text field allowing to add new tasks to a card"


added "vimscript" to language map

added "vimscript" to language map

--- src/me/panzoo/story.clj
+++ src/me/panzoo/story.clj
@@ -163,6 +163,7 @@
    "scala" ["//" "shBrushScala.js"]
    "sql" ["--" "shBrushSql.js"]
    "vim" ["\"" "shBrushVimscript.js"]
+   "vimscript" ["\"" "shBrushVimscript.js"]
    "vb" ["'" "shBrushVb.js"]
    "vbnet" ["'" "shBrushVb.js"]
    ;"xml" "shBrushXml.js"


s/Microdoser/Mikrodosar/

s/Microdoser/Mikrodosar/

--- src/cljs/mokkameister/core.cljs
+++ src/cljs/mokkameister/core.cljs
@@ -75,7 +75,7 @@
 (def ^:private chart-titles
   (flatten [(repeat 2 "Brygg per monade")
             (repeat 8 "Brygg per månad")
-            (repeat 1 "Microdoser per månad")]))
+            (repeat 1 "Mikrodosar per månad")]))

 (defn chart [chart-data]
   (let [month-count (map :count chart-data)]


New functions piece-type, piece-color in core ns.

--- src/clojure/clj_chess/core.cljc
+++ src/clojure/clj_chess/core.cljc
@@ -2,7 +2,12 @@
   (:require [clj-chess.board :as b]
             [clj-chess.game :as g]
             #?(:cljs [jschess.chess :as jsc]))
-  #?(:clj (:import (chess Square))))
+  #?(:clj (:import (chess Square Piece))))
+
+(def ^:private color-to-keyword
+  "Converts the internal integer representation of piece colors to one of
+  the keywords :white, :black or :empty."
+  [:white :black :empty])

 (def ^:private piece-type-to-keyword
   "Converts the internal integer representation of piece types to keywords of
@@ -13,6 +18,20 @@
   "Converts the internal integer representation of chess pieces to keywords
   of the form :wp :wn, etc."
   [:? :wp :wn :wb :wr :wq :wk :? :? :bp :bn :bb :br :bq :bk :? :empty])
+
+(defn piece-type
+  "The type of a piece, given by a keyword of the form :pawn, :knight, etc."
+  [piece]
+  (piece-type-to-keyword
+    #?(:clj (Piece/type piece)
+       :cljs (jsc/pieceType piece))))
+
+(defn piece-color
+  "The color of a piece, :white or :black."
+  [piece]
+  (let [color #?(:clj (Piece/color piece)
+                 :cljs (jsc/pieceColor piece))]
+    (color-to-keyword color)))

 (defn move-from
   "The source square of a move"


Removed -target-init and made -project serve that function as well.

--- src/clojure/freactive/core.cljc
+++ src/clojure/freactive/core.cljc
@@ -880,15 +880,12 @@
 (defn source-pull [this idx] (-source-pull this idx))

 (defprotocol IProjectionTarget
-  (-target-init [this source])
   (-target-insert [this projected-elem before-idx])
   (-target-peek [this elem-idx])
   (-target-take [this elem-idx])
   (-target-count [this])
   (-target-move [this elem-idx before-idx]))

-(defn target-init [this source] (-target-init this source))
-
 (defn target-insert [this elem before-idx] (-target-insert this elem before-idx))

 (defn target-peek [this idx] (-target-peek this idx))
@@ -908,7 +905,14 @@
     (target-remove this 0)))

 (defprotocol IProjection
-  (-project [this target enqueue-fn]))
+  (-project [this target enqueue-fn]
+    "Initializes a projection with a target IProjectionTarget and a platform
+enqueue-fn. The return value should be the actual IProjectionSource that this
+IProjection is binding to the IProjectionTarget. All updates should be
+dispatched via enqueue-fn in batches that are as big as possible - this usually
+means that updates are batched to enqueue-fn only if they are the direct result
+of some state change, not updates propogated up from a lower level projection
+source."))

 (defn project [projection target enqueue-fn]
   (-project projection target enqueue-fn))
@@ -1073,8 +1077,8 @@
        (reify IProjection
          (-project [this target enqueue]
            (let [source (SeqProjectionSource. elements target enqueue)]
-             (target-init target source)
-             (enqueue (fn [] (.refresh source)))))))
+             (enqueue (fn [] (.refresh source)))
+             source))))

      (defprotocol IAsVirtualElement
        (-as-velem [this as-velem-fn]))
@@ -1091,8 +1095,6 @@
          (wrap wrap-fn (source-pull source idx)))

        IProjectionTarget
-       (-target-init [this src]
-         (set! source src))
        (-target-insert [this elem before-idx]
          (target-insert target (wrap wrap-fn elem) before-idx))
        (-target-peek [this i]
@@ -1108,8 +1110,8 @@
        (reify IProjection
          (-project [this target enqueue-fn]
            (let [pproj (MapProjection. wrap-fn target nil)]
-             (target-init target pproj)
-             (project proj pproj enqueue-fn)))))
+             (set! (.-source pproj) (project proj pproj enqueue-fn))
+             pproj))))

      (deftype OffsetProjection [offset source target]
        Object
@@ -1135,8 +1137,8 @@
        (reify IProjection
          (-project [this target enqueue-fn]
            (let [pproj (OffsetProjection. offset target nil)]
-             (target-init target pproj)
-             (project proj pproj enqueue-fn)))))
+             (set! (.-source pproj) (project proj pproj enqueue-fn))
+             pproj))))

      (deftype LimitProjection [offset source target]
        Object
@@ -1161,7 +1163,10 @@
      (defn plimit [proj limit]
        (reify IProjection
          (-project [this target enqueue-fn]
-           (project proj (LimitProjection. limit proj target) enqueue-fn))))
+           (let [pproj (LimitProjection. limit proj target)]
+             (set! (.-source pproj) (project proj pproj enqueue-fn))
+             pproj))))
+

      (defn- cmap2* [f keyset-cursor
                     {:keys [filter sort offset limit placeholder-idx placeholder] :as opts}]


Indentation changes

Indentation changes

--- src/com/akr/ez_patcher/core.clj
+++ src/com/akr/ez_patcher/core.clj
@@ -52,8 +52,8 @@

 (defn construct [klass & args]
   (.newInstance
-    (.getConstructor klass (into-array java.lang.Class (map type args)))
-    (object-array args)))
+   (.getConstructor klass (into-array java.lang.Class (map type args)))
+   (object-array args)))

 (defn get-nested-object [obj reflector property]
@@ -104,8 +104,8 @@

                  [nil _ _ _] nil
                  [_ 'clojure.lang.PersistentArrayMap _ _] (let [nested-object (get-nested-object obj reflector prop)]
-                                                          (update-with nested-object value)
-                                                          nested-object)
+                                                            (update-with nested-object value)
+                                                            nested-object)
                  [_ 'clojure.lang.PersistentVector   _ _] (let [generic-classes (.. (class obj)
                                                                                (getDeclaredField prop)
                                                                                (getGenericType)
@@ -147,8 +147,8 @@
                  [_ 'java.lang.String  _                 true]   (let [klass (get-class-by-name property-type)]
                                                                    (Reflector/invokeStaticMethod klass "valueOf" (to-array [value])))
                  :else (-> property-type
-                             (resolve)
-                             (cast value)))]
+                           (resolve)
+                           (cast value)))]

       (Reflector/invokeInstanceMethod obj
                                       setter


Don't barf if ./bin/version doesn't work during dev

--- src/metabase/config.clj
+++ src/metabase/config.clj
@@ -60,8 +60,12 @@
 ;; Metabase version is of the format `GIT-TAG (GIT-SHORT-HASH GIT-BRANCH)`

 (defn- version-info-from-shell-script []
-  (let [[tag hash branch date] (-> (shell/sh "./bin/version") :out s/trim (s/split #" "))]
-    {:tag tag, :hash hash, :branch branch, :date date}))
+  (try
+    (let [[tag hash branch date] (-> (shell/sh "./bin/version") :out s/trim (s/split #" "))]
+      {:tag tag, :hash hash, :branch branch, :date date})
+    ;; if ./bin/version fails (e.g., if we are developing on Windows) just return something so the whole thing doesn't barf
+    (catch Throwable _
+      {:tag "?", :hash "?", :branch "?", :date "?"})))

 (defn- version-info-from-properties-file []
   (when-let [props-file (io/resource "version.properties")]


more tidying up.

more tidying up.

--- src/metabase/driver.clj
+++ src/metabase/driver.clj
@@ -138,8 +138,7 @@

   (field-values-lazy-seq ^clojure.lang.Sequential [this, ^FieldInstance field]
     "Return a lazy sequence of all values of FIELD.
-     This is used to implement `mark-json-field!`, and fallback implentations of `mark-no-preview-display-field!` and `mark-url-field!`
-     if drivers *don't* implement `field-avg-length` and `field-percent-urls`, respectively.")
+     This is used to implement some methods of the database sync process which require rows of data during execution.")

   (humanize-connection-error-message ^String [this, ^String message]
     "*OPTIONAL*. Return a humanized (user-facing) version of an connection error message string.
@@ -213,10 +212,7 @@
   "Default implementations of `IDriver` methods marked *OPTIONAL*."
   {:date-interval                     (fn [_ unit amount] (u/relative-date unit amount))
    :describe-table-fks                (constantly nil)
-   :driver-specific-sync-field!       (constantly nil)
    :features                          (constantly nil)
-   :field-avg-length                  default-field-avg-length
-   :field-percent-urls                default-field-percent-urls
    :humanize-connection-error-message (fn [_ message] message)
    :process-query-in-context          (fn [_ qp]      qp)
    :sync-in-context                   (fn [_ _ f] (f))


show popup link on slowness detect hint

show popup link on slowness detect hint

--- src/metronome/core.cljs
+++ src/metronome/core.cljs
@@ -181,7 +181,11 @@
                              (dom/span #js {:aria-hidden "true"}
                                        "\u00d7"))
                  (dom/strong nil "Missing some beats? ")
-                 "It seems like some beats where skipped. Did you run this in a background tab? Try popping this tab out into a separate window instead.")))))
+                 "It seems like some beats where skipped. Did you run this in a background tab? Try popping this tab out into a "
+                 (dom/a #js {:href "#"
+                             :onClick #(.open js/window (-> js/window .-location .-href) "metronome" "width=280,height=280")}
+                        "separate window")
+                 " instead.")))))

 (om/root
  (fn [app owner]
@@ -202,3 +206,4 @@
                (om/build skip-warning (:bpm app))))))
  app-state
  {:target (. js/document (getElementById "app"))})
+x


array object loop

array object loop

--- src/portfolio/core.cljs
+++ src/portfolio/core.cljs
@@ -33,6 +33,9 @@
 (defroute "/portfolio" []
       (swap! app-state assoc :page :portfolio))

+(defroute "/contact" []
+      (swap! app-state assoc :page :contact))
+
 (hook-browser-navigation!)

 (defmulti current-page #(@app-state :page))
@@ -53,15 +56,39 @@
      [:p.subtitle "Catchy subtitle"]
      [:a.cta {:href "#"} "GO"]]]]))

-(defn now [] (new java.util.Date))
+(defn current-year [] (.format (java.text.SimpleDateFormat. "yyyy") (new java.util.Date)))
+; (str (current-year) " asdasd")

 (defn footer []
- [:div.footer ])
+ [:div {:style {:background-color "#20202D"}}
+      "2017"  "/" [:a {:href "https://github.com"} "Tyler Roberts"]
+      "/"
+      [:a  {:href "https://github.com"} "Reid Quisenberry"]])

+(defn port-data []
+ [{:title "My Blog" :url "https"}
+  {:title "My Site" :url "https"}])
+
+(map #([:title]) port-data)
+
 (defmethod current-page :contact [])
+  ; (map #([:li :title] port-data)))
+  ; [:table
+  ;  (for [i (range 10)]
+  ;    [:tr (for [j (range 3)]
+  ;           [:td (str "Row " (+ 1 i) ", Col " (+ 1 j))])])]))

-
+; (defn lister [items]
+;   [:ul
+;    (for [item items]
+;      ^{:key item} [:li "Item " item])])
+;
+; (defn lister-user []
+;   [:div
+;    "Here is a list:"
+;    [lister (range 3)]])
+;

 (defn navbar []
  [:div#menu
@@ -77,18 +104,18 @@
      [:a {:href "#/portfolio"}
       [:span "Portfolio"]]]
     [:li
-     [:a {:href "#"}
+     [:a {:href "#/contact"}
       [:span "Contact"]]]]]])

 ;; View
-
 (defn portfolio-app [props]
-  [:div (navbar)
-   [:hr]
-   (current-page)
-   [:hr]
-   [:footer.footer (footer)]])
+ [:div.container
+  [:div (navbar)]
+  [:hr]
+  (current-page)
+  [:hr]
+  [:footer.footer (footer)]])

 ;; -------------------------
 ;; Initialize app


Add timeout to stdout stream to try to start the container

--- src/replme/web/repl.clj
+++ src/replme/web/repl.clj
@@ -1,5 +1,5 @@
 (ns replme.web.repl
-  (:require [clojure.core.async :refer [go <! >! <!! >!! chan close! go-loop filter<]]
+  (:require [clojure.core.async :refer [go <! >! <!! >!! chan close! go-loop alts! timeout]]
             [org.httpkit.server :refer [send! with-channel on-receive on-close open? websocket?]]
             [http.async.client :as http]
             [clojure.tools.logging :as log]
@@ -54,23 +54,28 @@
   [msg destination]
   {:message msg :destination destination})

+(defn- timeout-stdout
+  [stdout]
+  (go (or (first (alts! [stdout (timeout 30000)] :priority true)) "server started")))
+
 (defn- docker-repl
   [client args in-chan out-chan]
   (let [[id stdout] (start-docker client args)
         ip (docker-ip client id)
         port 8081]
-    (go-loop [msg (<! stdout)]
+    (go-loop [msg (<! (timeout-stdout stdout))]
+      (log/info msg)
       (if (re-find nrepl-sentinel msg)
         (do
           (log/info (str "Connecting to docker nrepl at" ip ":" port))
           (>! out-chan (out-msg "REPL OK" :command))
           (go-loop [command (<! in-chan)]
             (when command
-             (with-open [repl-conn (repl/connect :host ip :port port)]
-               (>! out-chan
-                   (-> (repl/client repl-conn 1000)
-                       (repl/message {:op :eval :code command})
-                       (out-msg :repl)))))
+              (with-open [repl-conn (repl/connect :host ip :port port)]
+                (>! out-chan
+                    (-> (repl/client repl-conn 1000)
+                        (repl/message {:op :eval :code command})
+                        (out-msg :repl)))))
             (recur (<! in-chan))))

         (do (>! out-chan (out-msg msg :console))


remove extra level

remove extra level

--- src/shuppet/web.clj
+++ src/shuppet/web.clj
@@ -74,7 +74,7 @@

 (defn- apply-app-config
   [env name]
-  (response {:report (core/apply-config env name)}))
+  (response (core/apply-config env name)))

 (defn- clean-app-config
   [environment name]
@@ -85,7 +85,7 @@

 (defn- apply-apps-config
   [env]
-  (response {:reports  (core/configure-apps env)}))
+  (response (core/configure-apps env)))

 (defn- create-app-config
   [name local master-only]


Fix tests

Fix tests

--- src/yada/schema.clj
+++ src/yada/schema.clj
@@ -327,7 +327,6 @@
          Consumes
          Methods
          {(s/optional-key :interceptor-chain) [s/Any]}
-         Responses
          ResourceDocumentation
          {NamespacedKeyword s/Any}))


+italiano/lab.clj

+italiano/lab.clj


meld: minor cleanup

meld: minor cleanup

--- cljs/src/meld/meld/support.cljs
+++ cljs/src/meld/meld/support.cljs
@@ -161,22 +161,22 @@
     "rect"))

 (defn get-graph-node-class [_node selected? disabled?]
-  (apply str
-    (interpose " "
-      (remove nil?
-        [(if selected? "selected")
-         (if disabled? "disabled")]))))
+  (let [classes [(if selected? "selected")
+                 (if disabled? "disabled")]]
+    (->> classes
+      (remove nil?)
+      (interpose " ")
+      (apply str))))

 (defn get-graph-node-info [node selected? disabled?]
   {:label (node/get-desc node)
    :shape (get-graph-node-shape node)
    :title (pretty-print node)
-   ;:rank (rand 1000)
    :class (get-graph-node-class node selected? disabled?)})

 (defn get-graph-edge-info [_node _child]
   {:lineInterpolate "basis"})
-(reify)
+
 (defn populate-graph-nodes! [graph start-loc selected-id]
   (let [top-id (zip/top-id start-loc)
         is-disabled? (fn [loc] (not (some #{top-id} (zip/ancestors loc))))]
@@ -246,7 +246,7 @@
                (this-as this
                  (.tipsy (js/$ this) #js {:gravity "w"
                                           :opacity 1
-                                          :title #(style-tooltip (.node graph v))
+                                          :title   #(style-tooltip (.node graph v))
                                           :html    true})))))))

 (defn render-dag [graph dom-element]


Fixing common app lib dependency version.

--- message-queue-lib/project.clj
+++ message-queue-lib/project.clj
@@ -3,7 +3,7 @@
   :url "***REMOVED***projects/CMR/repos/cmr/browse/message-queue-lib"
   :dependencies [[org.clojure/clojure "1.7.0"]
                  [nasa-cmr/cmr-common-lib "0.1.1-SNAPSHOT"]
-                 [nasa-cmr/cmr-common-app-lib "0.1.1-SNAPSHOT"]
+                 [nasa-cmr/cmr-common-app-lib "0.1.0-SNAPSHOT"]
                  [nasa-cmr/cmr-transmit-lib "0.1.0-SNAPSHOT"]
                  [nasa-cmr/cmr-acl-lib "0.1.0-SNAPSHOT"]
                  [com.novemberain/langohr "3.4.0"]]


Cleaning up beats example and removing midi bits.

--- src/examples/beats.clj
+++ src/examples/beats.clj
@@ -1,23 +1,7 @@
 (ns examples.beats
-  (:use overtone.live
-        [overtone.gui sequencer control stepinator]))
+  (:use overtone.live))

-(comment
-  * kick
-  * snare
-  * rim click
-  * crash symbal
-  * foot hi-hat
-  * close hi-hat
-  * half-open hi-hat
-  * open hi-hat
-  * ride cymbal
-  * high tom
-  * mid tom
-  * low tom
-)
-
- (defn ugen-cents
+(defn ugen-cents
   "Returns a frequency computed by adding n-cents to freq.  A cent is a
   logarithmic measurement of pitch, where 1-octave equals 1200 cents."
   [freq n-cents]
@@ -41,19 +25,19 @@
         dist (clip2 (* 2 (tanh (* 2 (distort (* 2 snd))))) 0.2)
         snd (b-peak-eq snd 55.38 1 36.4)]
     (* amp (+ dist snd))))
-(kick :noise-decay 4)
+;(kick :noise-decay 4)

 (definst hat
   [freq   {:default 44.77 :min 20 :max 400 :step 1}
    attack {:default 0.036 :min 0.00001 :max 2 :step 0.0001}
-   decay  {:default 1.284 :min 0.00001 :max 2 :step 0.0001}
+   decay  {:default 0.484 :min 0.00001 :max 2 :step 0.0001}
    rq     {:default 0.08 :min 0.01 :max 1 :step 0.01}
    amp    {:default 0.8 :min 0.01 :max 1 :step 0.01}]
   (let [noiz (white-noise)
         filt (rhpf noiz 4064.78 rq)
         env  (x-line 1 0.001 decay :action FREE)]
     (* amp env filt)))
-(hat)
+;(hat)

 (definst haziti-clap
   [freq   {:default 44.77 :min 20 :max 400 :step 1}
@@ -70,36 +54,7 @@
         skip (* wave wenv)]
     (* amp (+ (* env filt) skip))))

-(haziti-clap)
-
-(synth-controller hat)
-(synth-controller kick)
-
-(def m (metronome 128))
-(def step-seq (step-sequencer m 16 [kick hat]))
-
-;(def step (stepinator))
-(defn player
-  [beat]
-  (let [next-beat (inc beat)]
-    (at (m beat)
-        (kick :amp 0.5)
-        (if (zero? (mod beat 2))
-          (haziti :amp 0.3)))
-    (at (m (+ 0.5 beat))
-        (haziti-clap :decay 0.05 :amp 0.7))
-
-    (when (zero? (mod beat 3))
-      (at (m (+ 0.75 beat))
-          (haziti :decay 0.03 :amp 0.2)))
-
-    (when (zero? (mod beat 8))
-      (at (m (+ 1.25 beat))
-          (haziti :decay 0.03)))
-
-    (apply-at (m next-beat) #'player [next-beat])))
-
-(player (m))
+;(haziti-clap)

 (definst dance-kick
   [freq {:default 50.24 :min 20 :max 400 :step 1}
@@ -115,7 +70,7 @@
         dist (clip2 (* 2 (tanh (* 3 (distort (* 1.5 src))))) 0.8)
         eq (b-peak-eq dist 37.67 1 10.4)]
     (* amp eq)))
-(dance-kick)
+;(dance-kick)

 (definst quick-kick
   [freq {:default 20.0 :min 20 :max 400 :step 1}
@@ -131,32 +86,28 @@
         dist (clip2 (* 2 (tanh (* 3 (distort (* 1.5 src))))) 0.8)
         eq (b-peak-eq dist 57.41 1 44)]
     (* amp eq)))
-(quick-kick)
+;(quick-kick)

-(definst shzzz
-  [freq   {:default 44.77 :min 20 :max 400 :step 1}
-   attack {:default 0.004 :min 0.00001 :max 2 :step 0.0001}
-   decay  {:default 2.784 :min 0.00001 :max 2 :step 0.0001}
-   rq     {:default 0.9 :min 0.01 :max 1 :step 0.01}
-   amp    {:default 0.8 :min 0.01 :max 1 :step 0.01}
-   clap   {:default 0.1 :min 0.01 :max 1 :step 0.01}
-   clap-decay {:default 0.01 :min 0.01 :max 1 :step 0.01}]
-  (let [noiz (white-noise)
-        filt (rlpf noiz 2992 rq)
-        dist (clip2 (* 2 (tanh (* 3 (distort (* 1.5 filt))))) 0.8)
-        clap-trig (t-delay:kr (trig1:kr 1 10) clap-decay)
-        env  (decay:kr clap-trig decay)
-        clap-env (decay:kr (gate:kr (impulse:kr 60) (not-pos? clap-trig)) clap-decay)
-        eq (b-peak-eq dist 796 1 -44)
-        snd (+ (* clap-env filt) (* filt env))]
-    (detect-silence (* amp snd) 0.11 (+ attack decay clap-decay) :action FREE)
-    snd (* amp snd)))
-(shzzz)
-(stop)
+(def m (metronome 128))
+
 (defn player
-  [event _]
-  (println event))
+  [beat]
+  (let [next-beat (inc beat)]
+    (at (m beat)
+        (quick-kick :amp 0.5)
+        (if (zero? (mod beat 2))
+          (hat :amp 0.1)))
+    (at (m (+ 0.5 beat))
+        (haziti-clap :decay 0.05 :amp 0.3))

-(def mpk (midi-in "MPK"))
+    (when (zero? (mod beat 3))
+      (at (m (+ 0.75 beat))
+          (hat :decay 0.03 :amp 0.2)))

-(midi-handle-events mpk #'player)
+    (when (zero? (mod beat 8))
+      (at (m (+ 1.25 beat))
+          (hat :decay 0.03)))
+
+    (apply-at (m next-beat) #'player [next-beat])))
+
+;(player (m))


Deletes unused code

Deletes unused code

--- src/expound/alpha.cljc
+++ src/expound/alpha.cljc
@@ -245,11 +245,6 @@
    (not= :check-failed failure)
    (= :fn (first (:path problem)))))

-(defn check-exception-failure? [failure problem]
-  (and (= :check-failed failure)
-       ;; TODO - fill in here
-       false))
-
 (defn check-ret-failure? [failure problem]
   (and
    (= :check-failed failure)
@@ -397,9 +392,6 @@

     (fspec-fn-failure? failure problem)
     :problem/fspec-fn-failure
-
-    (check-exception-failure? failure problem)
-    :problem/check-exception-failure

     (check-ret-failure? failure problem)
     :problem/check-ret-failure


Simplify checks

Simplify checks

--- src/expound/paths.cljc
+++ src/expound/paths.cljc
@@ -84,17 +84,15 @@
       ;; detect a `:in` path that points at a key in a map-of spec
       (and (map? form)
            (= 0 idx)
-           ;; TODO - simplify
-           (or (not (associative? (get form k ::not-found)))
-               (not (contains? (get form k ::not-found) idx))))
+           (not (and (associative? (get form k ::not-found))
+                     (contains? (get form k ::not-found) idx))))
       (conj in' (->KeyPathSegment k))

       ;; detect a `:in` path that points at a value in a map-of spec
       (and (map? form)
            (= 1 idx)
-           ;; TODO - simplify
-           (or (not (associative? (get form k ::not-found)))
-               (not (contains? (get form k ::not-found) idx))))
+           (not (and (associative? (get form k ::not-found))
+                     (contains? (get form k ::not-found) idx))))
       (recur (get form k ::not-found) rst2 (conj in' k))

       ;; detech a `:in` path that points to a key/value pair in a coll-of spec


Minor changes on docstrings.

Minor changes on docstrings.

--- src/futura/promise.clj
+++ src/futura/promise.clj
@@ -224,13 +224,13 @@

 (defn fulfilled?
   "Returns true if promise `p` is
-  already fulfilled."
+  completed successfully."
   [p]
   (fulfilled* p))

 (defn rejected?
   "Returns true if promise `p` is
-  already rejected."
+  completed exceptionally."
   [p]
   (rejected* p))


structure-sharing between [:synsem :propernoun] and [:english :propernoun], so we can avoid putting an "s" at the end of plural proper nouns

--- src/babel/english/morphology.cljc
+++ src/babel/english/morphology.cljc
@@ -777,16 +777,20 @@
                        :infl infl}}))

    (and (= (get-in lexical-entry [:synsem :cat]) :noun)
-        (= (get-in lexical-entry [:synsem :pronoun]) true))
+        (or (= (get-in lexical-entry [:synsem :pronoun]) true)
+            (= (get-in lexical-entry [:synsem :propernoun]) true)))
    (let [agr (atom :top)
          cat (atom :top)
-         pronoun (atom :top)]
+         pronoun (atom :top)
+         propernoun (atom :top)]
      (unifyc lexical-entry
              {:english {:agr agr
                         :cat cat
+                        :propernoun propernoun
                         :pronoun pronoun}
               :synsem {:agr agr
                        :cat cat
+                       :propernoun propernoun
                        :pronoun pronoun}}
              pronoun-semantic-gender-agreement))

@@ -801,7 +805,8 @@
               :synsem {:agr agr
                        :cat cat
                        :pronoun pronoun}}))
-
+   ;; note that we don't unifyc with pronoun-semantic-gender-agreement in this second case.
+
    true
    lexical-entry))


now you can run "lein run -m babel.italiano.benchmark/run-benchmark <n>"  from shell

--- src/babel/italiano/benchmark.cljc
+++ src/babel/italiano/benchmark.cljc
@@ -13,13 +13,17 @@
             [clojure.string :as string]
             [dag_unify.core :refer [get-in strip-refs]]))

-(defn run-benchmark []
-  (repeatedly #(let [debug (println "starting generation")
-                     expr (time (generate :top))]
-                 (println (str "generated expression: " (fo expr)))
-                 (let [parsed (time (first (take 1 (parse (fo expr)))))]
-                   (println (str "parsed: " (fo parsed)))
-                   (println "")))))
-(defn -main []
-  (take 5 (run-benchmark)))
+(defn run-benchmark [times]
+  (count (take (Integer/parseInt times)
+               (repeatedly #(let [debug (println "starting generation..")
+                                  expr (time (generate :top))]
+                              (println (str "generated expression: " (fo expr)))
+                              (println (str "starting parsing.."))
+                              (let [parsed (time (first (take 1 (parse (fo expr)))))]
+                                (println (str "parsed: " (fo parsed)))
+                                (println "")))))))
+(defn -main [times]
+  (run-benchmark times))

+
+


cleaning up functions, removing irrelevant functions

--- src/clj/forma/trends/analysis.clj
+++ src/clj/forma/trends/analysis.clj
@@ -40,12 +40,6 @@

 (defn linear-residuals [y X] (:residuals (s/linear-model y X)))

-(defn expt-residuals
-  "returns a list of residuals from the linear regression of `y` on
-  `X`, raised to `power`"
-  [power residuals]
-  (map #(expt % power) residuals))
-
 (defn first-order-conditions
   "returns a matrix with residual weighted cofactors (incl. constant
   vector) and deviations from mean; corresponds to first-order
@@ -54,14 +48,11 @@
   Policy Modeling, 14(4), pp. 517-533"
   [coll]
   {:pre [(i/matrix? coll)]}
-  (let [n (count coll)
-        X (i/matrix (range n))
+  (let [X (i/matrix (range (count coll)))
         resid (linear-residuals coll X)
-        sq-resid (expt-residuals 2 resid)
+        sq-resid (i/mult resid resid)
         mu (utils/average sq-resid)]
-    (i/bind-rows (map * resid X)
-                 (map * resid (repeat n 1))
-                 (map #(- % mu) sq-resid))))
+    (i/bind-rows (map * resid X) resid (i/minus sq-resid mu))))

 (defn hansen-stat
   "returns the Hansen (1992) test statistic, based on (1) the first-order


Avoid a divide by zero in render-environment calculations.

--- src/cljc/mazes/renderers/svg.cljc
+++ src/cljc/mazes/renderers/svg.cljc
@@ -98,11 +98,11 @@
       :cell-width cell-width
       :cell-height cell-height
       ; spacing exists between cells, but not on the far side of the last
-      ; column/row; so divide the non-cell space by n - 1, not n.
+      ; column/row; so divide the non-cell space by n - 1 (minimum of 1), not n.
       :cell-h-spacing (/ (- cell-area-width (* cell-width columns))
-                         (- columns 1))
+                         (max (- columns 1) 1))
       :cell-v-spacing (/ (- cell-area-height (* cell-height rows))
-                         (- rows 1))})))
+                         (max (- rows 1) 1))})))

 (defn room-geometry
   "Given a render-environment map and a ::grid/cell, returns a map with keys :x,


Fix example reporters config in run-specs docs

The example shown was for when there was only a single reporter passed
through as a string rather than now, where a vector is passed through
with the key “reporters”.

--- src/cljs/speclj/run/standard.cljs
+++ src/cljs/speclj/run/standard.cljs
@@ -49,7 +49,7 @@
 runner and reporter.  A call to this function is typically placed at the end of a spec file so that all the specs
 are evaluated by evaluation the file as a script.  Optional configuration paramters may be passed in:

-(run-specs :stacktrace true :color false :reporter \"documentation\")"
+(run-specs :stacktrace true :color false :reporters [\"documentation\"])"
   (when armed
     (let [config (apply hash-map configurations)
           config (merge (dissoc default-config :runner) config)]


prepare controller for placement

prepare controller for placement

--- src/cljs/swarmpit/controller.cljs
+++ src/cljs/swarmpit/controller.cljs
@@ -70,9 +70,9 @@

 (defmethod dispatch :service-create-image
   [{:keys [handler]}]
-  (get (routes/path-for-backend :registries-sum)
+  (get (routes/path-for-backend :registries-list)
        (fn [registries]
-         (get (routes/path-for-backend :dockerhub-users-sum)
+         (get (routes/path-for-backend :dockerhub-users-list)
               (fn [users]
                 (state/set-value {:handler handler
                                   :data    {:registries registries
@@ -87,11 +87,14 @@
                 (fn [volumes]
                   (get (routes/path-for-backend :secrets)
                        (fn [secrets]
-                         (state/set-value {:handler handler
-                                           :data    (assoc params
-                                                      :networks networks
-                                                      :volumes volumes
-                                                      :secrets secrets)} cursor)))))))))
+                         (get (routes/path-for-backend :placement)
+                              (fn [placement]
+                                (state/set-value {:handler handler
+                                                  :data    (assoc params
+                                                             :networks networks
+                                                             :volumes volumes
+                                                             :secrets secrets
+                                                             :placement placement)} cursor)))))))))))

 (defmethod dispatch :service-edit
   [{:keys [route-params handler]}]
@@ -101,10 +104,13 @@
               (fn [volumes]
                 (get (routes/path-for-backend :secrets)
                      (fn [secrets]
-                       (state/set-value {:handler handler
-                                         :data    {:service service
-                                                   :volumes volumes
-                                                   :secrets secrets}} cursor))))))))
+                       (get (routes/path-for-backend :placement)
+                            (fn [placement]
+                              (state/set-value {:handler handler
+                                                :data    {:service   service
+                                                          :volumes   volumes
+                                                          :secrets   secrets
+                                                          :placement placement}} cursor))))))))))

 ;;; Network controller


Updated acl db to generate guids.

Updated acl db to generate guids.

--- src/cmr/mock_echo/data/acl_db.clj
+++ src/cmr/mock_echo/data/acl_db.clj
@@ -1,7 +1,8 @@
 (ns cmr.mock-echo.data.acl-db)

 (def initial-db-state
-  {:acls []})
+  {:last-id 0
+   :acls []})

 (defn create-db
   []
@@ -15,11 +16,20 @@
   [context]
   (reset! (context->acl-db context) initial-db-state))

+(defn- next-guid
+  [context]
+  (let [next-id (-> context
+                    context->acl-db
+                    (swap! update-in [:last-id] inc)
+                    :last-id)]
+    (str "guid" next-id)))
+
 (defn create-acl
   [context acl]
-  (-> context
-      context->acl-db
-      (swap! update-in [:acls] conj acl)))
+  (let [acl (assoc acl :id (next-guid context))]
+    (-> context
+        context->acl-db
+        (swap! update-in [:acls] conj acl))))

 (defn get-acls
   [context]


Add execution strategies

Add execution strategies

--- lazytest.clj
+++ lazytest.clj
@@ -21,11 +21,11 @@
   (run-tests [x] "Runs tests defined for the Namespace, Var, or TestCase."))

 (defprotocol TestInvokable
-  (invoke-test [t states active]
+  (invoke-test [t states active strategy]
                "(private) Executes the TestCase or Assertion."))

 (extend-class clojure.lang.Fn TestInvokable
-              (invoke-test [f states active] (apply f states)))
+              (invoke-test [f states active strategy] (apply f states)))

 ;;; DATATYPES

@@ -37,8 +37,8 @@
   clojure.lang.IFn
   (invoke [] (run-test-case this))
   (invoke [active] (run-test-case this active))
-  TestInvokable (invoke-test [states active]
-                             (run-test-case this active)))
+  TestInvokable (invoke-test [states active strategy]
+                             (run-test-case this active strategy)))

 (deftype Assertion [locals form])

@@ -141,15 +141,37 @@
                       '~m))))))

-;;; TEST CASE HANDLING
-
-(defn- unchunked-map
+;;; TEST RUNNING STRATEGIES
+
+(defn- map1
   "Like map but does not chunk results; slower but lazier than map."
   [f coll]
   (lazy-seq
    (when (seq coll)
      (cons (f (first coll))
-           (unchunked-map f (next coll))))))
+           (map1 f (next coll))))))
+
+(defn default-strategy []
+  "Default test execution strategy; uses (chunked) map."
+  [map default-strategy])
+
+(defn lazy-strategy []
+  "Truly lazy test execution strategy; uses (unchunked) map1."
+  [map1 lazy-strategy])
+
+(defn parallel-strategy []
+  [pmap parallel-strategy])
+
+(defn parallel-upto
+  "Returns a strategy that is parallel up to n levels of recursion,
+  then reverts to default-strategy."
+  [n]
+  (if (zero? n)
+    default-strategy
+    [pmap #(parallel-upto (dec n))]))
+
+
+;;; TEST CASE HANDLING

 (defn- has-after?
   "True if Context c or any of its parents has an :after function."
@@ -158,17 +180,21 @@
       (some has-after? (:parents c))))

 (defn run-test-case
-  "Executes a test case in context."
+  "Executes a test case in context.  active is the map of currently
+  active Contexts.  strategy is a function that determines how tests
+  are executed."
   ([t] (run-test-case t {}))
-  ([t active]
+  ([t active] (run-test-case t {} default-strategy))
+  ([t active strategy]
      {:pre [(= ::TestCase (type t))
             (every? #(= ::Context (type %)) (:contexts t))]}
      (try
-      (let [merged (reduce open-context active (:contexts t))
+      (let [[mapper child-strategy] (strategy)
+            merged (reduce open-context active (:contexts t))
             states (map merged (:contexts t))
-            ;; Prevent chunking for truly lazy execution:
-            results (unchunked-map #(invoke-test % states merged)
-                                   (:children t))]
+            results (mapper
+                     #(invoke-test % states merged child-strategy)
+                     (:children t))]
         ;; Force non-lazy execution to handle shutdown properly:
         (when (some has-after? (:contexts t))
           (dorun results)
@@ -410,7 +436,7 @@
 (def t6 (TestCase [c5] [t4 t4]))

 (with-log
-  (dorun (result-seq (run-test-case t6)))
+  (dorun (result-seq (run-test-case t6 {} lazy-strategy)))
   (assert (= @*log* [:c5-open :a3 :a4 :a3 :a4 :c5-close])))

 ;; Lazy Evaluation
@@ -419,7 +445,7 @@
 (def t7 (TestCase [c6] [a3 a4]))

 (with-log
-  (let [results (run-test-case t7)]
+  (let [results (run-test-case t7 {} lazy-strategy)]
     (assert (= @*log* [:c6-open]))
     (dorun (result-seq results))
     (assert (= @*log* [:c6-open :a3 :a4]))))
@@ -428,7 +454,7 @@
 (def t8 (TestCase [] [t7 t7]))

 (with-log
-  (let [results (run-test-case t8)]
+  (let [results (run-test-case t8 {} lazy-strategy)]
     (assert (= @*log* []))
     (dorun (:children (first (:children results))))
     (assert (= @*log* [:c6-open :a3 :a4]))
@@ -438,7 +464,7 @@
 (def t9 (TestCase [c6] [t7 t7]))

 (with-log
-  (let [results (run-test-case t9)]
+  (let [results (run-test-case t9 {} lazy-strategy)]
     (assert (= @*log* [:c6-open]))
     (dorun (result-seq results))
     (assert (= @*log* [:c6-open :a3 :a4 :a3 :a4]))))


Handle websocket close correctly.

Handle websocket close correctly.

--- src/tranjlator/user.clj
+++ src/tranjlator/user.clj
@@ -19,9 +19,12 @@

     (go-loop []
       (let [msg (edn/read-string (<! user-read))]
-        (chat/send-msg chat-room msg user-write)
-        (recur)))
+        (when-not (nil? msg)
+          (chat/send-msg chat-room msg user-write)
+          (recur))))

     (go-loop []
       (let [msg (<! user-write)]
-        (ws/send! websocket (pr-str (dissoc msg :sender)))))))
+        (when-not (nil? msg)
+          (ws/send! websocket (pr-str (dissoc msg :sender)))
+          (recur))))))


Remove BB LD flag

Remove BB LD flag

--- src-cljs/frontend/utils/vcs.cljs
+++ src-cljs/frontend/utils/vcs.cljs
@@ -1,10 +1,10 @@
 (ns frontend.utils.vcs
-  (:require [frontend.models.feature :as feature]
+  (:require [frontend.config :as config]
             [frontend.models.user :as user]))

 (defn bitbucket-enabled? [user]
-  (or (feature/enabled? :bitbucket)
-      (user/bitbucket-authorized? user)))
+  (and (not (config/enterprise?))
+       (user/bitbucket-authorized? user)))

 (def short-to-long-vcs
   {"gh" "github"