The db assigns ids for the archive container

--- src/mdr2/archive.clj
+++ src/mdr2/archive.clj
@@ -45,8 +45,7 @@
    "/var/spool/agadir")

 (def ^:private default-job
-  {:id 1
-   :verzeichnis ""
+  {:verzeichnis ""
    :archivar "NN"
    :abholer "NN"
    :aktion "save"
@@ -77,8 +76,9 @@
   archiving process from the point of view of the production system."
   [production]
   (let [new-job
-        {:id (container-id production)
-         :verzeichnis (container-path production)
+        {:verzeichnis (container-id production)
+         ;; :id (container-id production)
+         ;; :verzeichnis (container-path production)
          ;; if there is a cdimage attached to this production then we
          ;; need to add some magic incantations to get this properly
          ;; archived


Update data.cljs

Update data.cljs

--- src/prais2/data.cljs
+++ src/prais2/data.cljs
@@ -690,13 +690,13 @@
      [:.data-summary
       [:p {:key 1} "The hospital performed "
        [:b (:n-ops selected-row) "  operations. "]]
-      [:p {:key 2} "After 30 days there were "
+      [:p {:key 2} "Measured 30 days after surgery, "
        [:b {:key 1} (:n-survivors selected-row) " survivors "]
        "and "
        [:b {:key 2} (:n-deaths selected-row) " deaths"]
        " had been recorded. "]
       [:p {:key 3}
-       "The observed 30 day survival rate was " [:b (:survival-rate selected-row) "%"] "."]
+       "The hospital's 30 day survival rate was " [:b (:survival-rate selected-row) "%"] "."]
       ])))

 (rum/defc hospital-header < rum/static


Update string to use consistent styling.

--- src/caesium/crypto/generichash.clj
+++ src/caesium/crypto/generichash.clj
@@ -69,7 +69,7 @@
                     personal (or personal (bb/alloc blake2b-personalbytes))]
                 (b/call! blake2b-salt-personal buf msg key salt personal))
               (b/call! blake2b buf msg key)))
-     (throw (RuntimeException. "Error in blake2b hashing"))
+     (throw (RuntimeException. "Error in BLAKE2b hashing"))
      buf)))

 (defn blake2b


Switch to the huffman tranducer to decode

--- src/clj/algorithms_clj/huffman.clj
+++ src/clj/algorithms_clj/huffman.clj
@@ -75,51 +75,28 @@
 ;; Decoding
 ;; -----------------------------------------------------------

-(defn huffman-decoder
+(defn ^:private huffman-xf
   "Transducer step function to decode a huffman stream of values"
   [huffman-tree]
   (fn [xf]
-    (let [curr-branch (volatile! huffman-tree)
-          is-leaf #(= 1 (-> % :values count))
-          leaf-val #(-> % :values first)]
+    (let [curr-branch (volatile! huffman-tree)]
       (fn step-fn
         ([] (xf))
         ([result] (xf result))
         ([result input]
-          (let [{:keys [lhs rhs]} @curr-branch]
-            (vreset! curr-branch (if (= 0 input) lhs rhs))
-            (if (is-leaf @curr-branch)
-              (let [val (leaf-val @curr-branch)]
-                (do
-                 (vreset! curr-branch huffman-tree)
-                 (xf result val)))
+          (let [{:keys [lhs rhs]} @curr-branch
+                next-branch (if (= 0 input) lhs rhs)
+                values (:values next-branch)]
+            (vreset! curr-branch next-branch)
+            (if (= 1 (count values))
+              (do (vreset! curr-branch huffman-tree)
+                  (xf result (first values)))
               result)))
         ))))

-(defn decode-with-xf
+(defn decode
   [huffman-tree inputs]
-  (transduce (huffman-decoder huffman-tree) conj [] inputs))
-
-
-(defn ^:private decode-one ;; TODO - Could be made a step function of a transducer
-  [{:keys [values lhs rhs]} bits]
-  (cond
-    (= 1 (count values)) [(first values) bits]
-    (= 0 (first bits)) (recur lhs (rest bits))
-    (= 1 (first bits)) (recur rhs (rest bits))
-    ))
-
-(defn decode
-  "Encode a stream of values with the huffman tree provided as first parameter"
-  [huffman-tree inputs]
-  (loop [bits inputs
-         result []]
-    (if (empty? bits)
-      result
-      (let [[c tail-bits] (decode-one huffman-tree bits)]
-        (recur tail-bits (conj result c))
-        ))
-    ))
+  (transduce (huffman-xf huffman-tree) conj [] inputs))

 ;; -----------------------------------------------------------
@@ -132,9 +109,8 @@
 (defn tests []
   ;; TODO - Symetric testings with test.checks
   (prn (encode-with t [:a :b]))
-  (prn (encode [:a :b]))
+  (prn (second (encode [:a :b])))
   (prn (decode t [0 1 0 0 1 1]))
-  (prn (decode-with-xf t [0 1 0 0 1 1]))
   )


*ns* is a Namespace not a Symbol

*ns* is a Namespace not a Symbol

--- src/clj/reply/eval_modes/nrepl.clj
+++ src/clj/reply/eval_modes/nrepl.clj
@@ -174,7 +174,7 @@
        :session session}
       (binding [*print-length* nil
                 *print-level* nil]
-        (pr-str `(binding [*ns* (symbol ~(deref current-ns))] ~form))))
+        (pr-str `(binding [*ns* (the-ns (symbol ~(deref current-ns)))] ~form))))
     (read-string @results)))

 (defn poll-for-responses [{:keys [print-out print-err] :as options} connection]


Make get-selected-text return :text, instead of parinfer map

--- src/cljs/nightcode/paren_soup.cljs
+++ src/cljs/nightcode/paren_soup.cljs
@@ -35,7 +35,7 @@

 (defn get-selected-text []
   (when-let [text (or (p/selected-text) (p/focused-text))]
-    (cp/mode :both text 0 0)))
+    (:text (cp/mode :both text 0 0))))

 (defn mark-clean []
   (swap! state assoc :text-content (get-text-content))


Fix Oauth link placement

Fix Oauth link placement

--- src/cljs/salava/user/ui/login.cljs
+++ src/cljs/salava/user/ui/login.cljs
@@ -51,10 +51,10 @@
         [:div {:class "row login-links"}
          [:div {:class "col-xs-6 text-right"}
           [:a {:href (path-for "/user/register")} (t :user/Createnewaccount)]]
-         [:div {:class "col-xs-6 text-left"}
+         [:div {:class "col-sm-6 col-xs-12 text-left"}
           [:a {:href (path-for "/user/reset")} (t :user/Requestnewpassword)]]]
         [:div {:class "row oauth-buttons"}
-         [:div {:class "col-xs-6 text-right"} (facebook-link false)]
+         [:div {:class "col-sm-6 col-xs-12 text-right"} (facebook-link false)]
          [:div.col-xs-6 (linkedin-link nil nil)]]]]]]))

 (defn handler []


Avoid namespace collision warning.

Avoid namespace collision warning.

--- src/cljs/town_client/analyser.cljs
+++ src/cljs/town_client/analyser.cljs
@@ -39,10 +39,10 @@
         reducer (summer scale-keys)]
     (reduce reducer data)))

