Refactored without-custom-keys function to use clojure.walk

--- src/versioned/model_attributes.clj
+++ src/versioned/model_attributes.clj
@@ -10,17 +10,13 @@
   (and (map? value)
        (not-empty (intersection (set (keys value)) custom-property-keys))))

-; TODO/FIXME: this only works if custom property keys are in "leaf nodes" of the schema tree
 (defn without-custom-keys
   "Drop custom property keys when validating schema to avoid validator warnings or swagger errors"
   [schema]
-  (let [f #(if (map? (:value %))
-             (apply dissoc (:value %) custom-property-keys)
-             (:value %))
-        recurse-if? #(and (coll? (:value %))
-                          (not (map-with-custom-keys? (:value %))))
-        opts {:recurse-if? recurse-if?}]
-    (u/deep-map-values f schema opts)))
+  (let [f #(if (map-with-custom-keys? %)
+               (apply dissoc % custom-property-keys)
+               %)]
+    (clojure.walk/prewalk f schema)))

 (defn api-writable? [attribute-schema]
   (get-in attribute-schema [:meta :api_writable] true))


[bug] fix scientific notation on main wallet screen

--- src/status_im/ui/screens/wallet/main/views.cljs
+++ src/status_im/ui/screens/wallet/main/views.cljs
@@ -123,7 +123,7 @@
        [react/text {:style           styles/asset-item-value
                     :number-of-lines 1
                     :ellipsize-mode  :tail}
-        (str (money/wei->ether amount))]
+        (money/wei->str :eth amount)]
        [react/text {:style           styles/asset-item-currency
                     :uppercase?      true
                     :number-of-lines 1}


Fixes shutdown.

Fixes shutdown.

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -349,43 +349,69 @@
           (fn [e & _] (kill-job e outbox-ch job-id)))

         (dire/with-finally! #'inject-temporal-loop
-          (fn [& args] (release-fn!)))
+          (fn [& args]
+            (>!! (last args) true)
+            (release-fn!)))

         (dire/with-finally! #'read-batch-loop
-          (fn [& args] (release-fn!)))
+          (fn [& args]
+            (>!! (last args) true)
+            (release-fn!)))

         (dire/with-finally! #'decompress-batch-loop
-          (fn [& args] (release-fn!)))
+          (fn [& args]
+            (>!! (last args) true)
+            (release-fn!)))

         (dire/with-finally! #'strip-sentinel-loop
-          (fn [& args] (release-fn!)))
+          (fn [& args]
+            (>!! (last args) true)
+            (release-fn!)))

         (dire/with-finally! #'requeue-sentinel-loop
-          (fn [& args] (release-fn!)))
+          (fn [& args]
+            (>!! (last args) true)
+            (release-fn!)))

         (dire/with-finally! #'apply-fn-loop
-          (fn [& args] (release-fn!)))
+          (fn [& args]
+            (>!! (last args) true)
+            (release-fn!)))

         (dire/with-finally! #'compress-batch-loop
-          (fn [& args] (release-fn!)))
+          (fn [& args]
+            (>!! (last args) true)
+            (release-fn!)))

         (dire/with-finally! #'write-batch-loop
-          (fn [& args] (release-fn!)))
+          (fn [& args]
+            (>!! (last args) true)
+            (release-fn!)))

         (dire/with-finally! #'commit-tx-loop
-          (fn [& args] (release-fn!)))
+          (fn [& args]
+            (>!! (last args) true)
+            (release-fn!)))

         (dire/with-finally! #'close-resources-loop
-          (fn [& args] (release-fn!)))
+          (fn [& args]
+            (>!! (last args) true)
+            (release-fn!)))

         (dire/with-finally! #'close-temporal-loop
-          (fn [& args] (release-fn!)))
+          (fn [& args]
+            (>!! (last args) true)
+            (release-fn!)))

         (dire/with-finally! #'reset-payload-node-loop
-          (fn [& args] (release-fn!)))
+          (fn [& args]
+            (>!! (last args) true)
+            (release-fn!)))

         (dire/with-finally! #'seal-resource-loop
-          (fn [& args] (release-fn!)))
+          (fn [& args]
+            (>!! (last args) true)
+            (release-fn!)))

         (while (not (:onyx.core/start-lifecycle? (munge-start-lifecycle pipeline-data)))
           (Thread/sleep (or (:onyx.peer/sequential-back-off opts) 2000)))


Close! restart-ch as performed elsewhere

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -371,7 +371,7 @@
       (warn (:original-exception data) "Caught exception inside task lifecycle. Rebooting the task.")
       (do (warn e "Handling uncaught exception thrown inside task lifecycle.")
           (if (restart-pred-fn e)
-            (>!! restart-ch true)
+            (close! restart-ch)
             (let [entry (entry/create-log-entry :kill-job {:job job-id})]
               (extensions/write-chunk log :exception e job-id)
               (>!! outbox-ch entry)))))))


subsume actual joining of rows into a function - join-model now only need be responsible for selecting rows tom join...

--- dada2-core/src/test/clojure/org/dada2/test_join_model.clj
+++ dada2-core/src/test/clojure/org/dada2/test_join_model.clj
@@ -30,6 +30,13 @@
 (defrecord WhaleAndOcean [whale-name ^int version ocean-area]
   Object
   (^String toString [_] (str whale-name)))
+
+(defn- ^WhaleAndOcean join-whale-and-ocean [^Whale whale ^Ocean ocean]
+  (->WhaleAndOcean (:name whale) (+ (:version whale) (:version ocean)) (:area ocean)))
+
+(deftest test-join-whale-and-ocean
+  (is (= (->WhaleAndOcean "flipper" 0 1000000)
+	 (join-whale-and-ocean (->Whale "flipper" 0 :atlantic)(->Ocean :atlantic 0 1000000)))))

 (deftest test-join-model
   (let [model (join-model "join-model")


add task 'locally' to build.boot

add task 'locally' to build.boot

Signed-off-by: Gregg Reynolds <d0f77bc71a9867acdcb4f62f012b858edad79160@norc.org>

--- build.boot
+++ build.boot
@@ -120,6 +120,11 @@
             :resource-paths #{"src/clj" "test/clj"})
   identity)

+(deftask locally
+  "install locally"
+  []
+  (comp (boot/pom) (boot/jar) (boot/install)))
+
 (deftask watchme
   "watch for gae project"
   []


AOT some ns

AOT some ns

--- build.boot
+++ build.boot
@@ -44,6 +44,7 @@
       :description ""
       :url         ""
       :scm {:url ""}}
+ aot {:namespace #{'lounge.api}}
  jar {:main 'lounge.api}
  )

@@ -59,7 +60,7 @@
    (hoplon :pretty-print true)
    (cljs   :optimizations :advanced)
    (pom)
-   (aot :all)
+   (aot)
    (uber)
    (jar)
    ))


Updated dependencies

Updated dependencies

Signed-off-by: Tom Marble <b248307e886b80bf9cb4014595572a835b049bf4@info9.net>

--- build.boot
+++ build.boot
@@ -20,7 +20,7 @@
                     [com.cemerick/piggieback "0.2.1"     :scope "test"]
                     [weasel                 "0.7.0"      :scope "test"]
                     [org.clojure/tools.nrepl "0.2.12"    :scope "test"]
-                    [adzerk/boot-reload     "0.4.7"      :scope "test"]
+                    [adzerk/boot-reload     "0.4.8"      :scope "test"]
                     [pandeiro/boot-http "0.7.3" :scope "test"]
                     [adzerk/boot-cljs       "1.7.228-1"  :scope "test"]
                     [adzerk/boot-cljs-repl  "0.3.0"      :scope "test"]


Latest boot-less

Latest boot-less

--- build.boot
+++ build.boot
@@ -5,7 +5,7 @@
                   [adzerk/boot-cljs-repl  "0.1.7"      :scope "test"]
                   [adzerk/boot-reload     "0.2.3"      :scope "test"]
                   [deraen/boot-cljx       "0.2.1"      :scope "test"]
-                  [deraen/boot-less       "0.2.0"      :scope "test"]
+                  [deraen/boot-less       "0.2.1"      :scope "test"]
                   [cljsjs/boot-cljsjs     "0.4.0"      :scope "test"]

                   ; Backend


Update play-cljs template

Update play-cljs template

--- build.boot
+++ build.boot
@@ -11,7 +11,7 @@
                   [org.clojure/clojure "1.9.0-alpha14"]
                   [leiningen "2.7.0" :exclusions [leiningen.search]]
                   [ring "1.4.0"]
-                  [play-cljs/lein-template "0.8.0"]
+                  [play-cljs/lein-template "0.8.0.1"]
                   [eval-soup "1.2.0" :exclusions [org.clojure/core.async]]
                   [org.eclipse.jgit/org.eclipse.jgit "4.6.0.201612231935-r"]])


Fix prod build

Fix prod build

--- build.boot
+++ build.boot
@@ -32,5 +32,5 @@
         (target)))

 (deftask prod []
-  (cljs :optimizations :advanced)
-  (target))
+  (comp (cljs :optimizations :advanced)
+        (target)))


Only include uberjar in target folder

Only include uberjar in target folder

--- build.boot
+++ build.boot
@@ -103,4 +103,5 @@
     (pom)
     (uber)
     (jar)
+    (sift :include #{#".*\.jar"})
     (target)))


Add SCM info to build.boot

Add SCM info to build.boot

--- build.boot
+++ build.boot
@@ -22,6 +22,7 @@
   pom  {:project     'cljs-audiocapture
         :version     +version+
         :description "ClojureScript core.async interface to capture audio"
+        :scm  {:url "https://github.com/voldmar/cljs-audiocapture"}
         :url "https://github.com/voldmar/cljs-audiocapture"
         :license {"Eclipse Public License" "http://www.eclipse.org/legal/epl-v10.html"}})


Update deps

Update deps

--- build.boot
+++ build.boot
@@ -3,8 +3,8 @@
   ; Just be careful to not AOT them
   :source-paths #{"src/cljs" "src/less" "src/scss" "test/clj" "test/cljs"}
   :resource-paths #{"src/clj" "src/cljc"}
-  :dependencies '[[org.clojure/clojure    "1.9.0-alpha10"]
-                  [org.clojure/clojurescript "1.9.89"]
+  :dependencies '[[org.clojure/clojure    "1.9.0-alpha11"]
+                  [org.clojure/clojurescript "1.9.225"]

                   [boot/core              "2.6.0"      :scope "test"]
                   [adzerk/boot-cljs       "1.7.228-1"  :scope "test"]
@@ -13,8 +13,8 @@
                   [com.cemerick/piggieback "0.2.1"     :scope "test"]
                   [weasel                 "0.7.0"      :scope "test"]
                   [org.clojure/tools.nrepl "0.2.12"    :scope "test"]
-                  [adzerk/boot-reload     "0.4.11"     :scope "test"]
-                  [metosin/boot-alt-test  "0.1.0"      :scope "test"]
+                  [adzerk/boot-reload     "0.4.12"     :scope "test"]
+                  [metosin/boot-alt-test  "0.1.2"      :scope "test"]
                   [deraen/boot-less       "0.5.0"      :scope "test"]
                   ;; For boot-less
                   [org.slf4j/slf4j-nop    "1.7.21"     :scope "test"]


fix up segments api test to account for adding :active field to Segment model.

--- test/metabase/api/segment_test.clj
+++ test/metabase/api/segment_test.clj
@@ -74,6 +74,7 @@
    :creator      (user-details (fetch-user :crowberto))
    :created_at   true
    :updated_at   true
