fix typo

fix typo

--- src/clj/game/cards-resources.clj
+++ src/clj/game/cards-resources.clj
@@ -243,7 +243,7 @@
                         :choices {:req #(not (:rezzed %))}
                         :effect (req (gain state :corp :credit (rez-cost state side target))
                                      (rez state side target)
-                                     (system-msg state side (str "rezzes " (:title target) " at no cast")))}
+                                     (system-msg state side (str "rezzes " (:title target) " at no cost")))}
                       card nil))
     :abilities [{:msg "draw 1 card"
                  :effect (effect (trash card {:cause :ability-cost}) (draw))}]}


raised-button add childs

raised-button add childs

--- src/cljs/material/component.cljs
+++ src/cljs/material/component.cljs
@@ -113,6 +113,7 @@
   ([] (factory/radio-button nil)))

 (defn raised-button
+  ([props & childs] (factory/raised-button (clj->js props) childs))
   ([props] (factory/raised-button (clj->js props)))
   ([] (factory/raised-button nil)))


Refactor db-create-query

Refactor db-create-query

--- src/clojure/neko/data/sqlite.clj
+++ src/clojure/neko/data/sqlite.clj
@@ -1,3 +1,14 @@
+; Copyright © 2012 Alexander Yakushev
+; All rights reserved.
+;
+; This program and the accompanying materials are made available under the
+; terms of the Eclipse Public License v1.0 which accompanies this distribution,
+; and is available at <http://www.eclipse.org/legal/epl-v10.html>.
+;
+; By using this software in any fashion, you are agreeing to be bound by the
+; terms of this license.  You must not remove this notice, or any other, from
+; this software.
+
 (ns neko.data.sqlite
   "Alpha - subject to change.

@@ -44,13 +55,12 @@
   "Generates a table creation query from the provided schema and table
   name."
   [schema table-name]
-  (format "create table %s (%s);"
-          (name table-name)
-          (string/join
-           (interpose ", "
-                      (map (fn [[col params]]
-                             (str (name col) " " (:sql-type params)))
-                           (get-in schema [:tables table-name :columns]))))))
+  (->> (get-in schema [:tables table-name :columns])
+       (map (fn [[col params]]
+              (str (name col) " " (:sql-type params))))
+       (interpose ", ")
+       string/join
+       (format "create table %s (%s);" (name table-name))))

 (defn ^SQLiteOpenHelper create-helper
   "Creates a SQLiteOpenHelper instance for a given schema.


Minor mainly cosmetic fixes on keys ns.

Minor mainly cosmetic fixes on keys ns.

--- src/buddy/core/keys.clj
+++ src/buddy/core/keys.clj
@@ -72,19 +72,21 @@

 (defn private-key
   "Private key constructor from file path."
-  [^String path & [^String passphrase]]
-  (let [keypair (read-pem->keypair path passphrase)]
-    (.getPrivate keypair)))
+  ([path]
+   (private-key path nil))
+  ([path passphrase]
+   (let [keypair (read-pem->keypair path passphrase)]
+     (.getPrivate keypair))))

 (defn public-key
   "Public key constrcutor from file path."
-  [^String path]
+  [path]
   (read-pem->pubkey path))

 (defn str->public-key
   "Public key constructor from string."
-  [^String keydata]
-  (with-open [reader (StringReader. keydata)]
+  [keydata]
+  (with-open [reader (StringReader. ^String keydata)]
     (read-pem->pubkey reader)))

 (defn public-key?


Use type instead of class for compatibility with CLJS

--- src/com/wsscode/pathom/core.cljc
+++ src/com/wsscode/pathom/core.cljc
@@ -275,7 +275,7 @@
 (defn error-str [err]
   (let [msg (.getMessage err)
         data (ex-data err)]
-    (cond-> (class err)
+    (cond-> (type err)
       msg (str ": " msg)
       data (str " - " (pr-str data)))))


fix spec for :node-library :exports config

--- src/main/shadow/build/targets/node_library.clj
+++ src/main/shadow/build/targets/node_library.clj
@@ -20,7 +20,7 @@

     :map
     (s/map-of
-      keyword?
+      simple-keyword?
       shared/unquoted-qualified-symbol?)))

 (s/def ::target


Fix error with unresolved symbol *fi in 'cake run'

--- src/cake/tasks/eval.clj
+++ src/cake/tasks/eval.clj
@@ -41,7 +41,7 @@
     (bake [script (with-root *pwd* (str (file script)))
            args   (rest (drop-while (partial not= script) *args*))]
           (binding [*command-line-args* args]
-            (load-file *fi)))))
+            (load-file script)))))

 (deftask repl #{compile-java}
   "Start an interactive shell with history and tab completion."


Remove println.

Remove println.

--- src/cbfg/world-net.cljs
+++ src/cbfg/world-net.cljs
@@ -231,7 +231,6 @@
                                      vis-chs world-vis-init el-prefix)
                            (ago-loop cmd-dispatch-loop init-world [num-dispatches 0]
                                      (when-let [msg (atake cmd-dispatch-loop req-ch)]
-                                       (println :cmd-dispatch-loop msg)
                                        (when-let [client-cmd-ch (get client-cmd-chs (:client msg))]
                                          (aput cmd-dispatch-loop client-cmd-ch msg)
                                          (recur (inc num-dispatches))))))))))


cleaning up other validate functions

cleaning up other validate functions

--- src/midje/error_handling/semi_sweet_errors.clj
+++ src/midje/error_handling/semi_sweet_errors.clj
@@ -11,31 +11,29 @@
 (defmethod validate "fake" [form]
   (cond (not (list? (second form)))
         (user-error-report-form
-         form
-         "The left-hand-side of a prerequisite must look like a function call."
-         (cl-format nil "`~S` doesn't." (second form)))
+          form
+          "The left-hand-side of a prerequisite must look like a function call."
+          (cl-format nil "`~S` doesn't." (second form)))
         :else
         (rest form)))

-(defmethod validate "data-fake" [form]
-  (let [[header metaconstant arrow hash & remainder] form]
-    (cond (not (metaconstant-symbol? metaconstant))
-          (user-error-report-form
-           form
-           "You seem to be assigning values to a metaconstant, but there's no metaconstant.")
+(defmethod validate "data-fake" [[header metaconstant arrow hash & remainder :as form]]
+  (cond (not (metaconstant-symbol? metaconstant))
+        (user-error-report-form
+          form
+          "You seem to be assigning values to a metaconstant, but there's no metaconstant.")

-          (not= (matches-symbols-in-semi-sweet-or-sweet-ns? '(arrow) =contains=>))
-          (user-error-report-form
-           form
-           "Assigning values to a metaconstant requires =contains=>")
+        (not= (matches-symbols-in-semi-sweet-or-sweet-ns? '(arrow) =contains=>))
+        (user-error-report-form
+          form
+          "Assigning values to a metaconstant requires =contains=>")

-          :else
-          (rest form))))
+        :else
+        (rest form)))

 (defmethod validate "expect" [form]
-  (cond (< (count form) 4)
-        (user-error-report-form form
-         (cl-format nil "    This form: ~A" form)
-         (cl-format nil "Doesn't match: (~A <actual> => <expected> [<keyword-value pairs>*])" (first form)))
-        :else
-        (rest form)))
+  (if (< (count form) 4)
+    (user-error-report-form form
+      (cl-format nil "    This form: ~A" form)
+      (cl-format nil "Doesn't match: (~A <actual> => <expected> [<keyword-value pairs>*])" (first form)))
+    (rest form)))


documenting the captured-throwable ns

documenting the captured-throwable ns

--- src/midje/internal_ideas/capturedthrowable.clj
+++ src/midje/internal_ideas/capturedthrowable.clj
@@ -1,4 +1,6 @@
-(ns midje.internal-ideas.capturedthrowable)
+(ns midje.internal-ideas.capturedthrowable
+  "When a fact throws an Exception or Error it gets wrapped
+   in this deftype")

 (defprotocol ICapturedThrowable
   (throwable [this]))
@@ -11,4 +13,4 @@
   (CapturedThrowable. ex))

 (defn captured-throwable? [x]
-  (satisfies? ICapturedThrowable x))+  (instance? CapturedThrowable x))


tweak the zoom snapping a bit

tweak the zoom snapping a bit

--- src-cljs/frontend/camera.cljs
+++ src-cljs/frontend/camera.cljs
@@ -56,9 +56,10 @@
   "Step function to determine snap increment"
   [grid-size]
   (condp > grid-size
-    5 100
-    10 50
-    20 10
+    3 100
+    4 50
+    8 25
+    15 10
     50 5
     5))


(PDB-2576) Remove unneeded redefs from storage-test

--- test/puppetlabs/puppetdb/scf/storage_test.clj
+++ test/puppetlabs/puppetdb/scf/storage_test.clj
@@ -1330,12 +1330,11 @@
     (add-certname! "node2")
     (add-certname! "node3")
     (deactivate-node! "node1")
-    (with-redefs [now (constantly (-> 10 days ago))]
-      (deactivate-node! "node2"))
-
+    (deactivate-node! "node2" (-> 10 days ago))
     (purge-deactivated-and-expired-nodes! (-> 5 days ago))
-
-    (is (= (map :certname (query-to-vec "SELECT certname FROM certnames ORDER BY certname ASC"))
+    (is (= (map :certname
+                (query-to-vec
+                 "select certname from certnames order by certname asc"))
            ["node1" "node3"]))))

 (deftest-db purge-expired-nodes
@@ -1343,13 +1342,12 @@
     (add-certname! "node1")
     (add-certname! "node2")
     (add-certname! "node3")
-    (expire-node! "node1")
-    (with-redefs [now (constantly (-> 10 days ago))]
-      (expire-node! "node2"))
-
+    (expire-node! "node1" (now))
+    (expire-node! "node2" (-> 10 days ago))
     (purge-deactivated-and-expired-nodes! (-> 5 days ago))
-
-    (is (= (map :certname (query-to-vec "SELECT certname FROM certnames ORDER BY certname ASC"))
+    (is (= (map :certname
+                (query-to-vec
+                 "select certname from certnames order by certname asc"))
            ["node1" "node3"]))))

 (deftest-db report-sweep-nullifies-latest-report


(PDB-5141) Ensure call-with-lock-timeout handles existing tiemouts

--- test/puppetlabs/puppetdb/scf/storage_test.clj
+++ test/puppetlabs/puppetdb/scf/storage_test.clj
@@ -2161,3 +2161,19 @@
            (query-to-vec "select * from catalog_inputs")))
     (is (= [{:id 1 :certname "foo" :catalog_inputs_timestamp stamp-2 :catalog_inputs_uuid (:catalog_uuid catalog)}]
            (query-to-vec "select certname, id, catalog_inputs_timestamp, catalog_inputs_uuid::text from certnames")))))