-(defn divide [divisor [k v]]
+(defn division [divisor [k v]]
   [k (/ v divisor)])

 (defn averages [data]
   (into {}
-        (map (partial divide (count data))
+        (map (partial division (count data))
              (totals data))))


Make default file name .java for java projects

--- src/clojure/nightcode/projects.clj
+++ src/clojure/nightcode/projects.clj
@@ -188,15 +188,17 @@

 (defn new-file
   [e]
-  (when-let [leaf-path (enter-file-path "example.clj")]
-    (let [project-path (get-project-root-path)
-          new-file (java.io/file project-path leaf-path)]
-      (if (.exists new-file)
-        (s/alert (utils/get-string :file_exists))
-        (do
-          (.mkdirs (.getParentFile new-file))
-          (.createNewFile new-file)
-          (update-project-tree (.getCanonicalPath new-file)))))))
+  (let [project-path (get-project-root-path)
+        default-file-name (if (lein/is-java-project? project-path)
+                            "Example.java" "example.clj")]
+    (when-let [leaf-path (enter-file-path default-file-name)]
+      (let [new-file (java.io/file project-path leaf-path)]
+        (if (.exists new-file)
+          (s/alert (utils/get-string :file_exists))
+          (do
+            (.mkdirs (.getParentFile new-file))
+            (.createNewFile new-file)
+            (update-project-tree (.getCanonicalPath new-file))))))))

 (defn rename-file
   [e]


CMR-448: Changed mapping of orbit-number to float.

--- src/cmr/indexer/data/index_set.clj
+++ src/cmr/indexer/data/index_set.clj
@@ -66,7 +66,7 @@
    :dynamic "strict"
    :properties {:orbital-model-name string-field-mapping
                 :orbital-model-name.lowercase string-field-mapping
-                :orbit-number int-field-mapping
+                :orbit-number float-field-mapping
                 :start-orbit-number float-field-mapping
                 :stop-orbit-number float-field-mapping
                 :equator-crossing-longitude float-field-mapping


Call build-from-name correctly

Call build-from-name correctly

--- backend/src/circle/hooks.clj
+++ backend/src/circle/hooks.clj
@@ -26,5 +26,5 @@

 (defn run-build-from-jruby
   [project-name job-name]
-  (let [build config/build-from-name project-name (keyword job-name)]
+  (let [build (config/build-from-name project-name :job-name (keyword job-name))]
     (future (run/run-build build))))


Whoops

Whoops

--- src/speclj/core.cljc
+++ src/speclj/core.cljc
@@ -118,8 +118,10 @@
   `(speclj.components/new-around-all (fn ~context ~@body)))

 (def cljs-munge
-  (when (find-ns 'cljs.compiler)
-    (ns-resolve 'cljs.compiler (symbol "munge"))))
+  #?(:clj
+     (when (find-ns 'cljs.compiler)
+       (ns-resolve 'cljs.compiler (symbol "munge")))
+     :cljs nil))

 (defn ^:no-doc -make-with [name body ctor bang?]
   (let [var-name (with-meta (symbol name) {:dynamic true})


add write to board func

add write to board func

--- src/t3tr0s/core.cljs
+++ src/t3tr0s/core.cljs
@@ -66,8 +66,13 @@
 (defn print-board []
   (println (board-str (:board @state))))

+(defn write-to-board [ x y value ]
+  (swap! state assoc-in [:board y x] value)
+  )
+
 (defn init []
   (connect-repl)
-  (print-board))
+  (print-board)
+  )

-(document-ready init)
+(document-ready init)


redis dependency moved to "test" scope

redis dependency moved to "test" scope

--- build.boot
+++ build.boot
@@ -3,7 +3,7 @@
  :resource-paths #{"resources"}
  :directories    #{"config"}
  :dependencies '[[org.clojure/clojure "1.8.0" :scope "provided"]
-                 [com.taoensso/carmine "2.16.0"]
+                 [com.taoensso/carmine "2.16.0" :scope "test"]
                  [org.mindrot/jbcrypt "0.4"]
                  [mbuczko/boot-flyway "0.1.1" :scope "test"]
                  [adzerk/bootlaces "0.1.13" :scope "test"]


Update boot library versions

Update boot library versions

--- build.boot
+++ build.boot
@@ -2,17 +2,16 @@
  :source-paths    #{"src/cljs"}
  :resource-paths  #{"resources"}
  :dependencies '[[org.clojure/clojure "1.7.0"]
-                 [org.clojure/clojurescript "1.7.145"]
-                 [org.clojure/core.async "0.1.346.0-17112a-alpha"]
-                 [cljs-http "0.1.37"]
+                 [org.clojure/clojurescript "1.7.170"]
+                 [org.clojure/core.async "0.2.374"]
+                 [cljs-http "0.1.38"]
                  [reagent "0.5.1"]
-                 [bidi "1.21.1"]
+                 [bidi "1.23.1"]
                  [kioo "0.4.1"]
-                 [alandipert/storage-atom "1.2.4"]
-                 [boot/core "2.4.0" :scope "test"]
-                 [adzerk/boot-cljs "1.7.48-6" :scope "test"]
-                 [adzerk/boot-reload "0.4.1" :scope "test"]
-                 [pandeiro/boot-http "0.7.0-SNAPSHOT" :scope "test"]])
+                 [boot/core "2.4.2" :scope "test"]
+                 [adzerk/boot-cljs "1.7.170-3" :scope "test"]
+                 [adzerk/boot-reload "0.4.2" :scope "test"]
+                 [pandeiro/boot-http "0.7.1-SNAPSHOT" :scope "test"]])

 (require
  '[adzerk.boot-cljs :refer [cljs]]


sign releases

sign releases

--- build.boot
+++ build.boot
@@ -38,4 +38,4 @@
 (deftask push-release
   "Deploy release version to Clojars."
   [f file PATH str "The jar file to deploy."]
-  (push :file file :tag true :ensure-release true))
+  (push :file file :tag true :gpg-sign true :ensure-release true))


Fix repeatedly starting the system on file change

--- build.boot
+++ build.boot
@@ -101,15 +101,18 @@
   "Develop the server backend. The system is automatically started in
   the dev profile."
   []
-  (with-pass-thru _
-    (require 'reloaded.repl)
-    (let [go (resolve 'reloaded.repl/go)]
-      (try
-        (require 'user)
-        (go)
-        (catch Exception e
-          (boot.util/fail "Exception while starting the system\n")
-          (boot.util/print-ex e))))))
+  (let [run? (atom false)]
+    (with-pass-thru _
+      (when-not @run?
+        (reset! run? true)
+        (require 'reloaded.repl)
+        (let [go (resolve 'reloaded.repl/go)]
+          (try
+            (require 'user)
+            (go)
+            (catch Exception e
+              (boot.util/fail "Exception while starting the system\n")
+              (boot.util/print-ex (.getCause e)))))))))

 (deftask dev
   "This is the main development entry point."


version bump up

version bump up

--- build.boot
+++ build.boot
@@ -26,7 +26,7 @@
                  [ring-middleware-format "0.7.2"]
                  [digest "1.4.8"]])

-(def +version+ "1.1.0")
+(def +version+ "2.0.0")

 ;; to check the newest versions:
 ;; boot -d boot-deps ancient


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.9.0"]
+                  [play-cljs/lein-template "0.10.0"]
                   [eval-soup "1.2.0" :exclusions [org.clojure/core.async]]
                   [org.eclipse.jgit/org.eclipse.jgit "4.6.0.201612231935-r"]])


Use a newer boot.test

Use a newer boot.test

--- build.boot
+++ build.boot
@@ -9,7 +9,7 @@
   :developers {"James Laver" "james@seriesofpipes.com"}
   :license {"MIT" "https://en.wikipedia.org/MIT_License"}
   :dependencies '[[org.clojure/clojure      "1.8.0"  :scope "provided"]
-                  [adzerk/boot-test         "1.1.0"  :scope "test"]
+                  [adzerk/boot-test         "1.1.2"  :scope "test"]
                   [org.clojure/tools.nrepl  "0.2.12" :scope "test"]])

 (require '[adzerk.boot-test :as boot-test])


[Add] test printfl

[Add] test printfl

--- test/clj_elm/util_test.clj
+++ test/clj_elm/util_test.clj
@@ -2,6 +2,11 @@
   (:require [clj-elm.util :refer :all]
             [midje.sweet :refer :all]
             [midje.repl :refer (autotest load-facts)]))
+
+(facts "test-printfl"
+  (fact "(printfl obj)"
+    (printfl 3)
+    => [nil nil]))

 (facts "test-reftype?"
   (fact "(reftype? obj)"


Add group sort by line for api docs

Add group sort by line for api docs

--- docs/src/ns_to_markdown.clj
+++ docs/src/ns_to_markdown.clj
@@ -61,7 +61,12 @@
          (remove :anonymous)
          (sort-by :line)
          (map read-var)
-         (group-by :api-docs/heading))))
+         (group-by :api-docs/heading)
+         (mapv (fn [[heading vars]]
+                   {:heading heading
+                    :publics vars
+                    :line   (:line (first vars))}))
+         (sort-by :line))))

 (defn analyze-file
   [file]
@@ -110,8 +115,8 @@
             (:doc var))))

 (defn group->markdown
-  [[heading vars]]
-  (reduce str (format "## %s\n\n" heading) (map var->markdown vars)))
+  [{:keys [heading publics]}]
+  (reduce str (format "## %s\n\n" heading) (map var->markdown publics)))

 (defn -main


Update server task to auto-start the system

--- build.boot
+++ build.boot
@@ -69,8 +69,12 @@
       (require '[clojure.tools.namespace.repl :as repl])
       (apply repl/set-refresh-dirs (-> pod/env :directories))

-      (boot.repl/launch-nrepl {:init-ns 'user :port 5700 :server true
-                               :middleware (:middleware pod/env)}))
+      (boot.repl/launch-nrepl {:init-ns 'user :port 5600 :server true
+                               :middleware (:middleware pod/env)})
+      ;; Auto-start the system
+      (require 'dev) ;; Set the init-system (stateful at namespace level)
+      (require 'reloaded.repl)
+      (reloaded.repl/go))
     identity)) ;; Return identity so that composition works

 (deftask frontend


Bump version

Bump version

--- build.boot
+++ build.boot
@@ -1,4 +1,4 @@
-(def +version+ "0.5.0")
+(def +version+ "0.5.1-SNAPSHOT")

 (set-env!
   :resource-paths #{"src" "boot-less/src" "lein-less4j/src"}


codox source-uri points to the released version

--- build.boot
+++ build.boot
@@ -101,7 +101,7 @@
       :version +version+
       :description "A routing library for Om Next."
       :output-path (str "doc/" +version+)
-      :source-uri "https://github.com/anmonteiro/compassus/blob/master/{filepath}#L{line}")))
+      :source-uri (str "https://github.com/anmonteiro/compassus/tree/" +version+ "/{filepath}#L{line}"))))

 (deftask release-devcards []
   (set-env! :source-paths #(conj % "src/devcards"))


Start 2.5.10-SNAPSHOT

Start 2.5.10-SNAPSHOT

--- build.boot
+++ build.boot
@@ -37,7 +37,7 @@
 (task-options!
   sift {:include #{#"\.jar$"}}
   pom {:project 'nightcode
-       :version "2.5.9"
+       :version "2.5.10-SNAPSHOT"
        :description "An IDE for Clojure"
        :url "https://github.com/oakes/Nightcode"
        :license {"Public Domain" "http://unlicense.org/UNLICENSE"}}


Fix test-clj task

Fix test-clj task

--- build.boot
+++ build.boot
@@ -117,7 +117,7 @@
   "Runs the tests on JVM."
   []
   (comp (testing)
-        (boot-test/test :namespaces 'test-namespaces)))
+        (boot-test/test :namespaces test-namespaces)))

 (deftask test-node
   "Runs the tests in a Node.js environment."


Don't throw exceptions when executing

Don't throw exceptions when executing

--- test/icecap/e2e/common.clj
+++ test/icecap/e2e/common.clj
@@ -29,7 +29,7 @@
   "Executes the capability with the given URL."
   [cap-url]
   (info "Executing cap" cap-url)
-  (http/get (spy cap-url)))
+  (http/get (spy cap-url) {:throw-exceptions false}))

 (defn revoke-cap
   "Revokes the capability with the given URL."


Warn when merging a file with a directory of the same name

- fixes #361
- fixes #364

--- boot/pod/src/boot/tmpdir.clj
+++ boot/pod/src/boot/tmpdir.clj
@@ -127,15 +127,17 @@

 (defn- apply-mergers!
   [mergers ^File old-file path ^File new-file ^File merged-file]
-  (when-let [merger (some (fn [[re v]] (when (re-find re path) v)) mergers)]
-    (util/dbug "Merging duplicate entry (%s)\n" path)
-    (let [out-file (File/createTempFile (.getName merged-file) nil
-                                        (.getParentFile merged-file))]
-      (with-open [curr-stream (io/input-stream old-file)
-                  new-stream  (io/input-stream new-file)
-                  out-stream  (io/output-stream out-file)]
-        (merger curr-stream new-stream out-stream))
-      (file/move out-file merged-file))))
+  (if (some (memfn isDirectory) [old-file new-file])
+    (util/warn "Can't merge: entry is both file and directory: %s" path)
+    (when-let [merger (some (fn [[re v]] (when (re-find re path) v)) mergers)]
+      (util/dbug "Merging duplicate entry (%s)\n" path)
+      (let [out-file (File/createTempFile (.getName merged-file) nil
+                                          (.getParentFile merged-file))]
+        (with-open [curr-stream (io/input-stream old-file)
+                    new-stream  (io/input-stream new-file)
+                    out-stream  (io/output-stream out-file)]
+          (merger curr-stream new-stream out-stream))
+        (file/move out-file merged-file)))))

 (defn- set-dir
   [tree dir]


Rework binding handling for Repls

Rework binding handling for Repls

Add also *math-context* and *unchecked-math* for 1.3.

--- server/src/main/clojure/vimclojure/repl.clj
+++ server/src/main/clojure/vimclojure/repl.clj
@@ -59,7 +59,7 @@
 (def bindable-vars
   `[*warn-on-reflection* *print-meta* *print-length*
     *print-level* *compile-path* *command-line-args*
-    *unchecked-math* *1 *2 *3 *e
+    *unchecked-math* *math-context* *1 *2 *3 *e
     ; VimClojure specific.
     *print-pretty*])


bumo common-io

bumo common-io

--- elephantdb-core/project.clj
+++ elephantdb-core/project.clj
@@ -10,7 +10,7 @@
   :dependencies [[org.clojure/clojure "1.5.1"]
                  [jvyaml "1.0.0"]
                  [org.yaml/snakeyaml "1.9"]
-                 [commons-io "1.4"]
+                 [commons-io "2.1"]
                  [jackknife "0.1.6"]
                  [hadoop-util "0.3.0"]
                  [metrics-clojure "1.0.1"]


handle inserting new layers through pasting

--- src-cljs/frontend/controllers/controls.cljs
+++ src-cljs/frontend/controllers/controls.cljs
@@ -884,3 +884,35 @@
   [browser-state message {:keys [value]} state]
   (-> state
       (assoc-in [:layer-properties-menu :layer :layer/ui-target] (empty-str->nil value))))
+
+(defmethod control-event :layers-pasted
+  [browser-state message {:keys [layers rx ry]} state]
+  (let [[group-id & layer-ids :as used-ids] (take (inc (count layers)) (:entity-ids state))
+        doc-id (:document/id state)
+        mouse (:mouse state)
+        [current-rx current-ry] (cameras/screen->point (:camera state) (:x mouse) (:y mouse))
+        [move-x move-y] [(- current-rx rx) (- current-ry ry)]
+        [snap-move-x snap-move-y] (cameras/snap-to-grid (:camera state) move-x move-y)
+        snap-paths? (first (filter #(not= :layer.type/path (:layer/type %)) layers))]
+    (-> state
+        (assoc-in [:clipboard :layers] (conj (mapv (fn [l eid]
+                                                     (-> l
+                                                         (assoc :layer/ancestor (:db/id l)
+                                                                :db/id eid
+                                                                :document/id doc-id)
+                                                         (move-layer l
+                                                                     {:snap-x snap-move-x :snap-y snap-move-y
+                                                                      :move-x move-x :move-y move-y :snap-paths? snap-paths?})
+                                                         (dissoc :layer/current-x :layer/current-y)))
+                                                   layers layer-ids)
+                                             {:db/id group-id
+                                              :layer/type :layer.type/group
+                                              :layer/child (set layer-ids)}))
+        (assoc-in [:selected-eid] group-id)
+        (update-in [:entity-ids] #(apply disj % used-ids)))))
+
+(defmethod post-control-event! :layers-pasted
+  [browser-state message _ previous-state current-state]
+  (let [db (:db current-state)
+        layers (get-in current-state [:clipboard :layers])]
+    (d/transact! db layers {:can-undo? true})))


Remove nils->maps, which appears to be unnecessary

Looks like things are working without it. Removing it because it's
turning nils that are actually meant to be nil values into {}s as well.

--- src-cljs/frontend/core.cljs
+++ src-cljs/frontend/core.cljs
@@ -185,31 +185,6 @@
     (doseq [c (descendant-components root-component)]
       (.forceUpdate c))))

-;; http://stackoverflow.com/a/15020649/42188
-(defn- map-zipper [m]
-  (zip/zipper
-    (fn [x] (or (map? x) (map? (nth x 1))))
-    (fn [x] (seq (if (map? x) x (nth x 1))))
-    (fn [x children]
-      (if (map? x)
-        (into {} children)
-        (assoc x 1 (into {} children))))
-    m))
-
-(defn- nils->maps
-  "Turns {:a {:b nil}, :one {:two {:three \"3\"}}} into
-  {:a {:b {}}, :one {:two {:three \"3\"}}}"
-  [m]
-  (loop [z (map-zipper m)]
-    (cond
-      (zip/end? z) (zip/root z)
-
-      (and (implements? IMapEntry (zip/node z))
-           (nil? (val (zip/node z))))
-      (recur (zip/replace z [(key (zip/node z)) {}]))
-
-      :else (recur (zip/next z)))))
-
 (defn ^:export setup! []
   (let [legacy-state (initial-state)
         comms {:controls (chan)
@@ -255,7 +230,7 @@

                           ;; Workaround for
                           ;; https://github.com/omcljs/om/issues/781
-                          :merge-tree #(utils/deep-merge %1 (nils->maps %2))
+                          :merge-tree #(utils/deep-merge %1 %2)

                           :shared {:comms comms
                                    :timer-atom (timer/initialize)


Add type hint

Add type hint

--- src/clj_gatling/httpkit.clj
+++ src/clj_gatling/httpkit.clj
@@ -18,7 +18,7 @@
                                      factory (PrefixThreadFactory. "httpkit-callback-worker-")]
                                      (ThreadPoolExecutor. pool-size pool-size 60 TimeUnit/SECONDS queue factory)))

-(defn async-http-request [url user-id context callback]
+(defn async-http-request [url ^long user-id context callback]
   (let [check-status (fn [{:keys [status]}]
                         (callback (= 200 status)))]
     (http/get url {:worker-pool httpkit-callback-pool :client (get-httpkit-client user-id)} check-status)))


editar lembrandos!

editar lembrandos!

--- src/cljs/relembra/core.cljs
+++ src/cljs/relembra/core.cljs
@@ -104,9 +104,9 @@

 (defn md-editor [title value-k text]
   [:div.row.around-xs {:style {:margin-top "1em" :margin-bottom "1em"}}
-   [:div.col-xs-12.col-sm-5
+   [:div.col-xs-12
     [text-field title value-k text]]
-   [:div.col-xs-12.col-sm-6 {:style {:padding-top "0.5em" :font-family "Yrsa, serif" :font-size "120%"}}
+   [:div.col-xs-12 {:style {:padding-top "0.5em" :font-family "Yrsa, serif" :font-size "120%"}}
     [mathjax-box text]]])

 (defn toggle-drawer [b]
@@ -259,7 +259,8 @@
                        (d/pull (d/db conn)
                                '[{:lembrando/question [*]}]
                                lembrando))
-             show-answer? (posh-get0 :review/show-answer?)]
+             show-answer? (posh-get0 :review/show-answer?)
+             editing? (boolean (posh-get0 :review/editing?))]
          [rui/paper
           (captioned-markdown "Pergunta" (:question/body question))
           (if show-answer?
@@ -285,13 +286,58 @@
               [rui/flat-button
                {:label "Bah, chupado"
                 :icon (icons/social-sentiment-satisfied)
-                :on-touch-tap #(rate-recall lembrando 5)}]]]
+                :on-touch-tap #(rate-recall lembrando 5)}]]
+             [:div
+              [ui/flat-button
+               {:label "Editar"
+                :icon (icons/editor-mode-edit)
+                :on-touch-tap #(set0! :review/editing? true)}]]]
             [:div
              [rui/flat-button
               {:label "Mostrar resposta"
                :icon (icons/action-visibility)
                :on-touch-tap (fn [_]
-                               (set0! :review/show-answer? true))}]])]))]))
+                               (set0! :review/show-answer? true))}]])
+          (let [close #(set0! :review/editing? false
+                              :review-edit/question-text false
+                              :review-edit/answer-text false)
+                qtext (or
+                       (posh-get0 :review-edit/question-text)
+                       (:question/body question))
+                atext
+                (or (posh-get0 :review-edit/answer-text)
+                    (:question/answer question))]
+            [rui/dialog {:open editing?
+                         :actions [(r/as-element
+                                    [rui/flat-button
+                                     {:label "Cancelar"
+                                      :icon (icons/navigation-cancel)
+                                      :on-touch-tap close}])
+                                   (r/as-element
+                                    [rui/flat-button
+                                     {:label "Aplicar"
+                                      :icon (icons/action-done)
+                                      :on-touch-tap
+                                      (let [txn
+                                            [{:db/id (:db/id question)
+                                              :question/body qtext
+                                              :question/answer atext}]]
+                                        #(sente/send!
+                                          [:db/ops [[:transact txn]]]
+                                          10000
+                                          (fn [resp]
+                                            (if (cb-success? resp)
+                                              (d/transact! conn txn)
+                                              (js/alert "Error tratando de anovar pergunta: "
+                                                        (pr-str resp)))
+                                            (close))))}])]
+                         :modal true
+                         :onRequestClose close
+                         :autoScrollBodyContent false}
+
+             [:div.container
+              [md-editor "Pergunta" :review-edit/question-text qtext]
+              [md-editor "Resposta" :review-edit/answer-text atext]]])]))]))

 (def screens {:loading loading
               :welcome welcome


added :id :desc as additional ordering criteria to preserve the inverted order

--- src/done/db.clj
+++ src/done/db.clj
@@ -73,7 +73,7 @@
   [email]
   (try
     (let [rows (jdbc/query mysql (sql/select * :done (sql/where
-        {:email email}) (sql/order-by {:date :desc})))]
+           {:email email}) (sql/order-by [ {:date :desc} {:id :desc}])))]
       (if (empty? rows)
         {:status "ok" :rows []}
         {:status "ok" :rows rows}))