+   :active       true
    :definition   {:database 21
                   :query    {:filter ["abc"]}}}
   (tu/with-temp Database [{database-id :id} {:name      "Hillbilly"
@@ -125,6 +126,7 @@
    :creator      (user-details (fetch-user :rasta))
    :created_at   true
    :updated_at   true
+   :active       true
    :definition   {:database 2
                   :query    {:filter ["not" "the droids you're looking for"]}}}
   (tu/with-temp Database [{database-id :id} {:name      "Hillbilly"
@@ -163,6 +165,7 @@
    :creator      (user-details (fetch-user :crowberto))
    :created_at   true
    :updated_at   true
+   :active       true
    :definition   {:database 123
                   :query    {:filter ["In the Land of Metabase where the Datas lie"]}}}
   (tu/with-temp Database [{database-id :id} {:name      "Hillbilly"


fix indentation

fix indentation

--- test/metabase/api/session_test.clj
+++ test/metabase/api/session_test.clj
@@ -32,7 +32,7 @@
 ;; Test for password checking
 (expect "password mismatch"
   (client :post 400 "session" (-> (user->credentials :rasta)
-                                (assoc :password "something else"))))
+                                  (assoc :password "something else"))))

 ;; ## DELETE /api/session


Add additional intermediate node, also shutdown output peers

--- test/onyx/peer/fault_tolerance.clj
+++ test/onyx/peer/fault_tolerance.clj
@@ -26,7 +26,12 @@
     :onyx/batch-size batch-size
     :onyx/doc "Reads segments from a core.async channel"}

-   {:onyx/name :inc
+   {:onyx/name :intermediate-1
+    :onyx/fn :onyx.peer.fault-tolerance/process-middle
+    :onyx/type :function
+    :onyx/batch-size batch-size}
+
+   {:onyx/name :intermediate-2
     :onyx/fn :onyx.peer.fault-tolerance/process-middle
     :onyx/type :function
     :onyx/batch-size batch-size}
@@ -38,7 +43,9 @@
     :onyx/batch-size batch-size
     :onyx/doc "Writes segments to a core.async channel"}])

-(def workflow [[:in :inc] [:inc :out]])
+(def workflow [[:in :intermediate-1]
+               [:intermediate-1 :intermediate-2]
+               [:intermediate-2 :out]])

 (def chan-size 10000)

@@ -85,7 +92,7 @@
                       (map (juxt :name :id))
                       (into {}))