+
+(defn get-lock-timeout []
+  (-> "select setting from pg_settings where name = 'lock_timeout'"
+      query-to-vec first :setting Long/parseLong))
+
+(deftest-db call-with-lock-timeout-behavior
+  (let [orig (get-lock-timeout)]
+    (jdbc/with-db-transaction []
+      ;; Ensure an existing (in transaction (or global)) non-zero
+      ;; timeout doesn't cause an exception.  Previously, we were
+      ;; relying on "show lock_timeout", which produces human readable
+      ;; values like 300ms rather than the integer milliseconds value
+      ;; we expect to parse.
+      (sql/execute! jdbc/*db* "set local lock_timeout = 300")
+      (is (= 1000 (call-with-lock-timeout get-lock-timeout 1000))))
+    (is (= orig (get-lock-timeout)))))


(maint) Fix timing sensitive test

(maint) Fix timing sensitive test

The previous expression of this test made some unsound assumptions about the
passage of time.  Moving between various runs sometimes the 9 seconds
yielding an exactly 4 seconds delay was incorrect and instead returned the
fraction 9/2, or 4.5.  Here we check that the computed value fits into the
non-descending sequence of expected values, so we're less tied to actual
clocks, without mocking out all the time logic.

--- test/unit/puppetlabs/pcp/broker/core_test.clj
+++ test/unit/puppetlabs/pcp/broker/core_test.clj
@@ -64,8 +64,8 @@
     (is (= 1 (retry-delay (capsule/wrap (message/set-expiry (message/make-message) 1 :seconds))))))

   (testing "it's about half the time we have left"
-    (is (= 1 (retry-delay (capsule/wrap (message/set-expiry (message/make-message) 2 :seconds)))))
-    (is (= 4 (retry-delay (capsule/wrap (message/set-expiry (message/make-message) 9 :seconds))))))
+    (is (<= 1 (retry-delay (capsule/wrap (message/set-expiry (message/make-message) 2 :seconds))) 2))
+    (is (<= 4 (retry-delay (capsule/wrap (message/set-expiry (message/make-message) 9 :seconds))) 5)))

   (testing "high bounds should be 15 seconds"
     (is (= 15 (retry-delay (capsule/wrap (message/set-expiry (message/make-message) 3000000 :seconds)))))))


refacto

refacto

--- desktop/src-common/con_world/entity-enemy.clj
+++ desktop/src-common/con_world/entity-enemy.clj
@@ -80,13 +80,15 @@
           :z-side (directions (rand-int 3)))
       (init-enemy-body-spacial-settings))))

-(defn may-spawn-enemy [{:keys [last-spawn total-time] :as screen} entities]
+(defn may-spawn-enemy
+  "TODO : make timer reliable"
+  [{:keys [last-spawn total-time] :as screen} entities]
   (if (and (not= last-spawn (int total-time))
-           (= 0 (mod (int total-time) 2)))
+           (even? (int total-time)))
     (do
-      (println "spawn!")
       (spawn-enemy-sound (find-cell entities))
-      [(play-clj.core/update! screen :last-spawn (int total-time)) (conj entities (spawn-enemy screen entities))])
+      [(play-clj.core/update! screen :last-spawn (int total-time))
+       (conj entities (spawn-enemy screen entities))])
     [screen entities]))

 (defn animate-enemies [screen entities]


fix startup

fix startup

--- src/clj/signet/core.clj
+++ src/clj/signet/core.clj
@@ -47,9 +47,9 @@

 (defn -main [& args]
   (let [port (-> args first read-string)]
-    (info "Starting Server ...")
+    (info " - SERVER - Warming up...")
     (run-server (site #'handler) {:port (or port 8082) :join? false})
-    (info "done")
+    (info " - SERVER - started")
     (info  (str "Visit http://localhost:" (or port 8082)))))


remove comments

remove comments

--- src/clj_docker/core.clj
+++ src/clj_docker/core.clj
@@ -76,9 +76,3 @@
                                         :m         message
                                         :author    author}
                          :as :json})))
-
-;; examples
-(comment
-  (def cli(clj-docker.client/make-client))
-  (version cli)
-  (clj-docker.core/run cli "ubuntu" :tag "14.04" :cmd ["ls"]))


Adding some tests for destructuring

Adding some tests for destructuring

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -2683,6 +2683,19 @@
   (assert (= (re-matches (re-pattern "foo.*") "foo bar foo baz foo zot") "foo bar foo baz foo zot"))
   (assert (= (re-seq (re-pattern "foo") "foo bar foo baz foo zot") (list "foo" "foo" "foo")))
   (assert (= (re-seq (re-pattern "f(.)o") "foo bar foo baz foo zot") (list ["foo" "o"] ["foo" "o"] ["foo" "o"])))
+
+  ;; destructuring
+  (assert (= [2 1] (let [[a b] [1 2]] [b a])))
+  (assert (= #{1 2} (let [[a b] [1 2]] #{a b})))
+  (assert (= [1 2] (let [{a :a b :b} {:a 1 :b 2}] [a b])))
+  (assert (= [1 2] (let [{:keys [a b]} {:a 1 :b 2}] [a b])))
+  (assert (= [1 2 [1 2]] (let [[a b :as v] [1 2]] [a b v])))
+  (assert (= [1 42] (let [{:keys [a b] :or {b 42}} {:a 1}] [a b])))
+  (assert (= [1 nil] (let [{:keys [a b] :or {c 42}} {:a 1}] [a b])))
+  ;; broken destructuring
+  ; (assert (= [2 1] (let [[a b] '(1 2)] [b a])))
+  ; (assert (= {1 2} (let [[a b] [1 2]] {a b})))
+  ; (assert (= [2 1] (let [[a b] (seq [1 2])] [b a])))
   :ok
   )


CLJS-242: copy over mapv & filterv from clojure.core

Pure copy & paste from Clojure (removing :added & :static metadata).

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -2232,6 +2232,31 @@
     (persistent! (reduce -conj! (transient to) from))
     (reduce -conj to from)))

+(defn mapv
+  "Returns a vector consisting of the result of applying f to the
+  set of first items of each coll, followed by applying f to the set
+  of second items in each coll, until any one of the colls is
+  exhausted.  Any remaining items in other colls are ignored. Function
+  f should accept number-of-colls arguments."
+  ([f coll]
+     (-> (reduce (fn [v o] (conj! v (f o))) (transient []) coll)
+         persistent!))
+  ([f c1 c2]
+     (into [] (map f c1 c2)))
+  ([f c1 c2 c3]
+     (into [] (map f c1 c2 c3)))
+  ([f c1 c2 c3 & colls]
+     (into [] (apply map f c1 c2 c3 colls))))
+
+(defn filterv
+  "Returns a vector of the items in coll for which
+  (pred item) returns true. pred must be free of side-effects."
+  [pred coll]
+  (-> (reduce (fn [v o] (if (pred o) (conj! v o) v))
+              (transient [])
+              coll)
+      persistent!))
+
 (defn partition
   "Returns a lazy sequence of lists of n items each, at offsets step
   apart. If step is not supplied, defaults to n, i.e. the partitions


Cleanup

Cleanup

--- src/cljs/ufo/views.cljs
+++ src/cljs/ufo/views.cljs
@@ -56,90 +56,6 @@
         [:div.loading
          [:div.three-quarters-loader "Loading..."]]))))

-(defn github-id-input
-  []
-  (let [loading? (re-frame/subscribe [:loading?])
-        error? (re-frame/subscribe [:error?])
-        github-id (reagent/atom "")
-        on-click (fn [_]
-                   (when-not (empty? @github-id)
-                     (re-frame/dispatch [:set-github-id @github-id])
-                     (reset! github-id "")))]
-    (fn []
-      [:div
-       [:div.input-group
-        [:input.form-control {:type "text"
-                              :placeholder "Enter Github ID"
-                              :on-change #(reset! github-id (-> % .-target .-value))}]
-        [:span.input-group-btn
-         [:button.btn.btn-default {:type "button"
-                                   :on-click #(when-not @loading? (on-click %))}
-          "Go"]
-         ]]
-       (when @error?
-         [:p.error-text.text-danger "¯\\_(ツ)_/¯  Bad github handle or rate limited!"])])))
-
-(defn user-name-and-avatar
-  []
-  (fn []
-    (let [user-profile (re-frame/subscribe [:user-profile])]
-      [:div.user-details
-       [:img.img-circle {:src (get @user-profile "avatar_url")}]
-       [:h5.text-center (get @user-profile "name")]])))
-
-(defn user-repos-list
-  []
-  (let [user-repos (re-frame/subscribe [:user-repos])]
-    (fn []
-      [:ul.list-group
-       (map-indexed (fn [i repo]
-                      (vector :li.list-group-item {:key i}
-                              [:h4.list-group-item-heading (get repo "name")]
-                              [:p.list-group-item-text (get repo "description")]))
-                    @user-repos)])))
-;; home
-(defn home-panel []
-  (let []
-    (fn []
-      [:div
-       [:div.topbar
-        [:div.container
-         [:div.row
-          [:div.col-lg-6.col-lg-offset-3
-           [github-id-input]]]]]
-       [:div.main-content
-        [:div.container
-         [:div.row
-          [:div.col-lg-6.col-lg-offset-3
-           [user-repos-list]]]]]
-       ])))
-
-
-;; profile
-
-(defn profile-panel []
-  (fn []
-    [:div "This is the Profile Page."
-     [:div [:a {:href "#/"} "go to Home Page"]]
-     ]))
-
-
-;; main
-
-(defmulti panels identity)
-(defmethod panels :home-panel [] [home-panel])
-(defmethod panels :profile-panel [] [profile-panel])
-(defmethod panels :default [] [:div])
-
-#_(defn main-panel []
-  (let [active-panel (re-frame/subscribe [:active-panel])]
-    (fn []
-      [:div
-       [loading-throbber]
-       [user-name-and-avatar]
-       (panels @active-panel)
-       ])))
-
 (defn main-panel []
   (fn []
     [:div


Implement >>

Implement >>

--- src/cljx/cats/core.cljx
+++ src/cljx/cats/core.cljx
@@ -339,6 +339,14 @@
   ([mv f & fs]
      (reduce bind mv (cons f fs))))

+(defn >>
+  "Performs a Haskell-style left-associative bind,
+  ignoring the values produced by the monad computations."
+  ([mv mv']
+    (bind mv (fn [_] mv')))
+  ([mv & mvs]
+     (reduce bind mv mvs)))
+
 (defn =<<
   "Same as the two argument version of `>>=` but with the
   arguments interchanged."


Remove quil.util/callable? from ClojureScript code.

--- src/cljx/quil/util.cljx
+++ src/cljx/quil/util.cljx
@@ -5,9 +5,10 @@
   "Function that does nothing."
   [])

+#+clj
 (defn callable? [value]
   (or (fn? value)
-      #+clj (var? value)))
+      (var? value)))

 #+clj
 (defn absolute-path [path]


Suppress stack trace on missing pom.

Suppress stack trace on missing pom.

--- src/clojars/promote.clj
+++ src/clojars/promote.clj
@@ -63,7 +63,8 @@
   (let [jar (file-for group name version "jar")
         pom (file-for group name version "pom")
         keys (db/group-keys group)
-        info (try (maven/pom-to-map pom)
+        info (try (if (.exists pom)
+                    (maven/pom-to-map pom))
                   (catch Exception e
                     (.printStackTrace e) {}))]
     (-> []


Goddamn you, nibbles.

Goddamn you, nibbles.

--- src/clojurecraft/in.clj
+++ src/clojurecraft/in.clj
@@ -1,5 +1,20 @@
 (ns clojurecraft.in
-  (:use [clojurecraft.mappings]))
+  (:use [clojurecraft.mappings])
+  (:import (java.util.zip Inflater)))
+
+; Bytes ----------------------------------------------------------------------------
+(defn byte-seq [b]
+  (loop [n 0 b b s []]
+    (if (< n 8)
+      (recur (inc n) (bit-shift-right b 1) (conj s (bit-and b 1)))
+      (reverse s))))
+
+(defn top [b]
+  (bit-shift-right (bit-and b 0xf0) 4))
+
+(defn bottom [b]
+  (bit-and b 0x0f))
+

 ; Reading Data ---------------------------------------------------------------------
 (defn- -read-byte [conn]
@@ -308,19 +323,55 @@
          :z (-read-int conn)
          :mode (-read-bool conn)))

+
+(defn- -parse-nibbles [len data]
+  (loop [i 0
+         nibbles []
+         data data]
+    (if (= i len)
+      [nibbles data]
+      (let [next-byte (get data 0)
+            top-byte (top next-byte)
+            bottom-byte (bottom next-byte)]
+        (recur (+ i 1)
+               (conj nibbles bottom-byte top-byte)
+               (subvec data 1))))))
+
+(defn- -read-packet-mapchunk-decode [predata data-ba]
+  (let [len (* (:sizex predata) (:sizey predata) (:sizez predata))
+        data (into [] data-ba)
+        block-types (subvec data 0 len)
+        data (subvec data len)]
+    (let [[block-metadata data] (-parse-nibbles len data)
+          [block-light data] (-parse-nibbles len data)
+          [sky-light data] (-parse-nibbles len data)]
+      (map #({:blocktype %1 :blockmeta %2 :blocklight %3 :skylight %4})
+           block-types block-metadata block-light sky-light))))
+
+(defn- -read-packet-mapchunk-chunkdata [conn predata]
+  (let [raw-data (-read-bytearray conn (:compressedsize predata))
+        buffer (byte-array (/ (* 5
+                                 (:sizex predata)
+                                 (:sizey predata)
+                                 (:sizez predata)) 2))
+        decompressor (Inflater.)]
+    (-> decompressor
+      (.setInput raw-data 0 (:compressedsize predata))
+      (.inflate buffer)
+      .end)
+    buffer))
+
 (defn- read-packet-mapchunk [bot conn]
   (let [predata (assoc {}
                        :x (-read-int conn)
                        :y (-read-short conn)
                        :z (-read-int conn)
-                       :sizex (-read-byte conn)
-                       :sizey (-read-byte conn)
-                       :sizez (-read-byte conn)
+                       :sizex (+ 1 (-read-byte conn))
+                       :sizey (+ 1 (-read-byte conn))
+                       :sizez (+ 1 (-read-byte conn))
                        :compressedsize (-read-int conn))]
-    (assoc predata
-           :compresseddata
-           (-read-bytearray conn
-                            (:compressedsize predata)))))
+    (assoc predata :data (-read-packet-mapchunk-decode (-read-packet-mapchunk-chunkdata conn predata)))))
+

 (defn- read-packet-multiblockchange [bot conn]
   (assoc {}


Started commenting the globals.clj definitions.

--- src/clojush/globals.clj
+++ src/clojush/globals.clj
@@ -4,19 +4,23 @@
 ;; globals

 (def push-types '(:exec :integer :float :code :boolean :string :zip
-                        :tag :auxiliary :return :environment))
-(def max-number-magnitude 1000000000000)
-(def min-number-magnitude 1.0E-10)
-(def top-level-push-code true)
-(def top-level-pop-code true)
-(def min-random-integer -10)
-(def max-random-integer 10)
-(def min-random-float -1.0)
-(def max-random-float 1.0)
-(def min-random-string-length 1)
-(def max-random-string-length 10)
-(def max-string-length 100)
-(def max-points-in-random-expressions 50) ;; for code_rand
+                        :tag :auxiliary :return :environment)) ;; Stack types
+(def top-level-push-code true) ;; When true, run-push will push the program's code onto the code stack prior to running
+(def top-level-pop-code true) ;; When true, run-push will pop the code stack after running the program
+
+;; These definitions are used by instructions to keep computed values within limits
+;; or when using random instructions.
+(def max-number-magnitude 1000000000000) ;; Used by keep-number-reasonable as the maximum size of any integer or float
+(def min-number-magnitude 1.0E-10) ;; Used by keep-number-reasonable as the minimum magnitude of any float
+(def max-string-length 500) ;; Used by string instructions to ensure that strings don't get too large
+(def min-random-integer -10) ;; The minumum value created by the integer_rand instruction
+(def max-random-integer 10) ;; The maximum value created by the integer_rand instruction
+(def min-random-float -1.0) ;; The minumum value created by the float_rand instruction
+(def max-random-float 1.0) ;; The maximum value created by the float_rand instruction
+(def min-random-string-length 1) ;; The minimum length of string created by the string_rand instruction
+(def max-random-string-length 10) ;; The maximum length of string created by the string_rand instruction
+(def max-points-in-random-expressions 50) ;; The maximum length of code created by the string_rand instruction
+
 (def maintain-histories true) ;; histories are lists of total-error values for ancestors
 (def maintain-ancestors false) ;; if true save all ancestors in each individual (costly)
 (def print-ancestors-of-solution false)


Sideeffects minimized

Sideeffects minimized

--- agiledox.clj
+++ agiledox.clj
@@ -20,21 +20,17 @@
   (.toLowerCase (.replaceAll line "([A-Z])" " $1")))

 (defn test-lines? [test-file] (not-empty (test-file :lines)))
-(defn print-class [test-file] (println (as-header (test-file :name))))
-(defn print-line [line] (println (as-feature line)))
-(defn print-lines [test-file]
-  (dorun
-    (map print-line
-         (test-file :lines))))

-(defn print-spec [test-file]
+(defn make-spec [test-file]
   (if (test-lines? test-file)
-    (do
-      (print-class test-file)
-      (print-lines test-file)
-      (println ""))))
+    (list
+      (as-header (test-file :name))
+      (map as-feature (test-file :lines))
+      "")))

 (dorun
-  (map print-spec
-       (map make-test-file
-            (java-test-files "."))))
+  (map (fn [s] (if s (println s)))
+    (flatten
+      (map make-spec
+           (map make-test-file
+                (java-test-files "."))))))


remove even more redundancy

remove even more redundancy

--- clojure/adventofcode/src/adventofcode/days/day4.clj
+++ clojure/adventofcode/src/adventofcode/days/day4.clj
@@ -18,11 +18,11 @@

 (defn sector-value [room]
   (let [length (count room)]
-    (letfn [(room-name [room] (subs room 0 (- length 11)))
-            (sector-id [room] (subs room (- length 10) (- length 7)))
-            (checksum [room] (subs room (- length 6) (- length 1)))]
-      (if (= (checksum room) (calc-checksum (room-name room)))
-        (Integer. (sector-id room))
+    (letfn [(room-name [] (subs room 0 (- length 11)))
+            (sector-id [] (subs room (- length 10) (- length 7)))
+            (checksum [] (subs room (- length 6) (- length 1)))]
+      (if (= (checksum) (calc-checksum (room-name)))
+        (Integer. (sector-id))
         0))))

 (defn rooms [path]


TCLI-8: Correct unit test so that it actually tests something

--- src/test/clojure/clojure/tools/cli_legacy_test.clj
+++ src/test/clojure/clojure/tools/cli_legacy_test.clj
@@ -82,7 +82,7 @@
     (deftest should-work-with-trailing-boolean-args
       (let [[options args _] (cli ["--no-verbose" "some-file"]
                                   ["--[no-]verbose"])]
-        (is (= {:verbose false}))
+        (is (= {:verbose false} options))
         (is (= ["some-file"] args))))

     (deftest should-accept-double-hyphen-as-end-of-args


comments

comments

--- dada-demo/src/main/clojure/org/dada/demo/whales.clj
+++ dada-demo/src/main/clojure/org/dada/demo/whales.clj
@@ -490,3 +490,9 @@
     ;; (? (dsplit :type list [(dunion)(dpivot :ocean ["arctic" "atlantic" "indian" "pacific" "southern"] (keyword "sum(:weight)")) (dsum :weight) (dsplit :ocean)]) (dfrom "Whales"))

     ))
+
+;; TODO:
+;; - defmodel
+;; - djoin
+;; - dpivot
+;; - fix remaining broken queries


Handle URI's as exception file info

Handle URI's as exception file info

--- src/adzerk/boot_cljs/impl.clj
+++ src/adzerk/boot_cljs/impl.clj
@@ -48,6 +48,8 @@
   (let [{:keys [type tag file line column] :as data} (util/merge-cause-ex-data e)
         ; Get the message without location info
         message (.getMessage (util/last-cause e))
+        ; Sometimes filepath is a URI
+        file (str/replace file #"^file:" "")
         file (util/find-original-path source-paths dirs file)
         ; Remove file info from message
         message (if (and file (re-matches #".*in file.*" message))


use entity/get-by-id where possible

use entity/get-by-id where possible

--- src/kixi/hecuba/api/profiles.clj
+++ src/kixi/hecuba/api/profiles.clj
@@ -11,7 +11,8 @@
    [kixi.hecuba.storage.db :as db]
    [kixi.hecuba.storage.sha1 :as sha1]
    [kixi.hecuba.web-paths :as p]
-   [kixi.hecuba.data.users :as users]))
+   [kixi.hecuba.data.users :as users]
+   [kixi.hecuba.data.entity :as entity]))

 (def ^:private entity-profiles-resource (p/resource-path-string :entity-profiles-resource))

@@ -21,7 +22,7 @@
           method       (:request-method request)
           route-params (:route-params request)
           entity_id    (:entity_id route-params)
-          entity       (first (db/execute session (hayt/select :entities (hayt/where [[= :id entity_id]]))))]
+          entity       (entity/get-by-id session entity_id)]
       (case method
         :post (not (nil? entity))
         :get (let [items (db/execute session (hayt/select :profiles (hayt/where [[= :entity_id entity_id]])))]
@@ -592,7 +593,7 @@
         association-schema (:schema association)]
     (map
      (fn [attr]
-       [ (str (name association-name) "_" (name attr)) (item (name attr)) ])
+       [(str (name association-name) "_" (name attr)) (item (name attr))])
      association-schema)))

 (defn explode-associated-items [association items]
@@ -601,15 +602,15 @@
   Returns a list of vectors of two elements, the first being the attribute key,
   and the second the value.
   The keys are expanded like <association name>_<associated item index>_<attribute name>"
-  (let [association-name   (name (:name    association))
-        association-schema (:schema  association)]
+  (let [association-name   (name (:name association))
+        association-schema (:schema association)]
     (apply concat
     (map-indexed
       (fn [index item-string]
          (let [item-name         (str association-name "_" index)
                named-association (assoc association :name item-name)]
            (if (empty? association-schema)
-             [ item-name item-string ]
+             [item-name item-string]
              (explode-nested-item named-association item-string))))
       items))))

@@ -659,7 +660,7 @@
     (fn [associated-item associated-item-attr]
       (let [associated-item-attr-name (name associated-item-attr)
             exploded-attr-name (str (name association-name) "_" index "_" associated-item-attr-name)]
-        (conj associated-item { associated-item-attr (input exploded-attr-name)})))
+        (conj associated-item {associated-item-attr (input exploded-attr-name)})))
     {}
     association-schema))

@@ -826,9 +827,7 @@
           username   (sec/session-username (-> ctx :request :session))
           profile_id (sha1/gen-key :profile profile)]
       (when (and entity_id timestamp)
-        (when (seq
-                (first
-                  (db/execute session (hayt/select :entities (hayt/where [[= :id entity_id]])))))
+        (when (seq (entity/get-by-id session entity_id))
           (let [query-profile (-> profile
                                  (assoc :user_id username)
                                  (update-stringified-lists


added pintar

added pintar

--- src/babel/espanol/lexicon.clj
+++ src/babel/espanol/lexicon.clj
@@ -128,6 +128,9 @@
                       :sem {:pred :dormire}}}
    "echar" {:synsem {:cat :verb
                      :sem {:pred :throw-out}}}
+
+   "pintar" {:synsem {:cat :verb
+                      :sem {:pred :paint}}}

    "quedarse" (let [subject-semantics (ref {:animate true})
                     subject-agr (ref :top)]


dereference lexicon before using

dereference lexicon before using

--- src/babel/francais/writer.clj
+++ src/babel/francais/writer.clj
@@ -13,14 +13,15 @@
 (require '[dag_unify.core :refer (fail? get-in strip-refs unify)])

 (defn rewrite-lexicon []
-  (write-lexicon "fr" lexicon))
+  (write-lexicon "fr" @lexicon))

 (defn tout [ & [count]]
   (let [use-map-fn pmap
         count (if count (Integer. count) 10)
+        foo (babel.francais.lexicon/deliver-lexicon)
         root-verbs
         (zipmap
-         (keys lexicon)
+         (keys @lexicon)
          (use-map-fn
           (fn [lexeme-set]
             (filter (fn [lexeme]
@@ -31,14 +32,14 @@
                        (= (get-in lexeme [:synsem :infl]) :top)
                        (not (= :top (get-in lexeme [:synsem :sem :pred] :top)))))
                     lexeme-set))
-          (vals lexicon)))
+          (vals @lexicon)))
         root-verb-array
         (reduce concat
                 (use-map-fn (fn [key]
                               (get root-verbs key))
                             (sort (keys root-verbs))))]
     (init-db)
-    (write-lexicon "fr" lexicon)
+    (write-lexicon "fr" @lexicon)
     (log/info (str "done writing lexicon."))
     (log/info (str "generating examples with this many verbs:"
                    (.size root-verb-array)))


maybe fixes the build, more waiting

maybe fixes the build, more waiting

--- test/clj/conference_rating/functional_test.clj
+++ test/clj/conference_rating/functional_test.clj
@@ -70,6 +70,7 @@
   (click "conference-voices-brand")
   (wait-for "page-conference-list")
   (taxi/click ".tt-input")
+  (taxi/wait-until (taxi/exists? ".tt-open"))
   (taxi/send-keys ".tt-input" search-string)
   (wait-for "conference-suggestion-template")
   (click "conference-suggestion-template")
@@ -101,7 +102,7 @@
       (fill-past-date "date-conference-to")
       (click "button-create-conference")

-      ; detail page of the newly added conference
+      ; detail page of the newly added past conference
       (wait-for "page-conference-detail")
       (is (= conference-series (s/lower-case (text "text-conference-series")))) ; different chromedrivers treat css transform differently
       (is (= past-conference-name (text "text-conference-name")))
@@ -177,5 +178,4 @@
       (wait-for "page-conference-detail")
       (is (= conference-series (s/lower-case (text "text-conference-series")))) ; different chromedrivers treat css transform differently
       (is (= future-conference-name (s/lower-case (text "text-conference-name"))))
-      (is (= "This conference has not started yet and no conference of this series has been rated yet. Come back later!" (text "no-ratings-info"))))))
-
+      (is (= "This conference has not started yet and no conference of this series has been rated yet. Come back later!" (text "no-ratings-info"))))))


add test to ensure transaction items belong to account being reconciled

--- test/clj_money/models/reconciliations_test.clj
+++ test/clj_money/models/reconciliations_test.clj
@@ -309,4 +309,3 @@
         "The previous balance is the balance of the last completed reconciliation")))

 ; Test that any given transaction item cannot be included in more than one reconciliation at the validation level
-; Test that the transaction item references the account being reconciled


Add redirect for old `/v/<id>` urls

Add redirect for old `/v/<id>` urls

--- src/clj/clojuredocs/entry.clj
+++ src/clj/clojuredocs/entry.clj
@@ -73,11 +73,22 @@
       {:status 301
        :headers {"Location" (str "/" ns "/" name)}})))

+(defn old-v-page-redirect [id]
+  (fn [r]
+    (try
+      (let [{:keys [ns name] :as legacy-var}
+            (mon/fetch-one :legacy-var-redirects :where {:function-id (Integer/parseInt id)})]
+        (when legacy-var
+          {:status 307
+           :headers {"Location" (str "/" ns "/" (util/cd-encode name))}}))
+      (catch Exception e nil))))
+
 (defroutes old-url-redirects
   (GET "/clojure_core/:ns/:name" [ns name] (redirect-to-var ns name))
   (GET "/clojure_core/:version/:ns/:name" [ns name] (redirect-to-var ns name))
   (GET "/quickref/*" [] {:status 301 :headers {"Location" "/quickref"}})
-  (GET "/clojure_core" [] {:status 301 :headers {"Location" "/"}}))
+  (GET "/clojure_core" [] {:status 301 :headers {"Location" "/"}})
+  (GET "/v/:id" [id] (old-v-page-redirect id)))

 (defroutes _routes
   (context "/api" [] api.server/routes)


Use reflection to check if method exists

--- src/clj/nightcode/process.clj
+++ src/clj/nightcode/process.clj
@@ -39,8 +39,10 @@
 (defn stop-process!
   [process]
   (when-let [p @process]
-    (doseq [child (-> p .descendants .iterator iterator-seq)]
-      (.destroyForcibly child))
+    ; kill child processes if running on java 9 or later
+    (when (->> Process .getDeclaredMethods seq (some #(= (.getName %) "descendants")))
+      (doseq [child (-> p .descendants .iterator iterator-seq)]
+        (.destroyForcibly child)))
     (.destroyForcibly p))
   (reset! process nil))


base64 regex and check #230

base64 regex and check
#230

--- src/cljc/swarmpit/base64.cljc
+++ src/cljc/swarmpit/base64.cljc
@@ -1,6 +1,9 @@
 (ns swarmpit.base64
   #?(:clj
      (:import java.util.Base64)))
+
+(def base64-regex
+  #"^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$")

 #?(:clj
    (defn encode
@@ -13,3 +16,7 @@
      [encoded-data]
      (String. (.decode (Base64/getDecoder)
                        encoded-data))))
+
+(defn base64? [data]
+  (and (not= (count data) 4)
+       (some? (re-matches base64-regex data))))


updated some comments

updated some comments


More tweaks to attribute API

More tweaks to attribute API

--- src/clojure/alfresco/attr.clj
+++ src/clojure/alfresco/attr.clj
@@ -50,7 +50,7 @@
                    :value     value })))

 (defn- list-impl
-  "Private implementation of list-attrs."
+  "Private implementation of list."
   [keys]
   (let [result   (atom [])
         callback (proxy [AttributeService$AttributeQueryCallback] []
@@ -66,7 +66,7 @@
   (.exists (attribute-service) (construct-keys namespace name id)))

 (defn list
-  "List all attributes in the given namespace, or namespace+name.  Result is a vector of maps, each map containing the keys:
+  "List all attributes in the given namespace, or namespace & name.  Result is a vector of maps, each map containing the keys:
   :namespace - the namespace of the attribute
   :name      - the name of the attribute
   :id        - the id


fixing java interop

fixing java interop

--- src/clojure/sparkling/sql.clj
+++ src/clojure/sparkling/sql.clj
@@ -151,7 +151,7 @@

 (defn write-parquet
   "write out data frame in parquet format"
-  [data-frame path]
+  [path data-frame]
   (-> data-frame
       .write
       (.parquet path)))
@@ -160,8 +160,8 @@
   "read folder that contains parquet data"
   [sql-con path]
   (-> sql-con
-      read
-      (load path)))
+      .read
+      (.load path)))

 (defn rdd->data-frame [sql-context struct-type rowRdd]
   "convert rdd of rows to data frame"


unwrap data passed ot table view

unwrap data passed ot table view

--- app/views/viz/table.cljs
+++ app/views/viz/table.cljs
@@ -22,7 +22,7 @@

 (defn hide? [bounds d]
   (let [{:keys [low high]} bounds
-        t (get-in d [:data :timestamp])]
+        t (get-in d [:timestamp])]
     (and (>= t low) (< t high))))

 (defn ^:private update-selected [data owner e]
@@ -32,7 +32,7 @@
 (defcomponent data-row-view [data owner]
   (render
     [_]
-    (let [d (:data data)]
+    (let [d data]
     (html
       [:tr {:on-click #(update-selected data owner %) }
        [:td (:x d)]


CMR-1050: Fixing the system int test system.

--- system-int-test/src/cmr/system_int_test/system.clj
+++ system-int-test/src/cmr/system_int_test/system.clj
@@ -43,7 +43,7 @@
    (info "system-int-test System starting")
    (let [started-system (reduce (fn [system component-name]
                                   (update-in system [component-name]
-                                             #(lifecycle/start % system)))
+                                             #(when % (lifecycle/start % system))))
                                 system
                                 component-order)]
      (info "system-int-test System started")
@@ -59,7 +59,7 @@
    (when system
      (let [stopped-system (reduce (fn [system component-name]
                                     (update-in system [component-name]
-                                               #(lifecycle/stop % system)))
+                                               #(when % (lifecycle/stop % system))))
                                   system
                                   (reverse component-order))]
        (info "system-int-test System stopped")


[CS] statistics-test updates

[CS] statistics-test updates

--- test/vip/data_processor/db/statistics_test.clj
+++ test/vip/data_processor/db/statistics_test.clj
@@ -1,16 +1,17 @@
 (ns vip.data-processor.db.statistics-test
   (:require [clojure.test :refer :all]
-           [vip.data-processor.db.statistics :refer :all]))
+            [vip.data-processor.db.statistics :refer :all]))

 (deftest error-count-test
-  (let [table-name :contests
-        ctx {:warnings {table-name {:simple-map {:missing-header "Header missing"
-                                                 :too-long "Table seems way too long"}}}
-             :errors {table-name {:nested-maps {:bad-names {"Charleeee" "Too many E's"
-                                                            "" "Too short"
-                                                            "Christopher" "Already taken"}}}}
-             :critical {table-name {:sets-of-sets #{#{1 2} #{3 4} #{5 6} #{7 8} #{9 10}}
-                                    :maps-to-vectors {:three-problems [1 2 3]
-                                                      :four-problems [1 2 3 4]}}}
-             :fatal {:this-one-doesnt-have-that-table ["So it will contribute 0 to the count"]}}]
-    (is (= 17 (error-count table-name ctx)))))
+  (testing "reports appropriate total numbers for various error formats"
+    (let [table-name :contests
+          ctx {:warnings {table-name {:simple-map {:missing-header "Header missing"
+                                                   :too-long "Table seems way too long"}}}
+               :errors {table-name {:nested-maps {:bad-names {"Charleeee" "Too many E's"
+                                                              "" "Too short"
+                                                              "Christopher" "Already taken"}}}}
+               :critical {table-name {:sets-of-sets #{#{1 2} #{3 4} #{5 6} #{7 8} #{9 10}}
+                                      :maps-to-vectors {:three-problems [1 2 3]
+                                                        :four-problems [1 2 3 4]}}}
+               :fatal {:this-one-doesnt-have-that-table ["So it will contribute 0 to the count"]}}]
+      (is (= 17 (error-count table-name ctx))))))


66 unit tests

66 unit tests

--- spec/ralang/core_spec.clj
+++ spec/ralang/core_spec.clj
@@ -195,6 +195,134 @@
                         [:varID [:datatype "Int"] [:id "a"]]
                         [:varID [:datatype "Int"] [:id "b"]]]
                     [:datatype "String"]]])
-        (should= e (parser "function leFunction(Int a, Int b) -> String:"))))
+        (should= e (parser "function leFunction(Int a, Int b) -> String:")))
+    (it "parser: Function call with 0 args"
+        (should= [:token [:keyword [:expr [:funccall [:id "leFunction"] [:callargs]]]]] (parser "leFunction()")))
+    (it "parser: Function call with 1 arg"
+        (def e [:token [:keyword [:expr [:funccall [:id "leFunction"] [:callargs [:expr [:num [:int "5"]]]]]]]])
+        (should= e (parser "leFunction(5)")))
+    (it "parser: Function call with 2 args"
+        (def e [:token
+               [:keyword
+               [:expr
+               [:funccall
+                    [:id "leFunction"]
+                    [:callargs
+                        [:expr [:num [:int "30"]]]
+                        [:expr [:num [:int "15"]]]]]]]])
+        (should= e (parser "leFunction(30, 15)")))
+    (it "parser: Function call with arithmetic as 1 arg"
+        (def e [:token
+               [:keyword
+               [:expr
+               [:funccall
+                    [:id "leFunction"]
+                    [:callargs
+                        [:expr
+                            [:add
+                                [:num [:int "7"]]
+                                [:num [:int "8"]]]]]]]]])
+        (should= e (parser "leFunction(7+8)")))
+    (it "parser: Function call with arithmetic as 1 arg and 1 variable"
+        (def e [:token
+               [:keyword
+               [:expr
+               [:funccall
+                    [:id "leFunction"]
+                    [:callargs
+                        [:expr
+                            [:add
+                                [:num [:int "7"]]
+                                [:num [:int "8"]]]]
+                        [:expr
+                            [:varName "leVariable"]]]]]]])
+        (should= e (parser "leFunction(7+8, leVariable)")))
+    (it "parser: Function call with arithmetic as 1 arg, 1 variable and 1 string"
+        (def e [:token
+               [:keyword
+               [:expr
+               [:funccall
+                    [:id "leFunction"]
+                    [:callargs
+                        [:expr
+                            [:add
+                                [:num [:int "7"]]
+                                [:num [:int "8"]]]]
+                        [:expr
+                            [:varName "leVariable"]]
+                        [:string "\"leString\""]]]]]])
+        (should= e (parser "leFunction(7+8, leVariable, \"leString\")")))
+    (it "parser: If Int less than another Int"
+        (def e [:token [:keyword [:if [:boolexpr [:expr [:num [:int "2"]]] [:booloper [:le]] [:expr [:num [:int "10"]]]]]]])
+        (should= e (parser "if 2 < 10:")))
+    (it "parser: If Int less than or equal to another Int"
+        (def e [:token [:keyword [:if [:boolexpr [:expr [:num [:int "3"]]] [:booloper [:le]] [:expr [:num [:int "9"]]]]]]])
+        (should= e (parser "if 3 <= 9:")))
+    (it "parser: If Int is equal to another Int"
+        (def e [:token [:keyword [:if [:boolexpr [:expr [:num [:int "4"]]] [:booloper [:eq]] [:expr [:num [:int "4"]]]]]]])
+        (should= e (parser "if 4 == 4:")))
+    (it "parser: If Int greater than or equal to another Int"
+        (def e [:token [:keyword [:if [:boolexpr [:expr [:num [:int "5"]]] [:booloper [:ge]] [:expr [:num [:int "4"]]]]]]])
+        (should= e (parser "if 5 >= 4:")))
+    (it "parser: If Int greater than another Int"
+        (def e [:token [:keyword [:if [:boolexpr [:expr [:num [:int "6"]]] [:booloper [:ge]] [:expr [:num [:int "3"]]]]]]])
+        (should= e (parser "if 6 > 3:")))
+    (it "parser: If Int is different from another Int"
+        (def e [:token [:keyword [:if [:boolexpr [:expr [:num [:int "7"]]] [:booloper [:ne]] [:expr [:num [:int "1"]]]]]]])
+        (should= e (parser "if 7 != 1:")))
+    (it "parser: If Int less than another Variable"
+        (def e [:token [:keyword [:if [:boolexpr [:expr [:num [:int "2"]]] [:booloper [:le]] [:expr [:varName "leVariable"]]]]]])
+        (should= e (parser "if 2 < leVariable:")))
+    (it "parser: If Int less than or equal to another Variable"
+        (def e [:token [:keyword [:if [:boolexpr [:expr [:num [:int "3"]]] [:booloper [:le]] [:expr [:varName "leVariable"]]]]]])
+        (should= e (parser "if 3 <= leVariable:")))
+    (it "parser: If Int is equal to another Variable"
+        (def e [:token [:keyword [:if [:boolexpr [:expr [:num [:int "4"]]] [:booloper [:eq]] [:expr [:varName "leVariable"]]]]]])
+        (should= e (parser "if 4 == leVariable:")))
+    (it "parser: If Int greater than or equal to another Variable"
+        (def e [:token [:keyword [:if [:boolexpr [:expr [:num [:int "5"]]] [:booloper [:ge]] [:expr [:varName "leVariable"]]]]]])
+        (should= e (parser "if 5 >= leVariable:")))
+    (it "parser: If Int greater than another Variable"
+        (def e [:token [:keyword [:if [:boolexpr [:expr [:num [:int "6"]]] [:booloper [:ge]] [:expr [:varName "leVariable"]]]]]])
+        (should= e (parser "if 6 > leVariable:")))
+    (it "parser: If Int is different from another Variable"
+        (def e [:token [:keyword [:if [:boolexpr [:expr [:num [:int "7"]]] [:booloper [:ne]] [:expr [:varName "leVariable"]]]]]])
+        (should= e (parser "if 7 != leVariable:")))
+    (it "parser: If Variable less than another Int"
+        (def e [:token [:keyword [:if [:boolexpr [:expr [:varName "leVariable"]] [:booloper [:le]] [:expr [:num [:int "10"]]]]]]])
+        (should= e (parser "if leVariable < 10:")))
+    (it "parser: If Variable less than or equal to another Int"
+        (def e [:token [:keyword [:if [:boolexpr [:expr [:varName "leVariable"]] [:booloper [:le]] [:expr [:num [:int "9"]]]]]]])
+        (should= e (parser "if leVariable <= 9:")))
+    (it "parser: If Variable is equal to another Int"
+        (def e [:token [:keyword [:if [:boolexpr [:expr [:varName "leVariable"]] [:booloper [:eq]] [:expr [:num [:int "4"]]]]]]])
+        (should= e (parser "if leVariable == 4:")))
+    (it "parser: If Variable greater than or equal to another Int"
+        (def e [:token [:keyword [:if [:boolexpr [:expr [:varName "leVariable"]] [:booloper [:ge]] [:expr [:num [:int "4"]]]]]]])
+        (should= e (parser "if leVariable >= 4:")))
+    (it "parser: If Variable greater than another Int"
+        (def e [:token [:keyword [:if [:boolexpr [:expr [:varName "leVariable"]] [:booloper [:ge]] [:expr [:num [:int "3"]]]]]]])
+        (should= e (parser "if leVariable > 3:")))
+    (it "parser: If Variable is different from another Int"
+        (def e [:token [:keyword [:if [:boolexpr [:expr [:varName "leVariable"]] [:booloper [:ne]] [:expr [:num [:int "1"]]]]]]])
+        (should= e (parser "if leVariable != 1:")))
+    (it "parser: If Variable less than another Variable"
+        (def e [:token [:keyword [:if [:boolexpr [:expr [:varName "leVariable"]] [:booloper [:le]] [:expr [:varName "raVariable"]]]]]])
+        (should= e (parser "if leVariable < raVariable:")))
+    (it "parser: If Variable less than or equal to another Variable"
+        (def e [:token [:keyword [:if [:boolexpr [:expr [:varName "leVariable"]] [:booloper [:le]] [:expr [:varName "raVariable"]]]]]])
+        (should= e (parser "if leVariable <= raVariable:")))
+    (it "parser: If Variable is equal to another Variable"
+        (def e [:token [:keyword [:if [:boolexpr [:expr [:varName "leVariable"]] [:booloper [:eq]] [:expr [:varName "raVariable"]]]]]])
+        (should= e (parser "if leVariable == raVariable:")))
+    (it "parser: If Variable greater than or equal to another Variable"
+        (def e [:token [:keyword [:if [:boolexpr [:expr [:varName "leVariable"]] [:booloper [:ge]] [:expr [:varName "raVariable"]]]]]])
+        (should= e (parser "if leVariable >= raVariable:")))
+    (it "parser: If Variable greater than another Variable"
+        (def e [:token [:keyword [:if [:boolexpr [:expr [:varName "leVariable"]] [:booloper [:ge]] [:expr [:varName "raVariable"]]]]]])
+        (should= e (parser "if leVariable > raVariable:")))
+    (it "parser: If Variable is different from another Variable"
+        (def e [:token [:keyword [:if [:boolexpr [:expr [:varName "leVariable"]] [:booloper [:ne]] [:expr [:varName "raVariable"]]]]]])
+        (should= e (parser "if leVariable != raVariable:"))))

 (run-specs)


render reagent immediately

render reagent immediately

--- resources/leiningen/new/tenzing/reagent-app.cljs
+++ resources/leiningen/new/tenzing/reagent-app.cljs
@@ -13,12 +13,5 @@
   [:div "Parent component"
    [some-component]])

-(defn child [name]
-  [:p "Hi, I am " name])
-
-(defn childcaller []
-  [child "Foo Bar"])
-
-(defn mountit []
-  (reagent/render-component [childcaller]
-                            (.getElementById js/document "container")))
+(reagent/render-component [childcaller]
+                          (.getElementById js/document "container"))


Threading macro for resources

Threading macro for resources

--- test/desdemona/functions/sample_functions_test.clj
+++ test/desdemona/functions/sample_functions_test.clj
@@ -18,7 +18,11 @@

 (defn raw-example
   [kind]
-  (kwify-map (json/parse-stream (bs/to-reader (io/file (io/resource (str "test/example_" (name kind) ".json")))) true)))
+  (-> (str "test/example_" (name kind) ".json")
+      io/resource
+      io/reader
+      (json/parse-stream true)
+      kwify-map))

 (defn example
   [kind]


studying: clojure by example kimh on cursive

--- clj/ex/study_clojure/ex06/src/clojure_by_example_kimh.clj
+++ clj/ex/study_clojure/ex06/src/clojure_by_example_kimh.clj
@@ -37,7 +37,7 @@
       b 20]
   (+ 10 20))

-(def def-bindings "are global")
+(d f def-bindings "are global")

 (defn a-function
   [name]
@@ -51,6 +51,8 @@
 (meta (var documented))
 (meta #'documented)

+;; Anonymous functions
+
 (fn [] (str ""))
 (def anon-function (fn [] (str "")))
 (anon-function)
@@ -61,7 +63,91 @@
 (let [multiple-args #(+ %1 %2)]
   (multiple-args 50 20))

+;; Higher-order-functions
+
 (defn higher-order-function [fun]
   (fun 10))
 (higher-order-function inc)

+(defn closure [outer-arg] #(inc outer-arg))
+(def outer (closure 20))
+(outer)
+
+;; Namespaces
+
+(in-ns 'user)
+(outer) ; unable to resolve symbol
+
+(in-ns 'clojure_by_example_kimh)
+(outer)
+
+(in-ns 'user)
+(require 'clojure_by_example_kimh)
+(clojure_by_example_kimh/outer)
+
+(require '[clojure_by_example_kimh :as cbe])
+(cbe/outer)
+
+;; Control Flow
+
+(if (< 3 5)
+  "then"
+  "else")
+
+(if-let [a nil]
+  "then"
+  "else")
+
+(if-let [a 0]
+  "then"
+  "else")
+
+(when true "10")
+(when-let [a []] "then")
+(when-let [a false] "then")
+
+(let [n 2]
+  (case n
+    1 "a"
+    2 "b"
+    "other"))
+
+(let [n 3]
+  (cond
+    (< n 3) "a"
+    (< n 5) "b"
+    :else "other"))
+
+(let [n 2]
+  (condp < n
+    1 "a"
+    3 "b"
+    "else"))
+
+;; Boolean
+
+(boolean false)
+(boolean nil)
+(boolean 0)
+(boolean [])
+(boolean :a)
+
+;; Strings
+
+(str "join " "strings")
+(str "there is no " "string interpolation")
+
+(format "%s %s" "this is" "me")
+
+;; Numbers
+
+(/ 4 3)
+(* (/ 4 3) 3)
+(max 1 2 3)
+(mod 3 2)
+
+;; Lists
+
+'(1 2 3)
+(conj '(1 2) 3)
+


Change API routes

Change API routes

--- src/discuss/config.cljs
+++ src/discuss/config.cljs
@@ -2,8 +2,8 @@
   (:require [clojure.string :as str]))

 (goog-define version "0.2.1")
-(goog-define remote-host "http://muenchhausen.cn.uni-duesseldorf.de:4284/")
-(goog-define remote-search "http://muenchhausen.cn.uni-duesseldorf.de:9200/")
+(goog-define remote-host "http://localhost:4284/api")
+(goog-define remote-search "http://dbas.cs.uni-duesseldorf.de:9200/")

 (def project "discuss")

@@ -14,13 +14,14 @@
   (str (get-protocol (.. js/window -location -href)) "://" host))

 (def api {:host  remote-host
-          :init  "api/town-has-to-cut-spending"
-          :base  "api/"
-          :login "api/login"
-          :add   {:add-start-statement "api/add/start_statement"
-                  :add-start-premise   "api/add/start_premise"
-                  :add-justify-premise "api/add/justify_premise"}
-          :get   {:references       "api/references"
-                  :reference-usages "api/reference/usages"
-                  :statements       "api/statements"
-                  :statement-url    "api/statement/url"}})
+          :init  "/town-has-to-cut-spending"
+          :base  "/"
+          :login "/login"
+          :add   {:add-start-statement "/add/start_statement"
+                  :add-start-premise   "/add/start_premise"
+                  :add-justify-premise "/add/justify_premise"}
+          :get   {:references       "/references"
+                  :reference-usages "/reference/usages"
+                  :statements       "/statements"
+                  :statement-url    "/statement/url"}})
+


Update tools-deps variants to 1.11.1.1200


Better handle error setting up checkpoint watch.

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -687,18 +687,26 @@
                             :onyx.core/windows :onyx.core/triggers])
         (db/export-reader state-store)]))

-(defn setup-checkpoint-watch! [{:keys [onyx.core/log onyx.core/tenancy-id onyx.core/job-id
-                                       onyx.core/task-kill-flag onyx.core/kill-flag] :as event}
-                               track-checkpointed]
-  (cp/watch-checkpoint-coordinate log tenancy-id job-id
-   (fn [v]
-     (when (= :NodeDataChanged (:event-type v))
-       (swap! track-checkpointed
-              merge
-              (select-keys (cp/read-checkpoint-coordinate log tenancy-id job-id) [:epoch :replica-version])))
-     (when (and (not @task-kill-flag)
-                (not @kill-flag))
-       (setup-checkpoint-watch! event track-checkpointed)))))
+(defn setup-checkpoint-watch!
+  [{:keys [onyx.core/log onyx.core/tenancy-id onyx.core/job-id
+           onyx.core/group-ch onyx.core/job-id onyx.core/id onyx.core/task-kill-flag
+           onyx.core/kill-flag] :as event}
+   track-checkpointed]
+  (assert group-ch)
+  (try
+   (cp/watch-checkpoint-coordinate log tenancy-id job-id
+                                   (fn [v]
+                                     (when (= :NodeDataChanged (:event-type v))
+                                       (swap! track-checkpointed
+                                              merge
+                                              (select-keys (cp/read-checkpoint-coordinate log tenancy-id job-id)
+                                                           [:epoch :replica-version])))
+                                     (when (and (not @task-kill-flag)
+                                                (not @kill-flag))
+                                       (setup-checkpoint-watch! event track-checkpointed))))
+   (catch Throwable t
+     (warn "Error setting checkpoint watch. Restarting peer." t)
+     (>!! group-ch [:restart-vpeer id]))))

 (deftype TaskStateMachine
   [monitoring


More random clojure tabs work

More random clojure tabs work

--- nightweb-android/src/clojure/net/nightweb/tabs.clj
+++ nightweb-android/src/clojure/net/nightweb/tabs.clj
@@ -25,7 +25,11 @@
     :methods [["addTab" [] void]
               ["setSelectedTab" [android.view.View] void]
               ["getSelectedTab" [] int]
-              ["animateScroll" [int] void]]
+              ["animateScroll" [int] void]
+              ["setScroll" [int] void]
+              ["getScroll" [] int]
+              ["updateLayout" [] void]
+              ["ensureChildVisible" [] void]]
     :exposes-methods {onLayout superOnLayout
                       onScrollChanged superOnScrollChanged})
   (gen-class
@@ -49,7 +53,8 @@
     :constructors {[android.content.Context] [android.content.Context]
                    [android.content.Context android.util.AttributeSet] [android.content.Context android.util.AttributeSet]
                    [android.content.Context android.util.AttributeSet int] [android.content.Context android.util.AttributeSet int]}
-    :methods [["setTitle" [String] void]]
+    :methods [["setTitle" [String] void]
+              ["updateLayoutParams" [] void]]
     :exposes-methods {onLayout superOnLayout
                       setActivated superSetActivated})
   (gen-class
@@ -90,7 +95,7 @@
                             android.view.ViewGroup$LayoutParams/MATCH_PARENT))
         (.setPadding content-view tab-first-padding-left 0 0 0)
         (.addView this content-view)
-        ;(.scrollTo this (.getScrollX this) (.getScrollY this))
+        ;(.setScroll this (.getScroll this))
         (set-state! this :content-view content-view)
         (set-state! this :animation-duration animation-duration)))
     ([this context attrs] (tab-scroll-view-post-init this context))
@@ -98,16 +103,7 @@
   (defn tab-scroll-view-onLayout
     [this changed l t r b]
     (.superOnLayout this changed l t r b)
-    (if-let [child (.getChildAt (get-state this :content-view)
-                                (get-state this :selected))]
-      (let [childl (.getLeft child)
-            childr (+ childl (.getWidth child))
-            viewl (.getScrollX this)
-            viewr (+ viewl (.getWidth this))]
-        (if (< childl viewl)
-          (.animateScroll this childl)
-          (if (> childr viewr)
-            (.animateScroll this (+ (- childr viewr) viewl)))))))
+    (.ensureChildVisible this))
   (defn tab-scroll-view-onScrollChanged
     [this l t oldl oldt]
     (.superOnScrollChanged this l t oldl oldt)
@@ -145,6 +141,30 @@
                      this "scroll" (int-array [(.getScrollX this) new-scroll]))]
       (.setDuration animator ^int (get-state this :animation-duration))
       (.start animator)))
+  (defn tab-scroll-view-setScroll
+    [this new-scroll]
+    (.scrollTo this new-scroll (.getScrollY this)))
+  (defn tab-scroll-view-getScroll
+    [this]
+    (.getScrollX this))
+  (defn tab-scroll-view-updateLayout
+    [this]
+    (for [i (range 0 (.getChildCount (get-state this :content-view)))
+          :let [child (.getChildAt (get-state this :content-view) i)]]
+      (.updateLayoutParams child))
+    (.ensureChildVisible this))
+  (defn tab-scroll-view-ensureChildVisible
+    [this]
+    (if-let [child (.getChildAt (get-state this :content-view)
+                                (get-state this :selected))]
+      (let [childl (.getLeft child)
+            childr (+ childl (.getWidth child))
+            viewl (.getScrollX this)
+            viewr (+ viewl (.getWidth this))]
+        (if (< childl viewl)
+          (.animateScroll this childl)
+          (if (> childr viewr)
+            (.animateScroll this (+ (- childr viewr) viewl)))))))
   )

 (do
@@ -267,17 +287,20 @@
       (.setVisibility close (if selected android.view.View/VISIBLE android.view.View/GONE))
       (.setHorizontalFadingEdgeEnabled this (not selected))
       (.superSetActivated this selected)
-      (if-let [lp (.getLayoutParams this)]
-        (do
-          (set! (. lp width) (get-state this :tab-width))
-          (set! (. lp height) android.view.ViewGroup$LayoutParams/MATCH_PARENT)
-          (.setLayoutParams this lp)))
+      (.updateLayoutParams this)
       (.setFocusable this (not selected))
       (.postInvalidate this)))
   (defn tab-view-setTitle
     [this text]
     (let [title (get-state this :title)]
       (.setText title text)))
+  (defn tab-view-updateLayoutParams
+    [this]
+    (if-let [lp (.getLayoutParams this)]
+      (do
+        (set! (. lp width) (get-state this :tab-width))
+        (set! (. lp height) android.view.ViewGroup$LayoutParams/MATCH_PARENT)
+        (.setLayoutParams this lp))))
   )

 (do


New simple function: fourth added into the utils module

--- src/emender_jenkins/utils.clj
+++ src/emender_jenkins/utils.clj
@@ -17,6 +17,11 @@
     "Simple utility function - returns third item from a given sequence."
     [coll]
     (nth coll 2 nil))
+
+(defn fourth
+    "Simple utility function - returns fourth item from a given sequence, nil if third item does not exist."
+    [coll]
+    (nth coll 3 nil))

 (defn substring
     "Call method String.substring()."


apply dual offset to durability

apply dual offset to durability

--- src-cljs/sory/codec.cljs
+++ src-cljs/sory/codec.cljs
@@ -3,34 +3,62 @@
   (:require-macros [cljs.core.async.macros :refer [go-loop]]))

-(defn normalize-freq [freq]
-  (if (> freq 18500)
-    (let [ifreq (js/Math.round freq)
-          m (mod ifreq 50)]
-      (/ (- (if (< m 25)
-              (- ifreq m)
-              (+ ifreq (- 50 m)))
-            19000)
-         50))))
+(def low-bits-offset 18500)
+(def high-bits-offset 19500)
+
+
+(defn- normalize-freq [freq]
+  (.debug js/console (str "pre-normalized: " freq))
+  (let [ifreq (js/Math.round freq)
+        m (mod ifreq 50)]
+    (if (< m 25)
+      (- ifreq m)
+      (+ ifreq (- 50 m)))))
+
+
+(defn- encode-bits [bs offset]
+  (.debug js/console (str "encoded: " (-> bs (* 50) (+ offset))))
+  (-> bs (* 50) (+ offset)))
+
+
+(defn- decode-bits [freq offset]
+  (-> freq (- offset) (/ 50)))
+
+
+(defn- validate-and-decode-bits [freq high-bits?]
+  (if high-bits?
+    (when (>= freq high-bits-offset)
+      (decode-bits freq high-bits-offset))
+    (when (and (<= low-bits-offset freq)
+               (<= freq high-bits-offset))
+      (decode-bits freq low-bits-offset))))
+

 (defn encode [s]
   (let [bs (map #(.charCodeAt %) s)]
-    (map
-     #(+ 19000 (* 50 %))
-     (interleave
-      (map #(bit-shift-right (bit-and % 0xF0) 4) bs)
-      (map #(bit-and % 0x0F) bs)))))
+    (interleave
+     (map #(-> %
+               (bit-and 0xF0)
+               (bit-shift-right 4)
+               (encode-bits high-bits-offset))
+          bs)
+     (map #(-> %
+               (bit-and 0x0F)
+               (encode-bits low-bits-offset))
+          bs))))

 (defn <decode [channel]
   (let [c (chan)]
     (go-loop [prev nil]
-      (when-let [freq (normalize-freq (<! channel))]
-        (if (nil? prev)
-          (recur freq)
-          (let [decoded (js/String.fromCharCode
-                         (bit-or (bit-shift-left prev 4)
-                                 freq))]
-            (put! c decoded)
-            (recur nil)))))
+      (.debug js/console (str "prev:" prev))
+      (let [freq (normalize-freq (<! channel))]
+        (when-let [bits (validate-and-decode-bits freq (nil? prev))]
+          (if (nil? prev)
+            (recur bits)
+            (let [prev-bits (bit-shift-left prev 4)
+                  decoded (js/String.fromCharCode
+                           (bit-or prev-bits bits))]
+              (put! c decoded))))
+        (recur nil)))
     c))


Remove unused nav-ch from dashboard component

--- src-cljs/frontend/components/dashboard.cljs
+++ src-cljs/frontend/components/dashboard.cljs
@@ -21,7 +21,6 @@
             current-project (get-in data state/project-data-path)
             plan (:plan current-project)
             project (:project current-project)
-            nav-ch (get-in data [:comms :nav])
             nav-data (:navigation-data data)
             page (js/parseInt (get-in nav-data [:query-params :page] 0))
             builds-per-page (:builds-per-page data)]


fix issue with validation checks on boolean field and set default value for 'admin' attribute in body to false.

--- src/metabase/api/org.clj
+++ src/metabase/api/org.clj
@@ -49,9 +49,10 @@
       (hydrate :user)))

-(defendpoint POST "/:id/members" [id :as {{:keys [first_name last_name email admin]} :body}]
-  ; we require 4 attributes in the body
-  (check-400 (and first_name last_name email admin (util/is-email? email)))
+(defendpoint POST "/:id/members" [id :as {{:keys [first_name last_name email admin]
+                                           :or {admin false}} :body}]
+  ; check our input
+  (check-400 (and first_name last_name email (util/is-email? email)))
   ; user must have admin perms on org to proceed
   (write-check Org id)
   (let [user-id (:id (or (sel :one [User :id] :email email)                ; find user with existing email - if exists then grant perm


Show the list of follow-ups post first, then the rest of the posts. Remove must-see tag from headline.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -321,19 +321,9 @@
     (paragraph paragraph-text "" "text-left attribution")))

 (defn- post-headline [entry]
-  (let [ms (:must-see entry)]
-    [:div
-      [:span.post-title
-        (.text (soup/parse (:headline entry)))]
-      (when ms
-        [:span.must-see-container
-          [:img
-            {:class "must-see-icon"
-             :width "8"
-             :height "10"
-             :src (str config/email-images-prefix "/email_images/must_see@2x.png")}]
-          [:span.must-see
-            "MUST SEE"]])]))
+  [:div
+    [:span.post-title
+      (.text (soup/parse (:headline entry)))]])

 (defn- post-body [cleaned-body]
   [:div
@@ -472,44 +462,33 @@
 }
 "])

-(defn sort-must-see-board-name [a b]
-  (let [must-see (compare (:must-see a) (:must-see b))]
-    (if (zero? must-see)
-      (let [board-name (compare (:board-name a) (:board-name b))]
-        (if (zero? board-name)
-          (compare (:published-at a) (:published-at b))
-          board-name))
-      must-see)))
-
 (defn- digest-content [digest]
   (let [boards (map posts-with-board-name (:boards digest))
         posts (mapcat posts-for-board boards)
         digest-url (get-digest-url digest)
-        first-name (:first-name digest)
-
         boards (map posts-with-board-name (:boards digest))
         all-posts (mapcat :posts boards)
-        sorted-posts (sort sort-must-see-board-name all-posts)
-        must-see (filter :must-see sorted-posts)
-        non-must-see (filter (comp not :must-see) sorted-posts)
+        sorted-posts (sort-by (juxt :follow-up :board-name :published-at) all-posts)
+        follow-up-posts (filter :follow-up sorted-posts)
+        non-follow-up-posts (filter (comp not :follow-up) sorted-posts)
         user {:user-id (:user-id digest)
               :name (str (:first-name digest) " " (:last-name digest))}]
     [:td {:class "small-12 large-12" :valign "middle" :align "center"}
       [:center
         (spacer 40)
-        (when (seq must-see)
+        (when (seq follow-up-posts)
           [:table
             {:cellpadding "0"
              :cellspacing "0"
              :border "0"
-             :class "digest-content must-see"}
+             :class "digest-content follow-up"}
             [:tr
               [:td
                 [:label.digest-group-title
-                  "MUST SEE"]]]
+                  "FOLLOW-UP"]]]
             [:tr
               [:td
-                (for [p must-see]
+                (for [p follow-up-posts]
                   [:table
                     {:cellpadding "0"
                      :cellspacing "0"
@@ -518,9 +497,9 @@
                     [:tr
                       [:td {:class "small-12 large-12 columns"}
                         (digest-post-block user p)]]])]]])
-        (when (seq must-see)
+        (when (seq follow-up-posts)
           (spacer 32))
-        (when (seq non-must-see)
+        (when (seq non-follow-up-posts)
           [:table
             {:cellpadding "0"
              :cellspacing "0"
@@ -532,7 +511,7 @@
                   "NEW ACTIVITY"]]]
             [:tr
               [:td
-                (for [p non-must-see]
+                (for [p non-follow-up-posts]
                   [:table
                     {:cellpadding "0"
                      :cellspacing "0"


Fix for private var use

Fix for private var use

--- planck-cljs/script/decode.cljs
+++ planck-cljs/script/decode.cljs
@@ -13,6 +13,6 @@
 (let [file (first *command-line-args*)
       sm-json (slurp file)
       decoded (sm/decode (.parse js/JSON sm-json))
-      stripped (^:private-var-access-nowarn strip-source-map decoded)
+      stripped (#'strip-source-map decoded)
       transit-json (cljs->transit-json stripped)]
   (spit file transit-json))


add handy node-tree manipulation fns

add handy node-tree manipulation fns

--- src/overtone/sc/node.clj
+++ src/overtone/sc/node.clj
@@ -1,10 +1,12 @@
 (ns overtone.sc.node
   (:use [overtone.helpers lib]
+        [overtone.helpers.seq :only [zipper-seq]]
         [overtone.libs event deps]
         [overtone.sc comms bus server defaults]
         [overtone.sc.machinery allocator]
         [overtone.sc.util :only [id-mapper]])
-  (:require [overtone.config.log :as log]))
+  (:require [clojure.zip :as zip]
+            [overtone.config.log :as log]))

 ;; ## Node and Group Management

@@ -495,6 +497,33 @@
   []
   (group-node-tree 0))

+(defn node-tree-zipper
+  "Returns a zipper representing the tree of the specified node or
+  defaults to the current node tree"
+  ([] (node-tree-zipper 0))
+  ([root]
+     (zip/zipper map? :children #(assoc %1 :children %2) (group-node-tree root))))
+
+(defn node-tree-seq
+  "Returns a lazy seq of a depth-first traversal of the tree of the
+  specified node defaulting to the current node tree"
+  ([] (node-tree-zipper 0))
+  ([root] (zipper-seq (node-tree-zipper root))))
+
+(defn node-tree-matching-synth-ids
+  "Returns a seq of synth ids in the node tree with specific
+  root (defaulting to the entire node tree) that match regexp or
+  strign."
+  ([re-or-str] (node-tree-matching-synth-ids re-or-str 0))
+  ([re-or-str root]
+     (let [matcher-fn (if (string? re-or-str)
+                        =
+                        re-matches)]
+       (map :id
+            (filter #(and (:name %)
+                          (matcher-fn re-or-str (:name %)))
+                    (node-tree-seq root))))))
+
 (on-deps :core-groups-created ::create-synth-group #(dosync
                                                      (log/debug (str "Creating synth group at head of group with id: " (root-group)))
                                                      (ref-set synth-group* (group :head (root-group)))))


[sd] fixed recursive call to get-connection.

--- src/regarde/models/migration.clj
+++ src/regarde/models/migration.clj
@@ -4,37 +4,25 @@

 (defn create-exercises [db]
   (j/db-do-commands db (str "create table exercises ("
-                            "id serial PRIMARY KEY"
-                            "name varchar NOT NULL"
-                            "email varchar NOT NULL"
-                            "created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP"))
-  ;; (j/create-table :exercises
-  ;;                   [:id :serial "PRIMARY KEY"]
-  ;;                   [:name :varchar "NOT NULL"]
-  ;;                   [:created_at :timestamp "NOT NULL" "DEFAULT CURRENT_TIMESTAMP"])
-  )
+                            " id serial PRIMARY KEY,"
+                            " name varchar NOT NULL,"
+                            " email varchar NOT NULL,"
+                            " created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);")))

 (defn create-users [db]
   (j/db-do-commands db (str "create table users ("
-                         "id serial PRIMARY KEY"
-                         "name varchar NOT NULL"
-                         "email varchar NOT NULL"
-                         "created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);"))
-  ;; (j/create-table :users
-  ;;                   [:id :serial "PRIMARY KEY"]
-  ;;                   [:name :varchar "NOT NULL"]
-  ;;                   [:email :varchar "NOT NULL"]
-  ;;                   [:created_at :timestamp "NOT NULL" "DEFAULT CURRENT_TIMESTAMP"])
-  )
+                         " id serial PRIMARY KEY,"
+                         " name varchar NOT NULL,"
+                         " email varchar NOT NULL,"
+                         " created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);")))

 (defn drop-tables [db]
-  (j/db-do-commands db "drop table users;")
-  (j/db-do-commands db "drop table exercises;"))
+  (j/db-do-commands db "drop table if exists users;")
+  (j/db-do-commands db "drop table if exists exercises;"))

-(defn -main []
-  (println (str "hi? " (System/getenv "REGARDE_DATABASE_URL")))
-  (let [db-spec {:connection-uri (System/getenv "REGARDE_DATABASE_URL")}
-        db (j/get-connection db-spec)]
+(defn -main []
+  (let [db-spec (System/getenv "REGARDE_DATABASE_URL")
+        db {:connection (j/get-connection db-spec)}]
     (println "Deleting tables...")
     (drop-tables db)
     (println "Creating database structure...")
@@ -45,4 +33,4 @@
     (create-users db)
     (println "Created users...")
     (println " done")
-    (.close db)))
+    (.close (:connection db))))


Fixed cosine-similarity formula and renamed to cosine-distance.

--- project/analyze-data/src/analyze_data/knn/core.clj
+++ project/analyze-data/src/analyze_data/knn/core.clj
@@ -1,8 +1,9 @@
 (ns analyze-data.knn.core
   (:require [clojure.core.matrix :as m]))

-(defn cosine-similarity
-  "TODO: this is the cosine of the angle between the two vectors?
+(defn cosine-distance
+  "Calculate 1 - cos(theta) between each vector in X and y, where theta is the
+  angle between the vectors.

   X is a matrix of the form
   [[--x1--]
@@ -13,13 +14,13 @@

   Return a sequence of [distance-from-x1 distance-from-x2 ...]."
   [X y]
-  (m/div
-    (m/sub 1 (m/mmul X y))
-    (m/mul (map m/magnitude X)
-           (m/magnitude y))))
+  (let [dot-product (m/mmul X y)
+        product-of-norms (m/mul (map m/magnitude X) (m/magnitude y))
+        cosine-similarity (m/div dot-product product-of-norms)]
+    (m/sub 1 cosine-similarity)))

 (defn euclidean-distance
-  "Euclidean distance between each row of a matrix and a vector.
+  "Euclidean distance between each vector in X and y.

   X is a matrix of the form
   [[--x1--]


Fix concurrency: refs and dosync, not atoms.

--- src/afterglow/dj_link.clj
+++ src/afterglow/dj_link.clj
@@ -29,58 +29,67 @@
  [metronome target-name socket watcher packet-count sync-count last-sync]
   IClockSync
   (sync-start [this]
-    (swap! socket (fn [s]
-                    (when s (.close s))
-                    (DatagramSocket. port (InetAddress/getByName "0.0.0.0"))))
-    (reset! packet-count 0)
-    (reset! sync-count 0)
-    (reset! last-sync nil)
-    (swap! watcher (fn [w]
-                    (when w (future-cancel w))
-                    (future (while true
-                              (let [packet (receive @socket)
-                                    data (.getData packet)]
-                                ;; Check packet length and target name.
-                                ;; TODO: Check header bytes, perhaps use Protobuf for this?
-                                (swap! packet-count inc)
-                                (when (and (= 96 (.getLength packet))
-                                           (= target-name (String. data 11 (count target-name))))
-                                  ;; Record that we received a packet from the target, and when
-                                  (swap! sync-count inc)
-                                  (reset! last-sync (now))
-                                  (let [bpm (float (/ (+ (* 256 (unsign (aget data 90))) (unsign (aget data 91))) 100))
-                                        beat (aget data 92)]
-                                    (metro-bpm metronome bpm)
-                                    (metro-beat-phase metronome 0)
-                                    ;; TODO: Had to give up for now on the following line because the mixer
-                                    ;;       does not update its measure position based on that of the master
-                                    ;;       player.
-                                    ;;
-                                    ;;       Consider figuring out how to tell what the master player is from
-                                    ;;       the UDP traffic, and using that. But this should probably be an
-                                    ;;       option anyway because a lot of DJs do not beat grid that carefully,
-                                    ;;       and the light show operator will in those cases need to be able to
-                                    ;;       override the down beat, which will not be possible if this code is
-                                    ;;       resyncing the bar start on each beat from the Pioneer equipment.
-                                    ;;
-                                    ;;       If/when that mode is figured out and made an option, the following
-                                    ;;       line will be invoked INSTEAD of the one above.
-                                    #_(metro-bar-phase metronome (/ (dec beat) 4))))))))))
+    (dosync
+     (alter socket (fn [s]
+                     (when s (.close s))
+                     (DatagramSocket. port (InetAddress/getByName "0.0.0.0"))))
+     (ref-set packet-count 0)
+     (ref-set sync-count 0)
+     (ref-set last-sync nil)
+     (alter watcher (fn [w]
+                      (when w (future-cancel w))
+                      (future (while true
+                                (let [packet (receive @socket)
+                                      data (.getData packet)]
+                                  ;; Check packet length and target name.
+                                  ;; TODO: Check header bytes, perhaps use Protobuf for this?
+                                  (dosync
+                                   (alter packet-count inc)
+                                   (when (and (= 96 (.getLength packet))
+                                              (= target-name (String. data 11 (count target-name))))
+                                     ;; Record that we received a packet from the target, and when
+                                     (alter sync-count inc)
+                                     (ref-set last-sync (now))
+                                     (let [bpm (float (/ (+ (* 256 (unsign (aget data 90))) (unsign (aget data 91))) 100))
+                                           beat (aget data 92)]
+                                       (metro-bpm metronome bpm)
+                                       (metro-beat-phase metronome 0)
+                                       ;; TODO: Had to give up for now on the following line because the mixer
+                                       ;;       does not update its measure position based on that of the master
+                                       ;;       player.
+                                       ;;
+                                       ;;       Consider figuring out how to tell what the master player is from
+                                       ;;       the UDP traffic, and using that. But this should probably be an
+                                       ;;       option anyway because a lot of DJs do not beat grid that carefully,
+                                       ;;       and the light show operator will in those cases need to be able to
+                                       ;;       override the down beat, which will not be possible if this code is
+                                       ;;       resyncing the bar start on each beat from the Pioneer equipment.
+                                       ;;
+                                       ;;       If/when that mode is figured out and made an option, the following
+                                       ;;       line will be invoked INSTEAD of the one above.
+                                       #_(metro-bar-phase metronome (/ (dec beat) 4))))))))))))
   (sync-stop [this]
-    (swap! watcher (fn [w]
-                     (when w (future-cancel w))
-                     nil))
-    (swap! socket (fn [s]
-                    (when s (.close s))
-                    nil)))
+    (dosync
+     (alter watcher (fn [w]
+                      (when w (future-cancel w))
+                      nil))
+     (alter socket (fn [s]
+                     (when s (.close s))
+                     nil))))
   (sync-status [this]
-    {:type :dj-link,
-     :status (cond
-               (nil? watcher)                "Stopped."
-               (zero? @packet-count)         "Network problems? No DJ Link packets received."
-               (zero? @sync-count)           (str "Configuration problem? No DJ Link beat packets received from " target-name ".")
-               (> (- (now) @last-sync) 1000) (str "Stalled? No sync packets received in " (- (now) @last-sync) "ms.")
-               :else                         (str "Running. " @sync-count " beats received."))}))
+    (dosync
+     (ensure watcher)
+     (ensure packet-count)
+     (ensure sync-count)
+     (ensure last-sync)
+     {:type :dj-link,
+      :status (cond
+                (nil? @watcher)               "Stopped."
+                (zero? @packet-count)         "Network problems? No DJ Link packets received."
+                (zero? @sync-count)           (str "Configuration problem? No DJ Link beat packets received from "
+                                                   target-name ".")
+                (> (- (now) @last-sync) 1000) (str "Stalled? No sync packets received in " (- (now) @last-sync) "ms.")
+                :else                         (str "Running. " @sync-count " beats received."))})))

 ;; Suppress uninformative auto-generated documentation entries.
 (alter-meta! #'->UDPSync assoc :no-doc true)
@@ -93,6 +102,6 @@
   for use with afterglow.show/sync-to-external-clock."
   [dj-link-device-name]
   (fn [^afterglow.rhythm.Metronome metronome]
-    (let [sync-handler (UDPSync. metronome dj-link-device-name (atom nil) (atom nil) (atom 0) (atom 0) (atom nil))]
+    (let [sync-handler (UDPSync. metronome dj-link-device-name (ref nil) (ref nil) (ref 0) (ref 0) (ref nil))]
       (sync-start sync-handler)
       sync-handler)))


Replace dataset-id with formid

Replace dataset-id with formid

--- src/hatti/views/dataview.cljs
+++ src/hatti/views/dataview.cljs
@@ -101,8 +101,7 @@
     om/IRender
     (render [_]
       (let [form (om/get-shared owner :flat-form)
-            {:keys [dataset-id]} (om/get-shared owner)
-            {:keys [num_of_submissions]} dataset-info
+            {:keys [num_of_submissions formid]} dataset-info
             {:keys [loading? total-records]} status]
         (html
          [:div.right.rec-summary.rec-margin
@@ -114,7 +113,7 @@
             (when loading? [:i.fa.fa-spinner.fa-pulse])
             (pluralize-number num_of_submissions " Record")]]
           [:div.divider]
-          (om/build dataview-actions dataset-id)])))))
+          (om/build dataview-actions formid)])))))

 (defn activate-view!
   "Strip off ampersand suffixes then switch to view if result is a valid view"


whitespace

whitespace

--- src/greybear/server.clj
+++ src/greybear/server.clj
@@ -50,7 +50,7 @@

 (def app
   (-> (handler/site
-       (friend/authenticate
+       (friend/authenticate
         main-routes
         {:allow-anon? true
          :login-uri "/login"


Fixup ids branch of main-files

Fixup ids branch of main-files

--- src/adzerk/boot_cljs.clj
+++ src/adzerk/boot_cljs.clj
@@ -97,7 +97,7 @@
   ([fileset] (main-files fileset nil))
   ([fileset ids]
    (let [select (if (seq ids)
-                  #(core/by-name (map (fn [x] (str x ".cljs.edn"))) %)
+                  #(core/by-name (map (fn [x] (str x ".cljs.edn")) ids) %)
                   #(core/by-ext [".cljs.edn"] %))]
      (->> fileset
           core/input-files


Add futures and promises examples (6.10)

--- src/clojure/clojure_walkthrough/cjia/ch06_xx.clj
+++ src/clojure/clojure_walkthrough/cjia/ch06_xx.clj
@@ -159,3 +159,18 @@

 ; we can remove them using `remove-watch`
 (remove-watch adi :adi-watcher)
+
+;; 6.10: Futures and promises
+
+(defn long-calculation [num1 num2]
+  ; Simulated the long running process
+  (Thread/sleep 5000)
+  (* num1 num2))
+
+(defn long-run []
+  (let [x (long-calculation 11 13)
+        y (long-calculation 13 17)
+        z (long-calculation 17 19)]
+    (* x y z)))
+
+(time (long-run))


Add more examples from chapter 8 - functions

--- src/clojure/clojure_walkthrough/cjia/ch08_xx.clj
+++ src/clojure/clojure_walkthrough/cjia/ch08_xx.clj
@@ -1,3 +1,107 @@
 (ns clojure-walkthrough.cjia.ch08-xx)

 ;; More on functional programming
+(defn square [x]
+  (* x x))
+
+;; Idiomatic equivalent to empty list
+(defn square-all [numbers]
+  (if (empty? numbers)
+    nil
+    (cons (square (first numbers))
+          (square-all (rest numbers)))))
+
+(square-all [1 2 3 4 5 6]) ;; (1 4 9 16 25 36)
+
+(defn cube [x]
+  (* x x x))
+
+(defn cube-all [numbers]
+  (if (empty? numbers)
+    ()
+    (cons (cube (first numbers))
+          (cube-all (rest numbers)))))
+
+;; Again easy to test
+(cube-all [1 2 3 4 5 6]) ;; (1 8 27 64 125 216)
+
+(defn do-to-all [f numbers]
+  (if (empty? numbers)
+    ()
+    (cons (f (first numbers))
+          (do-to-all f (rest numbers)))))
+
+(do-to-all cube [1 2 3 4 5 6]) ;; (1 8 27 64 125 216)
+
+(do-to-all square [1 2 3 4 5 6]) ;; (1 4 9 16 25 36)
+
+;; if it is too big, it will blow up!
+;(do-to-all square (range 10000)) ;; StackOverflow
+
+(defn do-to-all [f numbers]
+  (lazy-seq
+   (if (empty? numbers)
+     ()
+     (cons (f (first numbers))
+           (do-to-all f (rest numbers))))))
+
+(do-to-all square (range 10000)) ;; No StackOverflow
+
+(take 10 (drop 10000 (do-to-all square (range 11000)))) ;; (100000000 100020001 100040004 100060009 100080016 100100025 100120036 100140049 100160064 100180081)
+
+(take 10 (drop 10000 (do-to-all square (range 11000)))) ;; (100000000 100020001 100040004 100060009 100080016 100100025 100120036 100140049 100160064 100180081)
+
+;; 8.1.2: reduce lists of things
+(defn total-of [numbers]
+  (loop [nums numbers sum 0]
+    (if (empty? nums)
+      sum
+      (recur (rest nums) (+ sum (first nums))))))
+
+(total-of [5 7 9 3 4 1 2 8]) ;; 39
+
+(defn larger-of [x y]
+  (if (> x y) x y))
+
+(larger-of 20 40) ;; 40
+(larger-of 30 20) ;; 30
+
+(defn largest-of [numbers]
+  (loop [l numbers candidate (first numbers)]
+    (if (empty? l)
+      candidate
+      (recur (rest l) (larger-of candidate (first l))))))
+
+(largest-of [5 7 9 3 4 1 2 8]) ;; 9
+
+(largest-of []) ;; nil
+
+(defn compute-across [func elements value]
+  (if (empty? elements)
+    value
+    (recur func (rest elements) (func value (first elements)))))
+
+(defn total-of [numbers]
+  (compute-across + numbers 0))
+
+(defn largest-of [numbers]
+  (compute-across larger-of numbers (first numbers)))
+
+(defn all-greater-than [theshold numbers]
+  (compute-across #(if (> %2 threshold) (conj %1 %2) %1) numbers [])))
+
+(total-of [5 7 9 3 4 1 2 8]) ;; 39
+(largest-of [5 7 9 3 4 1 2 8]) ;; 9
+
+(defn all-greater-than [threshold numbers]
+  (compute-across #(if (> %2 threshold) (conj %1 %2) %1) numbers []))
+
+(all-greater-than 5 [5 7 9 3 4 1 2 8]) ;; [7 9 8]
+
+;; Equivalent of `compute-across` using `reduce`
+(defn all-greater-than [threshold numbers]
+  (reduce #(if (> %2 threshold) (conj %1 %2) %1) [] numbers))
+
+(all-greater-than 5 [5 7 9 3 4 1 2 8]) ;; [7 9 8]
+
+;; 8.1.3: filtering lists of things (TBC)


rename action function,  plus use 'case' for performance

--- src/re_frame/router.cljs
+++ src/re_frame/router.cljs
@@ -71,7 +71,7 @@
   (-run-queue [this])
   (-pause-run [this])
   (-exception [this ex])
-  (-resume-run [this]))
+  (-begin-resume [this]))

 ;; Want to understand this? Look at FSM in -fsm-trigger?
@@ -127,7 +127,7 @@
                     (:yield m)     goog.async.nextTick)]   ;; almost immediately
       (later #(-fsm-trigger this :begin-resume nil))))

-  (-resume-run
+  (-begin-resume
     [this]
     (-process-1st-event this)               ;; do the event which paused processing
     (-fsm-trigger this :finish-resume nil)) ;; do the rest of the queued events
@@ -137,7 +137,7 @@

     ;; work out new FSM state and action function for the transition
     (let [[new-state action-fn]
-          (condp = [fsm-state trigger]
+          (case [fsm-state trigger]

             ; Here is the FSM
             ;[current-state :trigger]  [:new-state  action-fn]
@@ -158,7 +158,7 @@

             ;; event processing is paused - probably by :flush-dom metadata
             [:paused :add-event    ]  [:paused   #(-add-event this arg1)]
-            [:paused :begin-resume ]  [:resuming #(-resume-run this)]
+            [:paused :begin-resume ]  [:resuming #(-begin-resume this)]

             ;; processing an event which previously caused the queue to be paused
             [:resuming :add-event    ] [:resuming  #(-add-event this arg1)]


Make ensure-index somewhat cheaper

Make ensure-index somewhat cheaper

--- src/aurora/language.cljs
+++ src/aurora/language.cljs
@@ -41,19 +41,15 @@
                                (-update-facts (.elems other-index) (into-array other-fields) index fields))
                              (set! kind->name->fields->index (assoc-in kind->name->fields->index [kind name (vec fields)] index))
                              index)))
-  (ensure-index [this kind name default-fields]
-                (assert (array? default-fields))
-                (assert (or (identical? kind "know") (identical? kind "remember") (identical? kind "forget")) (pr-str [kind name default-fields]))
-                (if-let [fields->index (get-in kind->name->fields->index [kind name])]
-                  (assert (= (set default-fields) (set (first (keys fields->index)))) (pr-str [kind name default-fields (first (keys fields->index))]))
-                  (.get-or-create-index this kind name default-fields)))
   (update-facts [this kind name fields facts&vals]
-                #_(prn :updating kind name fields (alength facts&vals))
+                #_(when (> (alength facts&vals) 0)
+                  (prn :updating kind name fields (alength facts&vals)))
                 (assert (array? fields))
                 (assert (or (identical? kind "know") (identical? kind "remember") (identical? kind "forget")) (pr-str kind))
-                (.ensure-index this kind name (into-array (filter #(not (nil? %)) fields)))
                 (let [changed? false
-                      indexes (get-in kind->name->fields->index [kind name])]
+                      indexes (or (get-in kind->name->fields->index [kind name])
+                                  (let [filtered-fields (into-array (filter #(not (nil? %)) fields))]
+                                    [[(vec filtered-fields) (.get-or-create-index this kind name filtered-fields)]]))]
                   (assert (seq indexes) (pr-str kind name))
                   (doseq [[other-fields other-index] indexes]
                     (when (true? (-update-facts facts&vals fields other-index (into-array other-fields)))


Fixed typo in function documentation.

Fixed typo in function documentation.

--- lambdalf-lib/src/main/clojure/alfresco/nodes.clj
+++ lambdalf-lib/src/main/clojure/alfresco/nodes.clj
@@ -78,7 +78,7 @@
   (.getNode (node-locator-service) SitesHomeNodeLocator/NAME nil nil))

 (defn ^Node doc-lib
-  "Returns the document Library for the given site, or Company Home if the given site does not have a document library.
+  "Returns the Document Library for the given site, or Company Home if the given site does not have a document library.
   Note: the provided node must be a valid site."
   [site]
   {:pre [(site? site)]}


wip: implementing the recursion version of binary-tree validator

--- src/clojure_learning/4clojure-exercises.clj
+++ src/clojure_learning/4clojure-exercises.clj
@@ -1326,4 +1326,25 @@
 (empty? ()); true
 (if-let [c (seq ())] c) ; nil

-;; TODO: take the time, to implement this solution using low-level recursion ONLY
+;; the recursive version follows:
+(defn binary-tree?
+  ([xs] (binary-tree? []))
+  ([xs results]
+     (if (empty? xs)
+       results
+       (if (= 3 (count xs))
+          (if (sequential? (first xs))
+              (binary-tree? (first xs) results)
+              (binary-tree? (rest xs) results))
+          (conj results false)))))
+
+(binary-tree? '(:a (:b nil nil) nil))                  ; true
+(binary-tree? [1 [2 [3 [4 false nil] nil] nil] nil])   ; false
+(binary-tree? [1 [2 nil nil] [3 nil nil] [4 nil nil]]) ; false
+(binary-tree? '(:a nil ()))                            ; false
+
+
+
+(sequential? [])  ; true
+(sequential? '()) ; true
+(sequential? :3)  ; false


make the root route accessible without authentication; only require authentication for /dashboard for now

--- src/bitfondue/handler.clj
+++ src/bitfondue/handler.clj
@@ -47,7 +47,8 @@
       (bad-request {:message "wrong auth data"}))))

 (defroutes app-routes
-  (GET "/" [] home)
+  (GET "/" [] "Success!")
+  (GET "/dashboard" [] home)
   (POST "/login" [] login)
   (route/resources "/"))


(#14659) Compatibility with PG 8.1.x

(#14659) Compatibility with PG 8.1.x

RHEL5 ships with 8.1.23, and ARRAY declaration syntax was different waaaaaay
back then. Running PuppetDB with that vintage PG results in SQLExceptions
during initial migration.

In particular, while more recent PG versions support data type definitions like
“foo ARRAY NOT NULL”, PG 8.1 requires “foo ARRAY[1] NOT NULL”. The “1” is
ignored by PG (much like how it ignores the size of a VARCHAR column).

Signed-off-by: Deepak Giridharagopal <d11186354d1ef01ca06ae37d7e23e827da13e85f@puppetlabs.com>

--- src/com/puppetlabs/puppetdb/scf/storage.clj
+++ src/com/puppetlabs/puppetdb/scf/storage.clj
@@ -72,7 +72,7 @@

 (defmethod sql-array-type-string "PostgreSQL"
   [basetype]
-  (format "%s ARRAY" basetype))
+  (format "%s ARRAY[1]" basetype))

 (defmethod sql-array-query-string "PostgreSQL"
   [column]


Fix maybe mappend implementation (bugs introduced in previous commits).

--- src/cats/monad/maybe.cljc
+++ src/cats/monad/maybe.cljc
@@ -171,9 +171,9 @@
       (cond
         (nothing? mv) mv'
         (nothing? mv') mv
-        :else (just (p/mappend ctx
-                               (p/extract mv)
-                               (p/extract mv')))))
+        :else (just (let [mv (p/extract mv)
+                          mv' (p/extract mv')]
+                      (p/mappend (p/get-context mv) mv mv')))))

     p/Monoid
     (mempty [_]


tags and mentions can have anything after them

Was requiring that mentions & tags always had a space or end of line
after


Whitespace

Whitespace

--- src/braid/core/core.cljc
+++ src/braid/core/core.cljc
@@ -136,4 +136,3 @@

        (register-state! braid.core.client.store/initial-state
                         braid.core.client.store/AppState))))
-


Copy inspect into circle.util.repl

Copy inspect into circle.util.repl

--- src/circle/util/repl.clj
+++ src/circle/util/repl.clj
@@ -11,4 +11,11 @@
     (->> (all-ns)
          (mapcat ns-publics)
          (vals)
-         (filter matches?))))+         (filter matches?))))
+
+(defmacro inspect
+  "prints the expression '<name> is <value>', and returns the value"
+  [value]
+  `(let [result# ~value]
+     (println '~value "is" (with-out-str (clojure.pprint/pprint result#)))
+     result#))