Template verison 0.22.0

Template verison 0.22.0

--- template/project.clj
+++ template/project.clj
@@ -1,4 +1,4 @@
-(defproject swagger1st/lein-template "0.22.0-SNAPSHOT"
+(defproject swagger1st/lein-template "0.22.0"
   :description "Leiningen template for creating a swagger1st app."
   :url "https://github.com/zalando/swagger1st"


Fix shadowed function (due to last commit)

--- src/braid/core/client/ui/styles/header.cljs
+++ src/braid/core/client/ui/styles/header.cljs
@@ -178,7 +178,7 @@
     ".options:hover"
     {:display "inline-block"}]])

-(defn header-button [size]
+(defn header-text-button [size]
   [:&
    (header-text size)
    mixins/standard-font
@@ -203,7 +203,7 @@
     {:margin-left vars/pad}

     [:button.join
-     (header-button size)]
+     (header-text-button size)]

     [:>.user-info
      {:display "inline-block"


Make a security comment.

Make a security comment.

--- src/circle/web/views/github_commit_hook.clj
+++ src/circle/web/views/github_commit_hook.clj
@@ -53,6 +53,8 @@
   \"ref\": \"refs/heads/master\"
 }"))

+;;; SECURITY TODO: this data is unverified - consider DDOS possibility
+;;; at least.
 (defn process-json [github-json]
   (def last-json github-json)
   (when (= "CircleCI" (-> github-json :repository :name))


improved logs

improved logs

--- src/clj/algorithms_clj/macro_initiation.clj
+++ src/clj/algorithms_clj/macro_initiation.clj
@@ -411,9 +411,8 @@
   (str "[TRACE] Entering \"" fct-name "\" with arguments: "))

 (defn compile-log-message
-  [form binding-vec]
-  (let [fct-name (-> form second str)
-        bindings (bindings->bound-vars binding-vec)]
+  [fct-name binding-vec]
+  (let [bindings (bindings->bound-vars binding-vec)]
     `(log-enter-message
        ~(log-prefix fct-name)
        (quote ~bindings)
@@ -423,7 +422,7 @@
   [name bindings body]
   `(defn ~name
      ~bindings
-     (println ~(compile-log-message &form bindings))
+     (println ~(compile-log-message name bindings))
      ~body))

 (defn-log add-with-log
@@ -449,7 +448,7 @@
   `(defn ~name
      ~bindings
      (if-let [log-fct# @logger]
-       (log-fct# ~(compile-log-message &form bindings)))
+       (log-fct# ~(compile-log-message name bindings)))
      ~body))

 (defn-log-2 add-with-log-2


fixed arity in handlers/security

fixed arity in handlers/security

--- src/clojure/catacumba/handlers/security.clj
+++ src/clojure/catacumba/handlers/security.clj
@@ -95,9 +95,9 @@
   https://developer.mozilla.org/en-US/docs/Web/Security/CSP"
   ([] (csp-headers {}))
   ([options]
-   (let [options' (select-keys options :default-src :frame-ancestors :frame-src
+   (let [options' (select-keys options [:default-src :frame-ancestors :frame-src
                                :child-src :connect-src :font-src :form-action
-                               :img-src :media-src :object-src :reflected-xss)
+                               :img-src :media-src :object-src :reflected-xss])
          value (reduce (fn [acc [key value]]
                          (conj acc (str (name key) value)))
                        [] (seq options'))]


fixed typeahead bug for series by adding an atom | fs / sg | #19

--- src/cljs/conference_rating/add_conference_page/add_conference_page.cljs
+++ src/cljs/conference_rating/add_conference_page/add_conference_page.cljs
@@ -15,8 +15,9 @@
    [:label {:for (:id (second input))} label]
    input])

-(defn conference-series-input []
-  [:input {:field :text :id :series :class "form-control" :placeholder "Name of the conference series, e.g. EuroClojure for the EuroClojure 2015 conference"}])
+(defn conference-series-input [data-atom]
+  (fn []
+    [:input {:field :text :on-blur (fn [e] (swap! data-atom #(assoc % :series (-> e .-target .-value)))) :id :series :class "form-control" :placeholder "Name of the conference series, e.g. EuroClojure for the EuroClojure 2015 conference"}]))

 (defn conference-series-suggestions [q cb]
   (backend/load-series-suggestions q (fn [x]
@@ -27,9 +28,9 @@
        "
"series"
"
        "
"))

-(def conference-series-component
+(defn conference-series-component [data-atom]
   (typeahead/init-typeahead
-    conference-series-input
+    (conference-series-input data-atom)
     (typeahead/config {:hint true,
                        :highlight true,
                        :minLength 1})
@@ -39,9 +40,9 @@
                           :async true
                           :templates {:suggestion conference-series-template}})))

-(def conference-form-template
+(defn conference-form-template [data-atom]
   [:div
-   (form-input "Series" [:input {:field :text :id :series :class "form-control" :placeholder "Name of the conference series, e.g. EuroClojure for the EuroClojure 2015 conference"}])
+   [(conference-series-component data-atom)]
    (form-input "Name" [:input {:field :text :id :name :class "form-control" :placeholder "Name of the conference"}])
    [:div {:class "row"}
     [:div {:class "col-md-6"} (form-input "From" [:div {:field :datepicker :id :from-date :date-format "yyyy/mm/dd" :inline false :auto-close? true}])]
@@ -73,6 +74,6 @@
        [:div {:class "col-lg-2"}]
        [:div {:class "col-lg-8"}
         [:div {:class "add-conference-form-container bg-light"}
-         [forms/bind-fields conference-form-template doc]
+         [forms/bind-fields (conference-form-template doc) doc]
          [:button {:class "btn btn-primary btn-md btn-orange" :on-click #(create-conference doc)} "Create"]]]
        [:div {:class "col-lg-2"}]]]]))


add url helper to repl

add url helper to repl

--- src/pc/repl.clj
+++ src/pc/repl.clj
@@ -2,6 +2,7 @@
   "Utility functions to make repl access more convenient.
    Also serves as a guide for how nses should be aliased"
   (:require [cheshire.core :as json]
+            [cemerick.url :as url]
             [clj-http.client :as http]
             [clj-time.core :as time]
             [clojure.java.javadoc :refer (javadoc)]


Remove commented out fn

Remove commented out fn

--- src/kixi/datastore/schemastore/inmemory.clj
+++ src/kixi/datastore/schemastore/inmemory.clj
@@ -29,17 +29,6 @@
   (some->> (vals @data)
            (some #(when (sub-map sub-spec %) %))))

-#_(defn resolve-spec
-    [spec-sym get-spec-fn]
-    (let [[initial & forms] spec-sym]
-      (when (= initial 'clojure.spec/cat)
-        (doseq [f (->> forms
-                       (partition 2)
-                       (map second))]
-          (let [inner-spec (get-spec-fn f)]
-            (s/def-impl f inner-spec (eval inner-spec)))))
-      (s/spec (eval spec-sym))))
-
 (defn read-spec
   [data id]
   (fetch-with-sub-spec data {::ss/id id}))


log error properly with clojure.stacktrace

--- src/link_checker/render.clj
+++ src/link_checker/render.clj
@@ -5,7 +5,7 @@
             [link-checker.http :refer [successful-status? url->links fetch-link
                                        default-clj-http-options]]
             [clostache.parser :as clostache]
-            [clojure.repl]
+            [clojure.stacktrace]
             [clojure.string]))

 (defn- render-haml
@@ -111,7 +111,8 @@
       (stream-links* send-event-fn sse-context url options)
       {:status 200}
       (catch Exception exception
-        (log/error :msg (str "Unexpected error: " exception))
-        (clojure.repl/pst exception 25) ;; should log instead of print
+        (log/error :msg (str "Unexpected error within stream-links")
+                   :exception exception
+                   :stacktrace (with-out-str (clojure.stacktrace/print-stack-trace exception)))
         (send-event-fn sse-context "error" "An unexpected error occurred. :(")))
     (log/error :msg "No url given to verify links. Ignored.")))


[Fix #97] Use `fake.class.path` in case the project is managed by boot

Intend to work around problems discussed in boot-clj/boot#251 and
boot-clj/boot#249. Because of `boot`-s inner workings the original
directories for the project source paths are on `fake.class.path` and
the real classpath points to a temporary directory for the source
files. This confuses cljr. See corresponding fix for cider: clojure-emacs/cider-nrepl#422

--- src/refactor_nrepl/core.clj
+++ src/refactor_nrepl/core.clj
@@ -41,13 +41,22 @@
               false
               (:ignore-paths config/*config*))))

+(defn boot-project? []
+  ;; fake.class.path under boot contains the original directories with source
+  ;; files, see https://github.com/boot-clj/boot/issues/249
+  (not (nil? (System/getProperty "fake.class.path"))))
+
 (defn dirs-on-classpath
   "Return all dirs on classpath, filtering out our inlined deps
-  directory and paths matching :ignore-paths specified in config."
+  directory and paths matching :ignore-paths specified in config.
+  For boot it considers `fake.class.path` rather than real classpath."
   []
-  (->> (cp/classpath)
-       (filter fs/directory?)
-       (remove #(-> % str normalize-to-unix-path ignore-dir-on-classpath?))))
+  (let [files-on-cp (if (boot-project?)
+                      (map io/file (str/split (System/getProperty "fake.class.path") #":"))
+                      (cp/classpath))]
+    (->> files-on-cp
+         (filter fs/directory?)
+         (remove #(-> % str normalize-to-unix-path ignore-dir-on-classpath?)))))

 (defn project-root
   "Return the project root directory.


Shuffle firing squad's back row

Shuffle firing squad's back row

--- src/obb_rules/auto_deploys/firingsquad.cljc
+++ src/obb_rules/auto_deploys/firingsquad.cljc
@@ -35,7 +35,8 @@
 (defn- deploy-back-row
   "Deploys a back row with all the given units"
   [result player stash]
-  (let [raw-actions (common/build-deploy-actions player stash 8)
+  (let [stash (shuffle stash)
+        raw-actions (common/build-deploy-actions player stash 8)
         actions (map deploy/build-deploy raw-actions)]
     (reduce (partial common/do-actions player) result actions)))


Fix BigInt to use tag 'n'; simplify extension example

--- src/transit.clj
+++ src/transit.clj
@@ -55,9 +55,9 @@

    clojure.lang.BigInt
    (reify Handler
-     (tag [_ _] "i")
-     (rep [_ bi] (biginteger bi))
-     (stringRep [_ bi] (str bi))
+     (tag [_ _] "n")
+     (rep [_ bi] (str (biginteger bi)))
+     (stringRep [this bi] (.rep this bi))
      (verboseHandler [_] nil))

    clojure.lang.Keyword
@@ -115,7 +115,12 @@
    "ratio"
    (reify Decoder
      (decode [_ o] (/ (.get ^java.util.List o 0)
-                      (.get ^java.util.List o 1))))})
+                      (.get ^java.util.List o 1))))
+
+   "n"
+   (reify Decoder
+     (decode [_ o] (clojure.lang.BigInt/fromBigInteger
+                    (BigInteger. ^String o))))})

 (defn map-builder
   []
@@ -197,6 +202,7 @@
   (write w [#{1 2} #{1 2}])
   (write w (int-array (range 10)))
   (write w {[:a :b] 2})
+  (write w [123N])

   (def in (ByteArrayInputStream. (.toByteArray out)))

@@ -216,12 +222,12 @@
   (def ext-handlers
     {Point
      (make-handler (constantly "point")
-                     (fn [p] (com.cognitect.transit.impl.TaggedValue. "array" [(.x p) (.y p)]))
-                     (constantly nil))
+                   (fn [p] [(.x p) (.y p)])
+                   (constantly nil))
      Circle
      (make-handler (constantly "circle")
-                     (fn [c] (com.cognitect.transit.impl.TaggedValue. "array" [(.c c) (.r c)]))
-                     (constantly nil))})
+                   (fn [c] [(.c c) (.r c)])
+                   (constantly nil))})

   (def ext-decoders
     {"point"


Get rid of pesky React warning in demo

Get rid of pesky React warning in demo

--- demo/reagentdemo/common.cljs
+++ demo/reagentdemo/common.cljs
@@ -2,27 +2,26 @@
   (:require [reagent.core :as r]
             [reagent.debug :refer-macros [dbg println]]))

-(defn demo-component []
-  (let [showing (r/atom true)]
-    (fn [{:keys [comp src complete no-heading]}]
-      [:div
-       (when comp
-         [:div.demo-example.clearfix
-          [:a.demo-example-hide {:on-click (fn [e]
-                                             (.preventDefault e)
-                                             (swap! showing not)
-                                             false)}
-           (if @showing "hide" "show")]
+(defn demo-component [{:keys [comp src complete no-heading]}]
+  (r/with-let [showing (r/atom true)]
+    [:div
+     (when comp
+       [:div.demo-example.clearfix
+        [:a.demo-example-hide {:on-click (fn [e]
+                                           (.preventDefault e)
+                                           (swap! showing not)
+                                           nil)}
+         (if @showing "hide" "show")]
+        (when-not no-heading
+          [:h3.demo-heading "Example "])
+        (when @showing
+          (if-not complete
+            [:div.simple-demo [comp]]
+            [comp]))])
+     (if @showing
+       (if src
+         [:div.demo-source.clearfix
           (when-not no-heading
-            [:h3.demo-heading "Example "])
-          (when @showing
-            (if-not complete
-              [:div.simple-demo [comp]]
-              [comp]))])
-       (if @showing
-         (if src
-           [:div.demo-source.clearfix
-            (when-not no-heading
-              [:h3.demo-heading "Source"])
-            src]
-           [:div.clearfix]))])))
+            [:h3.demo-heading "Source"])
+          src]
+         [:div.clearfix]))]))


test code maintenance

test code maintenance

--- test/misaki/compiler/markdown/core_test.clj
+++ test/misaki/compiler/markdown/core_test.clj
@@ -52,6 +52,7 @@
 (defcompilertest make-base-site-data-test
   (let [site (make-base-site-data)]
     (are [x y] (= x y)
+      "/"   (:root site)
       nil   (:next-page site)
       nil   (:prev-page site)
       1     (count (:posts site))
@@ -62,8 +63,9 @@
                 :next-page "n", :prev-page "p"]
     (let [site (make-base-site-data)]
       (are [x y] (= x y)
-        "n" (:next-page site)
-        "p" (:prev-page site)
+        "/foo/" (:root site)
+        "n"     (:next-page site)
+        "p"     (:prev-page site)
         )
       )
     )


Remove uneeded code.

Remove uneeded code.

--- src/clj/fleetdb/core.clj
+++ src/clj/fleetdb/core.clj
@@ -457,15 +457,13 @@
                            (hash-set indexed record))))))

 (defn- index-delete [index on-fn record]
-  (let [aval    (on-fn record)
-        indexed (get index aval)]
-    (update index aval
-      (fn [indexed]
-        (condv indexed
-          set? (do (assert (contains? indexed record))
-                   (disj indexed record))
-          map? (do (assert (= indexed record))
-                   nil))))))
+  (update index (on-fn record)
+    (fn [indexed]
+      (condv indexed
+        set? (do (assert (contains? indexed record))
+                 (disj indexed record))
+        map? (do (assert (= indexed record))
+                 nil)))))

 (defn- empty-index [ispec]
   (sorted-map-by (attr-compare ispec)))


Changed doc string for spotify-api-call.

--- src/clj_spotify/core.clj
+++ src/clj_spotify/core.clj
@@ -79,9 +79,8 @@
       :form-params
       :query-params))

-;TODO - better doc string
 (defn spotify-api-call
-  "Creates a function f with doc-string d that calls the http-verb verb for url url."
+  "Returns a function that takes a map m and an optional oauth-token t as arguments."
   [verb url]
   (fn f
     ([m] (f m nil))


Simplify API function definitions with some abstraction

--- src/clj_spotify/core.clj
+++ src/clj_spotify/core.clj
@@ -42,13 +42,13 @@
   "Build a new url by switching parts in url with values in param-map. Keys are substrings of the full url. If a key is not present in template-keys it won't be exchanged."
   [param-map url]
   (if (string/blank? url)
-    ""
+    ""
     (let [act-tmplt-keys (select-keys param-map template-keys)
           split-url (string/split (string/replace url "https://" "") #"/")]
       (build-new-url "" split-url act-tmplt-keys))))

 (defn comma-separate
-  "If v is a sequence, convert to a comma separated string."
+  "If v is a sequence, convert to a comma separated string."
   [v]
   (if (or (seq? v) (vector? v))
     (string/join "," v)
@@ -87,35 +87,52 @@

 (defn spotify-api-call
   "Returns a function that takes a map m and an optional oauth-token t as arguments."
-  [verb url]
+  [verb endpoint]
   (fn f
     ([m] (f m nil))
     ([m t]
-     (let [query-params {(select-params-type verb) (modify-form-params m) :oauth-token t :content-type :json}]
-       (->
-         (try
-           (verb (replace-url-values m url) query-params)
-           (catch Exception e (ex-data e)))
-         (response-to-map))))))
+     (let [query-params {(select-params-type verb) (modify-form-params m)
+                         :oauth-token t
+                         :content-type :json}
+           url (str spotify-api-url endpoint)]
+       (-> (try
+             (verb (replace-url-values m url) query-params)
+             (catch Exception e (ex-data e)))
+           (response-to-map))))))
+
+
+; Define (api-get), (api-post), etc.
+(let [defverb #(intern *ns*
+                       (symbol (str "api-" %))
+                       (partial spotify-api-call
+                                (resolve (symbol "client" %))))]
+  (doseq [verb ["get" "post" "put" "delete"]]
+    (defverb verb)))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;  Public API
+

 ;Albums
-(def get-an-album
+(def get-an-album
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory key in m is :id, optional key is :market.
   :id has to have the value of an existing album's id.
   :market is an ISO 3166-1 alpha-2 country code.

   Example: (get-an-album {:id \"0MnG7y5F1n4Wns63RjEItx\" :market \"SE\"} \"BQBw-JtC..._7GvA\")"
-  (spotify-api-call client/get (str spotify-api-url "albums/id")))
-
-(def get-several-albums
+  (api-get "albums/id"))
+
+(def get-several-albums
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory key in m is :ids, optional key is :market.
   :ids has to be a comma separated string of spotify album ids.
   :market is an ISO 3166-1 alpha-2 country code.

   Example: (get-several-albums {:ids \"4hTil0JVdMyxK2vH11ZbiX,4RjjFbiqFaO8mKTDM2Kzna\" :market \"SE\"} \"BQBw-JtC..._7GvA\") "
-  (spotify-api-call client/get (str spotify-api-url "albums")))
+  (api-get "albums"))

 (def get-an-albums-tracks
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
@@ -125,24 +142,27 @@
   :offset is the index of the first track to return, default is 0.
   :market is an ISO 3166-1 alpha-2 country code.

-  Example: (get-tracks-of-album {:id \"3XCGFOBqESirxxICswSity\" :market \"SE\" :limit 50 :offset 50} \"BQBw-JtC..._7GvA\")" (spotify-api-call client/get (str spotify-api-url "albums/id/tracks")))
+  Example: (get-tracks-of-album {:id \"3XCGFOBqESirxxICswSity\" :market \"SE\" :limit 50 :offset 50} \"BQBw-JtC..._7GvA\")"
+  (api-get "albums/id/tracks"))

 ;Artists
-(def get-an-artist
+(def get-an-artist
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory key in m is :id.
   :id has to have the value of an existing artist's id.

-  Example: (get-an-artist {:id \"5CE2IfdYZEQGIDsfiRm8SI\"} \"BQBw-JtC..._7GvA\")" (spotify-api-call client/get (str spotify-api-url "artists/id")))
-
-(def get-several-artists
+  Example: (get-an-artist {:id \"5CE2IfdYZEQGIDsfiRm8SI\"} \"BQBw-JtC..._7GvA\")"
+  (api-get "artists/id"))
+
+(def get-several-artists
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory key in m is :ids.
   :ids has to be a comma separated string of spotify artist ids.

-  Example: (get-several-artists {:ids \"1kK2LYgoP3raZNngbb1qMT,2RitCPbwEYyYNw5LkbXTGv\"} \"BQBw-JtC..._7GvA\")" (spotify-api-call client/get (str spotify-api-url "artists")))
-
-(def get-an-artists-albums
+  Example: (get-several-artists {:ids \"1kK2LYgoP3raZNngbb1qMT,2RitCPbwEYyYNw5LkbXTGv\"} \"BQBw-JtC..._7GvA\")"
+  (api-get "artists"))
+
+(def get-an-artists-albums
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory key in m is :id, optional keys are :album_type, :market, :limit and :offset.
   :id has to have the value of an existing artist's id.
@@ -152,22 +172,25 @@
   :limit is the maxium number of tracks to return, default is 20.
   :offset is the index of the first track to return, default is 0.

-  Example: (get-an-artists-albums {:id \"7lOJ7WXyopaxri0dbOiZkd\" :album_type \"album, single\" :market \"SE\" :limit 50 :offset 50}} \"BQBw-JtC..._7GvA\")" (spotify-api-call client/get (str spotify-api-url "artists/id/albums")))
-
-(def get-an-artists-top-tracks
+  Example: (get-an-artists-albums {:id \"7lOJ7WXyopaxri0dbOiZkd\" :album_type \"album, single\" :market \"SE\" :limit 50 :offset 50}} \"BQBw-JtC..._7GvA\")"
+  (api-get "artists/id/albums"))
+
+(def get-an-artists-top-tracks
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory keys in m are :id and :country.
   :id has to be a spotify artist id.
   :country is an ISO 3166-1 alpha-2 country code.

-  Example: (get-an-artists-top-tracks {:id \"7hCsRnXtcbez8msLPfjbkz\" :country \"SE\"} \"BQBw-JtC..._7GvA\")" (spotify-api-call client/get (str spotify-api-url "artists/id/top-tracks")))
+  Example: (get-an-artists-top-tracks {:id \"7hCsRnXtcbez8msLPfjbkz\" :country \"SE\"} \"BQBw-JtC..._7GvA\")"
+  (api-get "artists/id/top-tracks"))

 (def get-an-artists-related-artists
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory key in m is :id.
   :id has to be a spotify artist id.

-  Example: (get-an-artists-related-artists {:id \"4EF5vIcCYKMM61oYOG2Tqa\"} \"BQBw-JtC..._7GvA\")" (spotify-api-call client/get (str spotify-api-url "artists/id/related-artists")))
+  Example: (get-an-artists-related-artists {:id \"4EF5vIcCYKMM61oYOG2Tqa\"} \"BQBw-JtC..._7GvA\")"
+  (api-get "artists/id/related-artists"))

 ;Browse
 (def get-a-list-of-featured-playlists
@@ -175,13 +198,14 @@
   There are no compulsary keys in m, optional keys are :locale, :country, :timestamp, :limit and :offset.
   :locale is an ISO 639 language code and a ISO 3166-1 alpha-2 country code joined with an underscore.
   :country is an ISO 3166-1 alpha-2 country code.
-  :timestamp is ISO 8601 formatted timestamp.
-  :limit is the maxium number of tracks to return, default is 20.
-  :offset is the index of the first track to return, default is 0.
-
-  Example: (get-a-list-of-featured-playlists {:locale \"sv_SE\" :country \"SE\" :timestamp \"2015-10-23T09:00:00\" :limit 50 :offset 50} \"BQBw-JtC..._7GvA\")" (spotify-api-call client/get (str spotify-api-url "browse/featured-playlists")))
-
-(def get-a-list-of-new-releases
+  :timestamp is ISO 8601 formatted timestamp.
+  :limit is the maxium number of tracks to return, default is 20.
+  :offset is the index of the first track to return, default is 0.
+
+  Example: (get-a-list-of-featured-playlists {:locale \"sv_SE\" :country \"SE\" :timestamp \"2015-10-23T09:00:00\" :limit 50 :offset 50} \"BQBw-JtC..._7GvA\")"
+  (api-get "browse/featured-playlists"))
+
+(def get-a-list-of-new-releases
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   There are no compulsary keys in m, optional keys are :country, :limit and :offset.
   :country is an ISO 3166-1 alpha-2 country code.
@@ -189,27 +213,30 @@
   :offset is the index of the first track to return, default is 0.

   Example: (get-a-list-of-new-releases {:country \"SE\" :limit 50 :offset 50} \"BQBw-JtC..._7GvA\")"
-  (spotify-api-call client/get (str spotify-api-url "browse/new-releases")))
-
-(def get-a-list-of-categories
+
+  (api-get "browse/new-releases"))
+
+(def get-a-list-of-categories
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   There are no compulsary keys in m, optional keys are :country, :limit and :offset.
   :country is an ISO 3166-1 alpha-2 country code.
   :limit is the maxium number of tracks to return, default is 20.
   :offset is the index of the first track to return, default is 0.

-  Example: (get-a-list-of-categories {:country \"SE\" :limit 50 :offset 50} \"BQBw-JtC..._7GvA\")" (spotify-api-call client/get (str spotify-api-url "browse/categories")))
-
-(def get-a-category
+  Example: (get-a-list-of-categories {:country \"SE\" :limit 50 :offset 50} \"BQBw-JtC..._7GvA\")"
+  (api-get "browse/categories"))
+
+(def get-a-category
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory key in m is :category_id, optional keys are :country and :locale.
   :category_id has to be a spotify category id.
   :country is an ISO 3166-1 alpha-2 country code.
   :locale is an ISO 639 language code and a ISO 3166-1 alpha-2 country code joined with an underscore.

-  Example: (get-a-category {:category_id \"dinner\" :country \"SE\" :locale \"sv_SE\"} \"BQBw-JtC..._7GvA\")" (spotify-api-call client/get (str spotify-api-url "browse/categories/category_id")))
-
-(def get-a-categorys-playlists
+  Example: (get-a-category {:category_id \"dinner\" :country \"SE\" :locale \"sv_SE\"} \"BQBw-JtC..._7GvA\")"
+  (api-get "browse/categories/category_id"))
+
+(def get-a-categorys-playlists
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory key in m is :category_id, optional keys are :country, :limit and :offset.
   :category_id has to be a spotify category id.
@@ -217,7 +244,8 @@
   :limit is the maxium number of tracks to return, default is 20.
   :offset is the index of the first track to return, default is 0.

-  Example: (get-a-categorys-playlist {:category_id \"dinner\" :country \"SE\" :locale \"sv_SE\" :limit 50 :offset 50} \"BQBw-JtC..._7GvA\")" (spotify-api-call client/get (str spotify-api-url "browse/categories/category_id/playlists")))
+  Example: (get-a-categorys-playlist {:category_id \"dinner\" :country \"SE\" :locale \"sv_SE\" :limit 50 :offset 50} \"BQBw-JtC..._7GvA\")"
+  (api-get "browse/categories/category_id/playlists"))

 ;Follow
 (def get-users-followed-artists
@@ -227,100 +255,112 @@
   :limit is the maxium number of items to return, default is 20.
   :after the last artist id retrieved from a previous request. Use this to get next set of artists.

-  Example: (get-users-followed-artists {:type \"artist\" :limit 50 :offset 50} \"BQBw-JtC..._7GvA\") " (spotify-api-call client/get (str spotify-api-url "me/following")))
-
-(def follow-artists-or-users
+  Example: (get-users-followed-artists {:type \"artist\" :limit 50 :offset 50} \"BQBw-JtC..._7GvA\") "
+  (api-get "me/following"))
+
+(def follow-artists-or-users
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory key in m is :type and :ids.
   :type has to be set to \"artist\" or \"user\".
-  :ids has to be a comma separated list of users or artists.
-
-  Example: (follow-artists-or-users {:type \"artist\" :ids \"2933wDUojoQmvqSdTAE5NB,1AUCkAIfT6Ig8lOegDGK3Z\" } \"BQBw-JtC..._7GvA\")" (spotify-api-call client/put (str spotify-api-url "me/following")))
-
-(def unfollow-artists-or-users
+  :ids has to be a comma separated list of users or artists.
+
+  Example: (follow-artists-or-users {:type \"artist\" :ids \"2933wDUojoQmvqSdTAE5NB,1AUCkAIfT6Ig8lOegDGK3Z\" } \"BQBw-JtC..._7GvA\")"
+  (api-put "me/following"))
+
+(def unfollow-artists-or-users
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory key in m is :type and :ids.
   :type has to be set to \"artist\" or \"user\".
-  :ids has to be a comma separated list of users or artists.
-
-  Example: (unfollow-artists-or-users {:type \"artist\" :ids \"0uCCBpmg6MrPb1KY2msceF,1WsMRWV5KEC2AxpYkeb2Cf\" } \"BQBw-JtC..._7GvA\")" (spotify-api-call client/delete (str spotify-api-url "me/following")))
-
-(def user-following-artists-or-users?
+  :ids has to be a comma separated list of users or artists.
+
+  Example: (unfollow-artists-or-users {:type \"artist\" :ids \"0uCCBpmg6MrPb1KY2msceF,1WsMRWV5KEC2AxpYkeb2Cf\" } \"BQBw-JtC..._7GvA\")"
+  (api-delete "me/following"))
+
+(def user-following-artists-or-users?
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory key in m is :type and :ids.
   :type has to be set to \"artist\" or \"user\".
-  :ids has to be a comma separated list of users or artists.
-
-  Example: (user-following-artists-or-users? {:type \"artist\" :ids \"3H6Js0rhywEhHda3UwuhGW,4r8bVMyYyGyARs9OfBvyj4\" } \"BQBw-JtC..._7GvA\")" (spotify-api-call client/get (str spotify-api-url "me/following/contains")))
-
-(def follow-a-playlist
+  :ids has to be a comma separated list of users or artists.
+
+  Example: (user-following-artists-or-users? {:type \"artist\" :ids \"3H6Js0rhywEhHda3UwuhGW,4r8bVMyYyGyARs9OfBvyj4\" } \"BQBw-JtC..._7GvA\")"
+  (api-get "me/following/contains"))
+
+(def follow-a-playlist
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory keys in m are :owner_id and :playlist_id.
   :owner_id has to be the spotify user id of the user owning the playlist.
-  :playlist_id the spotify playlist id.
-
-  Example: (follow-a-playlist {:owner_id \"sondre_lerche\" :playlist_id \"7q8QuE0YbAgbvzR0NJVwV8\" } \"BQBw-JtC..._7GvA\")" (spotify-api-call client/put (str spotify-api-url "users/owner_id/playlists/playlist_id/followers")))
-
-(def unfollow-a-playlist
+  :playlist_id the spotify playlist id.
+
+  Example: (follow-a-playlist {:owner_id \"sondre_lerche\" :playlist_id \"7q8QuE0YbAgbvzR0NJVwV8\" } \"BQBw-JtC..._7GvA\")"
+  (api-put "users/owner_id/playlists/playlist_id/followers"))
+
+(def unfollow-a-playlist
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory keys in m are :owner_id and :playlist_id.
   :owner_id has to be the spotify user id of the user owning the playlist.
-  :playlist_id the spotify playlist id.
-
-  Example: (unfollow-a-playlist {:owner_id \"ulyssestone\" :playlist_id \"3WG4abOpUpocexRakPioAg\" } \"BQBw-JtC..._7GvA\")" (spotify-api-call client/delete (str spotify-api-url "users/owner_id/playlists/playlist_id/followers")))
-
-(def user-following-playlist?
+  :playlist_id the spotify playlist id.
+
+  Example: (unfollow-a-playlist {:owner_id \"ulyssestone\" :playlist_id \"3WG4abOpUpocexRakPioAg\" } \"BQBw-JtC..._7GvA\")"
+  (api-delete "users/owner_id/playlists/playlist_id/followers"))
+
+(def user-following-playlist?
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory keys in m are :owner_id and :playlist_id.
   :owner_id has to be the spotify user id of the user owning the playlist.
-  :playlist_id the spotify playlist id.
-
-  Example: (user-following-playlist? {:owner_id \"lecowboy\" :playlist_id \"2PftXV7dgcxFjMWe75GuSG\" } \"BQBw-JtC..._7GvA\")" (spotify-api-call client/get (str spotify-api-url "users/owner_id/playlists/playlist_id/followers/contains")))
+  :playlist_id the spotify playlist id.
+
+  Example: (user-following-playlist? {:owner_id \"lecowboy\" :playlist_id \"2PftXV7dgcxFjMWe75GuSG\" } \"BQBw-JtC..._7GvA\")"
+  (api-get "users/owner_id/playlists/playlist_id/followers/contains"))

 ;Library
-(def save-tracks-for-user
+(def save-tracks-for-user
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory key in m is :ids.
   :ids has to be a comma separated list of spotify track ids.

-  Example: (save-tracks-for-user {:ids \"3BSpuy2yHhoEazfXVU7WGq,0BcaWLANkstu2v9kghrCAj\"} \"BQBw-JtC..._7GvA\")" (spotify-api-call client/put (str spotify-api-url "me/tracks")))
-
-(def get-users-saved-tracks
+  Example: (save-tracks-for-user {:ids \"3BSpuy2yHhoEazfXVU7WGq,0BcaWLANkstu2v9kghrCAj\"} \"BQBw-JtC..._7GvA\")"
+  (api-put "me/tracks"))
+
+(def get-users-saved-tracks
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   There are no compulsory keys in m, optional keys are :market, :limit and :offset.
   :market is an ISO 3166-1 alpha-2 country code.
   :limit is the maxium number of tracks to return, default is 20.
   :offset is the index of the first track to return, default is 0.

-  Example: (get-users-saved-tracks {:market \"SE\" :limit 50 :offset 50}} \"BQBw-JtC..._7GvA\")" (spotify-api-call client/get (str spotify-api-url "me/tracks")))
-
-(def remove-users-saved-tracks
+  Example: (get-users-saved-tracks {:market \"SE\" :limit 50 :offset 50}} \"BQBw-JtC..._7GvA\")"
+  (api-get "me/tracks"))
+
+(def remove-users-saved-tracks
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory key in m is :ids.
   :ids has to be a comma separated list of spotify track ids.

-  Example: (remove-users-saved-tracks {:ids \"1RyZgkIghj1eL2U1zlYOoE,6NwbeybX6TDtXlpXvnUOZC\"} \"BQBw-JtC..._7GvA\")" (spotify-api-call client/delete (str spotify-api-url "me/tracks")))
+  Example: (remove-users-saved-tracks {:ids \"1RyZgkIghj1eL2U1zlYOoE,6NwbeybX6TDtXlpXvnUOZC\"} \"BQBw-JtC..._7GvA\")"
+  (api-delete "me/tracks"))

 ;TODO - better name for this function
-(def check-users-saved-tracks
+(def check-users-saved-tracks
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory key in m is :ids.
   :ids has to be a comma separated list of spotify track ids.

-  Example: (check-users-saved-tracks {:ids \"28nlyt9KhVZQ0lGQsg8Yht,09ZGF6mwJVzw5jxqbtT53E\"} \"BQBw-JtC..._7GvA\")" (spotify-api-call client/get (str spotify-api-url "me/tracks/contains")))
+  Example: (check-users-saved-tracks {:ids \"28nlyt9KhVZQ0lGQsg8Yht,09ZGF6mwJVzw5jxqbtT53E\"} \"BQBw-JtC..._7GvA\")"
+  (api-get "me/tracks/contains"))

 ;Playlists
-(def get-a-list-of-a-users-playlists
+(def get-a-list-of-a-users-playlists
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory key in  m is :user_id, optional keys are :limit and :offset.
   :user_id is the users spotify id.
   :limit is the maxium number of tracks to return, default is 20.
   :offset is the index of the first track to return, default is 0.

-  Example: (get-a-list-of-a-users-playlists {:user_id \"elkalel\" :limit 50 :offset 50} \"BQBw-JtC..._7GvA\")" (spotify-api-call client/get (str spotify-api-url "users/user_id/playlists")))
+  Example: (get-a-list-of-a-users-playlists {:user_id \"elkalel\" :limit 50 :offset 50} \"BQBw-JtC..._7GvA\")"
+  (api-get "users/user_id/playlists"))

 ;TODO - Change this fields string to be a map?
-(def get-a-playlist
+(def get-a-playlist
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory keys in  m are :user_id and :playlist_id, optional keys are :fields, :market, :limit and :offset.
   :user_id is the users spotify id.
@@ -331,9 +371,10 @@
   :limit is the maxium number of tracks to return, default is 20.
   :offset is the index of the first track to return, default is 0.

-  Example: (get-a-playlist {:owner_id \"elkalel\" :playlist_id \"6IIjEBw2BrRXbrSLerA7A6\" :fields \"href,name,owner\" :market \"SE\" :limit 50 :offset 50} \"BQBw-JtC..._7GvA\")" (spotify-api-call client/get (str spotify-api-url "users/owner_id/playlists/playlist_id")))
-
-(def get-a-playlists-tracks
+  Example: (get-a-playlist {:owner_id \"elkalel\" :playlist_id \"6IIjEBw2BrRXbrSLerA7A6\" :fields \"href,name,owner\" :market \"SE\" :limit 50 :offset 50} \"BQBw-JtC..._7GvA\")"
+  (api-get "users/owner_id/playlists/playlist_id"))
+
+(def get-a-playlists-tracks
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory keys in  m are :user_id and :playlist_id, optional keys are :fields, :limit and :offset and :market.
   :owner_id is the users spotify id.
@@ -344,31 +385,34 @@
   :offset is the index of the first track to return, default is 0.
   :market is an ISO 3166-1 alpha-2 country code.

-  Example: (get-a-playlists-tracks {:owner_id \"elkalel\" :playlist_id \"6IIjEBw2BrRXbrSLerA7A6\" :fields \"href,name,owner\":limit 50 :offset 50 :market \"SE\"} \"BQBw-JtC..._7GvA\")" (spotify-api-call client/get (str spotify-api-url "users/owner_id/playlists/playlist_id/tracks")))
-
-(def create-a-playlist
+  Example: (get-a-playlists-tracks {:owner_id \"elkalel\" :playlist_id \"6IIjEBw2BrRXbrSLerA7A6\" :fields \"href,name,owner\":limit 50 :offset 50 :market \"SE\"} \"BQBw-JtC..._7GvA\")"
+  (api-get "users/owner_id/playlists/playlist_id/tracks"))
+
+(def create-a-playlist
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory keys in m are :user_id and :name, optional key is :public.
   :user_id is the users spotify id.
   :name is the name for the new playlist.
   :public is set to true if a playlist should be public and false if not.

-  Example: (create-a-playlist {:user_id \"elkalel\" :name \"The songs you didn't know you liked.\" :public true} \"BQBw-JtC..._7GvA\")" (spotify-api-call client/post (str spotify-api-url "users/user_id/playlists")))
-
-(def add-tracks-to-a-playlist
+  Example: (create-a-playlist {:user_id \"elkalel\" :name \"The songs you didn't know you liked.\" :public true} \"BQBw-JtC..._7GvA\")"
+  (api-post "users/user_id/playlists"))
+
+(def add-tracks-to-a-playlist
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory key in m are :user_id and :playlist_id, optional keys are :uris and :position.
   :user_id is the users spotify id.
   :playlist_id is the playlist spotify id.
   :uris a list of spotify track uris.
-  :position the position to insert the tracks.
+  :position the position to insert the tracks.

   Example: (add-tracks-to-playlist {:user_id \"elkalel\" :playlist_id \"6IIjEBw2BrRXbrSLerA7A6\" :uris \"spotify:track:4iV5W9uYEdYUVa79Axb7Rh,
-  spotify:track:1301WleyT98MSxVHPZCA6M\" :position 2} \"BQBw-JtC..._7GvA\")" (spotify-api-call client/post (str spotify-api-url "users/user_id/playlists/playlist_id/tracks")))
-
-;TODO - Deal with correct formatting of :tracks.
+  spotify:track:1301WleyT98MSxVHPZCA6M\" :position 2} \"BQBw-JtC..._7GvA\")"
+  (api-post "users/user_id/playlists/playlist_id/tracks"))
+
+;TODO - Deal with correct formatting of :tracks.
 ;TODO - Additional doc string with optional and required values in :tracks.
-(def remove-tracks-from-a-playlist
+(def remove-tracks-from-a-playlist
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory key in m are :user_id, :playlist_id and :tracks, optional keys is :snapshot_id.
   :user_id is the users spotify id.
@@ -377,9 +421,10 @@
   :snapshot_id a playlist snapshot ID.
   See the spotify developer API for the logic behind deleting tracks.

-  Example: (remove-tracks-from-playlist {:user_id \"elkalel\" :playlist_id \"6IIjEBw2BrRXbrSLerA7A6\" :tracks [{:uri \"spotify:track:4iV5W9uYEdYUVa79Axb7Rh\", :positions [2]} {:uri \"spotify:track:1301WleyT98MSxVHPZCA6M\", :positions [7]}]}  \"BQBw-JtC..._7GvA\")" (spotify-api-call client/delete (str spotify-api-url "users/user_id/playlists/playlist_id/tracks")))
-
-(def reorder-a-playlists-tracks
+  Example: (remove-tracks-from-playlist {:user_id \"elkalel\" :playlist_id \"6IIjEBw2BrRXbrSLerA7A6\" :tracks [{:uri \"spotify:track:4iV5W9uYEdYUVa79Axb7Rh\", :positions [2]} {:uri \"spotify:track:1301WleyT98MSxVHPZCA6M\", :positions [7]}]}  \"BQBw-JtC..._7GvA\")"
+  (api-delete "users/user_id/playlists/playlist_id/tracks"))
+
+(def reorder-a-playlists-tracks
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory key in m are :user_id, :playlist_id, :range_start and :insert_before, optional keys are :range_length and :snapshot_id.
   :user_id is the users spotify id.
@@ -389,9 +434,10 @@
   :range_length the amount of tracks to be reordered.
   :snapshot_id a playlist snapshot ID.

-  Example: (reorder-a-playlists-tracks {:user_id \"elkalel\" :playlist_id \"6IIjEBw2BrRXbrSLerA7A6\" :range_start 1 :range_length 2 :insert_before 3} \"BQBw-JtC..._7GvA\")" (spotify-api-call client/put (str spotify-api-url "users/user_id/playlists/playlist_id/tracks")))
-
-(def replace-a-playlists-tracks
+  Example: (reorder-a-playlists-tracks {:user_id \"elkalel\" :playlist_id \"6IIjEBw2BrRXbrSLerA7A6\" :range_start 1 :range_length 2 :insert_before 3} \"BQBw-JtC..._7GvA\")"
+  (api-put "users/user_id/playlists/playlist_id/tracks"))
+
+(def replace-a-playlists-tracks
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory key in m are :user_id and :playlist_id, optional keys are :uris and :position.
   :user_id is the users spotify id.
@@ -399,9 +445,10 @@
   :uris a list of spotify track uris.

   Example: (replace-a-playlists-tracks {:user_id \"elkalel\" :playlist_id \"6IIjEBw2BrRXbrSLerA7A6\" :uris \"spotify:track:4iV5W9uYEdYUVa79Axb7Rh,
-  spotify:track:1301WleyT98MSxVHPZCA6M\"} \"BQBw-JtC..._7GvA\")" (spotify-api-call client/put (str spotify-api-url "users/user_id/playlists/playlist_id/tracks")))
-
-(def change-a-playlists-details
+  spotify:track:1301WleyT98MSxVHPZCA6M\"} \"BQBw-JtC..._7GvA\")"
+  (api-put "users/user_id/playlists/playlist_id/tracks"))
+
+(def change-a-playlists-details
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory key in m are :user_id and :playlist_id, optional keys are :name and :public.
   :user_id is the users spotify id.
@@ -409,24 +456,27 @@
   :name is the name for the new playlist.
   :public is set to true if a playlist should be public and false if not.

-  Example: (change-a-playlists-details {:user_id \"elkalel\" :playlist_id \"6IIjEBw2BrRXbrSLerA7A6\" :name \"Fantastic playlist\" :public true} \"BQBw-JtC..._7GvA\")" (spotify-api-call client/put (str spotify-api-url "users/user_id/playlists/playlist_id")))
+  Example: (change-a-playlists-details {:user_id \"elkalel\" :playlist_id \"6IIjEBw2BrRXbrSLerA7A6\" :name \"Fantastic playlist\" :public true} \"BQBw-JtC..._7GvA\")"
+  (api-put "users/user_id/playlists/playlist_id"))

 ;Profiles
-(def get-a-users-profile
+(def get-a-users-profile
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory key in m is :user_id.
   :user_id has to be a spotify user id.

-  Example: (get-a-users-profile {:user_id \"elkalel\"} \"BQBw-JtC..._7GvA\")" (spotify-api-call client/get (str spotify-api-url "users/user_id")))
+  Example: (get-a-users-profile {:user_id \"elkalel\"} \"BQBw-JtC..._7GvA\")"
+  (api-get "users/user_id"))

 ;TODO - what happens when map is not present or nil?
-(def get-current-users-profile
+(def get-current-users-profile
   " Takes an oauth-token t.

-  Example: (get-current-users-profile {} \"BQBw-JtC..._7GvA\")" (spotify-api-call client/get (str spotify-api-url "me")))
+  Example: (get-current-users-profile {} \"BQBw-JtC..._7GvA\")"
+  (api-get "me"))

 ;Search
-(def search
+(def search
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory keys in m are :q and :type, optional keys are :market, :limit and :offset.
   :q is the search string.
@@ -435,21 +485,24 @@
   :limit is the maxium number of tracks to return, default is 20.
   :offset is the index of the first track to return, default is 0.

-  Example: (search {:q \"Gerry Rafferty\" :type \"artist\"  :market \"SE\" :limit 50 :offset 50}} \"BQBw-JtC..._7GvA\")" (spotify-api-call client/get (str spotify-api-url "search")))
+  Example: (search {:q \"Gerry Rafferty\" :type \"artist\"  :market \"SE\" :limit 50 :offset 50}} \"BQBw-JtC..._7GvA\")"
+  (api-get "search"))

 ;Tracks
-(def get-a-track
+(def get-a-track
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory key in m is :id, optional key is :market.
   :id has to have the value of an existing track's id.
   :market is an ISO 3166-1 alpha-2 country code.

-  Example: (get-a-track {:id \"3BEmmHuv5jm0tbCUVI6ceD\" :market \"SE\"} \"BQBw-JtC..._7GvA\")" (spotify-api-call client/get (str spotify-api-url "tracks/id")))
-
-(def get-several-tracks
+  Example: (get-a-track {:id \"3BEmmHuv5jm0tbCUVI6ceD\" :market \"SE\"} \"BQBw-JtC..._7GvA\")"
+  (api-get "tracks/id"))
+
+(def get-several-tracks
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory key in m is :ids, optional key is :market.
   :ids has to be a comma separated string of spotify track ids.
   :market is an ISO 3166-1 alpha-2 country code.

-  Example: (get-several-tracks {:ids \"2Dlo9QsN9ohaz9kASYkKmv,6XYvLpqJFebcjnOTolwkGw\" :market \"SE\"} \"BQBw-JtC..._7GvA\")" (spotify-api-call client/get (str spotify-api-url "tracks")))
+  Example: (get-several-tracks {:ids \"2Dlo9QsN9ohaz9kASYkKmv,6XYvLpqJFebcjnOTolwkGw\" :market \"SE\"} \"BQBw-JtC..._7GvA\")"
+  (api-get "tracks"))


Go literals

Go literals

--- src/cljs/go/compiler.clj
+++ src/cljs/go/compiler.clj
@@ -333,14 +333,14 @@
   (emit-wrap env
     (if (= js-type :object)
       (do
-        (emits "{")
+        (emits "map[string]interface{}{")
         (when-let [items (seq items)]
           (let [[[k v] & r] items]
             (emits "\"" (name k) "\": " v)
             (doseq [[k v] r]
               (emits ", \"" (name k) "\": " v))))
         (emits "}"))
-      (emits "[" (comma-sep items) "]"))))
+      (emits "[]interface{}{" (comma-sep items) "}"))))

 (defmethod emit* :constant
   [{:keys [form env]}]


CMR-3279 fixes valid param name

CMR-3279 fixes valid param name

--- access-control-app/src/cmr/access_control/services/acl_search_service.clj
+++ access-control-app/src/cmr/access_control/services/acl_search_service.clj
@@ -40,7 +40,7 @@

 (defmethod cpv/valid-parameter-options :acl
   [_]
-  {:colleciton-concept-id #{}
+  {:collection-concept-id #{}
    :permitted-group cpv/string-param-options
    :provider cpv/string-param-options
    :identity-type cpv/string-param-options


no need

no need

--- clojure/src/dev/user.cljs
+++ clojure/src/dev/user.cljs
@@ -1,11 +0,0 @@
-(ns cljs.user
-  (:require [dnd.character   :refer [
-                                     move-character!
-                                     get-item!
-                                     drop-item!
-                                     character-direction
-                                     redirect-character!
-                                     ]]
-            [dnd.level       :refer [make-level]]
-            [dnd.showScreen  :refer [show-screen]]
-            [dnd.core        :refer [term level character queue pusher!]]))


Fix typo in collapser options keyword name (from shared-fn to shard-fn)

--- hystrix-contrib/hystrix-clj/src/main/clojure/com/netflix/hystrix/core.clj
+++ hystrix-contrib/hystrix-clj/src/main/clojure/com/netflix/hystrix/core.clj
@@ -430,7 +430,7 @@
 (defn- extract-hystrix-collapser-options
   [meta-map]
   (let [key-map {:hystrix/collapser-key :collapser-key
-                 :hystrix/shared-fn     :shard-fn
+                 :hystrix/shard-fn      :shard-fn
                  :hystrix/scope         :scope
                  :hystrix/cache-key-fn  :cache-key-fn
                  :hystrix/init-fn       :init-fn }]


Set timeout on Thread/join for RServe updates

--- worker/src/clinicico/worker/pirate/core.clj
+++ worker/src/clinicico/worker/pirate/core.clj
@@ -81,7 +81,7 @@
     {:socket socket
      :port port
      :close (fn []
-              (do (.interrupt listener) (.close socket) (.join listener)))}))
+              (do (.interrupt listener) (.close socket) (.join listener 10)))}))

 (defn execute
   "Executes, in R, the method present in the file with the given params.


Redo small changes to run with Java 9/10/11

--- examples/todomvc/project.clj
+++ examples/todomvc/project.clj
@@ -1,14 +1,14 @@
 (defproject todomvc-re-frame "0.10.5"
-  :dependencies [[org.clojure/clojure        "1.8.0"]
-                 [org.clojure/clojurescript  "1.9.908"]
-                 [reagent "0.7.0"]
-                 [re-frame "0.10.5"]
+  :dependencies [[org.clojure/clojure        "1.9.0"]
+                 [org.clojure/clojurescript  "1.10.339"]
+                 [reagent "0.8.1"]
+                 [re-frame "0.10.6"]
                  [binaryage/devtools "0.9.4"]
                  [secretary "1.2.3"]]

   :plugins [[lein-cljsbuild "1.1.7"]
-            [lein-figwheel  "0.5.14"]]
+            [lein-figwheel  "0.5.16"]]

   :hooks [leiningen.cljsbuild]


Reformating

Reformating

--- src/connect5_ai/core.clj
+++ src/connect5_ai/core.clj
@@ -14,7 +14,7 @@
 (defn gen-heuristic-dictionary
   "Generate the dictionnary of heuristics values"
   [depth]
-  (apply merge (for [x '(:min :max :wall :empty)];
+  (apply merge (for [x '(:min :max :wall :empty)]           ;
                  (if (= depth 0)
                    {x 0}
                    {x (gen-heuristic-dictionary (dec depth))}))))
@@ -24,9 +24,9 @@
   [list-to-check player opponent]

   (if
-    (and
-      (= (.indexOf list-to-check opponent) -1)
-      (= (.indexOf list-to-check :wall) -1))
+      (and
+        (= (.indexOf list-to-check opponent) -1)
+        (= (.indexOf list-to-check :wall) -1))
     (let [count-in-list (reduce #(+ %1 (if (= %2 player) 1 0)) 0 list-to-check)]
       (if (< count-in-list 3)
         (Math/pow 2 count-in-list)
@@ -105,79 +105,79 @@
           ;(prn prev-left-direct-streak prev-left-streak-type prev-right-streak-type prev-right-direct-streak)
           ;(prn prev-left-is-dead prev-right-is-dead)
           (empty? left-part)
-            (and prev-left-is-dead prev-right-is-dead))
+          (and prev-left-is-dead prev-right-is-dead))
       (if (and (not= prev-left-streak-type prev-right-streak-type)
                (not= prev-left-streak-type :wall)
                (not= prev-right-streak-type :wall))
         ; Types differents
         (let [opl (if (= :min prev-left-streak-type) + +)
               opr (if (= :min prev-right-streak-type) + +)]
-        (+
-          (opl
-            (cond
-             ;(prn prev-left-partial-streak-count prev-right-partial-streak-count) -3332
-             (or (= :wall prev-left-streak-type) (= :empty prev-left-streak-type)) 0
-
-             (= 4 prev-left-direct-streak) Double/POSITIVE_INFINITY
-             (and
-               (= 3 prev-left-direct-streak)
-               (< 0 prev-left-partial-streak-count)
-               (< 0 prev-right-partial-streak-count)
-               (= 0 prev-right-direct-streak)) 50000
-
-             ;(and
-             ;  (= 3 prev-left-direct-streak)
-             ;  (< 0 prev-left-partial-streak-count)
-             ;  (or (= 0 prev-right-direct-streak)
-             ;      (and (< 0 prev-right-direct-streak)
-             ;           (not= prev-left-streak-type prev-right-streak-type)))) 50000
-
-             (<= 4 (+ prev-left-streak-count prev-left-partial-streak-count)) (+ prev-left-direct-streak prev-left-streak-count)
-             :else 0))
-
-          (opr
-            (cond
-             ;(prn prev-left-partial-streak-count prev-right-partial-streak-count) -333
-             (or (= :wall prev-right-streak-type) (= :empty prev-right-streak-type)) 0
-             (= 4 prev-right-direct-streak) Double/POSITIVE_INFINITY
-             (and
-               (= 3 prev-right-direct-streak)
-               (< 0 prev-right-partial-streak-count)
-               (< 0 prev-left-partial-streak-count)
-               (= 0 prev-left-direct-streak)) 50000
-
-             ;(and
-             ;  (= 3 prev-right-direct-streak)
-             ;  (< 0 prev-right-partial-streak-count)
-             ;  (or (= 0 prev-left-direct-streak)
-             ;      (and (< 0 prev-left-direct-streak)
-             ;           (not= prev-left-streak-type prev-right-streak-type)))) 50000 ;
-
-             (<= 4 (+ prev-right-streak-count prev-right-partial-streak-count)) (+ prev-right-direct-streak prev-right-streak-count)
-             :else 0))
-           ))
+          (+
+            (opl
+              (cond
+                ;(prn prev-left-partial-streak-count prev-right-partial-streak-count) -3332
+                (or (= :wall prev-left-streak-type) (= :empty prev-left-streak-type)) 0
+
+                (= 4 prev-left-direct-streak) Double/POSITIVE_INFINITY
+                (and
+                  (= 3 prev-left-direct-streak)
+                  (< 0 prev-left-partial-streak-count)
+                  (< 0 prev-right-partial-streak-count)
+                  (= 0 prev-right-direct-streak)) 50000
+
+                ;(and
+                ;  (= 3 prev-left-direct-streak)
+                ;  (< 0 prev-left-partial-streak-count)
+                ;  (or (= 0 prev-right-direct-streak)
+                ;      (and (< 0 prev-right-direct-streak)
+                ;           (not= prev-left-streak-type prev-right-streak-type)))) 50000
+
+                (<= 4 (+ prev-left-streak-count prev-left-partial-streak-count)) (+ prev-left-direct-streak prev-left-streak-count)
+                :else 0))
+
+            (opr
+              (cond
+                ;(prn prev-left-partial-streak-count prev-right-partial-streak-count) -333
+                (or (= :wall prev-right-streak-type) (= :empty prev-right-streak-type)) 0
+                (= 4 prev-right-direct-streak) Double/POSITIVE_INFINITY
+                (and
+                  (= 3 prev-right-direct-streak)
+                  (< 0 prev-right-partial-streak-count)
+                  (< 0 prev-left-partial-streak-count)
+                  (= 0 prev-left-direct-streak)) 50000
+
+                ;(and
+                ;  (= 3 prev-right-direct-streak)
+                ;  (< 0 prev-right-partial-streak-count)
+                ;  (or (= 0 prev-left-direct-streak)
+                ;      (and (< 0 prev-left-direct-streak)
+                ;           (not= prev-left-streak-type prev-right-streak-type)))) 50000 ;
+
+                (<= 4 (+ prev-right-streak-count prev-right-partial-streak-count)) (+ prev-right-direct-streak prev-right-streak-count)
+                :else 0))
+            ))
         ; Types identiques ou mur
         (let [op (if (or (= :min prev-left-streak-type) (= :min prev-right-streak-type)) + +)]
           (op (cond
-          (= :wall prev-left-streak-type prev-right-streak-type) 0;
-          (= 4 (+ prev-left-direct-streak prev-right-direct-streak)) (if (or
-                                                                           (= prev-left-streak-type :max)
-                                                                           (= prev-left-streak-type :min)
-                                                                           (= prev-right-streak-type :max)
-                                                                           (= prev-right-streak-type :min))
-                                                                       Double/POSITIVE_INFINITY
-                                                                       0);
-          (and (= 3 (+ prev-left-direct-streak prev-right-direct-streak))
-               (>= prev-right-partial-streak-count 1)
-               (>= prev-left-partial-streak-count 1);
-          )
-          50000
-          (<= 5 (+ prev-left-direct-streak prev-right-direct-streak)) 0
-
-          :else (+ prev-left-direct-streak
-                   prev-left-streak-count
-                   prev-right-direct-streak
-                   prev-right-streak-count)))))
+                (= :wall prev-left-streak-type prev-right-streak-type) 0 ;
+                (= 4 (+ prev-left-direct-streak prev-right-direct-streak)) (if (or
+                                                                                (= prev-left-streak-type :max)
+                                                                                (= prev-left-streak-type :min)
+                                                                                (= prev-right-streak-type :max)
+                                                                                (= prev-right-streak-type :min))
+                                                                             Double/POSITIVE_INFINITY
+                                                                             0) ;
+                (and (= 3 (+ prev-left-direct-streak prev-right-direct-streak))
+                     (>= prev-right-partial-streak-count 1)
+                     (>= prev-left-partial-streak-count 1)  ;
+                     )
+                50000
+                (<= 5 (+ prev-left-direct-streak prev-right-direct-streak)) 0
+
+                :else (+ prev-left-direct-streak
+                         prev-left-streak-count
+                         prev-right-direct-streak
+                         prev-right-streak-count)))))

       (let [left (first left-part)
             right (first right-part)
@@ -206,7 +206,7 @@
                                             :else (inc prev-left-partial-streak-count))

             right-partial-streak-count (cond (or right-is-dead (not= right :empty)) prev-right-partial-streak-count
-                                             :else (inc prev-right-partial-streak-count));
+                                             :else (inc prev-right-partial-streak-count)) ;

             left-direct-streak (if left-direct-streak-is-dead prev-left-direct-streak (inc prev-left-direct-streak))
             right-direct-streak (if right-direct-streak-is-dead prev-right-direct-streak (inc prev-right-direct-streak))
@@ -343,13 +343,13 @@
 (defn build-all-lines-from-state
   [state grid-w grid-h is-first-player]

-    {:max (gen-lines (state is-first-player) grid-w grid-h)
-    :min (gen-lines (state (not is-first-player)) grid-w grid-h)}
+  {:max (gen-lines (state is-first-player) grid-w grid-h)
+   :min (gen-lines (state (not is-first-player)) grid-w grid-h)}

   ;{:max (gen-lines (state true) grid-w grid-h)
   ; :min (gen-lines (state false) grid-w grid-h)}

-;
+  ;
   )

 (defn get-value-for-point
@@ -386,9 +386,9 @@
   ""
   [grid-w grid-h state]

-    (get-value-for-point (state :lines)
-                         (state :last-move)
-                         [grid-w grid-h]))
+  (get-value-for-point (state :lines)
+                       (state :last-move)
+                       [grid-w grid-h]))

 (defn generate-world-from-position
   ""
@@ -399,23 +399,23 @@

     (assoc! tstate is-first-player (conj (state is-first-player) position))
     (assoc! tstate :heuristic-result (- (get-value-for-state grid-w
-                                                          grid-h
-                                                          state)))
+                                                             grid-h
+                                                             state)))
     (persistent! tstate)))

-  (defn generate-successor-states
-    ""
-    [state grid-width grid-height is-first-player]
-    (let [possible-moves (gen-children-points state grid-width grid-height)
-          possible-states (set
-                            (map
-                              #(generate-world-from-position grid-width grid-height state % is-first-player)
-                              possible-moves))]
-      (reduce
-        (fn [col item]
-          (assoc col item (item :heuristic-result)))
-        (clojure.data.priority-map/priority-map-by <)
-        possible-states)))
+(defn generate-successor-states
+  ""
+  [state grid-width grid-height is-first-player]
+  (let [possible-moves (gen-children-points state grid-width grid-height)
+        possible-states (set
+                          (map
+                            #(generate-world-from-position grid-width grid-height state % is-first-player)
+                            possible-moves))]
+    (reduce
+      (fn [col item]
+        (assoc col item (item :heuristic-result)))
+      (clojure.data.priority-map/priority-map-by <)
+      possible-states)))

 (defn is-terminal-state?
   ""
@@ -424,19 +424,19 @@
   (or (= Double/POSITIVE_INFINITY (state :heuristic-result))
       (= Double/NEGATIVE_INFINITY (state :heuristic-result))))

-  (defn minimax-decision
-    [grid-w grid-h is-first-player state timeout]
-
-    (println grid-w grid-h is-first-player state)
-    (if (and
-          is-first-player
-          (empty? (state true)))
-      ; Return a vector
-      ; If the board is empty and we are player 1
-      [(long (/ grid-w 2)) (long (/ grid-h 2))]
-      ; Otherwise
-      ;(gen-successors grid-w grid-h is-first-player state)
-      ))
+(defn minimax-decision
+  [grid-w grid-h is-first-player state timeout]
+
+  (println grid-w grid-h is-first-player state)
+  (if (and
+        is-first-player
+        (empty? (state true)))
+    ; Return a vector
+    ; If the board is empty and we are player 1
+    [(long (/ grid-w 2)) (long (/ grid-h 2))]
+    ; Otherwise
+    ;(gen-successors grid-w grid-h is-first-player state)
+    ))

 (defn- is-it-a-win?
   ""
@@ -505,13 +505,13 @@
           (if (empty? sucessors)
             best
             (let [{child-best-move :best-move tmp-child-best-value :best-value who-win? :who-win?} (negamax-inner (first (first sucessors))
-                                                                                (- beta)
-                                                                                (- alpha)
-                                                                                got-time?
-                                                                                (not is-first-player)
-                                                                                (dec max-depth)
-                                                                                grid-width
-                                                                                grid-height)
+                                                                                (- beta)
+                                                                                (- alpha)
+                                                                                got-time?
+                                                                                (not is-first-player)
+                                                                                (dec max-depth)
+                                                                                grid-width
+                                                                                grid-height)
                   child-best-value (- tmp-child-best-value)]

               (if (and (= child-best-value (best :best-value) Double/POSITIVE_INFINITY)
@@ -520,17 +520,17 @@
                 (if (and (= (best :best-value) Double/POSITIVE_INFINITY)
                          (< child-best-value (best :best-value)))
                   best
-              (if (> child-best-value (best :best-value))
-                (let [best {:best-value child-best-value :best-move child-best-move :who-win? who-win?}]
-                  (if (> (best :best-value) alpha)
-                    (let [alpha (best :best-value)]
-                      (if (and (>= alpha beta)
-                               (or (not= child-best-value Double/POSITIVE_INFINITY)
-                                   (not= who-win? nil)))
-                        best
+                  (if (> child-best-value (best :best-value))
+                    (let [best {:best-value child-best-value :best-move child-best-move :who-win? who-win?}]
+                      (if (> (best :best-value) alpha)
+                        (let [alpha (best :best-value)]
+                          (if (and (>= alpha beta)
+                                   (or (not= child-best-value Double/POSITIVE_INFINITY)
+                                       (not= who-win? nil)))
+                            best
+                            (recur (rest sucessors) best alpha)))
                         (recur (rest sucessors) best alpha)))
-                    (recur (rest sucessors) best alpha)))
-                (recur (rest sucessors) best alpha)))))))))))
+                    (recur (rest sucessors) best alpha)))))))))))

 (defn negamax
   ""
@@ -545,36 +545,36 @@
                                            Double/POSITIVE_INFINITY
                                            got-time?
                                            (not is-first-player)
-                                           deepness          ; Steps
+                                           deepness         ; Steps
                                            grid-width grid-height))

         (recur (inc deepness)))
       (prn "Deepness" deepness)
       )))

-  (defn -getNextMove
-    "Gets the next best move"
-    [charmat timeout]
-    (let [ret-chan (async/chan (async/sliding-buffer 1))
-          timeout-chan (async/timeout timeout)
-          got-time? (atom true)
-          charmat-seq (lazy-seq charmat)
-          state (gen-map-from-charmat charmat-seq {true #{} false #{}} 0)
-          is-first-player (even? (+ (count (state true)) (count (state false))))
-          grid-width (count (first charmat-seq))
-          grid-height (count charmat-seq)]
-
-      (async/go
-        (negamax is-first-player
-                 state
-                 got-time?
-                 grid-width
-                 grid-height
-                 ret-chan))
-
-      ; Block on the timeout channel
-      (async/<!! timeout-chan)
-
-      (let [{decision :best-move} (async/<!! ret-chan)]
-        (swap! got-time? (fn [lastval] false))
-        (into [] decision))))+(defn -getNextMove
+  "Gets the next best move"
+  [charmat timeout]
+  (let [ret-chan (async/chan (async/sliding-buffer 1))
+        timeout-chan (async/timeout timeout)
+        got-time? (atom true)
+        charmat-seq (lazy-seq charmat)
+        state (gen-map-from-charmat charmat-seq {true #{} false #{}} 0)
+        is-first-player (even? (+ (count (state true)) (count (state false))))
+        grid-width (count (first charmat-seq))
+        grid-height (count charmat-seq)]
+
+    (async/go
+      (negamax is-first-player
+               state
+               got-time?
+               grid-width
+               grid-height
+               ret-chan))
+
+    ; Block on the timeout channel
+    (async/<!! timeout-chan)
+
+    (let [{decision :best-move} (async/<!! ret-chan)]
+      (swap! got-time? (fn [lastval] false))
+      (into [] decision))))


added comment to task overview

added comment to task overview

--- src/distillery/tasks.clj
+++ src/distillery/tasks.clj
@@ -111,6 +111,7 @@
 ;;      + Speech Recognition Results
 ;;      + Similarity Matching
 ;;  * XML Result Generation
+;;  * Text Result Generation
 ;;  * Website Generation
 ;;      + Main Pages
 ;;      + Category Pages


Fix warning in cljs.tet reporter

Fix warning in cljs.tet reporter

--- src/flare/cljs_test.cljs
+++ src/flare/cljs_test.cljs
@@ -4,15 +4,15 @@
             [cljs.test :as ct]))

 (defn render-diff [m]
-  (try
-    (let [[pred & values] (second (:actual m))]
+  (let [[pred & values] (second (:actual m))]
+    (try
       (when (and (= pred '=) (= 2 (count values)))
         (when-let [diff (apply diff/diff* values)]
-          (println "\n" (clojure.string/join "\n" (report/report* diff))))))
-    (catch js/Error e
-      (println "*** Oh noes! Flare threw an exception diffing the following values:")
-      (println values)
-      (println "*** Exception thrown is:" e))))
+          (println "\n" (clojure.string/join "\n" (report/report* diff)))))
+      (catch js/Error e
+        (println "*** Oh noes! Flare threw an exception diffing the following values:")
+        (println values)
+        (println "*** Exception thrown is:" e)))))

 (defmethod cljs.test/report [:cljs.test/default :fail] [m]
   (ct/inc-report-counter! :fail)


didn't mean to comment this out

didn't mean to comment this out

--- src/foreclojure/core.clj
+++ src/foreclojure/core.clj
@@ -23,7 +23,7 @@
 (add-index! :users [:user] :unique true)
 (add-index! :users [[:solved -1]])

-; (reconcile-solved-count)
+(reconcile-solved-count)

 (defroutes main-routes
   (GET "/" [] (welcome-page))


tasks: added newlines to logs

tasks: added newlines to logs

--- tasks.cljs
+++ tasks.cljs
@@ -17,17 +17,17 @@
                                 (.-ext dest-els)
                                 "_backup"))]
     (try
-      (print "copy" dest-path "to" backup-path)
+      (println "copy" dest-path "to" backup-path)
       (.copySync fs dest-path backup-path)
-      (print "copy" source-path "to" dest-path)
+      (println "copy" source-path "to" dest-path)
       (.copySync fs source-path dest-path)
       (f)

       (finally
-        (print "recover" dest-path "from" backup-path)
+        (println "recover" dest-path "from" backup-path)
         (.copySync fs backup-path dest-path)

-        (print "remove temp file" backup-path)
+        (println "remove temp file" backup-path)
         (.removeSync fs backup-path)))))

 (defn ^:task api


Bump version to 0.1.1

Bump version to 0.1.1

--- cortex/project.clj
+++ cortex/project.clj
@@ -1,4 +1,4 @@
-(defproject thinktopic/cortex "0.1.1-SNAPSHOT"
+(defproject thinktopic/cortex "0.1.1"
   :description "A neural network toolkit for Clojure."
   :dependencies [[org.clojure/clojure "1.8.0"]
                  [com.taoensso/timbre "4.3.1"]