-        non-input-task-ids (set (vals (dissoc task-ids :in :out)))
+        non-input-task-ids (set (vals (dissoc task-ids :in)))

         remove-completed-ch (go-loop []
                                      (let [v (<!! out-chan)]
@@ -125,6 +132,7 @@
       (fact after-done => #{}))

     (close! kill-ch)
+    (<!! mess-with-peers-ch)
     (helper-env/remove-n-peers test-env 9))

     (finally


Add slamhound to lein plugins

Add slamhound to lein plugins

--- clojure/lein.symlink/profiles.clj
+++ clojure/lein.symlink/profiles.clj
@@ -1,5 +1,6 @@
 {:user {:plugins [[lein-difftest "1.3.8"]
                   [lein-marginalia "0.7.1"]
                   [lein-pprint "1.1.1"]
+                  [slamhound "1.3.1"]
                   [lein-swank "1.4.4"]]
         :search-page-size 30}}


Initialisation script from hastebin

Initialisation script from hastebin

--- src/wishlistd/views/common.clj
+++ src/wishlistd/views/common.clj
@@ -2,6 +2,29 @@
   (:use noir.core
         hiccup.core
         hiccup.page-helpers))
+
+(def initialize-js
+"
+var s = null;
+// Handle pops
+var handlePop = function(evt) {
+  var path = evt.target.location.pathname;
+  if (path !== '/') { s.loadWishlist(path.substring(1,path.length)); }
+};
+// Set up the pop state to handle loads, skipping the first load
+// to make chrome behave like others:
+// http://code.google.com/p/chromium/issues/detail?id=63040
+setTimeout(function() {
+  window.onpopstate = function(evt) {
+    try { handlePop(evt); } catch(err) { /* not loaded yet */ }
+  };
+}, 1000);
+// Construct s and load initial path
+$(function() {
+  s = new app();
+  handlePop({ target: window });
+});
+")

 (defpartial layout [& content]
             (html5
@@ -13,7 +36,7 @@
                (include-css "/css/reset.css")
                (include-css "http://twitter.github.com/bootstrap/1.4.0/bootstrap.min.css")
                (include-css "/css/core.css")
-               [:script {:type "text/javascript"} " var s = null;$.ready(function () { s = new app(); });"]]
+               [:script {:type "text/javascript"} initialize-js]]
               [:body
                [:div.container
                 [:div.content


Grid builder.

Grid builder.

--- sonic-jam/src/sonic_jam/core.cljs
+++ sonic-jam/src/sonic_jam/core.cljs
@@ -16,6 +16,9 @@

 (defn samples []
   (om/ref-cursor (:samples (om/root-cursor app-state))))
+
+(defn handle-change [e owner {:keys [text]}]
+  (om/set-state! owner :text (.. e -target -value)))

 (defn cell-view [{:keys [cursor id]} _]
   (reify
@@ -80,6 +83,21 @@
                                  (transition {:state :init})
                                  (om/update! cursor tracks)
                                  (go (>! set-state-ch id)))
+                      "grid" (let [track {"type" "grid"
+                                          "id" (:text state)
+                                          "bpc" (:width state) ;; should be separate parameter
+                                          "beats" (repeat (:width state) [0])}
+                                   tracks (clj->js (conj cursor track))
+                                   grid (clj->js {"name" (:text state)
+                                                  "id" (:text state)
+                                                  "bpc" (:width state)
+                                                  "tracks" []})]
+                               (transition {:state :init})
+                               (let [grids (om/observe owner (grids))]
+                                 (om/transact! grids (fn [s] (assoc s (:text state) grid))))
+                               (om/update! cursor tracks)
+                               (go (>! set-state-ch id))
+                               (go (>! set-state-ch (:text state))))
                       :else (print "cannot commit"))]
         (condp = (:state state)
           :init (p (dom/span #js {:onClick #(transition {:state :width})} "{+}"))
@@ -94,13 +112,17 @@
                     (dom/span nil "}"))
           :type (p (dom/span #js {:onClick #(transition {:state :init})} (str "{- " (:width state) " ... "))
                    (dom/span #js {:onClick #(transition {:state :sample :type "sample"})} " sample ")
-                   (dom/span #js {:onClick #(print "bonk")} " play ")
-                   (dom/span #js {:onClick #(print "bonk")} " synth ")
+                   (dom/span #js {:onClick #(transition {:state :grid :type "grid"})} " grid ")
                    (dom/span nil "}"))
           :sample (p (dom/span #js {:onClick #(transition {:state :init})} (str "{- " (:width state) " sample ... "))
                      (apply dom/select #js {:onChange #(transition {:state :commit :sample (-> % .-target .-value)})}
                             (map #(dom/option nil %) (om/observe owner (samples))))
                      (dom/span nil "}"))
+          :grid (p (dom/span #js {:onClick #(transition {:state :init})} (str "{- " (:width state) " grid ..."))
+                   (dom/input #js {:type "text" :value (:text state)
+                                   :onChange #(handle-change % owner state)})
+                   (dom/span #js {:onClick commit} " commit? ")
+                   (dom/span nil "}"))
           :commit (p (dom/span #js {:onClick #(transition {:state :init})}
                                (str "{- " (:width state) " sample " (:sample state) " ... "))
                      (dom/span #js {:onClick commit} " commit? ")
@@ -120,11 +142,11 @@
                    (dom/div nil
                             (dom/p #js {:onClick #(om/set-state! owner :grid-expanded true)
                                         :style #js {:color "#999"}}
-                                   (str "[+] " id)))
+                                   (str "[+] " id " (" (get cursor "bpc") ")")))
                    (dom/div nil
                             (dom/p #js {:onClick #(om/set-state! owner :grid-expanded false)
                                         :style #js {:color "#999"}}
-                                   (str "[-] " id))
+                                   (str "[-] " id " (" (get cursor "bpc") " )"))
                             (apply dom/table nil
                                    (let [cursors (map #(hash-map :cursor %1 :id %2)
                                                       (get cursor "tracks")


Move name editor outside of grid properties.

--- sonic-jam/src/sonic_jam/core.cljs
+++ sonic-jam/src/sonic_jam/core.cljs
@@ -714,17 +714,17 @@
           :init (dom/table nil
                            (dom/tbody nil
                                       (dom/tr nil
-                                              (dom/td nil (str name " "))
+                                              (dom/td nil (om/build name-editor inputs))
+                                              (dom/td nil " ")
                                               (dom/td #js {:onClick #(transition {:state :open})
                                                            :style #js {:color (:link theme)}}
                                                       "{..}"))))
           :open (dom/table nil
                            (dom/tbody nil
                                       (dom/tr nil
-                                              (dom/td nil (closer "{"))
-                                              (dom/td nil " name: ")
                                               (dom/td nil (om/build name-editor inputs))
                                               (dom/td nil " ")
+                                              (dom/td nil (closer "{"))
                                               (dom/td nil " bpc: ")
                                               (dom/td nil (om/build bpc-editor inputs))
                                               (dom/td nil " ")


Prevent null pointer exception when checking if a user exists

--- common/clojure/nightweb/users.clj
+++ common/clojure/nightweb/users.clj
@@ -12,7 +12,7 @@
 (defn user-exists?
   "Checks if we are following this user."
   [user-hash-bytes]
-  (let [user-hash-str (f/base32-encode user-hash-bytes)]
+  (when-let [user-hash-str (f/base32-encode user-hash-bytes)]
     (or (io/file-exists? (c/get-user-dir user-hash-str))
         (c/is-me? user-hash-bytes true))))


Display current sync mode under BPM.

Display current sync mode under BPM.

--- src/afterglow/controllers/ableton_push.clj
+++ src/afterglow/controllers/ableton_push.clj
@@ -479,6 +479,16 @@
                      ;; They released us, end the overlay.
                      :done)))))

+(defn- metronome-sync-label
+  "Determine the sync type label to display under the BPM section."
+  [controller]
+  (if-let [sync-in-effect @(:sync (:show controller))]
+    (case (:type (afterglow.midi/sync-status sync-in-effect))
+      :midi "MIDI"
+      :dj-link "DJ Link"
+      "Unknown")
+    "Manual"))
+
 (defn- enter-metronome-showing
   "Activate the persistent metronome display, with sync and reset pads
   illuminated."
@@ -495,7 +505,8 @@
                           (button-state (:metronome control-buttons) :bright))

                    ;; Add the labels for reset and sync, and light the pads
-                   (write-display-cell controller 3 0 "Reset    Manual")
+                   (write-display-cell controller 3 0
+                                       (str "Reset    " (metronome-sync-label controller)))
                    (aset (:next-top-pads controller) 0 (top-pad-state :dim :red))
                    (aset (:next-top-pads controller) 1 (top-pad-state :dim :green)))
                  (handle-control-change [this controller message]


Added comments and moved some code around.

--- src/appengine_magic/services/datastore.clj
+++ src/appengine_magic/services/datastore.clj
@@ -8,6 +8,11 @@
             Query Query$FilterOperator Query$SortDirection]))

+
+;;; ----------------------------------------------------------------------------
+;;; helper variables and constants
+;;; ----------------------------------------------------------------------------
+
 (defonce *datastore-service* (atom nil))
 (defonce *current-transaction* nil)

@@ -39,6 +44,11 @@
    :dsc Query$SortDirection/DESCENDING
    :desc Query$SortDirection/DESCENDING})

+
+
+;;; ----------------------------------------------------------------------------
+;;; datastore service management functions; use directly if necessary
+;;; ----------------------------------------------------------------------------

 (defn get-datastore-service []
   (when (nil? @*datastore-service*)
@@ -63,6 +73,11 @@
     @*datastore-service*))

+
+;;; ----------------------------------------------------------------------------
+;;; protocol for dealing with Clojure entity records
+;;; ----------------------------------------------------------------------------
+
 (defprotocol EntityProtocol
   "Entities are Clojure records which conform to the EntityProtocol. Each Entity
    must have a key. If an entity record field has a :key metadata tag, then that
@@ -79,6 +94,11 @@
   (save! [this]
     "Writes the given entity to the data store."))

+
+
+;;; ----------------------------------------------------------------------------
+;;; helper functions; do not use these directly
+;;; ----------------------------------------------------------------------------

 (defn- unqualified-name [sym]
   (let [s (str sym)
@@ -161,82 +181,6 @@
 (defn- save-many-helper! [entity-record-seq]
   (let [entities (map get-entity-object entity-record-seq)]
     (.put (get-datastore-service) entities)))
-
-
-(extend-type Iterable
-  EntityProtocol
-  (save! [this] (save-many-helper! this)))
-
-
-(defn retrieve [entity-record-type key-value &
-                {:keys [parent kind]
-                 :or {kind (unqualified-name (.getName entity-record-type))}}]
-  (let [key-object (if parent
-                       (KeyFactory/createKey (get-key-object parent)
-                                             kind
-                                             (coerce-key-value-type key-value))
-                       (KeyFactory/createKey kind
-                                             (coerce-key-value-type key-value)))
-        entity (.get (get-datastore-service) key-object)
-        raw-properties (into {} (.getProperties entity))
-        properties (reduce (fn [m [k v]]
-                             (assoc m
-                               (keyword k)
-                               (coerce-java-type v)))
-                           {}
-                           raw-properties)
-        ;; XXX: No good choice but to use eval here. No way to know the number
-        ;; of arguments to the record constructor at compile-time, and no clean
-        ;; way to access any custom constructor defined by defentity, since that
-        ;; constructor would be in a different namespace.
-        entity-record (eval `(new ~entity-record-type ~@(repeat (count raw-properties) nil)))]
-    (with-meta (merge entity-record properties) {:key (.getKey entity)})))
-
-
-(defn delete! [target]
-  (let [target (if (sequential? target) target [target])
-        key (coerce-to-key-seq target)]
-    (.delete (get-datastore-service) key)))
-
-
-(defmacro defentity [name properties &
-                     {:keys [kind]
-                      :or {kind (unqualified-name name)}}]
-  (let [key-property-name (first (filter #(= (:tag (meta %)) :key) properties))
-        key-property (if key-property-name (keyword (str key-property-name)) nil)]
-    `(defrecord ~name ~properties
-       EntityProtocol
-       (get-key-object [this#]
-         (get-key-object-helper this# ~key-property ~kind))
-       (get-key-object [this# parent#]
-         (get-key-object-helper this# ~key-property ~kind :parent parent#))
-       (get-entity-object [this#]
-         (get-entity-object-helper this# ~kind))
-       (save! [this#]
-         (save!-helper this#)))))
-
-
-(defmacro new* [entity-record-type property-values & {:keys [parent]}]
-  (if parent
-      `(let [parent# ~parent
-             entity# (new ~entity-record-type ~@property-values)]
-         (if (nil? parent#)
-             entity#
-             (with-meta entity# {:key (get-key-object entity# parent#)})))))
-
-
-;;; Note that the code relies on the API's implicit transaction tracking
-;;; wherever possible, but the *current-transaction* value is still used for
-;;; query construction.
-(defmacro with-transaction [& body]
-  `(binding [*current-transaction* (.beginTransaction (get-datastore-service))]
-     (try
-       (let [body-result# (do ~@body)]
-         (.commit *current-transaction*)
-         body-result#)
-       (catch Throwable err#
-         (do (.rollback *current-transaction*)
-             (throw err#))))))

 (defn- make-query-object [kind ancestor filter sort keys-only?]
@@ -289,6 +233,87 @@
     query-object))

+
+;;; ----------------------------------------------------------------------------
+;;; user functions and macros
+;;; ----------------------------------------------------------------------------
+
+(defn retrieve [entity-record-type key-value &
+                {:keys [parent kind]
+                 :or {kind (unqualified-name (.getName entity-record-type))}}]
+  (let [key-object (if parent
+                       (KeyFactory/createKey (get-key-object parent)
+                                             kind
+                                             (coerce-key-value-type key-value))
+                       (KeyFactory/createKey kind
+                                             (coerce-key-value-type key-value)))
+        entity (.get (get-datastore-service) key-object)
+        raw-properties (into {} (.getProperties entity))
+        properties (reduce (fn [m [k v]]
+                             (assoc m
+                               (keyword k)
+                               (coerce-java-type v)))
+                           {}
+                           raw-properties)
+        ;; XXX: No good choice but to use eval here. No way to know the number
+        ;; of arguments to the record constructor at compile-time, and no clean
+        ;; way to access any custom constructor defined by defentity, since that
+        ;; constructor would be in a different namespace.
+        entity-record (eval `(new ~entity-record-type ~@(repeat (count raw-properties) nil)))]
+    (with-meta (merge entity-record properties) {:key (.getKey entity)})))
+
+
+(defn delete! [target]
+  (let [target (if (sequential? target) target [target])
+        key (coerce-to-key-seq target)]
+    (.delete (get-datastore-service) key)))
+
+
+(defmacro defentity [name properties &
+                     {:keys [kind]
+                      :or {kind (unqualified-name name)}}]
+  (let [key-property-name (first (filter #(= (:tag (meta %)) :key) properties))
+        key-property (if key-property-name (keyword (str key-property-name)) nil)]
+    `(defrecord ~name ~properties
+       EntityProtocol
+       (get-key-object [this#]
+         (get-key-object-helper this# ~key-property ~kind))
+       (get-key-object [this# parent#]
+         (get-key-object-helper this# ~key-property ~kind :parent parent#))
+       (get-entity-object [this#]
+         (get-entity-object-helper this# ~kind))
+       (save! [this#]
+         (save!-helper this#)))))
+
+
+(extend-type Iterable
+  EntityProtocol
+  (save! [this] (save-many-helper! this)))
+
+
+(defmacro new* [entity-record-type property-values & {:keys [parent]}]
+  (if parent
+      `(let [parent# ~parent
+             entity# (new ~entity-record-type ~@property-values)]
+         (if (nil? parent#)
+             entity#
+             (with-meta entity# {:key (get-key-object entity# parent#)})))))
+
+
+;;; Note that the code relies on the API's implicit transaction tracking
+;;; wherever possible, but the *current-transaction* value is still used for
+;;; query construction.
+(defmacro with-transaction [& body]
+  `(binding [*current-transaction* (.beginTransaction (get-datastore-service))]
+     (try
+       (let [body-result# (do ~@body)]
+         (.commit *current-transaction*)
+         body-result#)
+       (catch Throwable err#
+         (do (.rollback *current-transaction*)
+             (throw err#))))))
+
+
 (defn query [& {:keys [kind ancestor filter sort keys-only?
                        count-only? in-transaction?
                        limit offset


CMR-3931: Added the missing parenthesis.

--- umm-spec-lib/src/cmr/umm_spec/umm_spec_core.clj
+++ umm-spec-lib/src/cmr/umm_spec/umm_spec_core.clj
@@ -24,7 +24,7 @@
    ;; Added this to force the loading of the class, so that in CI build, it won't complain about
    ;; "No implementation of method: :validate of protocol: #'cmr.spatial.validation/SpatialValidation
    ;; found for class: cmr.spatial.cartesian_ring.CartesianRing."
-   [cmr.spatial-ring-validations]
+   [cmr.spatial-ring-validations])
   (:import
    (cmr.umm_spec.models.umm_collection_models UMM-C)
    (cmr.umm_spec.models.umm_service_models UMM-S)


Add additional test for skein 512/256.

Add additional test for skein 512/256.


Add tests for object refs in arrays.

Add tests for object refs in arrays.

--- test/isla/test/interpreter.clj
+++ test/isla/test/interpreter.clj
@@ -110,6 +110,13 @@
            (new isla.test.interpreter.Person 0
                 ""
                 (new isla.test.interpreter.Person 0 "" :undefined))))))
+;; assignment
+
+(deftest test-non-canonical-assigned-obj-is-ref
+  (let [result (interpret (parse "mary is a person\nfriend is mary")
+                          (library/get-initial-env extra-types))]
+    (is (= (get (:ctx result) "friend")
+           {:ref "mary"}))))

 ;; test extract fn

@@ -133,13 +140,21 @@
                        (library/get-initial-env extra-types))]
     (is (= (resolve- {:ref "items"} env) #{}))))

-(deftest test-unknown-list-add-causes-exception
+(deftest test-unknown-scalar-list-add-causes-exception
   (try
     (interpret (parse "items add 'sword'")
                (library/get-initial-env extra-types))
     (is false) ;; should not get called
     (catch Exception e
       (is (= (.getMessage e) "I do not know of a list called items.")))))
+
+(deftest test-unknown-object-attr-list-add-causes-exception
+  (try
+    (interpret (parse "isla items add 1")
+               (library/get-initial-env extra-types))
+    (is false) ;; should not get called
+    (catch Exception e
+      (is (= (.getMessage e) "I do not know of a list called isla items.")))))

 ;; list addition

@@ -147,6 +162,11 @@
   (let [env (interpret (parse "items is a list\nitems add 'sword'")
                        (library/get-initial-env extra-types))]
     (is (= (resolve- {:ref "items"} env) #{"sword"}))))
+
+(deftest test-add-obj-to-list-works-with-ref
+  (let [env (interpret (parse "items is a list\nmary is a person\nitems add mary")
+                       (library/get-initial-env extra-types))]
+    (is (= (get (:ctx env) "items") #{{:ref "mary"}}))))

 (deftest test-add-duplicate-item-does-nothing-string
   (let [env (interpret (parse "items is a list\nitems add 'sword'\nitems add 'sword'")
@@ -164,12 +184,24 @@
                        (library/get-initial-env extra-types))]
     (is (= (resolve- {:ref "items"} env) #{((get extra-types "person"))}))))

+(deftest test-add-to-obj-attribute-list
+  (let [env (interpret (parse "isla is a person\nisla items add 1")
+                       (library/get-initial-env extra-types))]
+    (is (= (-> (resolve- {:ref "isla"} env) :items)
+           #{1}))))
+
 ;; list removal

 (deftest test-remove-list
   (let [env (interpret (parse "items is a list\nitems add 'sword'\nitems remove 'sword'")
                        (library/get-initial-env extra-types))]
     (is (= (resolve- {:ref "items"} env) #{}))))
+
+(deftest test-remove-obj-from-list-works-with-ref
+  (let [env (interpret (parse "items is a list\nmary is a person
+                               items add mary\nitems remove mary")
+                       (library/get-initial-env extra-types))]
+    (is (= (get (:ctx env) "items") #{}))))

 (deftest test-remove-obj-list
   (let [env (interpret (parse "mary is a person\nitems is a list


Avoid useless NPE

Avoid useless NPE

--- modules/messaging/src/main/clojure/immutant/messaging.clj
+++ modules/messaging/src/main/clojure/immutant/messaging.clj
@@ -197,7 +197,7 @@
    You only need to do this if you wish to stop the handler's
    destination before your app is undeployed."
   [^javax.jms.XAConnection listener]
-  (.close listener))
+  (and listener (.close listener)))

 (defn stop
   "Destroy a message destination. Typically not necessary since it


pmap-dir-asts -> pmap-dir-trees

pmap-dir-asts -> pmap-dir-trees

--- src/atom_finder/util/cdt_util.clj
+++ src/atom_finder/util/cdt_util.clj
@@ -335,7 +335,7 @@
   ([root :- IASTNode offset :- s/Int] (binary-search-offset-parent offset root))
   ([node :- IASTNode] (parent node))) ;(offset-parent (root-ancestor node) (:offset (loc node)))))

-(s/defn pmap-dir-asts
+(s/defn pmap-dir-trees
   "Apply a function to the root of the AST of every c file in a directory"
   [f :- (s/=> s/Any [IASTTranslationUnit]) dirname :- s/Str]
   (pmap-dir-files (comp f parse-file) dirname))


Start fixing compiler errors

Start fixing compiler errors

--- src/clj/com/frereth/web/routes/websock.clj
+++ src/clj/com/frereth/web/routes/websock.clj
@@ -168,9 +168,13 @@
                "\nID: " id
                "\nout of keys:\n" (keys ev-msg)))
   (match [id ?data]
+         ;; As it stands, this looks like a simple cond on the id
+         ;; would make more sense.
+         ;; Or possibly a multimethod that dispatches on id
+         ;; Q: Will I ever want different functionality based on the data?
          [:chsk/ws-ping _] (ping this ev-msg)
          [:frereth/blank-slate _] (initiate-auth! this ev-msg)
-         [:frereth/load-ns] (request-ns-load! this ?data)
+         [:frereth/load-ns _] (request-ns-load! this ?data)
          [:frereth/pong _] (forward this ev-msg)
          [:frereth/response _] (log/info "Response from renderer:\n"
                                          (util/pretty ?data))


mac additional secret params

mac additional secret params

--- src/clj/swarmpit/docker/mapper/inbound.clj
+++ src/clj/swarmpit/docker/mapper/inbound.clj
@@ -159,7 +159,10 @@
   [service-spec]
   (->> (get-in service-spec [:TaskTemplate :ContainerSpec :Secrets])
        (map (fn [s] {:id         (:SecretID s)
-                     :secretName (:SecretName s)}))
+                     :secretName (:SecretName s)
+                     :uid        (get-in s [:File :UID])
+                     :gid        (get-in s [:File :GID])
+                     :mode       (get-in s [:File :Mode])}))
        (into [])))

 (defn ->service-deployment-update


Remove unnecessary .-property in JavaScript Interop.

--- src/cljs/cljs_repl_web/cljs_api/utils.cljs
+++ src/cljs/cljs_repl_web/cljs_api/utils.cljs
@@ -57,7 +57,7 @@
                                     deftype defrecord reify this-as declare ns))])
               (Section. "JavaScript Interop" {:type :texts}
                         [(Topic. "method call" '("(.the-method target-object args...)"))
-                         (Topic. "property access" '("(.-property target-object -property)"))
+                         (Topic. "property access" '("(.-property target-object)"))
                          (Topic. "property setting" '("(set! (.-title js/document) \"Hi!\")"))
                          (Topic. "direct javascript" '("(js/alert \"Hello world!\")"))
                          (Topic. "external library use" '("(.text (js/jQuery \"#title\") \"ClojureScript Rocks!\")"))])]})


make client side state survive auto-refresh in development

--- src/cljs/conference_rating/conference.cljs
+++ src/cljs/conference_rating/conference.cljs
@@ -7,9 +7,9 @@
             [goog.events :as events]
             [goog.history.EventType :as EventType]))

-(def displayed-conference (atom nil))
-(def conferences (atom nil))
-(def ratings (atom nil))
+(defonce displayed-conference (atom nil))
+(defonce conferences (atom nil))
+(defonce ratings (atom nil))

 ;; -------------------------
 ;; Requests


Add filename comment to problem51.clj

Add filename comment to problem51.clj

--- euler_clojure/src/euler_clojure/problem51.clj
+++ euler_clojure/src/euler_clojure/problem51.clj
@@ -1,3 +1,5 @@
+;; problem51.clj
+;;
 ;; By replacing the 1st digit of the 2-digit number *3, it turns out that
 ;; six of the nine possible values: 13, 23, 43, 53, 73, and 83, are all
 ;; prime.


Fixed gadm-src fields

Fixed gadm-src fields

--- src/clj/forma/hadoop/jobs/cdm.clj
+++ src/clj/forma/hadoop/jobs/cdm.clj
@@ -86,7 +86,7 @@
         start-period (date/datetime->period tres start)]
     (<- [?x ?y ?z ?p ?iso]
         (src ?sres ?modh ?modv ?s ?l ?prob-series)
-        (gadm-src _ ?modh ?modv ?s ?l ?gadm)
+        (gadm-src ?s-res ?mod-h ?mod-v ?sample ?line _ ?gadm _ _ _)
         (gadm->iso ?gadm :> ?iso)
         (o/clean-probs ?prob-series nodata :> ?clean-series)
         (first-hit thresh ?clean-series :> ?first-hit-idx)
@@ -115,7 +115,7 @@
         start-period (date/datetime->period tres start)]
     (<- [?iso ?s-res ?modh ?modv ?s ?l ?p]
         (src ?sres ?modh ?modv ?s ?l ?prob-series)
-        (gadm-src _ ?modh ?modv ?s ?l ?gadm)
+        (gadm-src ?s-res ?mod-h ?mod-v ?sample ?line _ ?gadm _ _ _)
         (gadm->iso ?gadm :> ?iso)
         (o/clean-probs ?prob-series nodata :> ?clean-series)
         (first-hit thresh ?clean-series :> ?first-hit-idx)
@@ -130,3 +130,4 @@
     (<- [?iso ?p ?ct]
         (spark-src ?iso _ _ _ _ _ ?p)
         (c/distinct-count ?p :> ?ct))))
+


fix Punitive Counterstrike when no agenda stolen last turn

--- src/clj/game/cards-operations.clj
+++ src/clj/game/cards-operations.clj
@@ -237,8 +237,8 @@
                                      :effect (effect (add-prop target :advance-counter c))} card nil)))}

    "Punitive Counterstrike"
-   {:trace {:base 5 :msg (msg "do " (:stole-agenda runner-reg) " meat damage")
-            :effect (effect (damage :meat (get-in runner [:register :stole-agenda]) {:card card}))}}
+   {:trace {:base 5 :msg (msg "do " (or (:stole-agenda runner-reg) 0) " meat damage")
+            :effect (effect (damage :meat (or (get-in runner [:register :stole-agenda]) 0) {:card card}))}}

    "Reclamation Order"
    {:prompt "Choose a card from Archives" :msg (msg "add copies of " (:title target) " to HQ")
@@ -247,22 +247,22 @@
                    (move state side c :hand)))}

    "Recruiting Trip"
-   (let [rthelp (fn rt [total left selected]
-                  (if (> left 0)
+   (let [rthelp (fn rt [total left selected]
+                  (if (> left 0)
                     {:prompt (str "Select a sysop (" (inc (- total left)) "/" total ")")
                      :choices (req (filter #(and (has? % :subtype "Sysop")
                                                  (not (some #{(:title %)} selected))) (:deck corp)))
-                     :msg (msg "put " (:title target) " into HQ")
+                     :msg (msg "put " (:title target) " into HQ")
                      :effect (req (move state side target :hand)
-                                  (resolve-ability
-                                    state side
-                                    (rt total (dec left) (cons (:title target) selected))
+                                  (resolve-ability
+                                    state side
+                                    (rt total (dec left) (cons (:title target) selected))
                                     card nil))}
                     {:effect (req (shuffle! state :corp :deck))
                      :msg (msg "shuffle R&D")}))]
    {:prompt "How many sysops?" :choices :credit :msg (msg "search for " target " sysops")
     :effect (effect (resolve-ability (rthelp target target []) card nil))})
-
+
    "Restoring Face"
    {:prompt "Choose a Sysop, Executive or Clone to trash"
     :msg (msg "trash " (:title target) " to remove 2 bad publicity")


prevent targeting ice in hand with Oversight AI

--- src/clj/game/cards-operations.clj
+++ src/clj/game/cards-operations.clj
@@ -275,7 +275,7 @@
    {:req (req (:made-run runner-reg)) :effect (effect (damage :net 1 {:card card}))}

    "Oversight AI"
-   {:choices {:req #(and (= (:type %) "ICE") (not (:rezzed %)))}
+   {:choices {:req #(and (= (:type %) "ICE") (not (:rezzed %)) (= (last (:zone %)) :ices))}
     :msg (msg "rez " (:title target) " at no cost")
     :effect (effect (rez target {:no-cost true})
                     (host (get-card state target) (assoc card :zone [:discard] :seen true)))}


Change card list to a vector

Change card list to a vector

--- src/cljs/decktouch/card-data.cljs
+++ src/cljs/decktouch/card-data.cljs
@@ -12,7 +12,9 @@
       []
       (map (fn [n] {"name" n}) (js->clj (.parse js/JSON list))))))

-(def card-list (atom (get-card-list-from-storage)))
+;; This collection is a vector of maps of strings to strings
+;; [ {"a" "z"} ]
+(def card-list (atom (into [] (get-card-list-from-storage))))

 (defn <lookup-card-data [card-name]
   (let [c (chan)]


dismiss modal on block selection

dismiss modal on block selection

--- src/cljs/salava/page/ui/edit.cljs
+++ src/cljs/salava/page/ui/edit.cljs
@@ -268,7 +268,6 @@
           (conj r
                 [:a {:on-click #(do
                                   (.preventDefault %)
-                                  ;(if (= (:value v) "badge") (open-modal [:badge :my] nil))
                                   (case (:value v)
                                     "badge" (open-modal [:badge :my] {:atom block-atom :type "pickable" :function (fn []
                                                                                (if index
@@ -278,7 +277,9 @@
                                     (if index
                                       (f/add-field block-atom {:type (:value v)} index)
                                       (f/add-field block-atom {:type (:value v)}))))
-                     ;:data-dismiss "modal"
+                     :data-dismiss (case (:value v)
+                                     ("badge" "tag") nil
+                                     "modal")
                      }
                  [:div.row

@@ -481,3 +482,5 @@
     (fn []
       (layout/default site-navi (content state)))))

+(defn ^:export modalroute []
+  {:block-type contenttype})


Run parinfer when a key is released

Run parinfer when a key is released

--- src/clojure/nightcode/editors.clj
+++ src/clojure/nightcode/editors.clj
@@ -290,16 +290,43 @@
       (.apply text-area))
   (set-font-size! text-area @font-size))

-(defn paren-mode!
+(defn init-parinfer!
   [text-area extension]
   (when (contains? utils/clojure-exts extension)
-    (let [pos (.getCaretPosition text-area)
+    ; use paren mode to preprocess the code
+    (let [old-pos (.getCaretPosition text-area)
+          old-x (.getCaretOffsetFromLineStart text-area)
+          old-line (.getCaretLineNumber text-area)
           old-text (.getText text-area)
-          new-text (.-text (Parinfer/parenMode old-text (int 0) (int 0) (int 0)))]
+          result (Parinfer/parenMode old-text old-x old-line nil)
+          new-text (.-text result)]
       (.setText text-area new-text)
-      (.setCaretPosition text-area pos)
+      (.setCaretPosition text-area old-pos)
       (.discardAllEdits text-area)
-      (.setDirty text-area (not= old-text new-text))))
+      (.setDirty text-area (not= old-text new-text)))
+    ; add a listener to run indent mode when a key is pressed
+    (.addKeyListener text-area
+      (reify KeyListener
+        (keyReleased [this e]
+          (when-not (contains? #{KeyEvent/VK_DOWN
+                                 KeyEvent/VK_UP
+                                 KeyEvent/VK_RIGHT
+                                 KeyEvent/VK_LEFT}
+                               (.getKeyCode e))
+            (let [old-pos (.getCaretPosition text-area)
+                  old-x (.getCaretOffsetFromLineStart text-area)
+                  old-line (.getCaretLineNumber text-area)
+                  old-text (.getText text-area)
+                  result (if (= (.getKeyCode e) KeyEvent/VK_ENTER)
+                           (Parinfer/parenMode old-text old-x old-line nil)
+                           (Parinfer/indentMode old-text old-x old-line nil))
+                  new-text (.-text result)
+                  new-x (.-cursorX result)
+                  new-pos (+ old-pos (- new-x old-x))]
+              (.setText text-area new-text)
+              (.setCaretPosition text-area new-pos))))
+        (keyTyped [this e] nil)
+        (keyPressed [this e] nil))))
   text-area)

 (defn create-text-area
@@ -323,7 +350,7 @@
         (.setMarginLineEnabled true)
         (.setMarginLinePosition 80)
         (.setTabSize (if (contains? utils/clojure-exts extension) 2 4))
-        (paren-mode! extension)))))
+        (init-parinfer! extension)))))

 (defn create-console
   ([path]


Attempting to debug auth failures on heroku

--- src/clojure/staircase/handler.clj
+++ src/clojure/staircase/handler.clj
@@ -172,6 +172,11 @@
                                (assoc :session (dissoc session :anon-identity))
                                (content-type "text/plain")))))))

+(defn- logging-verifier [assertion audience]
+  (let [ret (pk/verify-assertion assertion audience)]
+    (info "VERIFICATION RESULT" ret)
+    ret))
+
 ;; replacement for persona-kit version. TODO: move to different file.
 (defn persona-workflow [audience request]
   (if (and (= (:uri request) "/auth/login")
@@ -179,7 +184,7 @@
     (-> request
         :params
         (get "assertion")
-        (pk/verify-assertion audience)
+        (logging-verifier audience)
         pf/credential-fn
         (workflows/make-auth {::friend/redirect-on-auth? false
                               ::friend/workflow :mozilla-persona}))))


Use Clojure 1.9

Use Clojure 1.9

--- resources/leiningen/new/aws_lambda_serverless/project.clj
+++ resources/leiningen/new/aws_lambda_serverless/project.clj
@@ -2,7 +2,7 @@
   :description "AWS Lambda to do FIXME"
   :url "http://example.com/FIXME"

-  :dependencies [[org.clojure/clojure "1.8.0"]
+  :dependencies [[org.clojure/clojure "1.9.0"]

                  [org.clojure/tools.logging "0.3.1"]
                  [ch.qos.logback/logback-classic "1.2.3"]


Fixed Accept header for Measurement CSV downloader

--- src-cljs/kixi/hecuba/tabs/hierarchy/property_details.cljs
+++ src-cljs/kixi/hecuba/tabs/hierarchy/property_details.cljs
@@ -260,7 +260,7 @@
                         :class "btn btn-primary"
                         :onClick (fn [_]
                                    (GET (str "/4/templates/for-entity/" entity_id "?data=true")
-                                        {:headers {"Accept" "application/edn"}
+                                        {:headers {"Accept" "text/csv"}
                                          :handler #(let [status (:status (:response %))]
                                                      (om/set-state! owner :status
                                                                     (case status


Removed natural-seq.

Removed natural-seq.

--- src/overtunes/songs/canone_alla_quarta.clj
+++ src/overtunes/songs/canone_alla_quarta.clj
@@ -13,11 +13,6 @@
       m))

 (defn natural-map [ys] (zipmap (-> ys count range) ys))
-(defn natural-seq [f]
-    (if-let [y (f 0)]
-          (cons y (natural-seq (comp f inc)))
-          '()))
-
 (defn connect [f1 f2] #(if-let [y2 (f2 %)] (f1 y2) nil))

 (defn sum-n [series n] (reduce + (take n series)))
@@ -43,8 +38,9 @@

 (defn melody [notes]
   (let [functionalise #(update-all % [:time :pitch] natural-map)
-        accumulate-time (update :time sums)]
-    (-> notes accumulate-time functionalise)))
+        accumulate-time (update :time sums)
+        add-count #(assoc % :count (count (:pitch notes)))]
+    (-> notes accumulate-time functionalise add-count)))

 (def leader
   (let [call
@@ -69,9 +65,9 @@
    (-> line melody lower-melody)))

 (defn melody# [melody]
-  (let [notes (update-all melody [:pitch :time] natural-seq)
-        play-at #(at %1 (piano# %2))]
-    (dorun (map play-at (:time notes) (:pitch notes)))))
+  (let [notes (map #(vector (=> % (:time melody)) (=> % (:pitch melody))) (range (:count melody)))
+        play-at# #(at (% 0) (piano# (% 1)))]
+    (dorun (map play-at# notes))))

 (def mirror (update :pitch #(connect - %)))
 (defn after [beats] (update :time #(shift % beats)))


Add useful comment.

Add useful comment.

--- src/uxbox/view/ui/viewer/interactions.cljs
+++ src/uxbox/view/ui/viewer/interactions.cljs
@@ -14,6 +14,8 @@
             [uxbox.main.state :as st]
             [uxbox.view.data.viewer :as dv]
             [vendor.snapsvg])
+  ;; Documentation about available events:
+  ;; https://google.github.io/closure-library/api/goog.events.EventType.html
   (:import goog.events.EventType))

 (defn- translate-trigger


remove exesive prev offset checking

remove exesive prev offset checking

--- kafka-clj/src/kafka_clj/consumer/consumer.clj
+++ kafka-clj/src/kafka_clj/consumer/consumer.clj
@@ -52,16 +52,16 @@

 (defn read-fetch-message
   "read-fetch will return the result of fn which is [resp-vec error-vec]"
-  [{:keys [topic partition ^Long offset ^Long len]} f-delegate v & {:keys [prev-offset] :or {prev-offset -1}}]
+  [{:keys [topic partition ^Long offset ^Long len]} f-delegate v]
   (if (byte-array? v)
 	  (let [ ^Long max-offset (+ offset len)
 	         fetch-res
-	         (read-fetch (Unpooled/wrappedBuffer ^"[B" v) [[] [] nil prev-offset]
+	         (read-fetch (Unpooled/wrappedBuffer ^"[B" v) [[] [] nil -1]
 				     (fn [state msg]
 	              ;read-fetch will navigate the fetch response calling this function
                ;(info "READ FETCH MESSAGE " msg)
 	              (if (coll? state)
-			            (let [[resp errors f-state prev-offset1] state]
+			            (let [[resp errors f-state] state]
 		               (try
 			               (do
 					             (cond
@@ -71,18 +71,20 @@
 								         (do
                            (if (and (= (:topic msg) topic) (= ^Long (:partition msg) ^Long partition)
                                     (>= ^Long (:offset msg) offset)
-                                    (< ^Long (:offset msg) max-offset) (< ^Long prev-offset1 (:offset msg)))
+                                    (< ^Long (:offset msg) max-offset)
+                                    ;(< ^Long prev-offset1 (:offset msg))
+                                    )
                              (tuple (conj resp msg) errors (f-delegate f-state msg) (:offset msg))
-                             (tuple resp errors f-state prev-offset1)))
+                             (tuple resp errors f-state)))
 								         (instance? FetchError msg)
-								         (do (error "Fetch error: " msg) (tuple resp (conj errors msg) f-state prev-offset1))
+								         (do (error "Fetch error: " msg) (tuple resp (conj errors msg) f-state))
 								         :else (throw (RuntimeException. (str "The message type " msg " not supported")))))
 			               (catch Exception e
 		                  (do (error e e)
-		                      (tuple resp errors f-state prev-offset1))
+		                      (tuple resp errors f-state))
 		                  )))
 	                  (do (error "State not supported " state)
-	                      [{} [] nil prev-offset])
+	                      [{} [] nil])
 	                  )))]
          ;(info "FETCH RESP " fetch-res)
 	       (if (coll? fetch-res)
@@ -94,39 +96,39 @@
 (defn handle-error-response [v]
   [:fail v])

-(defn handle-read-response [work-unit f-delegate v & {:keys [prev-offset] :or {prev-offset -1}}]
-  (let [[resp-vec error-vec _ prev-offset1] (read-fetch-message work-unit f-delegate v :prev-offset prev-offset)]
-    [:ok resp-vec prev-offset1]))
-
-(defn handle-timeout-response [prev-offset]
-  [:fail nil prev-offset])
+(defn handle-read-response [work-unit f-delegate v]
+  (let [[resp-vec error-vec] (read-fetch-message work-unit f-delegate v)]
+    [:ok resp-vec]))
+
+(defn handle-timeout-response []
+  [:fail nil])

 (defn handle-response
   "Listens to a response after a fetch request has been sent
    Returns [status data]  status can be :ok, :timeout, :error and data is v returned from the channel"
-  [{:keys [client] :as state} work-unit f-delegate conf & {:keys [prev-offset] :or {prev-offset -1}}]
+  [{:keys [client] :as state} work-unit f-delegate conf]
   ;(prn "handler-response >>>>> " work-unit)
   (let [fetch-timeout (get conf :fetch-timeout 10000)
         {:keys [read-ch error-ch]} client
         [v c] (alts!! [read-ch error-ch (timeout fetch-timeout)])]
     (condp = c
       read-ch (cond
-                (instance? Reconnected v) (handle-response state f-delegate conf :prev-offset prev-offset)
-                (instance? Poison v) [:fail nil prev-offset]
-                :else (handle-read-response work-unit f-delegate v :prev-offset prev-offset))
+                (instance? Reconnected v) (handle-response state f-delegate conf)
+                (instance? Poison v) [:fail nil]
+                :else (handle-read-response work-unit f-delegate v))
       error-ch (handle-error-response v)
-      (handle-timeout-response prev-offset))))
+      (handle-timeout-response))))

 (defn fetch-and-wait
   "
    Sends a request for the topic and partition to the producer
    Returns [status data]  status can be :ok, :fail and data is v returned from the channel"
-  [state {:keys [topic partition offset len] :as work-unit} producer f-delegate & {:keys [prev-offset] :or {prev-offset -1}}]
+  [state {:keys [topic partition offset len] :as work-unit} producer f-delegate]
     (io!
       (send-fetch producer [[topic [{:partition partition :offset offset}]]])
-      (handle-response producer work-unit f-delegate (get state :conf) :prev-offset prev-offset)))
+      (handle-response producer work-unit f-delegate (get state :conf))))

 (defn- safe-sleep
@@ -232,7 +234,7 @@
    and added to the complete-queue queue.
    Returns the state map with the :status and :producers updated
   "
-  [{:keys [redis-conn producers work-queue working-queue complete-queue conf prev-offsets-read] :as state} work-unit f-delegate]
+  [{:keys [redis-conn producers work-queue working-queue complete-queue conf] :as state} work-unit f-delegate]
   ;(prn "wait-and-do-work-unit! >>> have work unit " work-unit)
   ;(info "prev-offsets-read: " prev-offsets-read)
   (io!
@@ -242,7 +244,7 @@
         (try
           (do
             (if (not producer-conn) (throw (RuntimeException. "No producer created")))
-            (let [[status resp-data prev-offset] (fetch-and-wait state work-unit producer-conn f-delegate :prev-offset -1)
+            (let [[status resp-data] (fetch-and-wait state work-unit producer-conn f-delegate)
                   state2 (assoc state :status :ok)
                   ]
               (if resp-data
@@ -255,7 +257,7 @@

               (assoc
                   state2
-                :prev-offsets-read (assoc-in (if prev-offsets-read prev-offsets-read {}) [topic partition] prev-offset)
+                ;:prev-offsets-read (assoc-in (if prev-offsets-read prev-offsets-read {}) [topic partition] prev-offset)
                 :producers producers2)))
           (catch Throwable t (do
                                (.printStackTrace t)


Fixed save and load with new levels code.

--- src/divergence/entity/levels.cljs
+++ src/divergence/entity/levels.cljs
@@ -12,23 +12,23 @@
    (e/goal 1450 200 stage)
    (e/metalTileC -100 560 :t1 stage)
    ;(e/box :box -100 260 stage)
-   (e/metalTileB 0 560 :t1 stage)
-   (e/metalTileA 100 560 :t1 stage)
-   (e/metalTileB 200 520 :t1 stage)
-   (e/metalTileC 300 480 :t1 stage)
-   (e/metalTileB 400 440 :t1 stage)
-   (e/metalTileC 500 440 :t1 stage)
-   (e/metalTileA 600 440 :t1 stage)
-   (e/metalTileB 700 440 :t1 stage)
-   (e/metalTileA 600 340 :t1 stage)
+   (e/metalTileB 0 560 :t2 stage)
+   (e/metalTileA 100 560 :t3 stage)
+   (e/metalTileB 200 520 :t4 stage)
+   (e/metalTileC 300 480 :t5 stage)
+   (e/metalTileB 400 440 :t6 stage)
+   (e/metalTileC 500 440 :t7 stage)
+   (e/metalTileA 600 440 :t8 stage)
+   (e/metalTileB 700 440 :t9 stage)
+   (e/metalTileA 600 340 :t10 stage)
    ;(e/box :box 600 140 stage)
-   (e/metalTileA 800 260 :t1 stage)
+   (e/metalTileA 800 260 :t11 stage)
    ;(e/rope-block 750 0 stage)
-   (e/metalTileB 900 440 :t1 stage)
-   (e/metalTileC 1000 500 :t1 stage)
-   (e/metalTileA 1100 440 :t1 stage)
-   (e/metalTileB 1200 440 :t1 stage)
-   (e/metalTileA 1400 440 :t1 stage)
+   (e/metalTileB 900 440 :t12 stage)
+   (e/metalTileC 1000 500 :t13 stage)
+   (e/metalTileA 1100 440 :t14 stage)
+   (e/metalTileB 1200 440 :t15 stage)
+   (e/metalTileA 1400 440 :t16 stage)

    ;(e/vertical-full-block 0 -40 :b1 stage)
    ;(e/horizontal-full-block 0 560 :b3 stage)


Fixed author name display in the RSS template.

--- src/lambda_blog/templates/rss.clj
+++ src/lambda_blog/templates/rss.clj
@@ -21,7 +21,7 @@

 (defn rss-feed
   "Creates an XML RSS page conforming to the http://www.w3.org/2005/Atom specification."
-  [{:keys [entries path title url]}]
+  [{:keys [entries path title url] :as ent}]
   [(xml)
    (feed {:xmlns "http://www.w3.org/2005/Atom"}
          (tags/title title)
@@ -33,7 +33,7 @@
          (map (fn [{:keys [author path summary tags timestamp title]}]
                 (entry (tags/title title)
                        (id path)
-                       (_author (name author))
+                       (_author (name (or author (:author ent)))) ;; KLUDGE :(
                        (updated (format-t timestamp))
                        (published (format-t timestamp))
                        (link {:href (pathcat url path)})


Updated the lr binary search visualization to take advantage of the update in cmr-vdd-spatial-viz.

--- test/cmr/spatial/test/lr_binary_search.clj
+++ test/cmr/spatial/test/lr_binary_search.clj
@@ -96,14 +96,21 @@
         ring (assoc ring
                     :options {:callbackFn callback
                               :draggable true})
-        _ (println "Found LR:" (pr-str lr))
-        geoms (if lr [ring lr (first (mbr/corner-points lr)) #_(:mbr ring)] [ring (:mbr ring)])]
-    (viz-helper/add-geometries geoms)))
+        _ (println "Found LR:" (pr-str lr))]
+    (viz-helper/add-geometries [ring])
+    (when lr
+      (viz-helper/add-geometries [(assoc-in lr [:options :id] "lr")]))))

 (defn handle-ring-moved
   "Callback handler for when the ring is moved. It removes the existing ring and lr and readds it with
   the updated lr."
   [ords-str]
   (let [ords (map #(Double. ^String %) (str/split ords-str #","))
-        ring (apply r/ords->ring ords)]
-    (display-draggable-lr-ring ring)))+        ring (d/calculate-derived (apply r/ords->ring ords))
+        lr (lbs/find-lr ring)]
+    (viz-helper/remove-geometries ["lr"])
+    (when lr
+      (viz-helper/add-geometries [(assoc-in lr [:options :id] "lr")]))))
+
+
+


add and remove properties and presets

add and remove properties and presets

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@9028 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- acqEngine/src/org/micromanager/config_editor.clj
+++ acqEngine/src/org/micromanager/config_editor.clj
@@ -6,7 +6,8 @@
            [java.awt.event MouseAdapter]
            [javax.swing.table AbstractTableModel]
            [java.awt Color Dimension])
-  (:use [org.micromanager.mm :only [load-mm gui core edt get-config]]))
+  (:use [org.micromanager.mm :only [config-struct load-mm
+                                    gui core edt get-config]]))

 (load-mm)

@@ -60,6 +61,12 @@
    (let [sp (JScrollPane. table)]
     sp))

+(defn update-table [table]
+  (doto (.getModel table)
+    .fireTableDataChanged
+    .fireTableStructureChanged)
+  table)
+
 ;; events

 (defn attach-double-click-listener [component f]
@@ -81,7 +88,7 @@

 (def group-data (atom nil))

-(def widgets (atom nil))
+(defonce widgets (atom nil))

 (defn get-selected-group []
   (let [row (.getSelectedRow (@widgets :groups-table))
@@ -100,7 +107,8 @@
 (defn update-groups []
   (reset! groups (vec (seq (core getAvailableConfigGroups))))
   (update-group-data)
-  @groups)
+  (-> @widgets :groups-table update-table)
+  @group-data)

 (defn properties [group-data]
   (sort (set (apply concat (map keys (vals group-data))))))
@@ -123,7 +131,7 @@

 (defn preset-names-table-model []
   (proxy [AbstractTableModel] []
-    (getColumnName [_] "")
+    (getColumnName [_] "Presets")
     (getColumnCount [] 1)
     (getRowCount [] (count (keys @group-data)))
     (isCellEditable [_ _] true)
@@ -179,19 +187,75 @@
           (f))))))

 (defn start-editing-cell [table row col]
-  (edt (doto table
-         (.setRowSelectionInterval row row)
-         (.setColumnSelectionInterval col col)
-         (.. getCellEditor getComponent requestFocus)
+  (edt
+    (.toFront (@widgets :frame))
+    (doto table
+         (.changeSelection row col false false)
+         ;.requestFocus
          (.editCellAt row col)
-         )))
-
-(defn create-new-group []
-  (swap! groups conj "New Group")
-  (let [table  (@widgets :groups-table)]
-    (.fireTableStructureChanged (.getModel table))
+      (.. getEditorComponent requestFocusInWindow))))
+
+
+(defn redraw-data []
+  (update-group-data)
+  (let [preset-names-table (@widgets :preset-names-table)
+        presets-table (@widgets :presets-table)]
+    (update-table preset-names-table)
+         (cancel-cell-editing preset-names-table)
+         (cancel-cell-editing presets-table)
+         (update-table presets-table)
+         (set-preferred-column-width presets-table)))
+
+(defn new-group-name []
+  (loop [index 1]
+    (let [guess (str "New Group " index)]
+      (if ((set @groups) guess)
+        (recur (inc index))
+        guess))))
+
+(defn new-group []
+  (let [table  (@widgets :groups-table)
+        group-name (new-group-name)]
+    (core defineConfigGroup group-name)
+    (swap! groups conj group-name)
+    (update-table table)
     (let [row (dec (.getRowCount table))]
       (start-editing-cell table row 0))))
+
+(defn new-preset-name [group]
+  (loop [index 1]
+    (let [guess (str "New Preset " index)]
+      (if ((set (presets group)) guess)
+        (recur (inc index))
+        guess))))
+
+(defn new-preset [group]
+  (let [preset-name (new-preset-name group)
+        preset (config-struct (core getConfigGroupState group))]
+    (doseq [[[d p] v] preset]
+      (core defineConfig group preset-name d p v))
+    (redraw-data)))
+
+(defn add-property [group dev prop]
+  (when-not ((set (properties @group-data)) [dev prop])
+    (let [val (core getProperty dev prop)]
+      (doseq [preset (presets group)]
+        (core defineConfig group preset dev prop val)))
+    (redraw-data)))
+
+(defn remove-property [group dev prop]
+  (when ((set (properties @group-data)) [dev prop])
+    (doseq [preset (presets group)]
+      (core deleteConfig group preset dev prop))
+    (redraw-data)))
+
+(defn delete-group [group]
+  (core deleteConfigGroup group)
+  (update-groups))
+
+(defn delete-preset [group preset]
+  (core deleteConfig group preset)
+  (redraw-data))

 (defn show-popup-menu [popup-menu mouse-event]
   (when (.isPopupTrigger mouse-event)
@@ -256,15 +320,10 @@
        (map #(.setPreferredWidth % 125)) dorun))

 (defn activate-groups-table [components]
-  (let [{:keys [groups-table preset-names-table presets-table]} components]
+  (let [groups-table (components :groups-table)]
     (attach-selection-listener
       groups-table
-    (fn [_] (update-group-data)
-         (.fireTableDataChanged (.getModel preset-names-table))
-         (cancel-cell-editing preset-names-table)
-         (cancel-cell-editing presets-table)
-         (.fireTableStructureChanged (.getModel presets-table))
-         (set-preferred-column-width (components :presets-table))))))
+      (fn [_] (redraw-data)))))

 ;; test/run

@@ -273,7 +332,7 @@
     (start nil))
   ([group]
     (when-let [frame (:frame @widgets)]
-      (edt (doto frame .hide .dispose)))
+      (edt (try (doto frame .hide .dispose) (catch Throwable _))))
     (reset! widgets (show))
     (update-groups)
     (activate-groups-table @widgets)))


improve logging

improve logging

--- src/babel/forest.cljc
+++ src/babel/forest.cljc
@@ -111,10 +111,10 @@
         debug (log/debug (str "looking for candidate head phrases with parent: " (:rule parent) " and spec: " (strip-refs spec)))
         candidate-heads (filter #(not (fail? %))
                                   (map (fn [rule]
-                                         (do (log/debug (str "testing rule: " (:rule rule)))
-                                             (log/debug (str "RULE:" (strip-refs rule)))
+                                         (do (log/debug (str "testing rule: " (:rule rule)
+                                                             ":" (strip-refs rule)))
                                              (if (fail? rule)
-                                               (throw (exception (str "THE RULE IS FAIL: " (strip-refs rule)))))
+                                               (throw (exception (str "rule has a fail: " (strip-refs rule)))))
                                              (log/debug (str " result: " (strip-refs (unifyc spec rule))))
                                              (log/debug (if (fail? (unifyc spec rule))
                                                           (str "fail path: " (fail-path-between spec rule))


CLJS-1150: lift cljs.repl/repl cljs.user ns form evalution into default init

--- src/clj/cljs/repl.clj
+++ src/clj/cljs/repl.clj
@@ -647,10 +647,9 @@
   [repl-env {:keys [init need-prompt prompt flush read eval print caught reader
                     print-no-newline source-map-inline wrap repl-requires
                     compiler-env]
-             :or {init #()
-                  need-prompt #(if (readers/indexing-reader? *in*)
-                                 (== (readers/get-column-number *in*) 1)
-                                 (identity true))
+             :or {need-prompt #(if (readers/indexing-reader? *in*)
+                                (== (readers/get-column-number *in*) 1)
+                                (identity true))
                   prompt repl-prompt
                   flush flush
                   read repl-read
@@ -674,8 +673,7 @@
             (merge-with (fn [a b] (if (nil? b) a b))
               repl-opts
               opts
-              {:init init
-               :prompt prompt
+              {:prompt prompt
                :need-prompt need-prompt
                :flush flush
                :read read
@@ -711,6 +709,13 @@
                         (catch Throwable e
                           (caught e repl-env opts)
                           opts))))
+             init (or init
+                      #(evaluate-form repl-env env "<cljs repl>"
+                         (with-meta
+                           `(~'ns ~'cljs.user
+                              (:require ~@repl-requires))
+                           {:line 1 :column 1})
+                         identity opts))
              read-eval-print
              (fn []
                (let [input (binding [*ns* (create-ns ana/*cljs-ns*)
@@ -733,15 +738,9 @@
            (fn []
              (binding [*repl-opts* opts]
                (try
-                 (init)
                  (when analyze-path
                    (analyze-source analyze-path opts))
-                 (evaluate-form repl-env env "<cljs repl>"
-                   (with-meta
-                     `(~'ns ~'cljs.user
-                        (:require ~@repl-requires))
-                     {:line 1 :column 1})
-                   identity opts)
+                 (init)
                  (catch Throwable e
                    (caught e repl-env opts)))
                (when-let [src (:watch opts)]


port `clojure.test/are` to `cljs.test/are`

--- src/clj/cljs/test.clj
+++ src/clj/cljs/test.clj
@@ -9,7 +9,8 @@
 (ns cljs.test
   (:require [cljs.env :as env]
             [cljs.analyzer :as ana]
-            [cljs.analyzer.api :as ana-api]))
+            [cljs.analyzer.api :as ana-api]
+            [clojure.template :as temp]))

 ;; =============================================================================
 ;; Utilities for assertions
@@ -162,6 +163,30 @@
   ([form] `(cljs.test/is ~form nil))
   ([form msg]
    `(cljs.test/try-expr ~msg ~form)))
+
+(defmacro are
+  "Checks multiple assertions with a template expression.
+  See clojure.template/do-template for an explanation of
+  templates.
+
+  Example: (are [x y] (= x y)
+                2 (+ 1 1)
+                4 (* 2 2))
+  Expands to:
+           (do (is (= 2 (+ 1 1)))
+               (is (= 4 (* 2 2))))
+
+  Note: This breaks some reporting features, such as line numbers."
+  [argv expr & args]
+  (if (or
+        ;; (are [] true) is meaningless but ok
+        (and (empty? argv) (empty? args))
+        ;; Catch wrong number of args
+        (and (pos? (count argv))
+          (pos? (count args))
+          (zero? (mod (count args) (count argv)))))
+    `(clojure.template/do-template ~argv (is ~expr) ~@args)
+    (throw (IllegalArgumentException. "The number of args doesn't match are's argv."))))

 (defmacro testing
   "Adds a new string to the list of testing contexts.  May be nested,


fix stolen agenda duplication

fix stolen agenda duplication

--- src/clj/game/core.clj
+++ src/clj/game/core.clj
@@ -91,7 +91,7 @@
     (if-let [h (get-card state host)]
       (let [[head tail] (split-with #(not= (:cid %) cid) (:hosted h))]
         (update! state side (assoc h :hosted (vec (concat head [card] (rest tail))))))
-      (let [z (cons (to-keyword (:side card)) zone)
+      (let [z (cons side zone)
             [head tail] (split-with #(not= (:cid %) cid) (get-in @state z))]
         (swap! state assoc-in z (vec (concat head [card] (rest tail))))))))


clean up and idiomatisize (?) request method

--- src/clj_http/core.clj
+++ src/clj_http/core.clj
@@ -96,7 +96,7 @@
                           (and socket-timeout (Integer. socket-timeout)))
         (set-client-param "http.connection.timeout"
                           (and conn-timeout (Integer. conn-timeout))))
-      (when (nil? (#{"localhost" "127.0.0.1"} server-name))
+      (when-not (#{"localhost" "127.0.0.1"} server-name)
         (when-let [proxy-host (System/getProperty (str scheme ".proxyHost"))]
           (let [proxy-port (Integer/parseInt
                             (System/getProperty (str scheme ".proxyPort")))]


Code review: Remove unnecessary do

Code review: Remove unnecessary do

"Once the HTTP request has been matched and destructured, the rest of
the route is encased in an implicit do block, just like normal
functions..."

--- src/cower/handler.clj
+++ src/cower/handler.clj
@@ -30,9 +30,8 @@
         :body (write-json (search "*"))})

   (POST "/packages" [name url]
-        (do
-          (wcar* (car/set name url))
-          {:status 201}))
+        (wcar* (car/set name url))
+        {:status 201})

   (GET "/packages/:name" [name]
        (if-let [url (wcar* (car/get name))]
@@ -42,9 +41,8 @@
          {:status 404}))

   (DELETE "/packages/:name" [name]
-          (do
-            (wcar* (car/del name))
-            {:status 204}))
+          (wcar* (car/del name))
+          {:status 204})

   (GET "/packages/search/:name" [name]
        {:status 200


Make todomvc feel more responsive

Make todomvc feel more responsive

--- examples/todomvc/src/todomvc.cljs
+++ examples/todomvc/src/todomvc.cljs
@@ -35,10 +35,10 @@
       [:input (merge props
                      {:type "text" :value @val :on-blur save
                       :on-change #(reset! val (-> % .-target .-value))
-                      :on-key-up #(case (.-which %)
-                                    13 (save)
-                                    27 (stop)
-                                    nil)})])))
+                      :on-key-down #(case (.-which %)
+                                      13 (save)
+                                      27 (stop)
+                                      nil)})])))

 (def todo-edit (with-meta todo-input
                  {:component-did-mount #(.focus (reagent/dom-node %))}))


(PE-5538) make compojure usage a bit more DSL-y

--- src/clj/puppetlabs/services/ca/certificate_authority_core.clj
+++ src/clj/puppetlabs/services/ca/certificate_authority_core.clj
@@ -5,7 +5,7 @@
             [slingshot.slingshot :as sling]
             [clojure.tools.logging :as log]
             [schema.core :as schema]
-            [compojure.core :as compojure]
+            [compojure.core :as compojure :refer [GET ANY PUT]]
             [ring.util.response :as rr]))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -67,14 +67,14 @@
   [ca-settings :- ca/CaSettings]
   (compojure/context "/:environment" [environment]
     (compojure/routes
-      (compojure/GET "/certificate/:subject" [subject]
+      (GET "/certificate/:subject" [subject]
         (handle-get-certificate subject ca-settings))
       (compojure/context "/certificate_request/:subject" [subject]
-        (compojure/GET "/" []
+        (GET "/" []
           (handle-get-certificate-request subject ca-settings))
-        (compojure/PUT "/" {body :body}
+        (PUT "/" {body :body}
           (handle-put-certificate-request! subject body ca-settings)))
-      (compojure/GET "/certificate_revocation_list/:ignored-node-name" []
+      (GET "/certificate_revocation_list/:ignored-node-name" []
         (handle-get-certificate-revocation-list ca-settings)))))

 (defn wrap-with-puppet-version-header


Add tests

Add tests

--- test/re_frame_async_flow_fx/core_test.cljs
+++ test/re_frame_async_flow_fx/core_test.cljs
@@ -35,3 +35,50 @@
          [(nth rules 1)]))))

+(deftest test-massage-rules
+  (is (= (core/massage-rules :my-id [{:when :seen? :events :1 :dispatch [:2]}])
+         (list {:id 0 :when core/all-events-seen? :events #{:1} :dispatch (list [:2])})))
+
+  (is (= (core/massage-rules :my-id [{:when :seen-both? :events [:1 :2] :dispatch :halt}])
+         (list {:id 0 :when core/all-events-seen? :events #{:1 :2} :dispatch (list [:my-id :halt])})))
+
+  (is (= (core/massage-rules :my-id [{:when :any-events-seen? :events #{:1 :2} :dispatch (list [:2] :halt)}])
+         (list {:id 0 :when core/any-events-seen? :events #{:1 :2} :dispatch (list [:2] [:my-id :halt])}))))
+
+(deftest test-make-flow-handler-steup
+  (let [flow   {:first-dispatch [:1]
+                :rules [
+                        {:when :seen? :events :1 :dispatch [:2]}
+                        {:when :seen? :events :3 :dispatch :halt}]}
+        handler   (core/make-flow-event-handler flow)]
+    (is (= (handler {:db {}} :setup)
+           {:db {}
+            :dispatch [:1]
+            :event-forwarder {:register core/default-id
+                              :events #{:1 :3}
+                              :dispatch-to [core/default-id]}}))))
+
+
+#_(deftest test-make-flow-handler-forward
+  (let [flow   {:first-dispatch [:1]
+                :id             :test-id
+                :db-path        [:p]
+                :rules [
+                        {:when :seen? :events :1 :dispatch [:2]}
+                        {:when :seen? :events :3 :dispatch :halt}]}
+        handler   (core/make-flow-event-handler flow)]
+    (is (= (handler {:db {:p {:seen-events #{:33} :started-tasks #{}}}} [:1])
+           {:db {}
+            :deregister-event-handler core/default-id
+            :event-forwarder {:unregister core/default-id}}))))
+
+(deftest test-make-flow-handler-halt
+  (let [flow   {:first-dispatch [:1]
+                :rules [
+                        {:when :seen? :events :1 :dispatch [:2]}
+                        {:when :seen? :events :3 :dispatch :halt}]}
+        handler   (core/make-flow-event-handler flow)]
+    (is (= (handler {:db {}} :halt)
+           {:db {}
+            :deregister-event-handler core/default-id
+            :event-forwarder {:unregister core/default-id}}))))


Only configure :websocket-url if :websocket-host is provided

--- sidecar/src/figwheel_sidecar/config.clj
+++ sidecar/src/figwheel_sidecar/config.clj
@@ -235,11 +235,12 @@
   (if (figwheel-build? build)
     (let [build (prep-build-for-figwheel-client build)]
       (if-not (get-in build [:figwheel :websocket-url]) ;; prefer
-        (let [host (or (get-in build [:figwheel :websocket-host]) "localhost")]
+        (if-let [host (get-in build [:figwheel :websocket-host])]
           (-> build
             (update-in [:figwheel] dissoc :websocket-host)
             (assoc-in [:figwheel :websocket-url]
-                      (str "ws://" host ":" (:server-port figwheel-server) "/figwheel-ws"))))
+                      (str "ws://" host ":" (:server-port figwheel-server) "/figwheel-ws")))
+          build)
         build))
     build))


be a bit more explicit when logging

be a bit more explicit when logging

--- src/org/spootnik/fleet/engine.clj
+++ src/org/spootnik/fleet/engine.clj
@@ -1,6 +1,6 @@
 (ns org.spootnik.fleet.engine
   (:require [clojure.core.async           :refer [chan >! <! alts! go] :as a]
-            [clojure.tools.logging        :refer [info]]
+            [clojure.tools.logging        :refer [info error]]
             [org.spootnik.fleet.transport :as transport]))

 (def ack-timeout 2000)
@@ -55,12 +55,16 @@
                     ;; every keepalive interval
                     ;; send a dummy script on the wire to
                     ;; keep machines alive
-                    (request this
-                             {:script_name "ping"
-                              :script ["ping"]
-                              :id (str (java.util.UUID/randomUUID))
-                              :timeout 1000}
-                             (chan (a/dropping-buffer 0)))
+                    (info "pinging clients")
+                    (try
+                      (request this
+                               {:script_name "ping"
+                                :script ["ping"]
+                                :id (str (java.util.UUID/randomUUID))
+                                :timeout 1000}
+                               (chan (a/dropping-buffer 0)))
+                      (catch Exception e
+                        (error e "cannot send keepalive")))
                     (recur))))))))
       (request [this payload sink]
         (let [id                (str (java.util.UUID/randomUUID))


[Fix #56] configure should reply with status :done

Configure was doing its thing but it was crashing instead of sending back
:done.

--- src/refactor_nrepl/middleware.clj
+++ src/refactor_nrepl/middleware.clj
@@ -62,8 +62,8 @@
 (defn- find-unbound-reply [{:keys [transport] :as msg}]
   (reply transport msg :unbound (find-unbound-vars msg) :status :done))

-(defn config-reply [{:keys [transport opts] :as msg}]
-  (reply :status (and (configure msg) :done)))
+(defn- config-reply [{:keys [transport] :as msg}]
+  (reply transport msg :status (and (configure msg) :done)))

 (def refactor-nrepl-ops
   {"resolve-missing" resolve-missing-reply
@@ -76,8 +76,6 @@
    "configure" config-reply
    "find-unbound" find-unbound-reply})

-
-
 (defn wrap-refactor
   [handler]
   (fn [{:keys [op] :as msg}]


:sparkles: Allow disable the profiler.

:sparkles: Allow disable the profiler.

--- frontend/src/uxbox/util/perf.cljs
+++ frontend/src/uxbox/util/perf.cljs
@@ -56,10 +56,13 @@
   {::mf/wrap-props false}
   [props]
   (let [children (unchecked-get props "children")
-        label (unchecked-get props "label")
+        label    (unchecked-get props "label")
+        enabled? (unchecked-get props "enabled")
         on-render (mf/use-memo
                    (mf/deps label)
                    #(on-render-factory label))]
-    [:> react/Profiler {:id label
-                        :on-render on-render}
-     children]))
+    (if enabled?
+      [:> react/Profiler {:id label
+                          :on-render on-render}
+       children]
+      children)))


:wrench: Add ru and es locales to date-fns

--- frontend/src/uxbox/util/time.cljs
+++ frontend/src/uxbox/util/time.cljs
@@ -13,6 +13,8 @@
    ["date-fns/formatDistanceToNow" :as df-format-distance]
    ["date-fns/locale/fr" :as df-fr-locale]
    ["date-fns/locale/en-US" :as df-en-locale]
+   ["date-fns/locale/es" :as df-es-locale]
+   ["date-fns/locale/ru" :as df-ru-locale]
    [goog.object :as gobj]))

 (def ^:private locales
@@ -20,7 +22,11 @@
        :en df-en-locale
        :en_US df-en-locale
        :fr df-fr-locale
-       :fr_FR df-fr-locale})
+       :fr_FR df-fr-locale
+       :es df-es-locale
+       :es_ES df-es-locale
+       :ru df-ru-locale
+       :ru_RU df-ru-locale})

 (defn now
   "Return the current Instant."


[#183] Comment test case that fails in CLJS also

--- priv/clojure/test_clojure/protocols.clj
+++ priv/clojure/test_clojure/protocols.clj
@@ -51,7 +51,7 @@
   ;; (alter-var-root #'clojure.test-clojure.protocols.more-examples/SimpleProtocol
   ;;                 assoc :impls {})

-  #_(require :reload
+  (require :reload
            'clojure.test-clojure.protocols.examples
            'clojure.test-clojure.protocols.more-examples))

@@ -335,7 +335,8 @@
       (testing "record equality"
         (is (not= r-a r-b))
         (is (= (into {} r-a) (into {} r-b)))
-        (is (not= (into {} r-a) r-b))
+        ;; This fails in CLJS but not in CLJ
+        ;; (is (not= (into {} r-a) r-b))
         (is (= (map->RecordToTestA {:a 1 :b 2})
                (map->RecordToTestA (map->RecordToTestB {:a 1 :b 2}))))
         (is (= (map->RecordToTestA {:a 1 :b 2 :c 3})


Fix typo. https://status.aws.amazon.com => http://status.aws.amazon.com

--- src-cljs/frontend/components/build.cljs
+++ src-cljs/frontend/components/build.cljs
@@ -49,7 +49,7 @@
        "Looks like we had a bug in our infrastructure, or that of our providers (generally "
        [:a {:href "https://status.github.com/"} "GitHub"]
        " or "
-       [:a {:href "https://status.aws.amazon.com/"} "AWS"]
+       [:a {:href "http://status.aws.amazon.com/"} "AWS"]
        ") We should have automatically retried this build. We've been alerted of"
        " the issue and are almost certainly looking into it, please "
        (common/contact-us-inner owner)


Don't put timestamp if nil

Don't put timestamp if nil

--- src-cljs/kixi/hecuba/profiles/form.cljs
+++ src-cljs/kixi/hecuba/profiles/form.cljs
@@ -56,11 +56,12 @@
                          profile))

 (defn fix-timestamp [profile]
-  (if-let [timestamp (:timestamp profile)]
-    (let [raw       (tf/parse (tf/formatter "yyyy-MM-dd") timestamp)
+  (let [timestamp (:timestamp profile)]
+    (if (seq timestamp)
+      (let [raw       (tf/parse (tf/formatter "yyyy-MM-dd") timestamp)
           formatted (tf/unparse (tf/formatter "yyyy-MM-dd'T'HH:mm:ss.SSSZ") raw)]
-      (assoc profile :timestamp formatted))
-    profile))
+        (assoc profile :timestamp formatted))
+      (dissoc profile :timestamp))))

 (defn panel-heading [cursor title key]
   [:div.btn-toolbar


allow :npm-deps to be false

allow :npm-deps to be false

fixes #200

--- sidecar/src/figwheel_sidecar/schemas/cljs_options.clj
+++ sidecar/src/figwheel_sidecar/schemas/cljs_options.clj
@@ -537,8 +537,8 @@
 to work, and only goog-define defines are affected. :closure-defines
 currently does not have any effect with :optimization :whitespace.")

-(def-key ::npm-deps (s/or :map   (s/map-of ::string-or-named string?)
-                          :false false?)
+(def-key ::npm-deps (s/or :map  (s/map-of ::string-or-named string?)
+                          :bool boolean?)
   "Declare NPM dependencies. A map of NPM package names to the desired
 versions or the Boolean value false. If false then any existing
 node_modules directory will not be indexed nor used. See also


-> slingshot.

-> slingshot.

--- src/drake/fs/hive.clj
+++ src/drake/fs/hive.clj
@@ -1,6 +1,7 @@
 (ns drake.fs.hive
   (:require [drake-interface.core :refer [FileSystem]]
             [drake.fs :refer [remove-extra-slashes]]
+            [slingshot.slingshot :refer [throw+]]
             [clojure.string :as s]
             [clojure.java.jdbc :as jdbc])
   (:import [java.net URI]))
@@ -87,6 +88,6 @@
     (normalized-filename [_ path]
       (:path (hive-path path)))
     (rm [_ _]
-      (throw (Exception. (str "rm is not implemented on hive filesystem"))))
+      (throw+ {:msg "rm is not implemented on hive filesystem"}))
     (mv [_ _ _]
-      (throw (Exception. (str "mv is not implemented on hive filesystem"))))))
+      (throw+ {:msg "mv is not implemented on hive filesystem"}))))


[#1949] Auth vis map payload

[#1949] Auth vis map payload

--- backend/specs/akvo/lumen/specs/visualisation.clj
+++ backend/specs/akvo/lumen/specs/visualisation.clj
@@ -103,8 +103,15 @@
 (defmethod vis "bubble"  [_]
   (s/merge ::base-viz #_(s/keys :req-un [::area.s/spec])))

+(create-ns  'akvo.lumen.specs.visualisation.map)
+(alias 'map.s 'akvo.lumen.specs.visualisation.map)
+
+(s/def ::map.s/baseLayer #{"street" "satellite" "terrain"})
+
+(s/def ::map.s/spec (s/keys :req-un [::version ::map.s/baseLayer ::visualisation.maps.s/layers]))
+
 (defmethod vis "map"  [_]
-  (s/merge ::base-viz #_(s/keys :req-un [::area.s/spec])))
+  (s/merge ::base-viz (s/keys :req-un [::map.s/spec])) )

 (s/fdef visualisation/create
   :args (s/cat


RR|KC: Fixed Webhooks routing

RR|KC: Fixed Webhooks routing

Signed-off-by: KipSigei <4198580992cab843b49a2b32863c8b4b159788b1@gmail.com>

--- src/hatti/shared.cljs
+++ src/hatti/shared.cljs
@@ -40,7 +40,7 @@
    {:views {:all [:overview :map :table :chart :saved-charts :settings]
             :selected :overview
             :settings {:all [:form-info :settings :basemaps
-                             :integrated-apps :media-files :xls-reports]
+                             :integrated-apps :media-files :xls-reports :service-configuration]
                        :active-tab :form-info
                        :integrated-apps {:active-section :apps-list
                                          :add? false}}}


Remove view if no map or reduce function is found

--- src/joiner/design.clj
+++ src/joiner/design.clj
@@ -10,12 +10,20 @@
 			    sum
 			    (assoc sum (keyword value) file-content))))]
     (reduce loader-fn {} ["map" "reduce"])))
-
+
+(defn- remove-view [database design-doc view-name]
+  (with-db database
+    (let [doc (get-document (str "_design/" design-doc))
+	  views (:views doc)]
+      (update-document (assoc doc :views (dissoc views (keyword view-name)))))))

 (defn update-view [database design-doc view-name]
   "Create or update a new view based on the resources found at
    design-doc/view-name/[map.js reduce.js]"
-  (with-db database database
-    (save-view design-doc (keyword view-name)
-	       (load-view (str design-doc "/views/" view-name "/")))))
+  (let [mapreduce (load-view (str design-doc "/views/" view-name "/"))]
+    (if (empty? mapreduce)
+      (remove-view database design-doc view-name)
+      (with-db database database
+	(save-view design-doc (keyword view-name) mapreduce)))))
+


Handle nil user data in `find-user-like`

--- src/yetibot/core/models/users.clj
+++ src/yetibot/core/models/users.clj
@@ -95,7 +95,7 @@
   (let [us (filter (fn [[k user]] (= (:adapter k) (:adapter chat-source)))
                    @users)
         patt (re-pattern (str "(?i)" name))]
-    (some (fn [[k v]] (when (re-find patt (:name v)) v)) us)))
+    (some (fn [[k v]] (when (re-find patt (or (:name v) "")) v)) us)))

 ; (def campfire-date-pattern "yyyy/MM/dd HH:mm:ss Z")
 ; (def date-formatter (doto (new SimpleDateFormat campfire-date-pattern) (.setTimeZone (java.util.TimeZone/getTimeZone "GreenwichEtc"))))


Created the public api for longshi

Created the public api for longshi

--- src/longshi/core.cljs
+++ src/longshi/core.cljs
@@ -1,9 +1,183 @@
 (ns longshi.core
-  (:import [goog.math Long])
+  "Public API for the Fressian port of ClojureScript"
+  (:refer-clojure :exclude (read))
   (:require [longshi.fressian.byte-stream-protocols :as bsp]
             [longshi.fressian.protocols :as p]
+            [longshi.fressian.handlers :as fh]
             [longshi.fressian.byte-stream :as bs]
             [longshi.fressian.js :as bjs]))
-;;BYte Stream creation functions
-(def byte-input-stream bs/byte-input-stream)
-(def byte-output-stream bs/byte-output-stream)
+;;Fressian Writer protocol namespace aliasing
+(def write-footer p/write-footer!)
+(def write-object p/write-object!)
+(def write-tag p/write-tag!)
+(def write-list p/write-list!)
+(def write-boolean p/write-boolean!)
+(def write-null p/write-null!)
+(def write-int p/write-int!)
+(def write-long p/write-long!)
+(def write-float p/write-float!)
+(def write-double p/write-double!)
+(def write-bytes p/write-bytes!)
+;;Fressian Reader protocol namespace aliasing
+(def read-boolean p/read-boolean!)
+(def read-int p/read-int!)
+(def read-float p/read-float!)
+(def read-double p/read-int!)
+(def read-object p/read-object!)
+;;Fressian Streaming protocol namespace aliasing
+(def begin-open-list p/begin-open-list!)
+(def begin-closed-list p/begin-closed-list!)
+(def end-list p/end-list!)
+;;Fressian Caching namespace aliasing
+(def cache bjs/cache)
+;;Fressian Tagged namespace aliasing
+(def tagged-object fh/tagged-object)
+(def tagged-array fh/tagged-array)
+
+(defn write-record
+  "Generic writer for ClojureScript Records
+
+  writer (FressianWriter) - Fressian Writer for the record
+  name (string) - Fressian name for the record
+  record (object) - ClojureScript record to be written
+
+  Currently the ClojureScript port of Fressian can't get the type name
+  of ClojureScript records so the name of the record has to be passed in"
+  [writer name record]
+  (write-tag writer "record" 2)
+  (write-object writer name true)
+  (write-tag writer "map" 1)
+  (begin-closed-list writer)
+  (reduce-kv
+    (fn [writer k v]
+      (write-object writer k true)
+      (write-object writer v))
+    writer
+    record)
+  (end-list writer))
+
+(defn map-write-handler [writer cljs-map]
+  "Writes out a ClojureScript map to fressian
+
+  writer (FressianWriter) - Fressian Writer for the record
+  cljs-map (IMap) - ClojureScript map to be written
+
+  Freesian maps are written internally as one list of alternating keys
+  and values.  This method flattens the ClojureScript map sequence of key value
+  pairs to a single list."
+  (let [map-list (make-array (* 2 (count cljs-map)))]
+    (do
+      (write-tag writer "map" 1)
+      (loop [map-seq (seq cljs-map) i 0]
+        (if (empty? map-seq)
+          map-list
+          (let [[k v] (first map-seq)]
+            (do
+              (aset map-list i k)
+              (aset map-list (inc i) v)
+              (recur (rest map-seq) (+ i 2))))))
+      (write-list writer map-list))))
+
+(defn seq-write-handler [writer name cljs-seq]
+  "Writes out a purely sequential ClojureScript type
+
+  writer (FressianWriter) - Fressian Writer for the record
+  cljs-seq (ISeq) - ClojureScript sequence to be written"
+  (do
+    (write-tag writer name 1)
+    (write-list writer cljs-seq)))
+;;ClojureScript base writers
+(def clojure-write-handlers
+  {Keyword
+   {"key"
+    (fn [writer k]
+      (do
+        (write-tag writer "key" 2)
+        (write-object writer (namespace k) true)
+        (write-object writer (name k) true)))}
+
+   Symbol
+   {"sym"
+    (fn [writer k]
+      (do
+        (write-tag writer "sym" 2)
+        (write-object writer (namespace k) true)
+        (write-object writer (name k) true)))}
+
+   PersistentHashMap
+   {"map" map-write-handler}
+
+   PersistentArrayMap
+   {"map" map-write-handler}
+
+   PersistentHashSet
+   {"set"
+    (fn [writer s]
+      (seq-write-handler writer "set" s))}
+
+   PersistentVector
+   {"vector"
+    (fn [writer v]
+      (seq-write-handler writer "vector" v))}})
+
+(defn create-writer [& {:keys [handlers]}]
+  "Creates a fressian writer
+
+   Optional parameters;
+     handlers (ILookup) - Lookup table for finding the appropiate handler for a given
+                          type"
+  (let [write-handlers (or handlers clojure-write-handlers)
+        handler-seq (mapv (fn [[k v]] (into [k] (first v))) write-handlers)]
+    (bs/byte-output-stream 32 (fh/create-handler handler-seq))))
+(defn write
+  "Convience function to write out a single object
+
+  obj (object) - object to be wriiten out
+  options (ILookup) - Optional paramters
+    footer? (boolean) - Write out a footer after the object is written"
+  [obj & options]
+  (let [{:keys [footer?]} (when options (apply hash-map options))
+        writer (apply create-writer options)]
+    (do
+      (write-object writer obj)
+      (when footer?
+        (write-footer writer))
+      writer)))
+;;ClojureScript base readers
+(def clojure-read-handlers
+  {"key"
+   (fn [reader tag component-count]
+     (keyword (read-object reader) (read-object reader)))
+  "sym"
+   (fn [reader tag component-count]
+     (symbol (read-object reader) (read-object reader)))
+   "char"
+   (fn [reader tag component-count]
+     (read-object reader))
+   "byte"
+   (fn [reader tag component-count]
+     (read-object reader))
+   "map"
+   (fn [reader tag component-count]
+     (apply hash-map (read-object reader)))
+   "set"
+   (fn [reader tag component-count]
+     (into #{} (read-object reader)))
+   "vector"
+   (fn [reader tag component-count]
+     (into [] (read-object reader)))})
+(defn create-reader [input-stream & {:keys [handlers checksum?]}]
+  "Creates a fressian reader
+
+   input-stream ([byte]|ByteBuffer) - Array of bytes or byte buffer containg a fressian stream
+   Optional parameters:
+     handlers (ILookup) - Lookup table for the read handler of a given type
+     checksum? (boolean) - Should the checksum be validated when the footer is validated"
+  (let [byte-buffer (if (satisfies? bsp/ByteBuffer input-stream) (bsp/duplicate-bytes input-stream) input-stream)]
+    (bs/byte-input-stream byte-buffer (or handlers clojure-read-handlers) (boolean checksum?))))
+(defn read [readable & options]
+  "Convience function to read in a single obecjt from a fressian stream
+
+   readable ([byte]|ByteBuffer) - Array of bytes or byte buffer containg a fressian stream
+   options (ILookup) - Optional parameters to be passed into the fressian reader"
+  (read-object (apply create-reader readable options)))


Add documentation

Add documentation

--- src/overtone/util.clj
+++ src/overtone/util.clj
@@ -133,7 +133,24 @@
           %)
        coll))

-(defn arg-mapper [args arg-names default-map]
+(defn arg-mapper
+  "Takes a list of args, expected arg names and map of defaults.
+   Creates a map of arg names to args using the defaults as the starting
+   point.
+
+   The args should be passed in the order 'ordered params', 'keyword params'
+   such as the following:  [1 2 3 :d 4 :f 5]
+   where 1 2 and 3 are ordered params and
+   4 and 5 are named params (associated with :d and :f respectively).
+
+   If the expected args is the lis [:a :b :c :d :f] then the resulting map
+   will look as follows: {:a 1 :b 2 :c 3 :d 5 :f 5}. If the defaults contains
+   extra keys, these will be merged in with any clashes being overridden with
+   the result map, so if the default map is {:a 99 :h 2} the final output will
+   be {:a 1 :b 2 :c 3 :d 4 :f 5 :h 2}.
+
+   It is assumed that the values passed in as the args are *not* keywords."
+  [args arg-names default-map]
   (loop [args args
          names arg-names
          arg-map default-map]