Add start message

Add start message

--- src/org/spootnik/fleet/http.clj
+++ src/org/spootnik/fleet/http.clj
@@ -92,6 +92,10 @@
                          engine
                          (api/prepare scenario profile matchargs args)
                          ch)]
+              (put! publisher (assoc data
+                                     :topic :events
+                                     :type :start
+                                     :scenario script_name))
               (if stream
                 {:status 200
                  :headers headers
@@ -117,7 +121,7 @@
                 (doseq [[msg source] (repeatedly #(yield-msg channel))
                         :while (or (not= channel source) msg)
                         :let [msg (or msg {:type "keepalive"})
-                              msg (dissoc msg "topic")
+                              msg (dissoc msg "topic" :topic)
                               data (format "data: %s\n\n" (generate-string msg))]]
                   (put! resp data))
                 (catch Exception e


LED demo.

LED demo.

--- src/com/lemondronor/turboshrimp.clj
+++ src/com/lemondronor/turboshrimp.clj
@@ -215,10 +215,10 @@
     (Thread/sleep 1000)
     (command drone :flat-trim)
     (Thread/sleep 1000)
-    ;;(do-led-animation drone :blink-green-red 0.5 4000)
-    ;;(do-led-animation drone :fire 0.5 4000)
-    ;;(do-led-animation drone :red-snake 3 4000)
-    ;;(do-led-animation drone :blank 2 0)
+    (do-led-animation drone :blink-green-red 3 4000)
+    (do-led-animation drone :fire 0.5 4000)
+    (do-led-animation drone :red-snake 3 4000)
+    (do-led-animation drone :blank 2 0)
     ;;(takeoff drone)
     ;;(clockwise drone 1.0)
     (Thread/sleep 5000)


Add assertion to clarify error when using connect plugin

--- src/com/wsscode/pathom/connect.cljc
+++ src/com/wsscode/pathom/connect.cljc
@@ -909,6 +909,7 @@
 (def connect-plugin
   {::p/wrap-parser2
    (fn [parser {::p/keys [plugins] ::keys [defresolver]}]
+     (assert defresolver "To use connect plugin you must provide ::pc/defresolver in your parser settings.")
      (let [resolvers        (keep ::resolvers plugins)
            resolver-weights (atom {})]
        (register defresolver [connect-resolvers resolvers])


Cleanup the loadBuffer function

Cleanup the loadBuffer function

--- src/petulant_life/rendering.clj
+++ src/petulant_life/rendering.clj
@@ -51,24 +51,10 @@
 (defn generateRectangles [rects]
   (flatten (map generateRectangle rects)))

-; Loading all of the lines from a file.
-(defn loadFile [path]
-  (try
-    (let [sb (java.lang.StringBuilder)
-          rd (java.io.BufferedReader (java.io.FileReader path))]
-      (loop []
-          (let [line (.readLine rd)]
-            (if (== line nil)
-              (do (.close rd)
-                  sb)
-              (do (.append sb (.append sb line) "\n")
-                  (recur))))))
-    (catch Exception e (throw e))))
-
 ; Loading a specific type of shader at a given path.
 (defn loadShader [path type]
   (try
-    (let [content (loadFile path)
+    (let [content (StringBuffer. (slurp path))
           sid     (GL20/glCreateShader type)]
       (do (GL20/glShaderSource sid content)
           (GL20/glCompileShader sid)


whitespace

whitespace

--- src/main/clojure/cljs/analyzer.cljc
+++ src/main/clojure/cljs/analyzer.cljc
@@ -1840,26 +1840,26 @@
              (AssertionError.
                (str "Namespace " name " has a segment starting with an invaild "
                     "JavaScript identifier"))))))
-    (let [docstring (if (string? (first args)) (first args))
-          mdocstr (-> name meta :doc)
-          args (if docstring (next args) args)
-          metadata (if (map? (first args)) (first args))
-          form-meta (meta form)
-          args (desugar-ns-specs (if metadata (next args) args))
-          name (vary-meta name merge metadata)
-          excludes (parse-ns-excludes env args)
-          deps (atom #{})
-          aliases (atom {:fns {} :macros {}})
-          spec-parsers {:require (partial parse-require-spec env false deps aliases)
+    (let [docstring    (if (string? (first args)) (first args))
+          mdocstr      (-> name meta :doc)
+          args         (if docstring (next args) args)
+          metadata     (if (map? (first args)) (first args))
+          form-meta    (meta form)
+          args         (desugar-ns-specs (if metadata (next args) args))
+          name         (vary-meta name merge metadata)
+          excludes     (parse-ns-excludes env args)
+          deps         (atom #{})
+          aliases      (atom {:fns {} :macros {}})
+          spec-parsers {:require        (partial parse-require-spec env false deps aliases)
                         :require-macros (partial parse-require-spec env true deps aliases)
-                        :use (comp (partial parse-require-spec env false deps aliases)
-                               (partial use->require env))
-                        :use-macros (comp (partial parse-require-spec env true deps aliases)
-                                      (partial use->require env))
-                        :import (partial parse-import-spec env deps)}
-          valid-forms (atom #{:use :use-macros :require :require-macros :import})
-          reload (atom {:use nil :require nil :use-macros nil :require-macros nil})
-          reloads (atom {})
+                        :use            (comp (partial parse-require-spec env false deps aliases)
+                                          (partial use->require env))
+                        :use-macros     (comp (partial parse-require-spec env true deps aliases)
+                                          (partial use->require env))
+                        :import         (partial parse-import-spec env deps)}
+          valid-forms  (atom #{:use :use-macros :require :require-macros :import})
+          reload       (atom {:use nil :require nil :use-macros nil :require-macros nil})
+          reloads      (atom {})
           {uses :use requires :require use-macros :use-macros require-macros :require-macros imports :import :as params}
           (reduce
             (fn [m [k & libs]]
@@ -1909,14 +1909,14 @@
            (when (seq use-macros)
              (check-use-macros use-macros env))))
       (let [ns-info
-            {:name name
-             :doc (or docstring mdocstr)
-             :excludes excludes
-             :use-macros use-macros
+            {:name           name
+             :doc            (or docstring mdocstr)
+             :excludes       excludes
+             :use-macros     use-macros
              :require-macros require-macros
-             :uses uses
-             :requires requires
-             :imports imports}
+             :uses           uses
+             :requires       requires
+             :imports        imports}
             ns-info
             (if (:merge form-meta)
               ;; for merging information in via require usage in REPLs
@@ -1932,7 +1932,7 @@
                   ns-info))
               ns-info)]
         (swap! env/*compiler* update-in [::namespaces name] merge ns-info)
-        (merge {:env env :op :ns :form form
+        (merge {:op :ns :env env :form form
                 :reloads @reloads}
           (cond-> ns-info
             (@reload :use)


Version 0.6.4-SNAPSHOT

Version 0.6.4-SNAPSHOT

--- metlog-vault/project.clj
+++ metlog-vault/project.clj
@@ -1,4 +1,4 @@
-(defproject metlog-vault "0.6.3"
+(defproject metlog-vault "0.6.4-SNAPSHOT"
   :description "Repository for storing and displaying time series data reported by metlog-agent.."

   :license {:name "Eclipse Public License"


get-content fix to return entire body content rather than just first element

--- scraper/src/scraper/core.clj
+++ scraper/src/scraper/core.clj
@@ -34,8 +34,8 @@
       (by-fn html-tree #(= (tag %) x)))

 (defn get-content [html-tree x]
-      (let [[tag-element attributes-element content-element] html-tree]
-           content-element))
+      (let [[tag-element attributes-element content-element & rest-of-content] html-tree]
+        (cons content-element rest-of-content))

 (defn get-attribute [html-tree x]
       (let [[tag-element attributes-element content-element] html-tree]
@@ -61,8 +61,6 @@

 (defn build-zone-modifiers [url]
   (by-tag (second (by-tag (first (by-attribute (parse url) {:class "factionTable"})) :tr)) :ul))
-
-(def test-map {})

 (defn -main
   "Entry point to scraper methods. Pulls in data from project1999's wiki to insert into an SQLite DB."


Add parsing/unparsing of datetimes

Add parsing/unparsing of datetimes

--- src/ansel/db.clj
+++ src/ansel/db.clj
@@ -99,6 +99,27 @@

 (defn get-comments-for-photo [photo]
   (get @comments photo))
+
+(defn val-map
+  "Given a map where every val is a coll, map f over each coll,
+  preserving the map's structure"
+  [f m]
+  (into {} (map
+             (fn [[k v]]
+               [k (vec (map f v))])
+             m)))
+
+(defn map-time->string [m]
+  (update-in m [:created] time->string))
+
+(defn map-string->time [m]
+  (update-in m [:created] string->time))
+
+(defn stringify-times [coll]
+  (val-map map-time->string coll))
+
+(defn timify-strings [coll]
+  (val-map map-string->time coll))

 ;; Loading --------------------------------------------------------------------

@@ -112,7 +133,7 @@
       (reset! albums    (:albums data))
       (reset! likes     (:likes data))
       (reset! config    (:config data))
-      (reset! comments  (:comments data))
+      (reset! comments  (timify-strings (:comments data)))
       (info "data loaded from disk"))))

 (defn get-context []
@@ -124,8 +145,10 @@
    :comments @comments})

 (defn save-data-to-disk []
-  (info "saving data to disk")
-  (spit "config.json" (pretty-json (get-context))))
+  (let [context (get-context)
+        context (update-in context [:comments] stringify-times)]
+    (info "saving data to disk")
+    (spit "config.json" (pretty-json context))))

 (defn assert-fs []
   (info "creating dirs")


CMR-3324: Fix cache api test to expect health

--- system-int-test/test/cmr/system_int_test/admin/cache_api_test.clj
+++ system-int-test/test/cmr/system_int_test/admin/cache_api_test.clj
@@ -70,25 +70,20 @@
       (are [url caches]
         (is (= (set caches) (set (list-caches-for-app url admin-read-token))))

-        (url/indexer-read-caches-url) ["acls" "indexer-index-set-cache" "token-imp" "kms"
+        (url/indexer-read-caches-url) ["acls" "indexer-index-set-cache" "token-imp" "kms" "health"
                                        "collection-granule-aggregation-cache" "humanizer-cache"]
-        (url/index-set-read-caches-url) ["token-imp"]
-        (url/mdb-read-caches-url) ["token-imp"]
-        (url/ingest-read-caches-url) ["token-imp" "providers" "acls" "token-user-ids" "kms"]
-        (url/access-control-read-caches-url) ["acls"]
-        (url/search-read-caches-url) ["acls"
-                                      "collections-for-gran-acls"
-                                      "has-granules-map"
-                                      "index-names"
-                                      "token-imp"
-                                      "token-sid"
-                                      "xsl-transformer-templates"
-                                      "metadata-cache"
-                                      "kms"])
+        (url/index-set-read-caches-url) ["token-imp" "health"]
+        (url/mdb-read-caches-url) ["token-imp" "health"]
+        (url/ingest-read-caches-url) ["token-imp" "providers" "acls" "token-user-ids" "kms"
+                                      "health"]
+        (url/access-control-read-caches-url) ["acls" "health"]
+        (url/search-read-caches-url) ["acls" "collections-for-gran-acls" "has-granules-map"
+                                      "index-names" "token-imp" "token-sid" "health"
+                                      "xsl-transformer-templates" "metadata-cache" "kms"])
       (s/only-with-real-database
        (testing "list caches for bootstrap"
          (let [response (list-caches-for-app (url/bootstrap-read-caches-url) admin-read-token)]
-           (is (= ["token-imp" "kms"] response))))))
+           (is (= ["token-imp" "kms" "health"] response))))))

     (testing "normal user cannot access cache list API"
@@ -233,4 +228,3 @@
         {:collection "collection"
          :granule "granule"
          :tag "tag"}))))
-


misc(frontend): remove stalled data from vendor/deps.cljs

--- frontend/vendor/deps.cljs
+++ frontend/vendor/deps.cljs
@@ -2,9 +2,6 @@
  [{:file "snapsvg/snap.svg.js"
    :file-min "snapsvg/snap.svg.min.js"
    :provides ["vendor.snapsvg"]}
-  {:file "date-fns/src/index.js"
-   :module-type :es6
-   :provides ["vendor2.dateFns"]}
   {:file "jszip/jszip.js"
    :file-min "jszip/jszip.min.js"
    :provides ["vendor.jszip"]}


Enrich plot display.

Enrich plot display.

--- metlog-vault/src-client/metlog.cljs
+++ metlog-vault/src-client/metlog.cljs
@@ -50,11 +50,18 @@
   (/ (- val (:min range))
      (- (:max range) (:min range))))

-(defn draw-tsplot [ ctx w h sinfo ]
-  (let [data (:data sinfo)
-        x-range (s-xrange data)
+(defn draw-tsplot-xlabel [ ctx text x y ]
+  (let [mt (.measureText ctx text)
+        w (.-width mt)]
+    (.log js/console (str [ w h]))
+    (.fillText ctx text (- x (/ w 2)) (+ 16 y))))
+
+(defn draw-tsplot-series [ ctx w h data ]
+  (.save ctx)
+  (.beginPath ctx)
+  (aset ctx "strokeStyle" "#0000FF")
+  (let [x-range (s-xrange data)
         y-range (s-yrange data)]
-;    (.fillRect ctx 0 0 w h)
     (when (> (count data) 0)
       (.moveTo ctx
                (* w (range-scale x-range (:t (first data))))
@@ -63,14 +70,49 @@
         (.lineTo ctx
                  (* w (range-scale x-range (:t pt)))
                  (- h (* h (range-scale y-range (:val pt))))))
-      (.stroke ctx))))
+      (.stroke ctx))
+    (.restore ctx)
+    (.save ctx)
+    (aset ctx "font" "16px Arial")
+    (draw-tsplot-xlabel ctx "min" 0 h)
+    (draw-tsplot-xlabel ctx "max" w h)
+    (.restore ctx)
+    ))
+
+(defn draw-tsplot-bg [ ctx w h ]
+  (.save ctx)
+  (aset ctx "fillStyle" "#FFFFFF")
+  (.fillRect ctx 0 0 w h)
+  (.restore ctx))
+
+(defn draw-tsplot-frame [ ctx w h ]
+  (.save ctx)
+  (.beginPath ctx)
+  (aset ctx "lineWidth" 2)
+  (aset ctx "strokeStyle" "#000000")
+  (.moveTo ctx 0 0)
+  (.lineTo ctx 0 h)
+  (.lineTo ctx w h)
+  (.stroke ctx)
+  (.restore ctx))
+
+(defn draw-tsplot [ ctx w h sinfo ]
+  (let [ w (- w 30) ]
+    (.save ctx)
+    (.translate ctx 50 0)
+
+    (draw-tsplot-bg ctx (- w 50) (- h 30))
+    (draw-tsplot-series ctx (- w 50) (- h 30) (:data sinfo))
+    (draw-tsplot-frame ctx (- w 50) (- h 30))
+
+    (.restore ctx)))

 (defn series-tsplot [ app-state owner ]
   (reify
     om/IInitState
     (init-state [_]

-      {:width 800 :height 150})
+      {:width 1024 :height 150})

     om/IDidMount
     (did-mount [_]
@@ -82,7 +124,7 @@

       (go
         (draw-tsplot (.getContext dom-element "2d")
-                     800 150
+                     1024 150
                      (<! (<<< fetch-series-data (:name app-state)))))))

     om/IRenderState


Add TODO

Add TODO

--- src/app/core.clj
+++ src/app/core.clj
@@ -85,6 +85,7 @@
         unit (.getName file)
         root (detect-project-root file)
         srcs (detect-source-dirs root)]
+    ; TODO if android, try adding source, then fallback to .jar
     [(concat (detect-java-core)) ; TODO add other jars
      (map #(str % File/separator) srcs)
      (str/join (drop-last 5 unit))


use secretary browser navigation

use secretary browser navigation

--- src_cljs/rrms/corecljs.cljs
+++ src_cljs/rrms/corecljs.cljs
@@ -18,7 +18,9 @@

 (def storage (r/atom {:documents {}
                       :current-page 1
-                      :total-pages 1}))
+                      :total-pages 1
+                      :page-location nil}))
+

 (defn set-key-value [k v]
   (reset! storage (assoc @storage k v)))
@@ -28,6 +30,9 @@

 (defn get-value! [k]
   (k @storage))
+
+(defn page []
+  (get-value! :page-location))

 (defn get-total-rec-no [nos]
   (let [totrec (quot nos 10)]
@@ -69,12 +74,6 @@
                     (clj->js (keep-indexed
                               #(if (and (>= %1 pag-start) (<= %1 pag-end)) %2) data))))))

-
-(defn is-all-search-fields-empty?
-  [date1 date2 srcstr]
-  (and (st/blank? date1)
-       (st/blank? date2)
-       (st/blank? srcstr)))

 (defn url-format [url title]
   [:a {:href url :class "btn btn-primary  glyphicon glyphicon-plus"} title])
@@ -107,9 +106,9 @@
                            (let [i (.-eventKey s2)]
                              (do
                                (set-key-value :current-page i)
-                               (r/render [render-documents (get-new-page-data (get-value! :documents)
-                                                                              (get-value! :current-page))]
-                                         (.getElementById js/document "app1")))))}])
+                               (set-key-value :page-location
+                                              [render-documents (get-new-page-data (get-value! :documents)
+                                                                                (get-value! :current-page))]))))}])

@@ -130,6 +129,9 @@
   (xhr/send url callback "DELETE"  (structs/Map. (clj->js {:Content-Type "application/json"}))))

 (declare render-documents)
+
+(defn cancel [event]
+  (secretary/dispatch! "/"))

 (defn search [event]
   (let [dt1 (.-value (.getElementById js/document "dt1"))
@@ -142,10 +144,10 @@
                                      (c/from-string dt1)
                                      (c/from-string dt2) dt)))
         (set-key-value :current-page 1)
-        (r/render [render-documents
-                   (get-new-page-data (get-value! :documents)
-                                      (get-value! :current-page))]
-                  (.getElementById js/document "app1")))))
+        (set-key-value :page-location
+                       [render-documents
+                        (get-new-page-data (get-value! :documents)
+                                           (get-value! :current-page))]))))

 (defn row [label input]
@@ -176,8 +178,11 @@
    :location (getinputvalue "location") })

 (defn save [event]
-  (let [onres (fn[data] (set! (.-location js/window) "http://localhost:8193"))]
-    (js/console.log (get-documents-formdata))
+  (let [onres (fn[json] (do
+                         (set-key-value :documents (getdata json))
+                         (set-key-value :page-location
+                                        [render-documents (get-new-page-data (get-value! :documents)
+                                                                             (get-value! :current-page))])))]
     (http-post "http://localhost:8193/documents/add"
                onres  (.serialize (Serializer.) (clj->js (get-documents-formdata))))))

@@ -187,9 +192,9 @@
                   (set-key-value :documents dt)
                   (set-key-value :total-pages (get-total-rec-no dt))
                   (set-key-value :current-page 1)
-                  (r/render [render-documents (get-new-page-data (get-value! :documents)
-                                                                 (get-value! :current-page))]
-                            (.getElementById js/document "app1"))))]
+                  (set-key-value :page-location
+                                 [render-documents (get-new-page-data (get-value! :documents)
+                                                                      (get-value! :current-page))])))]
     (http-get "http://localhost:8193/documents/all" onres)))

 (defn document-template []
@@ -200,7 +205,9 @@
    [:div#dt (input "Date":Date :date)]
    [:div#loc (input "Location":text :location)]
    [:input {:type "button" :value "Save"
-            :class "btn btn-primary" :on-click save}]])
+            :class "btn btn-primary" :on-click save}]
+   [:input {:type "button" :value "Cancel"
+            :class "btn btn-primary" :on-click cancel}]])

 (defn get-update-documents-formdata []
   {
@@ -212,11 +219,11 @@
    :location (getinputvalue "upd_location")})

 (defn click-update[id]
-  (.assign js/location (str "#/documents/update/" id)))
+  (secretary/dispatch! (str "#/documents/update/" id)))

 (defn docupdate [event]
   (let [onres (fn[data]
-                (.assign js/location "/"))]
+                (secretary/dispatch! "/"))]
     (http-post "http://localhost:8193/documents/update"
                onres (.serialize (Serializer.) (clj->js (get-update-documents-formdata))))))

@@ -229,15 +236,21 @@
    [:div (input "Date":Date :upd_date  (f/unparse (f/formatter "yyyy-MM-dd")(f/parse (.-date dmt))))]
    [:div (input "Location":text :upd_location (.-location dmt))]
    [:input {:type "button" :value "Save"
-            :class "btn btn-primary" :on-click docupdate}]])
+            :class "btn btn-primary" :on-click docupdate}]
+   [:input {:type "button" :value "Cancel"
+            :class "btn btn-primary" :on-click cancel}]])

 (defn delete[id]
   (let [onres (fn [json]
-                ((set-key-value :documents (getdata json))
-                 (r/render [render-documents (get-new-page-data (get-value! :documents)
-                                                                (get-value! :current-page))]
-                           (.getElementById js/document "app1"))))]
+                (do
+                  (set-key-value :documents (getdata json))
+                  (set-key-value :page-location
+                                 [render-documents (get-new-page-data (get-value! :documents)
+                                                                      (get-value! :current-page))])))]
     (http-delete (str "http://localhost:8193/documents/delete/" id)  onres)))
+
+(defn add [event]
+  (secretary/dispatch! "/documents/add"))

 (defn render-documents [documents]
   [:div
@@ -259,8 +272,10 @@
                                             :placeholder "Enter search text.."}]]
        [:input {:type "button" :value "Search"
                 :class "btn btn-primary" :on-click search}]
-       (url-format "#/documents/add" "Document")
-       [:input {:id "getall" :type "button" :value "Get-All"
+       [:input {:type "button" :value "Add"
+                :class "btn btn-primary" :on-click add}]
+       ;; (url-format "#/documents/add" "Document")
+       [:input {:id "getall" :type "button" :value "Refresh"
                 :class "btn btn-primary" :on-click get-all-click}]]
       [:div {:class "box-body"}

@@ -293,6 +308,7 @@
                               [:td  [:a {:href "javascript:;" :on-click #(delete(.-id dn))  :class "btn btn-danger btn-sm glyphicon glyphicon-remove"}] ]

                               ])]]]
+      [:div [shared-state 0]]
       ]]]
    ;; [:div.padding]
    ;;  [:div.page-footer [:h4 "Copyright All Rights Reserved © 2016 TechnoIdentity Solutions Pvt.Ltd"]]
@@ -311,28 +327,32 @@
                 (let [dt (getdata json)]
                   (set-key-value :documents dt)
                   (set-key-value :total-pages (get-total-rec-no dt))
-                  (r/render [render-documents (get-new-page-data (get-value! :documents)
-                                                                 (get-value! :current-page))]
-                            (.getElementById js/document "app1"))
-                  (r/render [shared-state 0]
-                            (.getElementById js/document "pindex"))))]
+                  (set-key-value :page-location
+                                 (render-documents
+                                  (get-new-page-data
+                                   (get-value! :documents)
+                                   (get-value! :current-page))))))]
     (http-get "http://localhost:8193/documents/all" onres)))

 (defroute documents-path "/documents/add" []
-  (r/render-component [document-template] (js/document.getElementById "add")))
+  (set-key-value :page-location [document-template]))

 (defroute documents-path1 "/documents/update/:id" [id]
-  (r/render [document-update-template id
-             (first (filter (fn[obj]
-                              (=(.-id obj) (.parseInt js/window id))) (get-value! :documents)))]
-            (js/document.getElementById "update")))
+  (set-key-value :page-location
+                 [document-update-template id
+                  (first (filter (fn[obj]
+                                   (=(.-id obj) (.parseInt js/window id))) (get-value! :documents)))]))

 (defroute "*" []
   (js/alert "
Not Found Page
"))
+

 (defn main
   []
   (secretary/set-config! :prefix "#")
+  (set-key-value :page-location [render-documents []])
+  (r/render [page]
+            (.getElementById js/document "app1"))
   (let [history (History.)]
     (events/listen history "navigate"
                    (fn [event]


catch all exceptions, just not numberFormat

--- src/org/spootnik/cyanite/carbon.clj
+++ src/org/spootnik/cyanite/carbon.clj
@@ -13,7 +13,7 @@
   default value if it fails"
   [parse default number]
   (try (parse number)
-    (catch NumberFormatException e
+    (catch Exception e
       (debug "got an invalid number" number (.getMessage e))
       default)))


Boot out dead peers when the replica doesn't reflect the cluster state.

--- src/onyx/log/commands/prepare_join_cluster.clj
+++ src/onyx/log/commands/prepare_join_cluster.clj
@@ -93,10 +93,25 @@
             :args {:observer (:subject diff)}}])))

 (s/defmethod extensions/fire-side-effects! :prepare-join-cluster :- State
-  [{:keys [args message-id]} :- LogEntry old new diff {:keys [monitoring] :as state}]
+  [{:keys [args message-id]} :- LogEntry old new diff {:keys [log monitoring] :as state}]
   (common/start-new-lifecycle
    old new diff
-   (cond (= (:id state) (:observer diff))
+   (cond ;; Handles the cases where all peers are actually dead.
+         ;; This can happen if a single node cluster comes down
+         ;; and is rebooted. We pick a predictably-random peer
+         ;; and knock it down if it's not up. This garuntees
+         ;; progress even if the cluster has experiences total failure.
+         (and (= (:id state) (:subject diff)) (nil? diff))
+         (let [candidates (keys (:prepared new))
+               k (mod message-id (count candidates))
+               target (nth candidates k)]
+           (when-not (extensions/peer-exists? log target)
+             (extensions/write-log-entry
+              (:log state)
+              {:fn :leave-cluster :args {:id target}
+               :entry-parent message-id})))
+
+         (= (:id state) (:observer diff))
          (let [ch (chan 1)]
            (extensions/emit monitoring {:event :peer-prepare-join :id (:id state)})
            (extensions/on-delete (:log state) (:subject diff) ch)


make and and or binary ugens foldable. Fixes #135

--- src/overtone/sc/machinery/ugen/special_ops.clj
+++ src/overtone/sc/machinery/ugen/special_ops.clj
@@ -119,7 +119,7 @@
    })

 (def FOLDABLE-BINARY-OPS
-  #{"+" "-" "*" "/" "<" ">" "<=" ">=" "min" "max"})
+  #{"+" "-" "*" "/" "<" ">" "<=" ">=" "min" "max" "and" "or"})

 ;;the following are Clojure fns that can only take numerical args
 (def NUMERICAL-CLOJURE-FNS


Use figwheel main for cursive

Use figwheel main for cursive

--- script/repl.clj
+++ script/repl.clj
@@ -1,3 +1,2 @@
-(use 'figwheel-sidecar.repl-api)
-(start-figwheel!) ;; <-- fetches configuration
-(cljs-repl)+(require '[figwheel.main.api :as fig])
+(fig/start "dev")


[#7931] fix - Text for chat name for empty public chat is not centered if contains > 1 row

Signed-off-by: Pedro Pombeiro <f8c34e1c5d363d76a4b9e8313641f62c1029c3e7@users.noreply.github.com>

--- src/status_im/ui/screens/chat/styles/main.cljs
+++ src/status_im/ui/screens/chat/styles/main.cljs
@@ -234,6 +234,7 @@
   {:font-size     22
    :font-weight   "700"
    :line-height   28
+   :text-align    :center
    :margin-bottom 8
    :color         colors/black})


Made ago chan explicit.

Made ago chan explicit.

--- src/cbfg/ago.clj
+++ src/cbfg/ago.clj
@@ -12,13 +12,18 @@
   `(cljs.core.async/>! (:event-ch (actx-top ~actx)) [~actx ~event]))

 (defmacro ago [child-actx-binding-name actx & body]
-  `(let [ago-id# ((:gen-id (actx-top ~actx)))
+  `(let [ago-ch# (achan-buf ~actx 1)
+         ago-id# ((:gen-id (actx-top ~actx)))
          ~child-actx-binding-name (conj ~actx
                                         (str '~child-actx-binding-name "-" ago-id#))]
      (go (actx-event ~actx [:ago :start ~child-actx-binding-name])
          (let [result# (do ~@body)]
+           (when result#
+             (aput ~child-actx-binding-name ago-ch# result#))
+           (aclose ~child-actx-binding-name ago-ch#)
            (actx-event ~actx [:ago :end ~child-actx-binding-name result#])
-           result#))))
+           result#))
+     ago-ch#))

 (defmacro ago-loop [child-actx-binding-name actx bindings & body]
   (let [m (->> bindings


Modified env variable name for http port.

--- src/gbu/core.clj
+++ src/gbu/core.clj
@@ -11,7 +11,7 @@

 (defn http-port
   []
-  (Integer/parseInt (utils/env "GBU_HTTP_PORT" "5000")))
+  (Integer/parseInt (utils/env "PORT" "5000")))

 (defroutes app
   ;; Pages
@@ -49,4 +49,4 @@

 (comment
   (-main)
-)+)


doc-generator: add cljs special-form parsing

--- cljs-api-parser/src/core.clj
+++ cljs-api-parser/src/core.clj
@@ -29,7 +29,8 @@
 (def cljs-ns-paths
   ; NS                        REPO             FILE               PATH IN REPO
   {"cljs.core"              {"clojurescript" {"core.cljs"        "src/cljs/cljs"
-                                              "core.clj"         "src/clj/cljs"}
+                                              "core.clj"         "src/clj/cljs"
+                                              "analyzer.clj"     "src/clj/cljs"}
                              "clojure"       {"core.clj"         "src/clj/clojure"
                                               "core_deftype.clj" "src/clj/clojure"
                                               "core_print.clj"   "src/clj/clojure"
@@ -298,6 +299,26 @@
           final (update-in merged [:source] try-remove-docs (:expected-docs specific))]
       final)))

+(defn parse-special*
+  "Parse cljs special forms of the form:
+  (defmethod parse 'symbol ...)"
+  [form]
+  (when (and (list? form)
+             (= 'defmethod (first form))
+             (= 'parse (second form)))
+    (let [quoted-name (nth form 2)
+          name- (second quoted-name)]
+      {:name name-})))
+
+(defn parse-special
+  [form ns- repo]
+  (when-let [special (parse-special* form)]
+    (let [location (parse-location form ns- repo)
+          extras {:full-name (str ns- "/" (:name special))
+                  :type "special form"}
+          final (merge special location extras)]
+      final)))
+
 (defn parse-api
   "Parse the functions and macros from the given repo file"
   [ns- repo file]
@@ -325,6 +346,7 @@
 (defmulti parse-ns-api (fn [ns-] ns-))

 (defn parse-extra-macros-from-clj
+  "cljs.core uses some macros from clojure.core, so find those here"
   []
   (let [clj-api (concat (parse-api "cljs.core" "clojure" "core.clj")
                         (parse-api "cljs.core" "clojure" "core_deftype.clj")
@@ -334,15 +356,26 @@
         cljs-forms   (get-forms "cljs.core" "clojurescript" "core.clj")
         imports      (get-imported-macro-api     cljs-forms clj-api)
         non-excludes (get-non-excluded-macro-api cljs-forms clj-api)]
-    (println "   " (count imports) "imported clojure.core macros")
-    (println "   " (count non-excludes) "non-excluded clojure.core macros")
+    (println "   " (count imports) "macros imported from clojure.core")
+    (println "   " (count non-excludes) "macros non-excluded clojure.core")
     (concat imports non-excludes)))
+
+(defn parse-cljs-special-forms
+  "cljs.core has some special forms defined in analyzer.clj, so find those here"
+  []
+  (let [ns- "cljs.core"
+        repo "clojurescript"
+        forms (get-forms ns- repo "analyzer.clj")
+        specials (keep #(parse-special % ns- repo) forms)]
+    (println "   " (count specials) "special forms in cljs.analyzer")
+    specials))

 (defmethod parse-ns-api "cljs.core" [ns-]
   (let [clj-api  (parse-api ns- "clojurescript" "core.clj")
         cljs-api (parse-api ns- "clojurescript" "core.cljs")
-        extra-macro-api (parse-extra-macros-from-clj)]
-    (concat extra-macro-api clj-api cljs-api)))
+        extra-macro-api (parse-extra-macros-from-clj)
+        special-forms (parse-cljs-special-forms)]
+    (concat extra-macro-api clj-api cljs-api special-forms)))

 (defmethod parse-ns-api "cljs.reader" [ns-]
   (parse-api ns- "clojurescript" "reader.cljs"))


CMR-6318 fixed whitespace

CMR-6318 fixed whitespace

--- system-int-test/test/cmr/system_int_test/search/autocomplete/suggestion_reindex_test.clj
+++ system-int-test/test/cmr/system_int_test/search/autocomplete/suggestion_reindex_test.clj
@@ -112,8 +112,7 @@
     (let [_ (index/reindex-suggestions)
           _ (index/wait-until-indexed)
           data (search/get-autocomplete-json "q=sol")
-          results (get-in data [:feed :entry])
-]
+          results (get-in data [:feed :entry])]
       ;; Verify results are returned after re-indexing, ignore scores because they may be subject to change
       (compare-autocomplete-results
        results


bump dependencies

bump dependencies

--- cljs/project.clj
+++ cljs/project.clj
@@ -2,17 +2,17 @@
   :description "Quark - Experimental ClojureScript editor component for Atom"
   :url "http://github.com/darwin/quark"

-  :dependencies [[org.clojure/clojure "1.7.0-beta3"]
+  :dependencies [[org.clojure/clojure "1.7.0"]
                  [org.clojure/clojurescript "0.0-3422"]
                  [org.clojure/tools.reader "0.10.0-SNAPSHOT"]
                  [org.clojure/core.async "0.1.346.0-17112a-alpha"]
-                 [rewrite-cljs "0.2.0"]
+                 [rewrite-cljs "0.3.0"]
                  [binaryage/devtools "0.1.2"]               ; Electron 0.28.2 has old Blink, we have to stick with this old version of devtools for now
-                 [figwheel "0.3.3"]
+                 [figwheel "0.3.7"]
                  [rm-hull/inkspot "0.0.1-SNAPSHOT"]
                  [spellhouse/phalanges "0.1.6"]
                  [reagent "0.5.0" :exclusions [cljsjs/react]]
-                 [cljsjs/react "0.12.2-5"]]
+                 [cljsjs/react "0.13.3-0"]]

   :plugins [[lein-cljsbuild "1.0.5"]
             [lein-figwheel "0.3.3"]]


Use two audio channels in the obi config file

for productions with a library_number

--- src/mdr2/obi.clj
+++ src/mdr2/obi.clj
@@ -24,18 +24,19 @@
 (defn- config-sexp
   [production]
   (let [recording-path (recording-path production)
-        recorded-path (recorded-path production)]
+        recorded-path (recorded-path production)
+        audiochannels (if (:library_number production) 2 1)]
     [:obiconfig
      [:import
       [:obiprojectdirectory recording-path]
       [:audiosamplerate 44100]
-      [:audiochannels 1]]
+      [:audiochannels audiochannels]]
      [:export
       [:directory recorded-path]
       [:standard "daisy2.02"]
       [:audioencoding "wav"]
       [:audiosamplerate 44100]
-      [:audiochannels 1]
+      [:audiochannels audiochannels]
       [:bitrate 64]]]))

 (defn config


Fixed bug. Program was not detecting all self-exclusive modes.

--- src/app/core.clj
+++ src/app/core.clj
@@ -40,6 +40,16 @@
 (defn info [opts msg]
   (println " [info] " msg))

+(defn self-exclusive-modes?
+  "Return true if opts contains self-exclusive modes"
+  [opts]
+  (let [self-exclusive-modes [:linter :interactive :query]]
+    (->> (select-keys opts self-exclusive-modes)
+         (vals)
+         (filter identity)
+         (count)
+         (< 1))))
+
 ; TODO extract part of this method to cli
 (defn -main
   "What I do"
@@ -50,9 +60,9 @@
     (do
       (when (:errors opts)
         (usageError banner opts ""))
+      (when (self-exclusive-modes? opts)
+        (usageError banner opts "Linter, interactive and query mode are self exclusive"))
       (when (:linter opts)
-        (when (or (:interactive opts) (:query opts))
-          (usageError banner opts "Linter, interactive and query mode are self exclusive"))
         (when (not (:dir opts))
           (info opts "Linter, no directory indicated. Using current directory")
           (linter ".")


(defn conjugate): add if-underspecified optional param

--- src/babel/francais/morphology.cljc
+++ src/babel/francais/morphology.cljc
@@ -76,85 +76,90 @@
                (or (log/debug (str "lookup-in: matched: " (strip-refs lexeme))) true)))
             lexemes)))

-(defn conjugate [infinitive conjugate-with]
+(defn conjugate [infinitive conjugate-with & [if-underspecified]]
   "Conjugate an infinitive into a surface form by taking the first
    element of regular-patterns where the element's :u unifies successfully with
    conjugate-with."
-  (if (nil? infinitive)
-    (throw (Exception. (str "conjugate passed null infinitive."))))
-
-  (if (= :top (get-in conjugate-with [:synsem :cat] :top))
-    (if false (throw (Exception. (str "conjugate: no [:synsem :cat] supplied: infinitive: " infinitive "; conjugate-with: " (strip-refs conjugate-with))))
-        (do
-          (log/warn (str "conjugate: no [:synsem :cat] supplied: infinitive: " infinitive "; conjugate-with: " (strip-refs conjugate-with))))))
-
-  (if (and
-       (= :verb (get-in conjugate-with [:synsem :cat]))
-       (= :top (get-in conjugate-with [:synsem :agr] :top)))
-    (do
-      (log/debug (str "conjugate: no [:synsem :agr] supplied: infinitive: " infinitive "; conjugate-with: " (strip-refs conjugate-with)))
-      (str "unconjugated: " infinitive)))
-
-  (let [diag
-        (log/debug (str "conjugate: infinitive=" infinitive "; conjugate-with: "
-                        (strip-refs conjugate-with)))
+  (let [underspecified?
+        (or
+         (= :top (get-in conjugate-with [:synsem :cat] :top))
+         (and
+          (= :verb (get-in conjugate-with [:synsem :cat]))
+          (= :top (get-in conjugate-with [:synsem :agr] :top))))]
+    (cond (nil? infinitive)
+          (throw (Exception. (str "conjugate passed null infinitive.")))
+
+          ;; default here is return log/warn rather than throwing an exception.
+          (and underspecified?
+               (not (= :if-underspecified :error)))
+          (do
+            (log/warn (str "conjugate: underspecified: returning infinitive: " infinitive "; conjugate-with: " (strip-refs conjugate-with)))
+            (str infinitive))
+
+          underspecified?
+          (throw (Exception. (str "conjugate: underspecified: returning infinitive: " infinitive "; conjugate-with: " (strip-refs conjugate-with))))

-        lookup-spec (strip-refs
-                     (unify
-                      (dissoc-paths
-                       conjugate-with [[:français :exception]])
-                      {:français {:infinitive infinitive
-                                  :exception true}}))
-        diag
-        (log/debug (str "conjugate: lookup-spec: " lookup-spec))
-
-        diag
-        (if (fail? lookup-spec)
-          (log/debug (str "fail-path for conjugate-with:"
-                          (strip-refs conjugate-with) "; "
-                          {:français {:infinitive infinitive
-                                      :exception true}} ": "
-                          (dag_unify.core/fail-path
-                           conjugate-with
-                           {:français {:infinitive infinitive
-                                       :exception true}}))))
-
-        error (if (= :fail lookup-spec)
-                (throw (Exception. (str "conjugate was given conjugate-with=:fail; "
-                                        "arg1="
-                                        (strip-refs (dissoc-paths
-                                                     conjugate-with [[:français :exception]])) "; "
-                                        "arg2="
-                                        {:français {:infinitive infinitive
-                                                    :exception true}}))))
-
-        exceptional-surface-forms
-        (remove nil?
-         (map #(let [{surface-fn :surface-fn
-                      unify-with :unify-with} %]
-                 (if (not (fail? (unify unify-with lookup-spec)))
-                   (surface-fn lookup-spec)))
-              verbs/irregular-conjugations))
-
-        regulars
-        (remove nil?
-                (map
-                 (fn [replace-pattern]
-                     (let [from (nth (:g replace-pattern) 0)
-                           to (nth (:g replace-pattern) 1)
-                           unify-against (if (:u replace-pattern)
-                                           (:u replace-pattern)
-                                           :top)
-                           unified (unify unify-against
-                                          conjugate-with)]
-                       (if (and from to infinitive
-                                (not (= :fail unified))
-                                (re-matches from infinitive))
-                         (string/replace infinitive from to))))
-                 regular-patterns))]
-    (let [results (concat exceptional-surface-forms regulars [infinitive])]
-      (first results))))
-
+          true
+          (let [diag
+                (log/debug (str "conjugate: infinitive=" infinitive "; conjugate-with: "
+                                (strip-refs conjugate-with)))
+
+                lookup-spec (strip-refs
+                             (unify
+                              (dissoc-paths
+                               conjugate-with [[:français :exception]])
+                              {:français {:infinitive infinitive
+                                          :exception true}}))
+                diag
+                (log/debug (str "conjugate: lookup-spec: " lookup-spec))
+
+                diag
+                (if (= :fail lookup-spec)
+                  (log/debug (str "fail-path for conjugate-with:"
+                                  (strip-refs conjugate-with) "; "
+                                  {:français {:infinitive infinitive
+                                              :exception true}} ": "
+                                  (dag_unify.core/fail-path
+                                   conjugate-with
+                                   {:français {:infinitive infinitive
+                                               :exception true}}))))
+
+                error (if (= :fail lookup-spec)
+                        (throw (Exception. (str "conjugate was given conjugate-with=:fail; "
+                                              "arg1="
+                                              (strip-refs (dissoc-paths
+                                                           conjugate-with [[:français :exception]])) "; "
+                                              "arg2="
+                                              {:français {:infinitive infinitive
+                                                          :exception true}}))))
+
+                exceptional-surface-forms
+                (remove nil?
+                        (map #(let [{surface-fn :surface-fn
+                                     unify-with :unify-with} %]
+                                (if (not (= :fail (unify unify-with lookup-spec)))
+                                  (surface-fn lookup-spec)))
+                             verbs/irregular-conjugations))
+
+                regulars
+                (remove nil?
+                        (map
+                         (fn [replace-pattern]
+                           (let [from (nth (:g replace-pattern) 0)
+                                 to (nth (:g replace-pattern) 1)
+                                 unify-against (if (:u replace-pattern)
+                                                 (:u replace-pattern)
+                                                 :top)
+                                 unified (unify unify-against
+                                                conjugate-with)]
+                             (if (and from to infinitive
+                                      (not (= :fail unified))
+                                      (re-matches from infinitive))
+                               (string/replace infinitive from to))))
+                         regular-patterns))]
+            (let [results (concat exceptional-surface-forms regulars [infinitive])]
+              (first results))))))
+
 (defn pre-conjugate [spec]
   "add structure-sharing so that (defn conjugate) can conjugate words correctly."
   (unify spec
@@ -171,7 +176,7 @@
 ;; TODO: separate part-of-speech -related functionality (e.g. the word is a verb) from
 ;; compositional functionality (e.g. the word has an :a and :b, so combine by concatenation, etc)
 ;;
-(defn get-string [word & [b lexicon]]
+(defn get-string [word & [b]]
   (cond
         (and (nil? b)
              (seq? word))


+(defn stem-analysis)

+(defn stem-analysis)

--- src/babel/italiano/morphology.cljc
+++ src/babel/italiano/morphology.cljc
@@ -193,6 +193,45 @@
      true
      infinitive)))

+(defn stem-analysis [word]
+  (let [infinitive (if (get-in word [:infinitive]) ;; regular present tense
+                     (get-in word [:infinitive])
+                     (get-in word [:italiano]))
+        ;; e.g.: lavarsi => lavare
+        infinitive (if (re-find #"[aei]rsi$" infinitive)
+                     (string/replace infinitive #"si$" "e")
+                     infinitive)
+        are-type (try (re-find #"are$" infinitive)
+                      (catch Exception e
+                        (throw (Exception. (str "Can't regex-find on non-string: " infinitive " from word: " word)))))
+        ere-type (re-find #"ere$" infinitive)
+        ire-type (re-find #"ire$" infinitive)
+        stem (cond (and (get-in word [:boot-stem1])
+                        (or (= (get-in word [:agr :number])
+                               :sing)
+                            (and (= (get-in word [:agr :person])
+                                    :3rd)
+                                 (= (get-in word [:agr :number])
+                                    :plur))))
+                   (get-in word [:boot-stem1])
+                   true
+                   (string/replace infinitive #"[iae]re$" ""))
+        last-stem-char-is-i (re-find #"i[iae]re$" infinitive)
+        last-stem-char-is-e (re-find #"e[iae]re$" infinitive)
+        is-care-or-gare? (re-find #"[cg]are$" infinitive)
+        person (get-in word '(:agr :person))
+        number (get-in word '(:agr :number))]
+    {:infinitive infinitive
+     :are-type are-type
+     :ere-type ere-type
+     :ire-type ire-type
+     :stem stem
+     :last-stem-char-is-i last-stem-char-is-i
+     :last-stem-char-is-e last-stem-char-is-e
+     :is-care-or-gare? is-care-or-gare?
+     :person person
+     :number number}))
+
 ;; TODO: this is an overly huge method that needs to be rewritten to be easier to understand and maintain.
 ;; TODO: use replace patterns instead (as with French)
 (defn get-string-1 [word]
@@ -757,6 +796,7 @@
      (and
       (= (get-in word '(:infl)) :present)
       (string? (get-in word '(:italiano))))
+     ;; TODO: use (defn stem-analysis [word])
      (let [infinitive (if (get-in word [:infinitive]) ;; regular present tense
                         (get-in word [:infinitive])
                         (get-in word [:italiano]))


Remove extraneous destructure of clojure-version

--- src/clj/reply/eval_modes/nrepl.clj
+++ src/clj/reply/eval_modes/nrepl.clj
@@ -79,21 +79,20 @@
 (defn run-repl
   ([connection] (run-repl connection nil))
   ([connection {:keys [prompt read-line-fn] :as options}]
-    (let [{:keys [major minor incremental qualifier]} *clojure-version*]
-      (loop [ns (execute-with-client connection options "")]
-        (let [ns (handle-ns-init-error ns connection options)
-              eof (Object.)
-              execute (partial execute-with-client connection
-                               (assoc options :interactive true))
-              forms (parsing/parsed-forms
-                      {:request-exit eof
-                       :prompt-string (prompt ns)
-                       :ns ns
-                       :read-line-fn read-line-fn
-                       :text-so-far nil})]
-          (if (reply.exit/done? eof (first forms))
-            nil
-            (recur (last (doall (map execute forms))))))))))
+   (loop [ns (execute-with-client connection options "")]
+     (let [ns (handle-ns-init-error ns connection options)
+           eof (Object.)
+           execute (partial execute-with-client connection
+                            (assoc options :interactive true))
+           forms (parsing/parsed-forms
+                   {:request-exit eof
+                    :prompt-string (prompt ns)
+                    :ns ns
+                    :read-line-fn read-line-fn
+                    :text-so-far nil})]
+       (if (reply.exit/done? eof (first forms))
+         nil
+         (recur (last (doall (map execute forms)))))))))

 ;; TODO: this could be less convoluted if we could break backwards-compat
 (defn- url-for [attach host port]


update project config to use private keystore

--- guest-side-tools/tbnl.figurehead/project.clj
+++ guest-side-tools/tbnl.figurehead/project.clj
@@ -40,8 +40,8 @@
                                  ;; and the the alias of the key you want to
                                  ;; sign APKs with. Do it either here or in
                                  ;; ~/.lein/profiles.clj
-                                 ;; :keystore-path "/home/user/.android/private.keystore"
-                                 ;; :key-alias "mykeyalias"
+                                 :keystore-path "/home/wei/.android/pengw.keystore"
+                                 :key-alias "pengw"

                                  :enable-dynamic-compilation true
                                  ;; !!! upstream neko has a misspelling here; fixed in org.clojars.pw4ever/neko-sdk18
@@ -51,8 +51,8 @@
                                  :sdk-path "android-sdk"

                                  ;; for the default "debug.keystore"
-                                 :keypass "android"
-                                 :storepass "android"
+                                 ;;:keypass "android"
+                                 ;;:storepass "android"

                                  :ignore-log-priority [:debug :verbose]
                                  :aot :all}}


Write properties files only when they have new content

--- src/clj/salava/core/translator.clj
+++ src/clj/salava/core/translator.clj
@@ -2,6 +2,7 @@
   (:require [clojure.tools.logging :as log]
             [clojurewerkz.propertied.properties :refer [properties->map map->properties]]
             [clojure.java.io :as io]
+            [clojure.data]
             [salava.registry]
             [salava.core.helper :refer [dump]]
             [salava.core.util :as util]))
@@ -51,9 +52,15 @@
           (properties->map true)))

+(defn prop-data-changed? [lang plugin new-data]
+  (let [old-data (load-prop-file lang plugin)
+        df (clojure.data/diff old-data new-data)]
+    (not (and (nil? (first df)) (nil? (second df))))))
+
+
 (defn save-prop-file [lang plugin data]
   (let [out-file (prop-file lang plugin)]
-    (do
+    (when (prop-data-changed? lang plugin data)
       (io/make-parents out-file)
       (prop-write out-file (map->properties data)))))


Minor refactoring of related-urls.

Minor refactoring of related-urls.

--- src/cmr/umm/echo10/related_url.clj
+++ src/cmr/umm/echo10/related_url.clj
@@ -7,6 +7,8 @@
             [cmr.umm.granule :as g]))

 (def resource-type->related-url-types
+  "A mapping of ECHO10 OnlineResource's type to UMM RelatedURL's type and sub-type.
+  This came from a list provided by Katie on ECHO10 collections, more may need to be added for granules."
   {"STATIC URL" ["GET DATA"]
    "GUIDE" ["VIEW RELATED INFORMATION" "USER'S GUIDE"]
    "HOMEPAGE" ["VIEW PROJECT HOME PAGE"]
@@ -96,10 +98,15 @@
   (seq (concat (xml-elem->online-access-urls granule-content-node)
                (xml-elem->online-resource-urls granule-content-node))))

+(defn downloadable-url?
+  "Returns true if the related-url is downloadable"
+  [related-url]
+  (= "GET DATA" (:type related-url)))
+
 (defn generate-access-urls
   "Generates the OnlineAccessURLs element of an ECHO10 XML from a UMM Granule related urls entry."
   [related-urls]
-  (let [downloadable-urls (filter #(= "GET DATA" (:type %)) related-urls)]
+  (let [downloadable-urls (filter downloadable-url? related-urls)]
     (when-not (empty? downloadable-urls)
       (x/element
         :OnlineAccessURLs {}
@@ -112,7 +119,7 @@
 (defn generate-resource-urls
   "Generates the OnlineResources element of an ECHO10 XML from a UMM Granule related urls entry."
   [related-urls]
-  (let [undownloadable-urls (filter #(not= "GET DATA" (:type %)) related-urls)]
+  (let [undownloadable-urls (filter (complement downloadable-url?) related-urls)]
     (when-not (empty? undownloadable-urls)
       (x/element
         :OnlineResources {}


Further removal of 1.3 code

Further removal of 1.3 code

--- test/user/fus_threading.clj
+++ test/user/fus_threading.clj
@@ -2,33 +2,31 @@
   (:use midje.sweet
         midje.test-util
         midje.util.ecosystem))
-
-(when-1-4+

- (use 'plumbing.core)
- (require '[plumbing.graph :as graph])
+(use 'plumbing.core)
+(require '[plumbing.graph :as graph])

- (defn tak-y [_] 5)
+(defn tak-y [_] 5)

- (defn tak [x y z]
-   (if (< y x)
-     (tak (tak (dec x) (tak-y 4) z)
-          (tak (dec y) (tak-y 4) x)
-          (tak (dec z) (tak-y 4) y))
-     z))
-
- (def computation-tree
-   {:one (fnk [arg] (tak arg (tak-y 4) 20))
-    :two (fnk [arg] (tak arg (tak-y 4) 20))
-    :three (fnk [arg] (tak arg (tak-y 4) 20))
-    :all (fnk [one two three] [one two three])})
-
- (def computation (graph/par-compile computation-tree))
-
- (fact "prerequisite bindings persist into other threads"
-   (:all (computation {:arg 20})) => [4 4 4]
-   (provided (tak-y 4) => 4))
-
-) ; 1.4+
+(defn tak [x y z]
+  (if (< y x)
+    (tak (tak (dec x) (tak-y 4) z)
+         (tak (dec y) (tak-y 4) x)
+         (tak (dec z) (tak-y 4) y))
+    z))

-
+(def computation-tree
+  {:one (fnk [arg] (tak arg (tak-y 4) 20))
+   :two (fnk [arg] (tak arg (tak-y 4) 20))
+   :three (fnk [arg] (tak arg (tak-y 4) 20))
+   :all (fnk [one two three] [one two three])})
+
+(def computation (graph/par-compile computation-tree))
+
+(fact "prerequisite bindings persist into other threads"
+  (:all (computation {:arg 20})) => [4 4 4]
+  (provided (tak-y 4) => 4))
+
+
+
+


Remove redundant gensym

Remove redundant gensym

--- src/huon/log.clj
+++ src/huon/log.clj
@@ -5,10 +5,10 @@

 (defmacro log [level & msg]
   "Evaluate and log `msg` if configured level >= `level`."
-  (let [src# (or (::src (meta &form)) (src-meta &form))]
-    `(log* ~(str *ns*)
+  (let [{:keys [ns line]} (or (::src (meta &form)) (src-meta &form))]
+    `(log* ~(str ns)
            ~level
-           ~(format "[%s:%s]" (:ns src#) (:line src#))
+           ~(format "[%s:%s]" ns line)
            (str "[" (clojure.string/upper-case (name ~level)) "]")
            (fn [] (list ~@msg)))))


Refactored fastDeref to reactiveDeref - commented out funky redefinition of deref.

--- src-cljs/freactive/core.cljs
+++ src-cljs/freactive/core.cljs
@@ -74,11 +74,11 @@
                   (doseq [[key f] (.-watches this)]
                     (f key this oldVal newVal))))})

-(let [core-deref cljs.core/deref]
-  (set! cljs.core/deref (fn [x]
-                          (if (.-fastDeref x)
-                            (.fastDeref x)
-                            (core-deref x)))))
+;; (let [core-deref cljs.core/deref]
+;;   (set! cljs.core/deref (fn [x]
+;;                           (if (.-reactiveDeref x)
+;;                             (.reactiveDeref x)
+;;                             (core-deref x)))))

 (def fwatch-binding-info
   (BindingInfo.
@@ -89,20 +89,19 @@
   (equiv [this other]
     (-equiv this other))
   (rawDeref [_] state)
-  (fastDeref [this]
+  (clean [this])
+  cljs.core/IAtom
+
+  IReactive
+  (-get-binding-fns [this] fwatch-binding-info)
+
+  cljs.core/IEquiv
+  (-equiv [o other] (identical? o other))
+
+  cljs.core/IDeref
+  (-deref [this]
     (register-dep this id fwatch-binding-info)
     state)
-  (clean [this])
-  cljs.core/IAtom
-
-  IReactive
-  (-get-binding-fns [this] fwatch-binding-info)
-
-  cljs.core/IEquiv
-  (-equiv [o other] (identical? o other))
-
-  cljs.core/IDeref
-  (-deref [this] (.fastDeref this))

   IMeta
   (-meta [_] meta)
@@ -219,7 +218,7 @@

 (def rx-mixin
   #js
-  {:fastDeref (fn fastDeref []
+  {:reactiveDeref (fn reactiveDeref []
                 (this-as this
                          (if (.-lazy this)
                            (register-dep this (.-id this) invalidates-binding-info)
@@ -273,7 +272,7 @@
   (-equiv [o other] (identical? o other))

   IDeref
-  (-deref [this] (.fastDeref this))
+  (-deref [this] (.reactiveDeref this))

   IMeta
   (-meta [_] meta)
@@ -349,7 +348,7 @@
   (-equiv [o other] (identical? o other))

   cljs.core/IDeref
-  (-deref [this] (.fastDeref this))
+  (-deref [this] (.reactiveDeref this))

   IMeta
   (-meta [_] meta)


make prcrsr bot blue

make prcrsr bot blue

--- src-cljs/frontend/state.cljs
+++ src-cljs/frontend/state.cljs
@@ -23,7 +23,7 @@
    :show-mouse? true
    :hide-in-list? true
    :cust/uuid "prcrsr-subscriber-bot"
-   :cust/color-name :color.name/green
+   :cust/color-name :color.name/blue
    :client-id "prcrsr-subscriber-bot"})

 (defn initial-state []


partway through 15.6

partway through 15.6

--- src/joy/ch15.clj
+++ src/joy/ch15.clj
@@ -42,3 +42,237 @@

 (first (time (zencat1 bv bv)))
 (first (time (zencat2 bv bv)))
+
+;; 15.3 Chunked Sequences
+(def gimme #(do (print \.) %))
+
+(take 1 (map gimme (range 32)))
+
+(defn seq1 [s]
+  (lazy-seq
+   (when-let [[x] (seq s)]
+     (cons x (seq1 (rest s))))))
+
+(take 1 (map gimme (seq1 (range 32))))
+
+;; 15.4 Memoization
+(def gcd (memoize
+          (fn [x y]
+            (cond
+             (> x y) (recur (- x y) y)
+             (< x y) (recur x (- y x))
+             :esle x))))
+
+(gcd 1000645475 56130776629010010)
+
+(defprotocol CacheProtocol
+  (lookup [cache e])
+  (has? [cache e])
+  (hit [cache e])
+  (miss [cache e ret]))
+
+(deftype BasicCache [cache]
+  CacheProtocol
+  (lookup [_ item]
+    (get cache item))
+  (has? [_ item]
+    (contains? cache item))
+  (hit [this item] this)
+  (miss [_ item result]
+    (BasicCache. (assoc cache item result))))
+
+(def cache (BasicCache. {}))
+(lookup (miss cache '(servo) :robot) '(servo))
+
+(defn through [cache f item]
+  (if (has? cache item)
+    (hit cache item)
+    (miss cache item (delay (apply f item)))))
+
+(deftype PluggableMemoization [f cache]
+  CacheProtocol
+  (has? [_ item] (has? cache item))
+  (hit [this item] this)
+  (miss [_ item result]
+    (PluggableMemoization. f (miss cache item result)))
+  (lookup [_ item]
+    (lookup cache item)))
+
+(defn memoization-impl [cache-impl]
+  (let [cache (atom cache-impl)]
+    (with-meta
+      (fn [& args]
+        (let [cs (swap! cache through (.f cache-impl) args)]
+          @(lookup cs args)))
+      {:cache cache})))
+
+(def slowly (fn [x] (Thread/sleep 3000) x))
+(def sometimes-slowly (memoization-impl
+                       (PluggableMemoization.
+                        slowly
+                        (BasicCache. {}))))
+
+(time [(sometimes-slowly 108) (sometimes-slowly 108)])
+
+;; 15.5 Understanding Coercion
+
+(defn factorial-a [original-x]
+  (loop [x original-x acc 1]
+    (if (>= 1 x)
+      acc
+      (recur (dec x) (* x acc)))))
+
+(factorial-a 20)
+
+(time (dotimes [_ 1e5] (factorial-a 20)))
+
+(defn factorial-b [original-x]
+  (loop [x (long original-x) acc 1]
+    (if (>= 1 x)
+      acc
+      (recur (dec x) (* x acc)))))
+
+(time (dotimes [_ 1e5] (factorial-b 20)))
+
+(defn factorial-c [^long original-x]
+  (loop [x original-x acc 1]
+    (if (>= 1 x)
+      acc
+      (recur (dec x) (* x acc)))))
+
+(time (dotimes [_ 1e5] (factorial-b 20)))
+
+(set! *unchecked-math* true)
+(defn factorial-d [^long original-x]
+  (loop [x original-x acc 1]
+    (if (>= 1 x)
+      acc
+      (recur (dec x) (* x acc)))))
+
+(time (dotimes [_ 1e5] (factorial-d 20)))
+
+(set! *unchecked-math* false)
+(time (dotimes [_ 1e5] (factorial-d 20)))
+
+(factorial-d 21)
+(factorial-a 21)
+
+(defn factorial-e [^double original-x]
+  (loop [x original-x acc 1.0]
+    (if (>= 1.0 x)
+      acc
+      (recur (dec x) (* x acc)))))
+
+(factorial-e 10.0)
+(factorial-e 10)
+(factorial-e 20.0)
+(factorial-e 30.0)
+(factorial-e 171.0)
+
+(time (dotimes [_ 1e5] (factorial-e 20.0)))
+
+(defn factorial-f [^long original-x]
+  (loop [x original-x acc 1]
+    (if (>= 1 x)
+      acc
+      (recur (dec x) (*' x acc)))))
+
+(factorial-f 20)
+(factorial-f 30)
+(factorial-f 171 )
+
+(time (dotimes [_ 1e5] (factorial-f 20)))
+
+;; 15.6 Reducibles
+
+(defn empty-range? [start end step]
+  (or (and (pos? step) (>= start end))
+      (and (neg? step) (<= start end))))
+
+(defn lazy-range [i end step]
+  (lazy-seq
+   (if (empty-range? i end step)
+     nil
+     (cons i
+           (lazy-range (+ i step)
+                       end
+                       step)))))
+
+(lazy-range 5 10 2)
+(lazy-range 6 0 -1)
+
+(reduce conj [] (lazy-range 6 0 -1))
+
+(reduce + 0 (lazy-range 6 0 -1))
+
+
+(defn reducible-range [start end step]
+  (fn [reducing-fn init]
+    (loop [result init i start]
+      (if (empty-range? i end step)
+        result
+        (recur (reducing-fn result i)
+               (+ i step))))))
+
+(def countdown-reducible (reducible-range 6 0 -1))
+(countdown-reducible conj [])
+(countdown-reducible + 0)
+
+(defn half [x] (/ x 2))
+
+(defn sum-half [result input]
+  (+ result (half input)))
+
+(reduce sum-half 0 (lazy-range 0 10 2))
+((reducible-range 0 10 2) sum-half 0)
+
+(defn half-transformer [f1]
+  (fn f1-half [result input]
+    (f1 result (half input))))
+
+((reducible-range 0 10 2) (half-transformer +) 0)
+
+((reducible-range 0 10 2) (half-transformer conj) [])
+
+(defn mapping [map-fn]
+  (fn map-transformer [f1]
+    (fn [result input]
+      (f1 result (map-fn input)))))
+
+((reducible-range 0 10 2) ((mapping half) +) 0)
+
+(defn filtering [filter-pred]
+  (fn [f1]
+    (fn [result input]
+      (if (filter-pred input)
+        (f1 result input)
+        result))))
+
+((reducible-range 0 10 2) ((filtering #(not= % 2)) conj) [] )
+
+((reducible-range 0 10 2)
+ ((filtering #(not= % 2))
+  ((mapping half) conj))
+ [])
+
+((reducible-range 0 10 2)
+ ((mapping half)
+  ((filtering #(not= % 2)) conj))
+ [])
+
+(defn mapcatting [map-fn]
+  (fn [f1]
+    (fn [result input]
+      (let [reducible (map-fn input)]
+        (reducible f1 result)))))
+
+(defn and-plus-ten [x]
+  (reducible-range x (+ 11 x) 10))
+
+((and-plus-ten 5) conj [])
+
+((reducible-range 0 10 2) ((mapcatting and-plus-ten) conj) [])
+
+(filter #(not= % 2)
+        (map half
+             (lazy-range 0 10 2)))


mutate -> mutatef to match readf

mutate -> mutatef to match readf

--- src/tudu/api.clj
+++ src/tudu/api.clj
@@ -4,9 +4,9 @@
     [om.next.server :as om]))

 (defmulti readf om/dispatch)
-(defmulti mutate om/dispatch)
+(defmulti mutatef om/dispatch)

-(def parser (om/parser {:read readf :mutate mutate}))
+(def parser (om/parser {:read readf :mutate mutatef}))

 (defn query [{:keys [body request]}]
   (let [query-env {:app-env (:tudu/env request)}]
@@ -22,15 +22,15 @@
   (let [{:keys [db]} app-env]
     {:value (vec (tudu.store/get-tasks db))}))

-(defmethod mutate :default [_ key params]
+(defmethod mutatef :default [_ key params]
   :notfound)

-(defmethod mutate 'tudu.item/close [{:keys [app-env]} _ {:keys [id]}]
+(defmethod mutatef 'tudu.item/close [{:keys [app-env]} _ {:keys [id]}]
   (let [{:keys [db]} app-env]
     (tudu.store/close-task db id)
     {}))

-(defmethod mutate 'tudu.item/create [{:keys [app-env]} _ {:keys [value]}]
+(defmethod mutatef 'tudu.item/create [{:keys [app-env]} _ {:keys [value]}]
   (let [{:keys [db]} app-env]
     (tudu.store/create-task db value)
     {}))


Get regex type for Google Closure compiler

Google Closure compiler doesn't like using the global constructor

--- src/longshi/fressian/handlers.cljs
+++ src/longshi/fressian/handlers.cljs
@@ -198,7 +198,8 @@
 ;;UUID byte array for transformations from string to byte array
 (def ^:private uuid-ba (make-byte-array 16))
 (def ^:private uuid-dv (make-data-view uuid-ba))
-
+;;Regex Alias since Google Closure can't optimize using js/RegExp
+(def ^:private regex-alias (.-constructor #""))
 (def
   ^{:doc
     "Extended freesian write handlers
@@ -221,7 +222,7 @@
              (dotimes [i (alength uuid-chunks)]
                (.setUint16 uuid-dv (* i 2) (js/parseInt (aget uuid-chunks i) 16) little-endian))
              (p/write-bytes! fw uuid-ba)))))]
-     [js/RegExp "regex"
+     [regex-alias "regex"
      (fn [fw re]
        (do
          (p/write-tag! fw "regex" 1)


Reindentations

Reindentations

--- test/cljs/comic_reader/ui_test.cljs
+++ test/cljs/comic_reader/ui_test.cljs
@@ -9,7 +9,6 @@
   "## Loading
    This is the loading svg used everywhere on the site."
   (ui/loading))
-

 (deftest test-site-element
   (is (= [:li [:a "A"]]
@@ -27,16 +26,17 @@
          (ui/site-list :loading)))

   (is (= [:div [:h1 "Comic Sites"]
-            [:ul
-             [:li [:a "A"]]
-             [:li [:a "B"]]
-             [:li [:a "C"]]]]
+          [:ul
+           [:li [:a "A"]]
+           [:li [:a "B"]]
+           [:li [:a "C"]]]]
          (ui/site-list [{:name "A" :id "a"}
                         {:name "B" :id "b"}
                         {:name "C" :id "c"}]))))

 (defcard-rg site-list-card
   (do
-    (re-frame/dispatch [:set-site-list [{:id :a :name "Comic A"}
-                                        {:id :b :name "Comic B"}]])
+    (re-frame/dispatch [:set-site-list
+                        [{:id :a :name "Comic A"}
+                         {:id :b :name "Comic B"}]])
      (ui/site-list-container)))


Refactor - add status atom support

Refactor - add status atom support

--- src/aerobio/htseq/rnaseq.clj
+++ src/aerobio/htseq/rnaseq.clj
@@ -181,20 +181,16 @@
   "Run a condition/replicate set of comparisons based on an experiment
   designated by eid (experiement id) and the input comparison sheet
   CSV comparison-sheet"
-  [eid recipient comparison-file get-toolinfo template]
+  [eid recipient comparison-file get-toolinfo template status-atom]
   (let [_ (get-phase-2-dirs eid nil)
         _ (get-phase-2-dirs eid :rep)
         ftype "CDS" ; <-- BAD 'magic number'
-        repcfg (assoc-in template
+        cfg (assoc-in template
                          [:nodes :ph2 :args]
                          [eid comparison-file true ftype :NA recipient])
-        repjob (pg/future+ (cmn/flow-program repcfg get-toolinfo :run true))
-        cfg (assoc-in template
-                      [:nodes :ph2 :args]
-                      [eid comparison-file false ftype :NA recipient])
-        cfgjob (pg/future+ (cmn/flow-program cfg get-toolinfo :run true))]
-    #_(clojure.pprint/pprint repflow)
-    [repjob cfgjob]))
+        futs-vec (cmn/flow-program cfg get-toolinfo :run true)]
+    (cmn/job-flow-node-results futs-vec status-atom)
+    (@status-atom :done)))

 #_(defmethod cmn/run-xcomparison :rnaseq
@@ -203,13 +199,13 @@
    eid recipient compfile get-toolinfo template))

 (defmethod cmn/run-comparison :rnaseq
-  [_ eid recipient compfile get-toolinfo template]
+  [_ eid recipient compfile get-toolinfo template status-atom]
   (run-rnaseq-comparison
-   eid recipient compfile get-toolinfo template))
+   eid recipient compfile get-toolinfo template status-atom))

 (defmethod cmn/run-phase-2 :rnaseq
-  [_ eid recipient get-toolinfo template]
+  [_ eid recipient get-toolinfo template status-atom]
   (run-rnaseq-comparison
-   eid recipient "ComparisonSheet.csv" get-toolinfo template))
-
-
+   eid recipient "ComparisonSheet.csv" get-toolinfo template status-atom))
+
+


Classify vimclojure as interactive environment.

--- src/appengine_magic/core.clj
+++ src/appengine_magic/core.clj
@@ -5,6 +5,7 @@
   (try
     (let [stack-trace (.getStackTrace (Thread/currentThread))]
       (some #(or (.contains (.toString %) "swank.core")
+                 (.contains (.toString %) "vimclojure")
                  (.contains (.toString %) "clojure.main$repl"))
             stack-trace))
     (catch java.security.AccessControlException ace


lint fixes.

lint fixes.

--- src/metabase/driver/crate/util.clj
+++ src/metabase/driver/crate/util.clj
@@ -1,33 +1,38 @@
 (ns metabase.driver.crate.util
-  (:require [metabase.util.korma-extensions :as kx]
-            [korma.sql.utils :as kutils]
+  (:refer-clojure :exclude [second])
+  (:require [korma.sql.utils :as kutils]
             [korma.core :as k]
+            [metabase.driver.generic-sql.query-processor :as qp]
             [metabase.util :as u]
-            [metabase.driver.generic-sql.query-processor :as qp])
+            [metabase.util.korma-extensions :as kx])
   (:import (java.sql Timestamp)))

-(defn unix-timestamp->timestamp [_ expr seconds-or-milliseconds]
+(defn unix-timestamp->timestamp
   "Converts datetime string to a valid timestamp"
+  [_ expr seconds-or-milliseconds]
   (case seconds-or-milliseconds
     :seconds      (recur nil (kx/* expr 1000) :milliseconds)
     :milliseconds (kutils/func (str "TRY_CAST(%s as TIMESTAMP)") [expr])))

-(defn- date-trunc [unit expr]
+(defn- date-trunc
   "date_trunc('interval', timezone, timestamp): truncates a timestamp to a given interval"
+  [unit expr]
   (let [timezone    (get-in qp/*query* [:settings :report-timezone])]
     (if (= (nil? timezone) true)
       (k/sqlfn :DATE_TRUNC (kx/literal unit) expr)
       (k/sqlfn :DATE_TRUNC (kx/literal unit) timezone expr))))

-(defn- date-format [format expr]
+(defn- date-format
   "date_format('format_string', timezone, timestamp): formats the timestamp as string"
+  [fmt expr]
   (let [timezone    (get-in qp/*query* [:settings :report-timezone])]
     (if (nil? timezone)
-      (k/sqlfn :DATE_FORMAT format expr)
-      (k/sqlfn :DATE_FORMAT format timezone expr))))
+      (k/sqlfn :DATE_FORMAT fmt expr)
+      (k/sqlfn :DATE_FORMAT fmt timezone expr))))

-(defn- extract    [unit expr]
+(defn- extract
   "extract(field from expr): extracts subfields of a timestamp"
+  [unit expr]
   (case unit
     ;; Crate DOW starts with Monday (1) to Sunday (7)
     :day_of_week (kx/+ (kx/mod (kutils/func (format "EXTRACT(%s FROM %%s)" (name unit)) [expr]) 7) 1)
@@ -71,8 +76,9 @@
 (defn- sql-interval [unit amount]
   (format "CURRENT_TIMESTAMP + %d" (* unit amount)))

-(defn date-interval [_ unit amount]
+(defn date-interval
   "defines the sql command required for date-interval calculation"
+  [_ unit amount]
   (case unit
     :quarter (recur nil :month (kx/* amount 3))
     :year (k/raw (sql-interval year amount))


fix require clause for compilation

fix require clause for compilation

--- src/overtone/samples/freesound.clj
+++ src/overtone/samples/freesound.clj
@@ -8,6 +8,7 @@
         [overtone.helpers.lib :only [defrecord-ifn]]
         [overtone.helpers.file :only [*authorization-header*]])
   (:require [clojure.data.json :as json]
+            [clojure.java.browse]
             [overtone.libs.asset :as asset]
             [overtone.sc.sample :as samp]
             [overtone.sc.buffer :as buffer]))


-babel.enrich; -babel.lexiconfn/unify

-babel.enrich; -babel.lexiconfn/unify

--- src/babel/espanol/writer.clj
+++ src/babel/espanol/writer.clj
@@ -1,14 +1,13 @@
 (ns babel.espanol.writer
   (:refer-clojure :exclude [get-in]))

-(require '[babel.enrich :refer [enrich]])
 (require '[babel.espanol :refer [small]])
 (require '[babel.espanol.grammar :refer [parse]])
 (require '[babel.espanol.lexicon :refer [lexicon]])
 (require '[babel.espanol.morphology :as morph])
 (require '[babel.espanol.pos :refer :all])
 (require '[babel.generate :refer [generate]])
-(require '[babel.lexiconfn :refer (compile-lex map-function-on-map-vals unify)])
+(require '[babel.lexiconfn :refer (compile-lex map-function-on-map-vals)])
 (require '[babel.log :refer [log4j!]])
 (require '[babel.parse :as parse])
 (require '[babel.ug :refer :all])
@@ -16,7 +15,7 @@
 (require '[clojure.string :as string])
 (require '[clojure.tools.logging :as log])
 (require '[dag_unify.core :refer (fail? get-in strip-refs)])
-(require '[dag_unify.core :as unify])
+(require '[dag_unify.core :as unify :refer [unify]])

 ;; for debugging:
 (require '[babel.espanol.morphology.verbs :as esverbs])


Removing need to ns code under test

Removing need to ns code under test

--- test/alphabet_diamond/midje.clj
+++ test/alphabet_diamond/midje.clj
@@ -1,26 +1,26 @@
 (ns alphabet-diamond.midje
-  (:require [alphabet-diamond.core :as ad])
+  (:require [alphabet-diamond.core :refer :all])
   (:use [midje.sweet]))

-(fact (clojure.string/trim (ad/row [1 "A"])) => "A")
+(fact (clojure.string/trim (row [1 "A"])) => "A")

-(fact (clojure.string/trim (ad/row [1 "B"])) => "A")
-(fact (clojure.string/trim (ad/row [2 "B"])) => "B B")
+(fact (clojure.string/trim (row [1 "B"])) => "A")
+(fact (clojure.string/trim (row [2 "B"])) => "B B")

-(fact (clojure.string/trim (ad/row [2 "C"])) => "B B")
-(fact (clojure.string/trim (ad/row [3 "C"])) => "C   C")
+(fact (clojure.string/trim (row [2 "C"])) => "B B")
+(fact (clojure.string/trim (row [3 "C"])) => "C   C")

-(fact (ad/commands-for "C") => [[1 "A"] [2 "B"] [3 "C"] [2 "B"] [1 "A"]])
-(fact (ad/commands-for "A") => [[1 "A"]])
-(fact (ad/commands-for "d") => [[1 "A"] [2 "B"] [3 "C"] [4 "D"] [3 "C"] [2 "B"] [1 "A"]])
+(fact (commands-for "C") => [[1 "A"] [2 "B"] [3 "C"] [2 "B"] [1 "A"]])
+(fact (commands-for "A") => [[1 "A"]])
+(fact (commands-for "d") => [[1 "A"] [2 "B"] [3 "C"] [4 "D"] [3 "C"] [2 "B"] [1 "A"]])

-(fact (ad/check-spec "A") => truthy)
-(fact (ad/check-spec "c") => truthy)
-(fact (ad/check-spec "Z") => truthy)
-(fact (ad/check-spec "  E   ") => truthy)
-(fact (ad/check-spec "") => (throws AssertionError))
-(fact (ad/check-spec "AA") => (throws AssertionError))
-(fact (ad/check-spec " ") => (throws AssertionError))
-(fact (ad/check-spec "4") => (throws AssertionError))
-(fact (ad/check-spec "(") => (throws AssertionError))
-(fact (ad/check-spec nil) => (throws AssertionError))
+(fact (check-spec "A") => truthy)
+(fact (check-spec "c") => truthy)
+(fact (check-spec "Z") => truthy)
+(fact (check-spec "  E   ") => truthy)
+(fact (check-spec "") => (throws AssertionError))
+(fact (check-spec "AA") => (throws AssertionError))
+(fact (check-spec " ") => (throws AssertionError))
+(fact (check-spec "4") => (throws AssertionError))
+(fact (check-spec "(") => (throws AssertionError))
+(fact (check-spec nil) => (throws AssertionError))


dead code

dead code

--- test/cljc/reitit/core_test.cljc
+++ test/cljc/reitit/core_test.cljc
@@ -333,13 +333,3 @@
   (let [router (r/router ["/endpoint" (->Named :kikka)])]
     (is (= [["/endpoint" {:name :kikka}]]
            (r/routes router)))))
-
-(r/router
-  [["/:abba" ::abba]
-   ["/abba/1" ::abba2]
-   ["/:jabba/2" ::jabba2]
-   ["/:abba/:dabba/doo" ::doo]
-   ["/abba/dabba/boo/baa" ::baa]
-   ["/abba/:dabba/boo" ::boo]
-   ["/:jabba/:dabba/:doo/:daa/*foo" ::wild]]
-  {:router r/trie-router})


make exception for interaction between person alternation and 3rd sing/pronoun-false generation

--- src/babel/espanol/writer.clj
+++ src/babel/espanol/writer.clj
@@ -90,15 +90,19 @@
                                             spec
                                             (if (fail? unified)
                                               (let [message (str "could not unify " spec " with person specification:" unify-with ".")]
-                                                (if false
+                                                (cond
+                                                  (and (= (get-in spec [:comp :synsem :agr :person])
+                                                          :3rd)
+                                                       (= (get-in spec [:comp :synsem :pronoun])
+                                                          false))
                                                   (do
                                                     (log/debug message)
                                                     (log/debug (str "Ignoring and continuing."))
-                                                    unified)
-                                                  (do
-                                                    (log/error message)
-                                                    (log/error "Stopping further processing now.")
-                                                    (throw (Exception. message)))))
+                                                    :fail)
+                                                  true
+                                                  (do (log/error message)
+                                                      (log/error "Stopping further processing now.")
+                                                      (throw (Exception. message)))))
                                               unified)
                                             ]
                                         (log/debug (str "generating from person: " person))


Fix :require

Fix :require

--- test/desdemona/metrics_test.clj
+++ test/desdemona/metrics_test.clj
@@ -1,7 +1,7 @@
 (ns desdemona.metrics-test
   (:require
    [desdemona.lifecycles.metrics :as m]
-   [clojure.test :as t]))
+   [clojure.test :refer [deftest is]]))

 (deftest add-metrics-tests
   (let [job {:lifecycles []}


Add header components

Add header components

--- src/bootstrap_cljs/core.cljc
+++ src/bootstrap_cljs/core.cljc
@@ -48,7 +48,11 @@
     Modal.Title
     Nav
     Navbar
-    NavbarBrand
+    Navbar.Header
+    Navbar.Toggle
+    Navbar.Brand
+    Navbar.Collapse
+    Navbar
     NavBrand
     NavDropdown
     NavItem


added the ability to skip a certain number of elements in the text line

--- src/clj/forma/playground.clj
+++ src/clj/forma/playground.clj
@@ -97,9 +97,10 @@

 (hfs-textline "/Users/danhammer/Desktop/rain-data.txt")

-(defn text->num [txtln]
-    "converts a text line of numbers to a float vector."
-    (vector (map #(Float. %) (s/split txtln #" "))))
+(defn text->num [txtln skip]
+    "converts a text line of numbers to a float vectors;
+    skips the variable #skip of elements"
+    (vector (drop skip (map #(Float. %) (s/split txtln #" ")))))

 (defn time-cofactors [pd]
     "creates a pd x 2 matrix of ones and incremental timeseries"
@@ -120,5 +121,5 @@
     [path pd]
     (?<- (stdout) [?sum]
         ((hfs-textline path) ?line)
-        (text->num ?line :> ?vector)
+        (text->num ?line 1 :> ?vector)
         (ols ?vector pd :> ?sum)))


safety lock

safety lock

--- src/clj/shadow/cljs/util.clj
+++ src/clj/shadow/cljs/util.clj
@@ -220,6 +220,9 @@
                       m))
          #{})))

+
+(def ^{:private true} require-lock (Object.))
+
 (defn load-macros
   [{:keys [name require-macros use-macros] :as ast}]
   (if (= 'cljs.core name)
@@ -230,11 +233,12 @@
               (into (vals use-macros)))]

       (binding [ana/*cljs-ns* name]
-        (doseq [macro-ns macro-namespaces]
-          (try
-            (require macro-ns)
-            (catch Exception e
-              (throw (ex-info (format "failed to require macro-ns:%s, it was required by:%s" macro-ns name) {:ns-info ast} e))))))
+        (locking require-lock
+          (doseq [macro-ns macro-namespaces]
+            (try
+              (require macro-ns)
+              (catch Exception e
+                (throw (ex-info (format "failed to require macro-ns:%s, it was required by:%s" macro-ns name) {:ns-info ast} e)))))))

       (if (contains? macro-namespaces name)
         (let [macros (find-macros-in-ns name)]


Oops got a little carried away in that last commit :)

--- src/clj/zetawar/players.cljs
+++ src/clj/zetawar/players.cljs
@@ -21,7 +21,7 @@
   (start [player])
   (stop [player]))

-(defmulti new-player (fn [player-ctx player-type faction-color]))
+(defmulti new-player (fn [player-ctx player-type faction-color] player-type))

 (defn notify [notify-chan msg]
   (log/debugf "Notifying player: %s" (pr-str msg))


select keys for nested structures

select keys for nested structures

--- src/cljc/swarmpit/utils.cljc
+++ src/cljc/swarmpit/utils.cljc
@@ -13,4 +13,11 @@
   [vector index]
   (vec (concat
          (subvec vector 0 index)
-         (subvec vector (inc index)))))+         (subvec vector (inc index)))))
+
+(defn select-keys* [m paths]
+  "Better select-keys supporting also nested maps. E.g. [[:name] [:node :nodeName]]"
+  (->> paths
+       (map (fn [p]
+              [(last p) (get-in m p)]))
+       (into {})))


small change to ssl proxy

small change to ssl proxy

--- src/clojure/picard/proxy.clj
+++ src/clojure/picard/proxy.clj
@@ -19,11 +19,12 @@
   [[{proxy-host :proxy-host host "host" :as hdrs}]]
   (if proxy-host
     proxy-host
-    (let [[host ^String port] (-> host str/trim (str/split #":" 2))]
+    (let [[host ^String port] (-> host str/trim (str/split #":" 2))
+          ssl? (request-ssl? hdrs)]
       (if (or (nil? port) (= "" port))
-        [host (if (request-ssl? hdrs) 443 80)]
+        [host (if ssl? 443 80) ssl?]
         [host (try (Integer. port)
-                   (catch NumberFormatException _))]))))
+                   (catch NumberFormatException _)) ssl?]))))

 (defn- chunked?
   [[_ _ body]]


fix optarg name

fix optarg name

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -70,10 +70,10 @@

 (deftask print-meta
   "Utility task to print perun metadata"
-  [m map-fn       MAPFN      code   "function to map over metadata items before printing (default: `identity`)"
-   _ filterer     FILTER     code   "predicate to use for selecting entries (default: `identity`)"
-   e extensions   EXTENSIONS [str]  "extensions of files to include (default: `[]`, aka, all extensions)"
-   b content-exts NOCONTENT  #{str} "print content for these extensions, default `#{}`"]
+  [m map-fn       MAPFN       code   "function to map over metadata items before printing (default: `identity`)"
+   _ filterer     FILTER      code   "predicate to use for selecting entries (default: `identity`)"
+   e extensions   EXTENSIONS  [str]  "extensions of files to include (default: `[]`, aka, all extensions)"
+   b content-exts CONTENTEXTS #{str} "print content for these extensions, default `#{}`"]
   (boot/with-pass-thru fileset
     (let [options (merge +print-meta-defaults+ *opts*)
           entries (doall (map (:map-fn options) (filter-meta-by-ext fileset options)))]


CMR-3410 some pr comments

CMR-3410 some pr comments

--- access-control-app/int_test/cmr/access_control/int_test/access_control_group_crud_test.clj
+++ access-control-app/int_test/cmr/access_control/int_test/access_control_group_crud_test.clj
@@ -324,36 +324,33 @@

 (deftest update-group-legacy-guid-test
   (let [group1 (u/make-group {:legacy_guid "legacy_guid_1" :name "group1"})
-        group2 (u/make-group {:legacy_guid "legacy_guid_2" :name "group2"})
-        group3 (u/make-group {:legacy_guid "legacy_guid_3" :name "group3"})

         no-legacy-group (u/make-group {:name "group1"})
-        same-legacy-group (u/make-group {:legacy_guid "legacy_guid_2" :name "group2"})
-        diff-legacy-group (u/make-group {:legacy_guid "wrong_legacy_guid" :name "group3"})
-
-        token (e/login (u/conn-context) "user1")
-        concept-id-no-legacy (:concept_id (u/create-group token group1))
-        concept-id-same-legacy (:concept_id (u/create-group token group2))
-        concept-id-diff-legacy (:concept_id (u/create-group token group3))
+        same-legacy-group (u/make-group {:legacy_guid "legacy_guid_1" :name "group1"})
+        diff-legacy-group (u/make-group {:legacy_guid "wrong_legacy_guid" :name "group1"})
+
+        token (e/login (u/conn-context) "user1")
+        concept-id (:concept_id (u/create-group token group1))
         _ (u/wait-until-indexed)

-        response-no-legacy (u/update-group token concept-id-no-legacy no-legacy-group)
-        response-same-legacy (u/update-group token concept-id-same-legacy same-legacy-group)
-        response-diff-legacy (u/update-group token concept-id-diff-legacy diff-legacy-group)]
+        response-no-legacy (u/update-group token concept-id no-legacy-group)
+        response-same-legacy (u/update-group token concept-id same-legacy-group)
+        response-diff-legacy (u/update-group token concept-id diff-legacy-group)]

     (u/wait-until-indexed)

-    ;;We should now successfully update groups with a legacy_guid, without specifying the legacy_guid in the updated group
-    (is (= {:status 200 :concept_id concept-id-no-legacy :revision_id 2}
-           response-no-legacy))
-    (u/assert-group-saved (assoc no-legacy-group :legacy_guid "legacy_guid_1") "user1" concept-id-no-legacy 2)
-
-    ;;Specifying the same legacy_guid should also successfully update the group
-    (is (= {:status 200 :concept_id concept-id-same-legacy :revision_id 2}
-           response-same-legacy))
-    (u/assert-group-saved (assoc same-legacy-group :legacy_guid "legacy_guid_2") "user1" concept-id-same-legacy 2)
-
-    ;;When specifying a different legacy_guid, an error message should be recieved
-    (is (= {:status 400,
-            :errors ["Legacy Guid cannot be modified. Attempted to change existing value [legacy_guid_3] to [wrong_legacy_guid]"]}
-           response-diff-legacy))))
+    (testing "We should now successfully update groups with a legacy_guid, without specifying the legacy_guid in the updated group")
+      (is (= {:status 200 :concept_id concept-id :revision_id 2}
+             response-no-legacy))
+      (println response-no-legacy)
+      (u/assert-group-saved (assoc no-legacy-group :legacy_guid "legacy_guid_1") "user1" concept-id 2)
+
+    (testing "Specifying the same legacy_guid should also successfully update the group")
+      (is (= {:status 200 :concept_id concept-id :revision_id 3}
+             response-same-legacy))
+      (u/assert-group-saved same-legacy-group "user1" concept-id 3)
+
+    (testing "When specifying a different legacy_guid, an error message should be received")
+      (is (= {:status 400,
+              :errors ["Legacy Guid cannot be modified. Attempted to change existing value [legacy_guid_1] to [wrong_legacy_guid]"]}
+             response-diff-legacy))))


a bit

a bit

--- Total-Hamming-Distance/THD.clj
+++ Total-Hamming-Distance/THD.clj
@@ -0,0 +1,31 @@
+(defn diff-ham  [x y]
+  (let [re 0
+        xin x
+        yin y]
+    (while (or (pos? @xin) (pos? @yin))
+      (do
+        (cond (not= (mod xin 2) (mod yin 2))
+              (swap! re inc))
+        (update-in xin - (mod xin 2))
+        (update-in xin / 2)
+        (update-in yin - (mod yin 2))
+        (update-in yin / 2)))
+    re))
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+


Re-enable colors flow test without retry This improves test coverage before the release

--- test/onyx/peer/colors_flow_test.clj
+++ test/onyx/peer/colors_flow_test.clj
@@ -89,7 +89,9 @@
      (swap! retry-counter inc))})

 ;; :broken due of use of flow retry
-(deftest ^:smoke ^:broken colors-flow
+;; TODO, re-enable retries and tests
+;; This test has been re-enabled to test flow conditions.
+(deftest ^:smoke colors-flow
   (let [id (random-uuid)
         config (load-config)
         env-config (assoc (:env-config config) :onyx/tenancy-id id)
@@ -169,7 +171,7 @@
                           :flow/exclude-keys [:extra-key]
                           :flow/predicate :onyx.peer.colors-flow-test/white?}

-                         {:flow/from :colors-in
+                         #_{:flow/from :colors-in
                           :flow/to :none
                           :flow/short-circuit? true
                           :flow/exclude-keys [:extra-key]
@@ -216,7 +218,7 @@

         lifecycles [{:lifecycle/task :colors-in
                      :lifecycle/calls :onyx.peer.colors-flow-test/colors-in-calls}
-                    {:lifecycle/task :colors-in
+                    #_{:lifecycle/task :colors-in
                      :lifecycle/calls :onyx.peer.colors-flow-test/retry-calls}
                     {:lifecycle/task :red-out
                      :lifecycle/calls :onyx.peer.colors-flow-test/red-out-calls}
@@ -279,6 +281,6 @@
         (is (= red-expectations (into #{} red)))
         (is (= blue-expectations (into #{} blue)))
         (is (= all-expectations (into #{} all)))
-        (is (= 1 @retry-counter)))
+        #_(is (= 1 @retry-counter)))

       (close! @colors-in-chan))))


Fix no DB connection when running tests

Fix no DB connection when running tests

--- test/territory_bro/handler_test.clj
+++ test/territory_bro/handler_test.clj
@@ -1,7 +1,16 @@
 (ns territory-bro.handler-test
   (:require [clojure.test :refer :all]
             [ring.mock.request :refer :all]
-            [territory-bro.handler :refer :all]))
+            [territory-bro.handler :refer :all]
+            [territory-bro.db.migrations :as migrations]
+            [territory-bro.db.core :as db]))
+
+(use-fixtures
+  :once
+  (fn [f]
+    (db/connect!)
+    (migrations/migrate ["migrate"])
+    (f)))

 (deftest test-app
   (testing "main route"


trigger the active player's events first

fixes #309

--- src/clj/game/core-events.clj
+++ src/clj/game/core-events.clj
@@ -26,12 +26,14 @@
   "Resolves all abilities registered as handlers for the given event key, passing them
   the targets given."
   [state side event & targets]
-  (doseq [{:keys [ability] :as e} (get-in @state [:events event])]
-    (when-let [card (get-card state (:card e))]
-      (when (and (not (apply trigger-suppress state side event (cons card targets)))
-                 (or (not (:req ability)) ((:req ability) state side card targets)))
-        (resolve-ability state side ability card targets))))
-  (swap! state update-in [:turn-events] #(cons [event targets] %)))
+  (let [get-side #(-> % :card :side game.utils/to-keyword)
+        is-active-player #(= (:active-player @state) (get-side %))]
+    (doseq [{:keys [ability] :as e} (sort-by (complement is-active-player) (get-in @state [:events event]))]
+      (when-let [card (get-card state (:card e))]
+        (when (and (not (apply trigger-suppress state side event (cons card targets)))
+                   (or (not (:req ability)) ((:req ability) state side card targets)))
+          (resolve-ability state side ability card targets))))
+    (swap! state update-in [:turn-events] #(cons [event targets] %))))

 ; Functions for registering trigger suppression events.
 (defn register-suppress


Fix triangular distribution

Fix triangular distribution

The mode was being used as the upper limit and vice-versa. This change
keeps the argument order as (lower, mode, upper) but fixes the
algorithm.

--- src/clj/genartlib/random.clj
+++ src/clj/genartlib/random.clj
@@ -18,17 +18,16 @@
    distribution with the given mean and variance"
   (range (int (abs-gauss mean variance))))

-(defn triangular [a b c]
-  "Returns a single sample from a Triangular distribution where:
-   - 'a' is the lower limit
-   - 'c' is the upper limit
-   - 'b' is the mode
-  "
-  (let [x (random 0.0 1.0)
-        transition-point (/ (- c a) (- b a))]
+(defn triangular [lower mode upper]
+  "Returns a single sample from a Triangular distribution"
+  (let [lower-extent     (- mode lower)
+        upper-extent     (- upper mode)
+        full-extent      (- upper lower)
+        x                (random 0.0 1.0)
+        transition-point (/ lower-extent full-extent)]
     (if (<= x transition-point)
-      (+ a (sqrt (* x (- b a) (- c a))))
-      (- b (sqrt (* (1 - x) (- b a) (- b c)))))))
+      (+ lower (sqrt (* x       full-extent lower-extent)))
+      (- upper (sqrt (* (- 1 x) full-extent upper-extent))))))

 (defn simple-triangular [b]
   "Like triangular, but assumes a = 0 and b = c"


user delete fix

user delete fix

--- src/clj/swarmpit/handler.clj
+++ src/clj/swarmpit/handler.clj
@@ -72,12 +72,13 @@
          (resp-ok))))

 (defmethod dispatch :user-delete [_]
-  (fn [{:keys [route-params logged-user]}]
-    (if (= (:_id (api/user-by-username logged-user))
-           (:id route-params))
-      (resp-error 400 "Operation not allowed")
-      (do (api/delete-user (:id route-params))
-          (resp-ok)))))
+  (fn [{:keys [route-params identity]}]
+    (let [user (get-in identity [:usr :username])]
+      (if (= (:_id (api/user-by-username user))
+             (:id route-params))
+        (resp-error 400 "Operation not allowed")
+        (do (api/delete-user (:id route-params))
+            (resp-ok))))))

 (defmethod dispatch :user-create [_]
   (fn [{:keys [params]}]


A bit o refactoring

A bit o refactoring

--- src/cljs/cljs_life/core.cljs
+++ src/cljs/cljs_life/core.cljs
@@ -4,14 +4,6 @@
             [cljs.core.async :refer (timeout <!)])
   (:require-macros [cljs.core.async.macros :refer (go)]))

-(defn add-timer
-  [f prefix]
-  (fn [& args]
-    (let [t (js/Date.)
-          r (apply f args)
-          t2 (js/Date.)]
-      (js/console.log prefix (- t2 t))
-      r)))

 (defn neighbors
   "Given a set of cells returns a seq of adjacent cells. If n cells share a
@@ -43,16 +35,13 @@
           (hash-set)
           (frequencies (neighbors cells))))

-
 (defn update-state
+  "Given the current state of the world returns the next state."
   [{:keys [cells bounds] :as state}]
   (assoc state :cells (next-state cells bounds)))

-
-#_(def update-state (add-timer update-state "update-state"))
-
-
 (defn live!
+  "Start the simulation loop."
   [app-state]
   (go
     (while true
@@ -61,7 +50,42 @@
         (when playing?
           (swap! app-state update-state))))))

+(defn toggle-play-state
+  "Given an om cursor and an event object toggles the playing? state"
+  [state _]
+  (om/transact! state [:playing?] not))
+
+(defn event->cell
+  "Calculates which cell on which an event happened"
+  [event cell-size]
+  (vector (quot (- (.-clientX event) 8) cell-size)
+          (quot (- (.-clientY event) 28) cell-size)))
+
+(defn handle-world-click
+  "Handle a user event on the world."
+  [state cell-size e]
+  (let [cell (event->cell e cell-size)]
+    (om/transact! state [:cells]
+                  (fn [cells]
+                    (if (contains? cells cell)
+                      (disj cells cell)
+                      (conj cells cell))))))
+
+(defn random-cells
+  "Returns a random set of live cells within a bounding box."
+  [[width height]]
+  (set (filter #(> (Math/random) 0.5)
+               (for [x (range 0 width)
+                     y (range 0 width)]
+                 (vector x y)))))
+
+(defn reset-random!
+  "Resets the app state cursor with a random set of live cells."
+  [app]
+  (om/transact! app (fn [{b :bounds :as s}] (assoc s :cells (random-cells b)))))
+
 (defn cell-els
+  "Contructs the svg elements to represent the cells."
   [width height cell-size cells]
   (for [cell-x (range 0 width)
         cell-y (range 0 height)]
@@ -74,43 +98,8 @@
                                  :stroke "#ccccce"
                                  :stroke-width "0.5"}}))))

-(defn toggle-play-state
-  [state _]
-  (om/transact! state [:playing?] not))
-
-
-(defn event->cell
-  [event cell-size]
-  (vector (quot (- (.-clientX event) 8) cell-size)
-          (quot (- (.-clientY event) 28) cell-size)))
-
-(defn handle-world-click
-  [state cell-size e]
-  (let [cell (event->cell e cell-size)]
-    (om/transact! state [:cells]
-                  (fn [cells]
-                    (if (contains? cells cell)
-                      (disj cells cell)
-                      (conj cells cell))))))
-
-(defn random-cells
-  [[width height]]
-  (set (filter #(> (Math/random) 0.5)
-               (for [x (range 0 width)
-                     y (range 0 width)]
-                 (vector x y)))))
-
-(defonce app-state (atom {:cells #{}
-                          :bounds [50 20]
-                          :playing? false
-                          :cell-size 20
-                          :speed 5}))
-
-(defn reset-random!
-  []
-  (swap! app-state (fn [{b :bounds :as s}] (assoc s :cells (random-cells b)))))
-
 (defn world
+  "Om component for the world."
   [app owner]
   (reify
     om/IRender
@@ -122,7 +111,7 @@
                             #js {:onClick (partial toggle-play-state app)}
                             (if (:playing? app) "stop" "play"))
                           (dom/button
-                            #js {:onClick #(reset-random!)}
+                            #js {:onClick #(reset-random! app)}
                             "random"))
                  (apply dom/svg #js {:height (* height cell-size)
                                      :width (* width cell-size)
@@ -132,12 +121,17 @@
                         (cell-els width height cell-size cells)))))))

 (defn draw!
+  "Kick-off Om with the app-state atom"
   [app-state]
-  (om/root world
-           app-state
-           {:target (. js/document (getElementById "app"))}))
+  (om/root world app-state {:target (. js/document (getElementById "app"))}))

+(defonce app-state (atom {:cells #{}
+                          :bounds [50 20]
+                          :playing? false
+                          :cell-size 20
+                          :speed 5}))
 (defn main []
+  "Entry point for the application."
   (draw! app-state)
   (live! app-state))