fix compiler warning after revert

fix compiler warning after revert

Signed-off-by: Chris Granger <5654cde260ae99bc4d30054171b8bcd902efd19a@gmail.com>

--- src/lt/objs/statusbar.cljs
+++ src/lt/objs/statusbar.cljs
@@ -93,8 +93,6 @@
 (defn ->cursor-str [{:keys [pos]}]
   [:span.pos (str "" (inc (:line pos)) " / " (inc (:ch pos)))])

-(declare status-cursor)
-
 (behavior ::update-cursor-location
                   :triggers #{:update!}
                   :reaction (fn [this pos]
@@ -108,13 +106,14 @@
                         (statusbar-item (bound this ->cursor-str) "")
                         ))

+(def statusbar-cursor (object/create ::statusbar.cursor))
+(add-statusbar-item statusbar-cursor)
+
 (behavior ::report-cursor-location
                   :triggers #{:move :active}
                   :reaction (fn [this]
                               (object/raise statusbar-cursor :update! (ed/->cursor this))))

-(def statusbar-cursor (object/create ::statusbar.cursor))
-(add-statusbar-item statusbar-cursor)

 ;;**********************************************************
 ;; loader
@@ -157,8 +156,8 @@
                         (statusbar-item (log this) "left")
                         ))

-(def status-loader (object/create ::statusbar.loader))
-(add-status-item status-loader)
+(def statusbar-loader (object/create ::statusbar.loader))
+(add-statusbar-item statusbar-loader)

 (defn loader-set []
   (object/merge! statusbar-loader {:loaders 0}))
@@ -187,10 +186,10 @@
                 :dirty 0
                 :tags [:statusbar.console-toggle]
                 :init (fn [this]
-                        (status-item (toggle-span this) "")))
+                        (statusbar-item (toggle-span this) "")))

 (def console-toggle (object/create ::statusbar.console-toggle))
-(add-status-item console-toggle)
+(add-statusbar-item console-toggle)

 (defn dirty []
   (object/update! console-toggle [:dirty] inc))


dtbook/dtbook-file doesn't return the production

so it can't be chained

--- src/mdr2/abacus/import.clj
+++ src/mdr2/abacus/import.clj
@@ -224,8 +224,8 @@
     (-> p
         prod/create!
         prod/set-state-structured!
-        dtbook/dtbook-file
-        merge-struct-file!)))
+        dtbook/dtbook-file)
+    (merge-struct-file! p)))

 (defn copy-obi-project! [production]
   (->> production format-move (append-to-file move-script))


Fix error messages for POST /api/label and PUT /api/label/:id :warning:

--- src/metabase/api/label.clj
+++ src/metabase/api/label.clj
@@ -14,16 +14,16 @@

 (defendpoint POST "/"
   "Create a new label."
-  [:as {{label-name :name, icon :icon} :body}]
-  {label-name [Required NonEmptyString]
-   icon       NonEmptyString}
-  (db/ins Label, :name label-name, :icon icon))
+  [:as {{:keys [name icon]} :body}]
+  {name [Required NonEmptyString]
+   icon NonEmptyString}
+  (db/ins Label, :name name, :icon icon))

 (defendpoint PUT "/:id"
   "Update a label."
-  [id :as {{label-name :name, icon :icon, :as body} :body}]
-  {label-name NonEmptyString
-   icon       NonEmptyString}
+  [id :as {{:keys [name icon], :as body} :body}]
+  {name NonEmptyString
+   icon NonEmptyString}
   (write-check Label id)
   (m/mapply db/upd Label id body)
   (Label id)) ; return the updated Label


Dropdown demo aesthetics

Dropdown demo aesthetics

--- src/re_demo/dropdowns.cljs
+++ src/re_demo/dropdowns.cljs
@@ -118,9 +118,9 @@
       [v-box
        :gap      "10px"
        :children [[p "The dropdown below shows how related choices can be displayed in groups. In this case, several country related groups. e.g. 'EN COUNTRIES'."]
-                  [p "This feature is triggered if any choice has a :group attribute. Typically all choices will have a :group or none will. It's up to you to ensure that choices with the same :group are adjacent in the vector."]
-                  [p "Because :model is initially nil, the :placeholder text is initially displayed."]
-                  [p ":max-width is set here to make the dropdown taller."]
+                  [p "This feature is triggered if any choice has a " [:code ":group"] " attribute. Typically all choices will have a " [:code ":group"] " or none will. It's up to you to ensure that choices with the same " [:code ":group"] " are adjacent in the vector."]
+                  [p "Because :model is initially nil, the " [:code ":placeholder"] " text is initially displayed."]
+                  [p [:code ":max-width"] " is set here to make the dropdown taller."]
                   [h-box
                    :gap      "10px"
                    :align    :center
@@ -147,7 +147,7 @@
       [v-box
        :gap      "10px"
        :children [[p "The dropdown below adds a filter text box to the dropdown section which is convenient for when there are many choices."]
-                  [p "The filter text is searched for in both the :group and the :label values. If the text matches the :group, then all
+                  [p "The filter text is searched for in both the :group and the :label values. If the text matches the " [:code ":group"] ", then all
                       choices under that group are considered to be 'matched'."]
                   [p "The initial model value has been set to 'US'."]
                   [h-box
@@ -207,7 +207,7 @@
       [v-box
        :gap      "10px"
        :children [[p "[single-dropdown ...] supports tab key navigation."]
-                  [p "The :tab-index parameter specifies position in the tab order,
+                  [p "The " [:code ":tab-index"] " parameter specifies position in the tab order,
                        or it can be removed from the tab order using a value of -1."]
                   [p "Up-arrow and Down-arrow do sensible things."]
                   [p "Home and End keys move to the beginning and end of the list."]
@@ -340,7 +340,7 @@
     (fn []
       [v-box
        :gap      "10px"
-       :children [[p "Dropdowns choices can be built with arbitrary markup using the :render-fn attribute. When filtering, only the text from the label will be considered."]
+       :children [[p "Dropdowns choices can be built with arbitrary markup using the " [:code ":render-fn"] " attribute. When filtering, only the text from the label will be considered."]
                   [h-box
                    :gap      "10px"
                    :align    :center


get the memoization right this time

get the memoization right this time

--- src/vip/data_processor/queue.clj
+++ src/vip/data_processor/queue.clj
@@ -6,20 +6,24 @@
             [turbovote.resource-config :refer [config]]))

 (defn sns-client
-  ([]
+  [access-key secret-key region]
+   (aws/client
+    {:api                  :sns
+     :region               region
+     :credentials-provider (credentials/basic-credentials-provider
+                            {:access-key-id     access-key
+                             :secret-access-key secret-key})}))
+
+(def sns-client-memo (memoize sns-client))
+
+(defn default-sns-client
+  []
    ;; memoize the default sns-client construction, so that
    ;; we can avoid creating extra thread pools over time.
    ;; see https://github.com/cognitect-labs/aws-api/issues/80
    (memoize (sns-client (config [:aws :creds :access-key])
                         (config [:aws :creds :secret-key])
                         (config [:aws :region]))))
-  ([access-key secret-key region]
-   (aws/client
-    {:api                  :sns
-     :region               region
-     :credentials-provider (credentials/basic-credentials-provider
-                            {:access-key-id     access-key
-                             :secret-access-key secret-key})})))

 (defn- publish
   [sns-client topic payload]
@@ -30,7 +34,7 @@
 (defn publish-success
   "Publish a successful feed processing message to the topic."
   ([payload]
-   (publish-success (sns-client)
+   (publish-success (default-sns-client)
                     (config [:aws :sns :success-topic-arn])
                     payload))
   ([sns-client topic payload]
@@ -41,7 +45,7 @@
 (defn publish-failure
   "Publish a failed feed processing message to the topic."
   ([payload]
-   (publish-failure (sns-client)
+   (publish-failure (default-sns-client)
                     (config [:aws :sns :failure-topic-arn])
                     payload))
   ([sns-client topic payload]


remove old comment

remove old comment

--- src/braid/mobile/core.cljs
+++ src/braid/mobile/core.cljs
@@ -24,7 +24,6 @@
   (let [threads (subscribe [:active-group-inbox-threads])
         group (subscribe [:active-group])]
     (fn []
-      ; TODO Why is this being rendered when sidebar is dragged?
       [:div.inbox.page
        [:div.threads
         [panels-view @threads thread-view]]])))


Ensure bur-rd and buf-wr phase arg is at audio rate when ugen is also at audio rate. Fixes #249.

--- src/overtone/sc/machinery/ugen/metadata/buf_io.clj
+++ src/overtone/sc/machinery/ugen/metadata/buf_io.clj
@@ -136,7 +136,7 @@
                :default 2
                :doc "1 means no interpolation, 2 is linear, 4 is cubic
                      interpolation"}]
-       ;; :check (when-ar (nth-input-ar 2))
+       :check (when-ar (nth-input-ar 1 "Phase must be audio rate. The following message is offset by 1 due to first arg being special.")) ;; first arg is in mode num-outs
        :doc "reads the contents of a buffer at a given index."}

       {:name "BufWr",
@@ -156,7 +156,7 @@
               {:name "loop"
                :default 1.0
                :doc "1 means true, 0 means false.  This is modulatable"}]
-;;       :check (when-ar (nth-input-ar 1))
+       :check (when-ar (nth-input-ar 1 "Phase must be audio rate. The following message is offset by 1 due to first arg being special."))  ;; first arg is in mode append-sequence
        :doc "writes to a buffer at a given index. Note, buf-wr (in
              difference to buf-rd) does not do multichannel expansion,
              because input is an array." }


(FIXUP) modify :fns to take a PersistentList to be more specific

--- src/puppetlabs/trapperkeeper/services_internal.clj
+++ src/puppetlabs/trapperkeeper/services_internal.clj
@@ -61,7 +61,7 @@
 (def ProtocolandDependenciesMap
   "Schema defining the map used to represent the protocol and dependencies
   of a service."
-  {:fns (schema/pred seq?)
+  {:fns [clojure.lang.PersistentList]
    :dependencies (schema/pred vector?)
    :service-protocol-sym (schema/maybe Symbol)})


fix docstring

fix docstring

--- src/clj_fakes/context.cljc
+++ src/clj_fakes/context.cljc
@@ -185,7 +185,7 @@

 ;;;;;;;;;;;;;;;;;;;;;;;; Fakes - API
 (defn -position
-  "Returns a position of the specified fake. Does not yet work for optional fakes and protocol method fakes."
+  "Returns a position of the specified fake. Does not yet work for optional fakes."
   [ctx f]
   {:pre [ctx f]}
   (get (:positions @ctx) f))


Decrease npc spawn rate

Decrease npc spawn rate

--- src/cljc/robinson/npc.cljc
+++ src/cljc/robinson/npc.cljc
@@ -271,7 +271,7 @@
   [state]
   (let [num-npcs (reduce + (vals (npc-freqs-in-player-place state)))]
     ;; higher random number = less npcs
-    (if (and (< (rr/uniform-int 110)
+    (if (and (< (rr/uniform-int 180)
                 (if (rw/is-night? state)
                    (/ 180 (inc num-npcs))
                    (/ 80 (inc num-npcs))))


Include "Multiplayer base location" for seaports

--- src/cljs/zetawar/data.cljs
+++ src/cljs/zetawar/data.cljs
@@ -731,10 +731,10 @@
      {:q 0
       :r 4
       :terrain-type :deep-water}
-     {:q 1
-      :r 4
-      :terrain-type :mountains
-      }
+     ;; Multiplayer base location
+     {:q 1
+      :r 4
+      :terrain-type :mountains}
      {:q 2
       :r 4
       :terrain-type :plains}
@@ -852,6 +852,7 @@
      {:q 4
       :r 8
       :terrain-type :deep-water}
+     ;; Multiplayer base location
      {:q 5
       :r 8
       :terrain-type :mountains}


change format of syntax docstring

change format of syntax docstring

--- src/cljs_api_gen/parse.clj
+++ src/cljs_api_gen/parse.clj
@@ -502,7 +502,7 @@
         type- "syntax"
         base-item (fn [{:keys [desc form] :as info}]
                     {:name desc
-                     :docstring (str "syntax for " desc " = " form)
+                     :docstring (str "syntax for " desc " " form)
                      :ns ns-
                      :type type-
                      :full-name (str ns- "/" desc)})]


Better initial values for signals

Better initial values for signals

--- src/cljs_game/signals.cljs
+++ src/cljs_game/signals.cljs
@@ -54,7 +54,8 @@
 ;;;; 2) Wait for all signals to change (must keep track of all signals...)
 (defn- map*
   [f in-signal]
-  (let [out-signal (signal nil "map")]
+  (let [init-val (f (value in-signal))
+        out-signal (signal init-val "map")]
     (watch in-signal (:tag out-signal)
            (fn [target old-state new-state]
              (propagate out-signal (f new-state))))
@@ -108,7 +109,7 @@
 (defn ^:export timed
   "Returns a signal that emits the time when the input-signal triggers."
   [trigger-signal]
-  (let [out-signal (signal 0.0 "timed")]
+  (let [out-signal (signal (system-time) "timed")]
     (watch trigger-signal (:tag out-signal)
            (fn [target old-state new-state]
              (propagate out-signal (system-time))))
@@ -143,7 +144,12 @@
 (defn ^:export switch
   "Reverse route, switch on signal. Switch signal provides key for signal to watch"
   [switch-signal inputs]
-  (let [out-signal (signal nil "switch")]
+  (let [init-switch (value switch-signal)
+        out-signal (signal init-switch "switch")]
+    (when (some? init-switch)
+      (watch (get inputs init-switch) (:tag out-signal)
+             (fn [target old new]
+               (propagate out-signal new))))
     (watch switch-signal (:tag out-signal)
            (fn [target old-switch new-switch]
              (unwatch (get inputs old-switch) (:tag out-signal))


Working the network printing apparatus into the training system.

--- suite/src/cortex/suite/train.clj
+++ suite/src/cortex/suite/train.clj
@@ -9,7 +9,8 @@
             [think.compute.nn.cpu-backend :as cpu-backend]
             [cortex.nn.execute :as execute]
             [cortex.nn.traverse :as traverse]
-            [cortex.optimise :as cortex-opt]))
+            [cortex.optimise :as cortex-opt]
+            [cortex.nn.network :as network]))

 (defn load-network
@@ -157,6 +158,8 @@
           epoch-processor (partial per-epoch-eval-training-network context
                                    best-network-atom network-filename initial-description
                                    best-network-fn cv-columnar-input cv-labels)]
+      (println "Training network:")
+      (network/print-layer-summary network)
       (->> (if epoch-count
              (take epoch-count train-sequence)
              train-sequence)


Typehint for c.c.doc

Typehint for c.c.doc

Signed-off-by: Daniel Borchmann <25857343a15bf1edafebc2912e82ecf775c585c1@mailbox.tu-dresden.de>

--- src/conexp/contrib/doc.clj
+++ src/conexp/contrib/doc.clj
@@ -70,7 +70,7 @@
   (for [ns *conexp-namespaces*
 	[f _] (public-api ns)
 	:let [def-ns (defining-namespace ns f)]
-	:when (and (.startsWith def-ns "conexp")
+	:when (and (.startsWith ^String def-ns "conexp")
 		   (not (test-exists? (defining-namespace ns f) f)))]
     (symbol def-ns (str f))))


Correct typo in lint docstring

Correct typo in lint docstring

--- ring-devel/src/ring/middleware/lint.clj
+++ ring-devel/src/ring/middleware/lint.clj
@@ -17,7 +17,7 @@
     (catch Exception e
       (if-not (re-find #"^Ring lint error: " (.getMessage e))
         (throw (Exception. (format
-          "Ring lint error: exception occured when checking that %s on %s: %s"
+          "Ring lint error: exception occurred when checking that %s on %s: %s"
           message (pr-str val) (.getMessage e))))
         (throw e)))))


aoc2021 day03

aoc2021 day03

--- 2021/src/adventofcode2021/day03.clj
+++ 2021/src/adventofcode2021/day03.clj
@@ -3,7 +3,11 @@
             [clojure.pprint :refer [pprint]]))

 (def test-input (line-seq (->> "day03.test.txt" io/resource io/file io/reader)))
-(def input (line-seq (->> "day03.txt" io/resource io/file io/reader)))
+(def input      (line-seq (->> "day03.txt"      io/resource io/file io/reader)))
+
+(defn to-bin-str [size n]
+  (clojure.string/replace (format (str "%" size "s") (Integer/toBinaryString n)) " " "0"))
+

 ;; most common bit
 (defn mcb [xs i]
@@ -11,7 +15,7 @@
         ones (->> xs
                   (map #(min 1 (bit-and % mask)))
                   (apply +))]
-    (if (> ones (/ (count xs) 2)) 1 0)))
+    (if (>= ones (/ (count xs) 2)) 1 0)))

 ;; less common bit
 (defn lcb [xs i] (rem (+ 1 (mcb xs i)) 2))
@@ -19,13 +23,32 @@

 (defn part-1 [lines]
   (let [numbers (map #(Integer/parseInt % 2) lines)
-        gamma   (->> lines first count range reverse (map #(bit-shift-left (mcb numbers %) %)) (apply +))
-        epsilon (->> lines first count range reverse (map #(bit-shift-left (lcb numbers %) %)) (apply +))]
+        size (count (first lines))
+        gamma   (->> (range size) (map #(bit-shift-left (mcb numbers %) %)) (apply +))
+        epsilon (->> (range size) (map #(bit-shift-left (lcb numbers %) %)) (apply +))]
     (* gamma epsilon)))

+
+(defn rating [crit-fn lines]
+  (loop [numbers (map #(Integer/parseInt % 2) lines)
+         i (dec (count (first lines)))]
+    (if (or (neg? i) (= 1 (count numbers)))
+      (first numbers)
+      (let [criteria (crit-fn numbers i)]
+        (recur (filter #(= criteria (bit-and 1 (bit-shift-right % i))) numbers)
+               (dec i))))))
+
+(defn part-2 [lines]
+  (let [oxygen (rating mcb lines)
+        co2 (rating lcb lines)]
+    (* oxygen co2)))

 (comment
   (part-1 test-input)
   (part-1 input)
-)
-
+
+  (part-2 test-input)
+
+  (part-2 input)
+
+  (rating lcb test-input))


Delete debug println.

Delete debug println.

--- src/haystack/feedback.clj
+++ src/haystack/feedback.clj
@@ -21,7 +21,6 @@
         "already-existed"
         (do
           (println "error in index create")
-          (println (re-find #"already.exists" (str e)))
           (throw e))))))

 (defn get-feedback


Removing code commented out

Removing code commented out

--- test/app/test/operationsTest.clj
+++ test/app/test/operationsTest.clj
@@ -37,6 +37,3 @@

 (deftest testResultsToStrings
   (is (= '(["row1" "1"] ["row2" "2"]) (resultsToStrings '(["row1" 1] ["row2" 2])))))
-
-;(deftest testResultsToStrings
-;  ([:class :numberOfConstructors]))


Implement def form in llcoolj

Implement def form in llcoolj

--- src/icfp2014/compiler.clj
+++ src/icfp2014/compiler.clj
@@ -2,6 +2,8 @@
   (:require [clojure.java.io]
             [clojure.string :as string]
             [spyscope.core :as spy]))
+
+(def ^:dynamic locals (atom []))

 (def macros
   {'up    [[:ldc 0 "; up"]]
@@ -88,15 +90,21 @@
   (let [labeled (conj stmt (format "; #%s" label))]
     (vec (concat [labeled] stmts))))

+(defn load-local
+  [name]
+  (let [index (.indexOf @locals name)]
+    (if-not (neg? index)
+      [:ld 0 index (format "; load var %s" name)])))
+
 (defn load-var
   [vars name]
   (let [index (.indexOf vars name)]
     (if-not (neg? index)
-      [:ld 0 index (format "; load var %s" name)])))
+      [:ld 1 index (format "; load var %s" name)])))

 (defn load-fn
   ([name]
-   (load-fn 1 name))
+   (load-fn 2 name))
   ([frame name]
    [:ld frame (format "^%s" name) (format "; load fn %s" name)]))

@@ -104,7 +112,7 @@
   [fns vars name]
   {:post [(vector? %)
           (not (some vector? %))]}
-  (if-let [load-stmt (or (load-var vars name) (load-fn name))]
+  (if-let [load-stmt (or (load-local name) (load-var vars name) (load-fn name))]
     load-stmt
     (throw (IllegalArgumentException. (format "Could not find symbol %s" name)))))

@@ -158,6 +166,15 @@
       (= (first form) 'quote)
       (concat (mapcat #(compile-form vars fns %) (second form))
               (repeat (dec (count form)) [:cons]))
+
+      ;; Variable declaration
+      (= (first form) 'def)
+      (let [[_ var-name val] form]
+        (if (neg? (.indexOf @locals var-name))
+          (swap! locals conj var-name))
+        (concat
+         (compile-form vars fns val)
+         [[:st 0 (.indexOf @locals var-name) (format "; store %s" var-name)]]))

       ;; function call
       :else
@@ -248,14 +265,22 @@
   {:pre [(list? code)]
    :post [(vector? (:code %))
           (every? vector? (:code %))]}
-  (let [fns (conj fns {:name name})
-        code (->> body
-                  (mapcat #(compile-form args fns %))
-                  (tag-with name))
-        code (concat code [[:rtn]])]
-    {:name name
-     :code (vec code)
-     :length (count code)}))
+  (binding [locals (atom [])]
+    (let [localname (format "%s_body" name)
+          code (->> body
+                    (mapcat #(compile-form args fns %))
+                    (tag-with localname))
+          code (concat code [[:rtn]])
+          num-locals (count @locals)
+          local-scope (concat [[:dum num-locals]]
+                       (vec (repeatedly num-locals #(identity [:ldc 0])))
+                       [[:ldf (format "@%s" localname)]
+                        [:trap num-locals]])
+          local-scope (tag-with name local-scope)
+          code (concat local-scope code)]
+      {:name name
+       :code (vec code)
+       :length (count code)})))

 (defn compile-ai
   [file]


refactor describe-as-* entity ctor to retrieve all relations (not just those in entity spec), update triple-map to also serialize any non-spec props back into triples (addresses #3)

--- src/imago/graph/model.clj
+++ src/imago/graph/model.clj
@@ -23,7 +23,8 @@
            (if-let [ser (:values f)]
              (ser (k rec))
              (k rec))]))
-       (into {})))
+       (into {})
+       (merge (select-keys rec (keys (apply dissoc rec :id (keys props)))))))

 (defn extract-key
   [props key]
@@ -70,35 +71,20 @@
     (let [k (id x)]
       (if (map? (first k)) (mapv :id k) (vec k)))))

-(defn build-patterns
-  [props]
-  (mapv (fn [[k v]] ['?id (:prop v) (symbol (str \? (name k)))]) props))
-
-(defn build-describe-spec
-  [g id props]
-  (let [[opt req] (d/bisect (fn [[_ v]] (:optional v)) props)
-        patterns [{:where (build-patterns req)}]
-        patterns (if (seq opt)
-                   (->> opt
-                        (build-patterns)
-                        (map (fn [p] {:optional [p]}))
-                        (into patterns))
-                   patterns)]
-    {:select :*
-     :from g
-     :query patterns
-     :values {'?id #{id}}}))
-
-(defn prepare-describe-results
-  [props res]
-  (reduce-kv
-   (fn [acc k v]
-     (let [p (keyword (q/qvar-name k))]
-       (assoc acc p
-              (if (and (== 1 (count v)) (-> props p :card (not= :*)))
-                (first v)
-                (vec v)))))
-   {} res))
+(defn entity-map-from-triples
+  [triples props id]
+  (let [iprop (reduce-kv (fn [acc k v] (assoc acc (:prop v) k)) {} props)
+        conj* (fnil conj [])]
+    (->> triples
+         (filter #(= id (:s %)))
+         (reduce
+          (fn [acc [_ p o]]
+            (let [p' (iprop p p)
+                  op (props p')]
+              (if (and op (-> op :card (not= :*)))
+                (assoc acc p' o)
+                (update-in acc [p'] conj* o))))
+          {:id id}))))

 (defmacro defentity
   [name type props]
@@ -109,6 +95,7 @@
         ctor       (symbol (str 'make- ctor-name))
         dctor      (symbol (str 'describe- ctor-name))
         dctor-as   (symbol (str 'describe-as- ctor-name))
+        dctor-as2   (symbol (str 'describe-as- ctor-name '2))
         mctor      (symbol (str 'map-> name))]
     `(let [validators# (build-validators ~props)
            defaults#   (extract-key ~props :default)
@@ -152,17 +139,14 @@

        (defn ~dctor-as
          {:doc ~(str "Constructs a new `" (namespace-munge *ns*) "." `~name "` entity based on a graph query\n"
-                     "  for given entity ID and its specified props/rels. If returned query results\n"
-                     "  conflict with entity validation, throws map of errors using `slingshot/throw+`.")
+                     "  for given entity ID and its specified props/rels (any additional rels will be included\n"
+                     "  too, but are not validated during construction). If returned query results conflict\n"
+                     "  with entity validation, throws map of errors using `slingshot/throw+`.")
           :arglists '([~'graph ~'id])}
          [g# id#]
-         (->> ~props
-              (build-describe-spec g# id#)
-              (q/query)
-              (q/accumulate-result-vars)
-              ;;((fn [x#] (prn x#) x#))
-              (prepare-describe-results ~props)
-              (~ctor))))))
+         (-> (~dctor g# id#)
+             (entity-map-from-triples ~props id#)
+             (~ctor))))))

 (defentity User (:User imago)
   {:user-name {:prop (:nick foaf)


add new extensions

add new extensions

taken from https://github.com/theJohnnyBrown/endophile/pull/10/files

--- src/io/perun/markdown.clj
+++ src/io/perun/markdown.clj
@@ -24,7 +24,14 @@
    :anchorlinks          Extensions/ANCHORLINKS
    :all                  Extensions/ALL
    :suppress-html-blocks Extensions/SUPPRESS_HTML_BLOCKS
-   :supress-all-html     Extensions/SUPPRESS_ALL_HTML})
+   :supress-all-html     Extensions/SUPPRESS_ALL_HTML
+   :atxheaderspace       Extensions/ATXHEADERSPACE
+   :forcelistitempara    Extensions/FORCELISTITEMPARA
+   :relaxedhrules        Extensions/RELAXEDHRULES
+   :tasklistitems        Extensions/TASKLISTITEMS
+   :extanchorlinks       Extensions/EXTANCHORLINKS
+   :all-optionals        Extensions/ALL_OPTIONALS
+   :all-with-optionals   Extensions/ALL_WITH_OPTIONALS})

 (defn- bit-or'
   "Bit-or which works if only one argument is given."


Display number of paths

Display number of paths

Actually, go ahead and show all the paths. All of them.

--- src/kevin/routes/home.clj
+++ src/kevin/routes/home.clj
@@ -41,15 +41,17 @@
         paths (if (seq hard-mode)
                 (filter s/ascending-years? paths)
                 paths)
+        total (count paths)
         bacon-number (int (/ (-> paths first count) 2))]
     (layout/common
-      (if (seq (take 50 paths))
+      (if (seq paths)
         [:div#results
          [:div.bacon_number
           [:p (:name result1)]
           [:mark bacon-number]
           [:p (:name result2)]]
          [:div.result_list
+          [:h3 (str total " Paths")]
           [:ul
            (for [path paths]
              [:li


more on protocols

more on protocols

--- src/language/protocol.clj
+++ src/language/protocol.clj
@@ -106,7 +106,48 @@
 @daguguguji

-
+;implement protocols
+
+(defrecord Point [x y]
+  Matrix
+  (lookup [pt i j]
+          (when (zero? j)
+            (case i
+              0 x
+              1 y)))
+  (update [pt i j val]
+          (if (zero? j)
+            (condp = i
+              0 (Point. val y)
+              1 (Point. x val))
+            pt))
+  (rows [pt] [[x] [y]])
+  (cols [pt] [x y])
+  (dims [pt] [2 1]))
+
+(lookup (Point. 3 4) 0 0)
+(update (Point. 3 4) 1 0 7)
+
+(defrecord Point [x y])
+
+(extend-protocol Matrix
+  Point
+  (lookup [pt i j]
+          (when (zero? j)
+            (case i
+              0 (.x pt)
+              1 (.y pt))))
+  (update [pt i j val]
+          (if (zero? j)
+            (condp i
+              0 (Point. val (.y pt))
+              1 (Point. (.x pt) val))
+            pt))
+  (rows [pt] [[(.x pt)] [(.y pt)]])
+  (cols [pt] [(.x pt) (.y pt)])
+  (dims [pt] [2 1]))
+
+(lookup (Point. 3 4) 1 0)

@@ -142,5 +183,23 @@
 (future (locking o
           (println "done!")))

-
-
+;some
+
+(some #{1 2 3} [3 4 5])
+
+(some #{1 2 3} [4 5 6])
+
+(some even? [4 5 6])
+
+(some even? [5 7 9])
+
+;condp
+
+(condp some [2 3 4]
+  ;#{0 1 2} "low!"
+  ;#{2 3 4} :>> #(str "higher than " %)
+  #{3 4 5} :>> #(str "find this -> " %)
+  #{4 5 6} "high!")
+
+
+


Refactoring and simplification

Refactoring and simplification

--- src/dot_utility/radial.clj
+++ src/dot_utility/radial.clj
@@ -43,53 +43,46 @@
   [polars]
   (reduce
    (fn [coords {radius :radius angle :angle}]
-     (conj coords {:x (* radius (cos angle))
-                   :y (* radius (sin angle))}))
+     (conj coords [(* radius (cos angle))
+                   (* radius (sin angle))]))
    []
    polars))
-
-(defn line
-  [^double x1 ^double y1 ^double x2 ^double y2]
-  (new Line2D$Double x1 y1 x2 y2))
-
-(defn radii
-  [pts]
-  (map (fn [{x :x y :y}] (line 0 0 x y)) pts))

 (defn hull
   [pts]
   (let [path (Path2D$Double.)
-        {x-org :x y-org :y} (first pts)
+        [x1 y1] (first pts)
         rest (reverse pts)]
-    (.moveTo path x-org y-org)
-    (doseq [{x :x y :y} rest]
+    (.moveTo path x1 y1)
+    (doseq [[x y] rest]
       (.lineTo path x y))
     path))

-(defn draw-radar
-  [^Graphics2D g ds w h]
-  (let [scale (/ (min w h) 2.0)
-        pen-width (/ 1.5 scale)
-        mapping (affine-mapping scale (- scale) (/ w 2) (/ h 2))
-        axes (polar->cartesian (axes ds))
-        scores (polar->cartesian (points ds))
-        hull (hull scores)
-        ]
-    #_(.scale g scale (- scale))
-    (.translate g (/ w 2.0) (/ h 2.0))
-    (.scale g scale (- scale))
-    (.setStroke g (BasicStroke. pen-width))
-    (.setColor g color-axis)
-    (doseq [l (radii axes)]
-      (.draw g l))
-    (.setStroke g (BasicStroke. (* 2 pen-width)))
-    (.setColor g color-score)
-    (doseq [l (radii scores)]
-      (.draw g l))
+(defn draw-hull
+  [^Graphics2D g ds]
+  (let [hull (hull (polar->cartesian (points ds)))]
     (.setColor g color-fill)
     (.fill g hull)
     (.setColor g color-outline)
     (.draw g hull)))
+
+(defn draw-radials
+  [^Graphics2D g polars]
+  (doseq [[x y] (polar->cartesian polars)]
+    (.draw g (Line2D$Double. 0 0 x y))))
+
+(defn draw-radar
+  [^Graphics2D g ds w h]
+  (let [scale (/ (min w h) 2.0)]
+    (.translate g (/ w 2.0) (/ h 2.0))
+    (.scale g scale (- scale))
+    (.setStroke g (BasicStroke. (/ 1.5 scale)))
+    (.setColor g color-axis)
+    (draw-radials g (axes ds))
+    (.setStroke g (BasicStroke. (/ 3.0 scale)))
+    (.setColor g color-score)
+    (draw-radials g (points ds))
+    (draw-hull g ds)))

 (defn antialias
   "Return a Graphics object with antialiasing turned on.
@@ -126,3 +119,12 @@
       (.setSize width height)
       (.show))
     radar))
+
+
+(def test-data
+     '[("Performance" 1 10)
+       ("Security" 2 5)
+       ("Scalability" 7 10)
+       ("Availability" 8 10)
+       ("Portability" 5 10)
+       ("Modifiability" 3 10)])


added support read data from stdin

added support read data from stdin

--- src/node_cljfmt/main.cljs
+++ src/node_cljfmt/main.cljs
@@ -28,8 +28,17 @@

 (defn edn-opts [edn-filename]
   (if edn-filename
-   (reader/read-string ((aget fs "readFileSync") edn-filename "utf8"))
-   {}))
+    (reader/read-string ((aget fs "readFileSync") edn-filename "utf8"))
+    {}))
+
+(defn stdin-read []
+  (let [stdin (aget js/process "stdin")
+        content (atom "")]
+    (.call (aget stdin "setEncoding") stdin "utf8")
+    (.call (aget stdin "on") stdin "readable" (fn [] (if-let [s (.call (aget stdin "read") stdin)] (swap! content str s))))
+    (.call (aget stdin "on") stdin "end" (fn []
+                                           (let [formatted (cljfmt/reformat-string @content)]
+                                             (.log js/console formatted))))))

 (defn -main []
   (let [parsed (parse-args (aget js/process "argv"))]
@@ -38,6 +47,6 @@
             opts (edn-opts (get-in parsed [:opts :edn]))
             formatted (cljfmt/reformat-string file opts)]
         ((aget fs "writeFileSync") filename formatted "utf8"))
-      (js/console.error "Provide a filename"))))
+      (stdin-read))))

 (set! *main-cli-fn* -main)


Get db conf from environment variable

Get db conf from environment variable

--- src/noppapeli/db/core.clj
+++ src/noppapeli/db/core.clj
@@ -3,9 +3,10 @@
     [yesql.core :refer [defqueries]]))

 (def db-spec
+  (or (System/getenv "DATABASE_URL")
   {:subprotocol "postgresql"
    :subname "//localhost/noppapeli"
    :user "db_user_name_here"
-   :password "db_user_password_here"})
+   :password "db_user_password_here"}))

 (defqueries "sql/queries.sql" {:connection db-spec})


Specify GOBIN during build phase

Specify GOBIN during build phase

Signed-off-by: Gregory Haskins <640d9fe47775e6723f0355b7315e38f7d98d3539@gmail.com>

--- src/obcc/build/golang.clj
+++ src/obcc/build/golang.clj
@@ -71,11 +71,13 @@
     (println "protoc")
     (println (:stderr (protoc "--go_out=./" (str proto) {:verbose true})))))

-(defn go [path & args]
-  (let [cwd (System/getProperty "user.dir")
-        fqpath (str cwd "/" path)
+(def cwd (System/getProperty "user.dir"))
+(defn fqpath [path] (->> (io/file cwd path) .getAbsolutePath))
+
+(defn go [path env & args]
+  (let [fqpath (fqpath path)
         gopath (str fqpath "/build/deps" ":" fqpath "/build" ":" fqpath ":" (System/getenv "GOPATH"))
-        _args (vec (concat ["go"] args [:env {"GOPATH" gopath}]))]
+        _args (vec (concat ["go"] args [:env (merge {"GOPATH" gopath} env)]))]
     (apply println _args)
     (let [result (apply sh/proc _args)]
       (sh/done result)
@@ -103,8 +105,12 @@
     ;; generate protobuf output
     (protoc protofile)

-    ;; test-compile our chaincode
-    (go path "get" "-d" "-v" "chaincode")
-    (go path "build" "chaincode")
+    ;; install dependencies
+    (go path {} "get" "-d" "-v" "chaincode")
+
+    ;; build the actual code
+    (let [gobin (io/file (fqpath path) "build/bin")]
+      (io/make-parents (io/file gobin ".dummy"))
+      (go path {"GOBIN" (.getAbsolutePath gobin)} "build" "chaincode"))

     (println "Compilation complete")))


Add mouse-over captions

Add mouse-over captions

--- src/airhead_frontend/components.cljs
+++ src/airhead_frontend/components.cljs
@@ -1,5 +1,5 @@
 (ns airhead-frontend.components
-  (:require [clojure.string :refer [blank? split]]
+  (:require [clojure.string :refer [blank? split lower-case]]
             [reagent.core :as r]
             [airhead-frontend.state :refer [app-state update-state!]]
             [airhead-frontend.requests :as req]))
@@ -144,12 +144,14 @@

 (defn playlist-add-button [track]
   [:button.pure-button.track-action
-   {:on-click #(req/playlist-add! (:uuid track))}
+   {:title "Add to playlist"
+    :on-click #(req/playlist-add! (:uuid track))}
    [:i.fa.fa-plus]])

 (defn playlist-remove-button [track]
   [:button.pure-button.track-action
-   {:on-click #(req/playlist-remove! (:uuid track))}
+   {:title "Remove from playlist"
+    :on-click #(req/playlist-remove! (:uuid track))}
    [:i.fa.fa-minus]])

 (defn track-field [text]
@@ -209,7 +211,8 @@
       (rseq sorted-tracks))))

 (defn sorting-th [field caption]
-  [:th.sorting-th {:on-click #(update-sort-field! field)}
+  [:th.sorting-th {:title (str "Sort by " (lower-case caption))
+                   :on-click #(update-sort-field! field)}
    [:span caption]
    [:span.sorting-th-arrow (when (= field (@app-state :sort-field))
                           (if (@app-state :ascending)


Planning notes

Planning notes

--- src-cljs/lein_ui/app.cljs
+++ src-cljs/lein_ui/app.cljs
@@ -283,3 +283,141 @@
    :jsload-callback (fn [] (print "reloaded"))) ;; optional callback
   )
 (connect)
+
+
+;; (def local-position 0)
+
+;; (def server (atom {:client-position 0
+;;                    :items []}))
+
+;; (def sync-client [client-position]
+;;   (let [old-position (@server :client-position)
+;;         items (@server :items)
+;;         state' (assoc state :client-position client-position)]))
+
+;;; Goal
+;;
+;; Multiple clients can connect to a server and submit nrepl commands.
+;;
+;; An "nREPL" log contains data for both the requests made to nrepl
+;; by all clients and their responses.
+
+;; The nREPL log can be replicated on each client.
+
+;; Users can see who sent each nrepl command
+
+;; Solutions
+;;
+;; Connect with a Websocket.
+;;
+;; There is a protocol for submitting commands to nREPL and reporting
+;; stream state and/or request a syncrhonization.
+
+;; An nREPL middle captures requests and responses and appends them to
+;; a log.  The order that they are appended is the 'server order'
+;; and this is the log clients sync.
+
+;; Commands to nREPL are submitted directly to nREPL.  Until the nREPL
+;; middleware logs the command, it is not part of the global state.
+
+;; (A second log exists for incoming commands.  There exists enough
+;; information to merge the nREPL log and the command log).
+
+;; Clients can ask for all entries from an offest (inclusive) and send
+;; a subscribe message with a current position.  The server will then
+;; send all message from current position and continue streaming
+;; messages as they arrive.
+
+
+;; Implementation
+
+;; lein-ui.nrepl
+;;  - middleware that logs to an atom passed in during initialization
+;;  - the logging fn makes sure no more than X items are active in the log (drop old)
+;;  - there's a function for getting the log between position A=then and B=now
+;;
+
+;; lein-ui.nrepl.handler
+;;  - Handler for setting up a websocket that listens for messages
+;;  - Responsible for observing the log and streaming it to clients
+;;  - Message format:
+;;    base: {:type (type/Union :nrepl/command :nrepl/observe-log)}
+;;          :nrepl/observe-log {:from Int}
+;;          :nrepl/command {:op :eval
+;;                          :code String}
+
+;;    response
+;;    [ <nrepl-msg> ... ]
+
+
+;; lein-ui.nrepl.client
+;;
+;;  - Connects to the server, receives the stream, and parses the
+;;  nrepl message to derive a data structure usable for display nrepl
+;;  interactions in the UI.  Also provides function for sending an
+;;  nrepl command
+
+;; lein-ui.app.nrepl
+;;  - Manages the nrepl client and presents a UI to the user
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+;; Multi-user builder
+;; Users interact with a definition window
+;; Users send their definitions to be run against a sample input/state or hookup an input from the browser
+
+;; Other users see new definitions and can edit them in place.  Sending the new definition forks the state (inputs against old defintion will effect the state of the old definition)
+
+;; When two users edit the same definition set, it forks.
+
+;; Users can hide defintions in DS from their view.  Defintions can be added and removed from the DS.


fix precision when chunking a file

fix precision when chunking a file

--- src/clj/clj_money/import/gnucash.clj
+++ src/clj/clj_money/import/gnucash.clj
@@ -28,7 +28,7 @@
 (defn- parse-decimal
   [string-decimal]
   (when-let [match (re-find #"(\d+)\/(\d+)" string-decimal)]
-    (with-precision 4
+    (with-precision 12
       (apply / (->> match
                     rest
                     (map bigdec))))))


Fixed vector nesting issue

Fixed vector nesting issue

--- src/clj/forma/postprocess/output.clj
+++ src/clj/forma/postprocess/output.clj
@@ -43,8 +43,8 @@
 Ex. (backward-looking-mavg 3 [1 2 3 4]) expands to [nil nil 1 2 3 4]. Nils are filtered out, so the output is effectively [(average [1]) (average [1 2]) (average [1 2 3]) (average 2 3 4)]"
   [window series]
   (let [expanded-ts (concat (repeat (dec window) nil) (flatten series))]
-    (vec-ify (map (comp float average (partial filter not-nil?))
-                  (partition window 1 expanded-ts)))))
+    (map (comp float average (partial filter not-nil?))
+                  (partition window 1 expanded-ts))))

 (defn mono-inc
   "Make a series of numbers monotonically increasing. Useful for retaining the maximum probability for a pixel over time.
@@ -52,7 +52,7 @@
 (mono-inc [3 4 34 34 23 1 34 13 35 35 ])
 ==> (3 4 34 34 34 34 34 34 35 35)"
   [series]
-  (vec-ify (cons (first series) (rest (reductions max series)))))
+  (cons (first series) (rest (reductions max series))))

 (defn dec->int100
   [coll]


don't try to tag nil attachments

don't try to tag nil attachments

--- src/clj_money/models/attachments.clj
+++ src/clj_money/models/attachments.clj
@@ -28,7 +28,8 @@
   ([attachment]
    (after-read nil attachment))
   ([_ attachment]
-   (authorization/tag-resource attachment :attachment)))
+   (when attachment
+     (authorization/tag-resource attachment :attachment))))

 (def create
   (create-fn {:create create-attachment


[REFACTOR] Rename `Timetable` var to `TIMETABLE`

Signed-off-by: Pang Yan Han <22594c345857f664c61cd411f607c4d40a9d4af9@gmail.com>

--- src/cljs/cljs_nusmods/timetable.cljs
+++ src/cljs/cljs_nusmods/timetable.cljs
@@ -29,8 +29,8 @@
 ;
 ; TimetableLessonInfo (abbrev: ttLessonInfo)
 ; ------------------------------------------
-; Describes a lesson in the `Timetable` global; this is the key used for each
-; row in a day of the `Timetable`.
+; Describes a lesson in the `TIMETABLE` global; this is the key used for each
+; row in a day of the `TIMETABLE`.
 ;
 ; Each instance of `TimetableLessonInfo` is a map in the following format:
 ;
@@ -215,7 +215,7 @@

 (def ^{:doc     "In-memory representation of a Timetable"
        :private true}
-  Timetable nil)
+  TIMETABLE nil)

 (def ^{:doc "Modules selected by the user. This map has the following
              format:
@@ -484,16 +484,16 @@
    The timetable is a vector of 6 rows, with each row representing a day from
    Monday to Saturday"
   []
-  (set! Timetable (vec (map (fn [x] (create-day-repr))
+  (set! TIMETABLE (vec (map (fn [x] (create-day-repr))
                             (range 0 time-helper/NR-DAYS)))))

 (defn- timetable-get-day
   "Retrieves the in-memory representation of the given 0-indexed day in the
    Timetable, where 0 = Monday, 1 = Tuesday, until 5 = Saturday"
   [day]
-  (nth Timetable day))
-
-; Retrieves a row for a given day in `Timetable`
+  (nth TIMETABLE day))
+
+; Retrieves a row for a given day in `TIMETABLE`
 (defmulti timetable-get-day-row (fn [a1 _] (number? a1)) :default true)

 ; First argument is a 0-indexed integer of the day
@@ -501,7 +501,7 @@
   [day rowNum]
   (nth (timetable-get-day day) rowNum))

-; First argument is a day in `Timetable - the return value of
+; First argument is a day in `TIMETABLE` - the return value of
 ; `timetable-get-day` function
 (defmethod timetable-get-day-row false
   [ttDay rowNum]
@@ -559,11 +559,11 @@
    	")

 (defn- add-new-row-to-timetable-day!
-  "Adds a new row to the 0-indexed day in the Timetable, where 0 = Monday,
+  "Adds a new row to the 0-indexed day in the `TIMETABLE`, where 0 = Monday,
    1 = Tuesday, until 5 = Saturday."
   [day]
-  (set! Timetable
-        (update-in Timetable [day]
+  (set! TIMETABLE
+        (update-in TIMETABLE [day]
                    (fn [ttDay]
                      (conj ttDay (create-empty-timetable-row)))))
   (.append (nth HTML-Timetable day)
@@ -574,11 +574,11 @@
     (attr thElem "rowspan" nrRows)))

 (defn- timetable-add-lesson!
-  "Adds a lesson to the `Timetable` global, effectively 'marking' the
+  "Adds a lesson to the `TIMETABLE` global, effectively 'marking' the
    time interval for that lesson as being occupied."
   [day rowNum ttLessonInfo $lessonDiv]
-  (set! Timetable
-        (update-in Timetable
+  (set! TIMETABLE
+        (update-in TIMETABLE
                    [day rowNum]
                    (fn [ttRow]
                      (assoc ttRow ttLessonInfo $lessonDiv)))))
@@ -586,15 +586,15 @@
 (defn- timetable-get-lesson-div
   "Retrieves the jQuery object for a lesson
"
   [day rowNum ttLessonInfo]
-  (get-in Timetable [day rowNum ttLessonInfo]))
+  (get-in TIMETABLE [day rowNum ttLessonInfo]))

 (defn- timetable-remove-lesson!
-  "Removes a lesson from the `Timetable` global, effectively 'marking' the
+  "Removes a lesson from the `TIMETABLE` global, effectively 'marking' the
    time interval occupied by that lesson as free."
   [day rowNum ttLessonInfo]
   (let [$lessonDiv (timetable-get-lesson-div day rowNum ttLessonInfo)]
-    (set! Timetable
-          (update-in Timetable [day rowNum]
+    (set! TIMETABLE
+          (update-in TIMETABLE [day rowNum]
                      (fn [ttRow] (dissoc ttRow ttLessonInfo))))
     $lessonDiv))

@@ -650,7 +650,7 @@
    the one on the row closest to that time.
    If such a `TimetableLessonInfo` object does not exist, returns nil."
   [day rowNum timeIdx]
-  (let [ttRow (get-in Timetable [day rowNum])]
+  (let [ttRow (get-in TIMETABLE [day rowNum])]
     (reduce (fn [ttLessonInfoBefore [ttLessonInfo _]]
               (let [endTime   (:endTime ttLessonInfo)]
                 (cond (and (nil? ttLessonInfoBefore)
@@ -671,7 +671,7 @@
    is the one on the row closest to that time.
    If such a `TimetableLessonInfo` object does not exist, returns nil."
   [day rowNum timeIdx]
-  (let [ttRow (get-in Timetable [day rowNum])]
+  (let [ttRow (get-in TIMETABLE [day rowNum])]
     (reduce (fn [ttLessonInfoAfter [ttLessonInfo _]]
               (let [startTime (:startTime ttLessonInfo)]
                 (cond (and (nil? ttLessonInfoAfter)
@@ -688,7 +688,7 @@
             ttRow)))

 (defn- timetable-row-empty?
-  "Returns true if there is no lesson for a given day and row in `Timetable`.
+  "Returns true if there is no lesson for a given day and row in `TIMETABLE`.
    Returns false otherwise."
   ([ttRow] (empty? ttRow))

@@ -696,7 +696,7 @@

 (defn- timetable-row-not-empty?
   "Returns true if there at least one lesson for a given day and row in
-   `Timetable`. Returns false otherwise."
+   `TIMETABLE`. Returns false otherwise."
   ([ttRow] (not (timetable-row-empty? ttRow)))

   ([day rowNum] (not (timetable-row-empty? day rowNum))))
@@ -734,12 +734,12 @@
           (timetable-enumerate-rows-in-day day)))

 (defn- timetable-prune-empty-rows-for-day!
-  "Removes empty rows from a day in `Timetable`, based on the return value of
+  "Removes empty rows from a day in `TIMETABLE`, based on the return value of
    the `timetable-day-get-empty-and-non-empty-rows` function."
   [day {:keys [emptyRows nonEmptyRows]}]
   (let [nrNonEmptyRows (count nonEmptyRows)]
-    (set! Timetable
-          (update-in Timetable [day]
+    (set! TIMETABLE
+          (update-in TIMETABLE [day]
                      (fn [ttDay]
                        (vec (map (fn [rowIdx]
                                    (timetable-get-day-row ttDay rowIdx))
@@ -756,7 +756,7 @@
                                              emptyRows)))))))))

 (defn- timetable-remove-lesson-group!
-  "Removes a selected lesson group for a module from the `Timetable`.
+  "Removes a selected lesson group for a module from the `TIMETABLE`.

    Returns a sequence of `TimetableLessonInfo` objects, augmented with the
    `:day`, `:rowNum` and `:divElem` keys. The `divElem` key's value is the
@@ -794,7 +794,7 @@
           (timetable-enumerate-rows-in-day day)))

 (defn- html-timetable-prune-empty-rows-for-day!
-  "Removes
 elements corresponding to empty rows in `Timetable`.
+  "Removes
 elements corresponding to empty rows in `TIMETABLE`.
    The 2nd argument should be the return value of the
    `timetable-day-get-empty-and-non-empty-rows` function."
   [day {:keys [emptyRows nonEmptyRows]}]
@@ -1748,7 +1748,7 @@
       (.remove $siblingTd))
     ; update colspan of destination
     (attr $destTd "colspan" slotsOccupied)
-    ; update `Timetable` global
+    ; update `TIMETABLE` global
     (timetable-remove-lesson! day rowNum ttLessonInfo)
     (timetable-add-lesson! day destinationRowNum ttLessonInfo $divElem)))


Make add locations set the initial current-location

It's a bit of an overloading, but it prevents weirdly rendering too
many locations...

--- src/cljs/comic_reader/ui/reader.cljs
+++ src/cljs/comic_reader/ui/reader.cljs
@@ -35,7 +35,10 @@

 (defn add-locations [app-db locations]
   (if (seq locations)
-    (update app-db :locations conj-locations locations)
+    (let [locations (conj-locations (:locations app-db) locations)]
+      (cond-> app-db
+        (not (:current-location app-db)) (assoc :current-location (first locations))
+        :always                          (assoc :locations locations)))
     app-db))

 (defn setup! []


Just use new app alias.

Just use new app alias.

--- src/cmr/dev/env/manager/components/cmr/mock_echo.clj
+++ src/cmr/dev/env/manager/components/cmr/mock_echo.clj
@@ -15,12 +15,10 @@
     (log/info "Starting mock-echo component ...")
     (log/debug "Component keys:" (keys component))
     (let [cfg (builder :mock-echo)
-          component (assoc component :config cfg)
-          dir (config/app-dir component)]
+          component (assoc component :config cfg)]
       (log/trace "Built configuration:" cfg)
       (log/debug "Config:" (:config component))
-      (log/debugf "Running `lein` from %s" dir)
-      (let [chan (util/spawn! "lein" "mock-echo" :dir dir)]
+      (let [chan (util/spawn! "lein" "mock-echo")]
         (log/debug "Started mock-echo component.")
         (assoc component :channel chan))))


wait longer for mirth to start for slow github action environment

--- test/mirthsync/fixture_tools.clj
+++ test/mirthsync/fixture_tools.clj
@@ -109,12 +109,18 @@
         mcserver (sh/proc "./mcserver" :dir mirth-base)]
     (future (sh/stream-to-out mcserver))

-    ;; wait up to 10 seconds for the server to appear
-    (dotimes [i 10]
-      (try
-        (client/head "http://localhost:8080")
-        (catch Exception e))
-      (Thread/sleep 1000))
+    ;; wait up to 60 seconds for the server to appear
+    (loop [i 0]
+      (when-not (and (try
+                     (client/head "http://localhost:8080")
+                     true
+                     (catch Exception e
+                       false))
+                   (< i 60))
+        (do
+          (prn "sleeping")
+          (Thread/sleep 1000)
+          (recur (inc i)))))

     mcserver))


TTT works! TODO: make functional w/ m/fun-mode

--- src/cljs/clj_mini_apps/tic-tac-toe.cljs
+++ src/cljs/clj_mini_apps/tic-tac-toe.cljs
@@ -23,22 +23,26 @@
   (q/rect 79 370 441 9)
   (q/rect-mode :center))

+(defn new-board []
+  [[nil nil nil]
+   [nil nil nil]
+   [nil nil nil]])
+
 (def board
   (atom
-    [[nil nil nil]
-     [nil nil nil]
-     [nil nil nil]]))
+    (new-board)))

 (def cells
   (for [x [79 229 379]
         y [79 229 379]
-        :let [[bx by] [(+ x 70)
+        :let [[cx cy] [(+ x 70)
                        (+ y 70)]
-              [row col] [(dec (quot bx 141))
-                         (dec (quot by 141))]]]
+              [row col] [(dec (quot cx 141))
+                         (dec (quot cy 141))]]]
     {:x x :y y
      :w 141 :h 141
-     :center [bx by] :tile [row col]}))
+     :center [cx cy]
+     :tile [row col]}))

 (defn is-in-cell?
   [{:keys [x y w h]} [mx my]]
@@ -53,23 +57,94 @@
        (filter #(is-in-cell? % [mx my]))
        (first)))

-(defn add-circle
-  [mx my]
+(defn add-circle!
+  [[mx my] [tx ty]]
   (let [[x y] (:center (mouse->cell [mx my]))]
+    (swap! board #(assoc-in % [tx ty] :o))
     (when (every? identity [x y])
       (q/fill (q/random 255) (q/random 255) (q/random 255))
       (q/ellipse x y 100 100)
       (q/fill 255)
       (q/ellipse x y 90 90))))

-(defn play-ttt []
+(defn tile->center
+  [[tx ty]]
+  (->> cells
+       (map (fn [{:keys [center tile]}]
+              (when (= [tx ty] tile)
+                center)))
+       (filter identity)
+       (first)))
+
+(defn cpu-move! []
+  (let [get-rand-tile (fn [] [(rand-int 3) (rand-int 3)])]
+    (loop [[tx ty] (get-rand-tile)]
+      (if (not (get-in @board [tx ty]))
+        (let [[cpu-x cpu-y] (tile->center [tx ty])]
+          (do (swap! board #(assoc-in % [tx ty] :x))
+              (q/fill (q/random 255) (q/random 255) (q/random 255))
+              (q/ellipse cpu-x cpu-y 70 70)))
+        (recur (get-rand-tile))))))
+
+(defn winner?! [board]
+  (letfn [(check-winner [rc]
+            (when (apply = rc)
+              (first rc)))]
+    (or
+      (check-winner (nth board 0))
+      (check-winner (nth board 1))
+      (check-winner (nth board 2))
+      (check-winner (map first board))
+      (check-winner (map second board))
+      (check-winner (map #(nth % 2) board))
+      (check-winner [(get-in board [0 0]) (get-in board [1 1]) (get-in board [2 2])])
+      (check-winner [(get-in board [0 2]) (get-in board [1 1]) (get-in board [2 0])]))))
+
+(defn clear-canvas! []
+  (q/rect-mode :corner)
+  (q/background 209 209 210)
+  (q/fill 255)
+  (q/rect 9 9 582 582)
+  (q/fill 0)
+  (q/rect 220 79 9 441)
+  (q/rect 370 79 9 441)
+  (q/rect 79 220 441 9)
+  (q/rect 79 370 441 9)
+  (q/rect-mode :center))
+
+(defn check-winner! []
+  (if-let [winner ({:o "You" :x "The CPU"} (winner?! @board))]
+    (do (log (str winner " Won!"))
+        (log "Starting A New Game")
+        (reset! board (new-board))
+        (clear-canvas!))
+    (when (->> (flatten @board)
+               (filter nil?)
+               count zero?)
+      (do (log "It was a tie!")
+          (log "Starting A New Game")
+          (reset! board (new-board))
+          (clear-canvas!)))))
+
+(defn move-player
+  [[mx my] [tx ty]]
+  (do (add-circle! [mx my] [tx ty])
+      (check-winner!)))
+
+(defn move-cpu []
+  (do (cpu-move!)
+      (check-winner!)))
+
+(defn play-ttt! []
   (let [[mx my] [(q/mouse-x) (q/mouse-y)]
         [tx ty] (:tile (mouse->cell [mx my]))]
-    (if true
-      (add-circle mx my))))
+    (if (and (every? identity [tx ty])
+             (not (get-in @board [tx ty])))
+      (do (move-player [mx my] [tx ty])
+          (move-cpu)))))

 (q/defsketch hello
   :host "canvas"
   :size [600 600]
   :setup init-board
-  :mouse-pressed play-ttt)
+  :mouse-pressed play-ttt!)


delay for a time, but measure by counting frames

--- src/cljs/infinitelives/pixi/events.cljs
+++ src/cljs/infinitelives/pixi/events.cljs
@@ -64,6 +64,19 @@
         (<! (next-frame))
         (recur (dec i))))))

+(defn wait-time
+  "returns a channel which closes when a certain amount of
+  time in milliseconds has passed, but determines that time by counting
+  the requestAnimationFrame callbacks, so that when tab focus is lost,
+  the callback, and thus this wait is suspended.
+
+  ```
+  ;; wait one seconds worth of frames
+  (<! (wait-time 1000))
+  ```"
+  [delay]
+  (wait-frames (* 60 (/ delay 1000))))
+

 ;;
 ;; Resize Channel


Fixing running re-frame on webworker

Fixing running re-frame on webworker

--- src/re_frame/interop.cljs
+++ src/re_frame/interop.cljs
@@ -6,7 +6,7 @@

 (defn on-load
       [listener]
-      (events/listen js/window "load" listener))
+      (events/listen js/self "load" listener))

 (def next-tick goog.async.nextTick)


Add short description to recipes

Add short description to recipes

--- src/robinson/crafting.clj
+++ src/robinson/crafting.clj
@@ -388,11 +388,17 @@
                     get-recipe-by-types
                     :recipe/id
                     ig/id->name)]
-    ;(apply str item-name (map mod-name (get recipe :effects)))
-    ;(log/info (-> recipe :types))
-    ;(-> recipe :types)
-    ;(assert (some item-name) (str "item-name not found" item-name))
     item-name))
+
+(defn recipe-short-desc
+  [recipe]
+  (let [merged-effects (->>
+                         (group-by :k (get recipe :effects))
+                         (map (fn [[_ effects]]
+                           (assoc (first effects) :amount (reduce + (map :amount effects)))))
+                          (filter (fn [effect]
+                                 (not= 0 (get effect :amount)))))]
+  (apply str "" (map mod-name merged-effects))))

 (defn save-recipe [state]
   (log/info "Saving recipe")
@@ -555,7 +561,10 @@
     (map (fn [[hotkey recipe]]
            (assoc recipe :hotkey hotkey :name (if (get recipe :empty)
                                                 "Empty"
-                                                (recipe-name recipe))))
+                                                (recipe-name recipe))
+                         :alt (if (get recipe :empty)
+                                "----"
+                                (recipe-short-desc recipe))))
          (merge
            {\a empty-recipe
             \b empty-recipe


Support sesame dataset restrictions with string value restrictions.

--- src/grafter/rdf/sesame.clj
+++ src/grafter/rdf/sesame.clj
@@ -547,18 +547,22 @@
 (defn make-restricted-dataset
   "Build a dataset to act as a graph restriction.  You can specify for
   both :default-graph and :named-graphs.  Both of which take sequences
-  of URI strings.  If nil is passed in nil is returned, which means we
-  use the default no restriction."
+  of URI strings."
   [& {:as options}]
   (when options
     (let [{:keys [default-graph named-graphs]
            :or {default-graph [] named-graphs []}} options
            private-graph "urn:private-drafter-graph-to-force-restrictions-when-no-graphs-are-listed"
            dataset (DatasetImpl.)]
-      (doseq [graph (conj default-graph private-graph)]
-        (.addDefaultGraph dataset (->uri graph)))
-      (doseq [graph named-graphs]
-        (.addNamedGraph dataset (->uri graph)))
+      (if (string? default-graph)
+        (.addDefaultGraph dataset (->uri default-graph))
+
+        (doseq [graph (conj default-graph private-graph)]
+          (.addDefaultGraph dataset (->uri graph))))
+      (if (string? named-graphs)
+        (.addNamedGraph dataset (->uri named-graphs))
+        (doseq [graph named-graphs]
+          (.addNamedGraph dataset (->uri graph))))
       dataset)))

 (defn- mapply [f & args]


How to thread argument mutation

How to thread argument mutation

--- test/layzee/integration/paging_search_examples.clj
+++ test/layzee/integration/paging_search_examples.clj
@@ -18,4 +18,23 @@
 (facts "How to page arbitrary sequences"
        (fact "for example, collect 20 results 5 at a time"
              (let [result (paging/page #(range 5) #(<= 20 (count %)) '())]
+               (count result) => 20)))
+(defn- page
+  ":fn-producer -- function that produces the results
+   :fn-args     -- function that produces arguments for the producer
+   :fn-stop     -- how we tell we're finished
+   :result      -- collects the results
+   :args        -- [optional] arguments for :fn-producer. Defaults to empty map/vector"
+  ([fn-producer fn-args fn-stop result args]
+     (if (apply fn-stop [result])
+       result
+       (recur fn-producer fn-args fn-stop (concat (apply fn-producer [args]) result) (apply fn-args [result args])))))
+
+(defn- source[args] (range 5))
+
+(defn- source-args[result args] (update-in args [:page] inc))
+
+(facts "You also need to be able to tailor the arguments to the next call -- or produce the next function to call"
+       (fact "for example, collect 20 results 5 at a time"
+             (let [result (page source source-args #(<= 20 (count %)) '() {:page 1})]
                (count result) => 20)))


Don't attempt to run clblast test if there is no decent platform available.

--- test/uncomplicate/neanderthal/clblast_cpu_test.clj
+++ test/uncomplicate/neanderthal/clblast_cpu_test.clj
@@ -24,7 +24,9 @@
   (real-test/test-tr-trs factory tr)
   (real-test/test-tr-sv factory tr))

-(let [devs (devices (decent-platform (platforms) :cpu) :cpu)]
+(let [devs (some-> (platforms)
+                   (decent-platform :cpu)
+                   (devices :cpu))]
   (when (< 0 (count devs))
     (with-release [dev (first devs)
                    ctx (context [dev])


chore: shutdown-agents not necessary anymore


More tweaks

More tweaks

--- src/leiningen/amp/impl.clj
+++ src/leiningen/amp/impl.clj
@@ -20,30 +20,6 @@
   [m f]
   (reduce (fn [altered-map [k v]] (assoc altered-map k (f v))) {} m))

-(defn- replace-parameters
-  [project value]
-  (s/replace
-    (s/replace
-      (s/replace
-        value
-        "${project.name}" (s/replace (:name project) "/" "."))
-      "${project.version}" (:version project))
-    "${project.description}" (:description project)))
-
-(defn- read-module-properties
-  [project module-properties-file]
-  (let [raw-props (java.util.Properties.)
-        _         (with-open [input-stream (io/input-stream module-properties-file)]
-                    (.load raw-props input-stream))]
-    (map-function-on-map-vals raw-props #(replace-parameters project %))))
-
-(defn- write-module-properties!
-  [file module-properties]
-  (let [props (java.util.Properties.)
-        _     (.putAll props module-properties)
-        _     (.store props (io/output-stream file) " !!!! DO NOT EDIT -- AUTO-GENERATED FILE -- DO NOT EDIT !!!!")]
-    nil))
-
 (defn- fexists
   [file]
   (.exists ^java.io.File file))
@@ -54,7 +30,7 @@

 (defn- mkdir-p
   [directory]
-  (io/make-parents (io/file directory ".")))   ; make-parents won't create the last path element of the file
+  (io/make-parents (io/file directory ".")))   ; make-parents won't create the last path element of the file passed to it

 (defn- zip-directory!
   "Recursively compress all files in 'directory' into 'zip-file'."
@@ -73,6 +49,57 @@
             (.closeEntry zip-stream-out))))))
   nil)

+(defn- fix-snapshot-version
+  "This method converts SNAPSHOT version numbers into something Alfresco can support. It does this by
+  decrementing the last non-zero version number element by 1 and appending a 999 version component on
+  the end.  It also always returns a version number with at least version components."
+  [version]
+  (if (.endsWith ^String version "-SNAPSHOT")
+    (let [non-snapshot-version      (.substring ^String version 0 (- (.length ^String version) (.length "-SNAPSHOT")))
+          version-number-components (map #(Integer/parseInt %) (s/split non-snapshot-version #"\."))
+          version-number-components (drop-while zero? (reverse version-number-components))
+          _                         (if (empty? version-number-components) (throw (RuntimeException. (str "Invalid version number: " version))))
+          version-number-components (reverse (concat [999 (dec (first version-number-components))] (rest version-number-components)))
+          version-number-components (if (= (count version-number-components) 1)
+                                      (concat version-number-components [999 999])
+                                      (if (= (count version-number-components) 2)
+                                        (concat version-number-components [999])
+                                        version-number-components))]
+      (s/join "." version-number-components))
+    version))
+
+(defn- replace-parameters
+  [project value]
+  (s/replace
+    (s/replace
+      (s/replace
+        value
+        "${project.name}" (str (if (nil? (:group project)) "" (str (:group project) "."))
+                               (:name project)))
+      "${project.version}" (fix-snapshot-version (:version project)))
+    "${project.description}" (:description project)))
+
+(defn- read-module-properties
+  [project module-properties-file]
+  (let [raw-props (java.util.Properties.)
+        _         (with-open [input-stream (io/input-stream module-properties-file)]
+                    (.load raw-props input-stream))]
+    (map-function-on-map-vals raw-props #(replace-parameters project %))))
+
+(defn- write-module-properties!
+  [file module-properties]
+  (doto (java.util.Properties.)
+    (.putAll module-properties)
+    (.store (io/output-stream file) " !!!! DO NOT EDIT -- AUTO-GENERATED FILE -- DO NOT EDIT !!!!"))
+  nil)
+
+(defn- rewrite-module-context!
+  [module-context-file module-id]
+  (let [module-context-content (slurp module-context-file)
+        rewritten-content      (s/replace module-context-content "${project.moduleId}" module-id)]
+    (spit module-context-file rewritten-content))
+  nil)
+
 (defn package-amp!
   [project args]
   (let [project-home           (io/file (:root project))
@@ -81,6 +108,7 @@
         _                      (if (not (fexists module-properties-file))
                                  (throw (RuntimeException. (str "Invalid AMP project - " module-properties-file " is missing."))))
         module-properties      (read-module-properties project module-properties-file)
+        _                      (println module-properties)
         module-id              (get module-properties "module.id")
         module-version         (get module-properties "module.version")

@@ -96,14 +124,16 @@

         ; Target paths (where the AMP gets constructs)
         target                 (io/file (:target-path project))
-        tgt-amp                (io/file target     "amp")
-        tgt-module-properties  (io/file tgt-amp    "module.properties")
-        tgt-file-mapping       (io/file tgt-amp    "file-mapping.properties")
-        tgt-config             (io/file tgt-amp    "config")
-        tgt-lib                (io/file tgt-amp    "lib")
-        tgt-licenses           (io/file tgt-amp    "licenses")
-        tgt-module             (io/file tgt-config module-id)
-        tgt-web                (io/file tgt-amp    "web")
+        tgt-amp                (io/file target              "amp")
+        tgt-module-properties  (io/file tgt-amp             "module.properties")
+        tgt-file-mapping       (io/file tgt-amp             "file-mapping.properties")
+        tgt-config             (io/file tgt-amp             "config")
+        tgt-lib                (io/file tgt-amp             "lib")
+        tgt-licenses           (io/file tgt-amp             "licenses")
+        tgt-alfresco-module    (io/file tgt-config          "alfresco/module")
+        tgt-module             (io/file tgt-alfresco-module module-id)
+        tgt-module-context     (io/file tgt-module          "module-context.xml")
+        tgt-web                (io/file tgt-amp             "web")

         ; Output AMP file
         tgt-amp-file           (io/file target
@@ -134,8 +164,12 @@
     ; ${AMP}/module/ - note: this one is a bit unusual as it gets merged into ${AMP}/config...
     (if (fexists src-module)
       (do
-        (fs/copy-dir src-module tgt-config)
-        (.renameTo (io/file tgt-config (fname src-module)) tgt-module)))
+        (mkdir-p tgt-alfresco-module)
+        (fs/copy-dir src-module tgt-alfresco-module)
+        (.renameTo (io/file tgt-alfresco-module (fname src-module)) tgt-module)))
+
+    (if (fexists tgt-module-context)
+      (rewrite-module-context! tgt-module-context module-id))

     ; ${AMP}/web/
     (if (fexists src-web)


Improved war servlet class options

Improved war servlet class options

--- src/leiningen/ring/war.clj
+++ src/leiningen/ring/war.clj
@@ -1,6 +1,7 @@
 (ns leiningen.ring.war
   (:require [leiningen.compile :as compile]
-            [clojure.java.io :as io])
+            [clojure.java.io :as io]
+            [clojure.string :as string])
   (:use [clojure.contrib.prxml :only (prxml)])
   (:import [java.util.jar Manifest
                           JarEntry
@@ -36,23 +37,50 @@
      "Built-By: " (System/getProperty "user.name") "\n"
      "Build-Jdk: " (System/getProperty "java.version") "\n\n"))))

+(defn default-servlet-class [project]
+  (let [handler-sym (get-in project [:ring :handler])
+        ns-parts    (-> (namespace handler-sym)
+                        (string/replace "-" "_")
+                        (string/split #"\.")
+                        (butlast)
+                        (vec)
+                        (conj "servlet"))]
+    (string/join "." ns-parts)))
+
+(defn servlet-class [project]
+  (or (get-in project [:ring :servlet-class])
+      (default-servlet-class project)))
+
+(defn servlet-ns [project]
+  (-> (servlet-class project)
+      (string/replace "_" "-")))
+
+(defn servlet-name [project]
+  (or (get-in project [:ring :servlet-name])
+      (str (get-in project [:ring :handler])
+           " servlet")))
+
+(defn context-path [project]
+  (-> (get-in project [:ring :context-path])
+      (or "/")
+      (str "*")))
+
 (defn make-web-xml [project]
   (with-out-str
     (prxml
       [:web-app
         [:servlet
-          [:servlet-name "war-servlet"]
-          [:servlet-class "deploy.servlet"]]
+          [:servlet-name  (servlet-name project)]
+          [:servlet-class (servlet-class project)]]
         [:servlet-mapping
-          [:servlet-name "war-servlet"]
-          [:url-pattern "/*"]]])))
-
+          [:servlet-name (servlet-name project)]
+          [:url-pattern (context-path project)]]])))

 (defn source-file [project namespace]
   (io/file (:compile-path project)
            (-> (str namespace)
-               (.replace "-" "_")
-               (.replace "." java.io.File/separator)
+               (string/replace "-" "_")
+               (string/replace "." java.io.File/separator)
                (str ".clj"))))

 (defn compile-form [project namespace form]
@@ -61,13 +89,14 @@
     (with-open [out (io/writer out-file)]
       (binding [*out* out] (prn form))))
   (compile/eval-in-project project
-    `(clojure.core/compile '~namespace)))
+    `(do (clojure.core/compile '~namespace) nil)))

 (defn compile-servlet [project]
   (let [handler-sym (get-in project [:ring :handler])
-        handler-ns  (symbol (namespace handler-sym))]
-    (compile-form project 'deploy.servlet
-      `(do (ns deploy.servlet
+        handler-ns  (symbol (namespace handler-sym))
+        servlet-ns  (symbol (servlet-ns project))]
+    (compile-form project servlet-ns
+      `(do (ns ~servlet-ns
              (:require ring.util.servlet ~handler-ns)
              (:gen-class :extends javax.servlet.http.HttpServlet))
            (ring.util.servlet/defservice ~handler-sym)))))


Tweak settings for experiments

Tweak settings for experiments

--- src/edu/berkeley/ai/scripts/z09_aij.clj
+++ src/edu/berkeley/ai/scripts/z09_aij.clj
@@ -93,13 +93,13 @@
 (defn make-aij-experiment-set [name max-seconds arg-spec]
   (experiments/make-experiment-set name
     arg-spec get-init-form get-solution-form
-    'edu.berkeley.ai.scripts.z09-aij nil ;10
+    'edu.berkeley.ai.scripts.z09-aij 10
      max-seconds 512 nil experiments/*planning-experiment-result*))

 (defn make-offline-experiment-set []
-  (make-aij-experiment-set "nav-switch-test" 1
+  (make-aij-experiment-set "nav-switch-test" 100
     [:product
       [:domain [] [[:nav-switch
 		    [:product


Used conjoin instead of cons for the child route generation to remove need for reverse
Re-ran bench, gc pressure relieved & mean exec time down maybe 10%

Evaluation count : 600 in 60 samples of 10 calls.
             Execution time mean : 111.539931 ms
    Execution time std-deviation : 6.694468 ms
   Execution time lower quantile : 108.478915 ms ( 2.5%)
   Execution time upper quantile : 124.320704 ms (97.5%)
                   Overhead used : 3.376706 ns

Found 10 outliers in 60 samples (16.6667 %)
	low-severe	 4 (6.6667 %)
	low-mild	 6 (10.0000 %)
 Variance from outliers : 45.0923 % Variance is moderately inflated by outliers

--- src/lonelyplanet/model.clj
+++ src/lonelyplanet/model.clj
@@ -60,11 +60,11 @@
   [loc acc]
   (let [loc-id (-> loc z/node :attrs :id)
         child-test (-> loc z/down z/right)]
-    (if child-test (recur (z/down child-test) (cons loc-id acc)) (cons loc-id acc))))
+    (if child-test (recur (z/down child-test) (conj acc loc-id)) (conj acc loc-id ))))

 (defn gen-route [loc]
   "Merge the parent route and the child route"
-  (concat (gen-route-parent loc []) (rest (reverse (gen-route-child loc [])))))
+  (concat (gen-route-parent loc []) (rest (gen-route-child loc []))))

 (defn gen-meta
   "Generate destination meta-info for the view"


Show message if file/folder is already in workspace

--- src/lt/objs/workspace.cljs
+++ src/lt/objs/workspace.cljs
@@ -4,6 +4,7 @@
             [lt.objs.files :as files]
             [lt.objs.command :as cmd]
             [lt.objs.cache :as cache]
+            [lt.objs.notifos :as notifos]
             [cljs.reader :as reader]
             [lt.util.load :as load]
             [lt.util.js :refer [now]]
@@ -207,18 +208,22 @@
 (behavior ::add-file!
                   :triggers #{:add.file!}
                   :reaction (fn [this f]
-                              (when-not (some #{f} (:files (-> @this)))
-                                (add! this :files f)
-                                (object/raise this :add f)
-                                (object/raise this :updated))))
+                              (if-not (some #{f} (:files @this))
+                                (do
+                                  (add! this :files f)
+                                  (object/raise this :add f)
+                                  (object/raise this :updated))
+                                (notifos/set-msg! "This file is already in your workspace." {:class "error"}))))

 (behavior ::add-folder!
                   :triggers #{:add.folder!}
                   :reaction (fn [this f]
-                              (when-not (some #{f} (:folders (-> @this)))
-                                (add! this :folders f)
-                                (object/raise this :add f)
-                                (object/raise this :updated))))
+                              (if-not (some #{f} (:folders @this))
+                                (do
+                                  (add! this :folders f)
+                                  (object/raise this :add f)
+                                  (object/raise this :updated))
+                                (notifos/set-msg! "This folder is already in your workspace." {:class "error"}))))

 (behavior ::remove-file!
                   :triggers #{:remove.file!}


fix typo

fix typo

--- src/modus/api/projects.clj
+++ src/modus/api/projects.clj
@@ -42,7 +42,7 @@
                 (resp/no-content))
               (resp/forbidden "Permission denied!")
               )))
-        (DELETE "/:team-id/accounts" [:as req]
+        (DELETE "/:project-id/accounts" [:as req]
           (let [auth-id (api-common/authenticated-id req)
                 {{project-id :project-id} :params} req
                 {{:keys [account-id]} :body} req


Fixed bug with unique constraint on (productid, date)

--- src/hackerati_interval_web_app/jdbc.clj
+++ src/hackerati_interval_web_app/jdbc.clj
@@ -29,12 +29,11 @@
   (db-do-commands db (create-table-ddl :products
                                             [:productid :integer "PRIMARY KEY" "AUTO_INCREMENT"]
                                             [:url "varchar(2083)"])))
-
+;; TODO add unique (date, productid) constraint
 (defn create-prices-table [db]
   (db-do-commands db (create-table-ddl :prices
                                             [:priceid :integer "PRIMARY KEY" "AUTO_INCREMENT"]
                                             [:productid :integer "references products (productid)"]
                                             [:date "date"]
-                                            [:price "decimal(7,2)"]
-                                            :table-spec "constraint uc_price unqiue (productid, date)")))
+                                            [:price "decimal(7,2), CONSTRAINT UNIQUE KEY `uc_price` (`productid`, `date`)" ])))


again forgot (future) in b54207d5c7df37b1fbcf7063e66ca408b2c5b26f

--- src/bzzz/index_search.clj
+++ src/bzzz/index_search.clj
@@ -315,7 +315,7 @@
         facets (:facets input)
         index (need :index input "need <index>")
         futures (into [] (for [shard (index-name-matching (resolve-alias index))]
-;;                           (future
+                           (future
                              (use-searcher shard
                                            (get input :must-refresh false)
                                            (fn [^IndexSearcher searcher ^DirectoryTaxonomyReader taxo-reader]
@@ -331,5 +331,5 @@
                                                            :sort (:sort input)
                                                            :spatial-filter (get input :spatial-filter nil)
                                                            :explain (get input :explain false)
-                                                           :fields (:fields input))))))]
+                                                           :fields (:fields input)))))))]
     (reduce-collection futures input ms-start)))


Gen world

Gen world

--- src/clj/threed/server.clj
+++ src/clj/threed/server.clj
@@ -63,6 +63,16 @@
   ;; TODO not owkring
   (component/stop @sys))

+(defn gen-world! [r]
+  (swap! (get-in @sys [:state :universe])
+         (fn [universe]
+           (uni/add-positions universe (gen/sphere [0 0 0] r)))))
+
+(defn empty-world! []
+  (swap! (get-in @sys [:state :universe])
+         (fn [universe]
+           (uni/clear universe))))
+
 (defn run [& [port]]
   (defonce stop! (atom nil))

@@ -78,21 +88,12 @@
                     (stop-web-server!)
                     (stop-system!))))

-  #_(swap! (get-in @sys [:state :universe]) (fn [universe] (threed.universe/add-position universe [0 0 0]))))
+  (gen-world! 20))

 ;; reconnect dispatcher after reload
 ;; (when @sys
 ;;   (threed.dispatcher/dispatch-actions! (:dispatcher @sys) (:system-bus @sys)))

-(defn gen-world! [r]
-  (swap! (get-in @sys [:state :universe])
-         (fn [universe]
-           (uni/add-positions universe (gen/sphere [0 0 0] r)))))
-
-(defn empty-world! []
-  (swap! (get-in @sys [:state :universe])
-         (fn [universe]
-           (uni/clear universe))))

 (defn -main [& [port]]
   (run port))


Disallow changing the name of the admin

Disallow changing the name of the admin

--- src/clj_crud/accounts.clj
+++ src/clj_crud/accounts.clj
@@ -285,12 +285,15 @@
                  {:account (with-account-links account)})))
   :post! (fn [ctx]
            (let [params (get-in ctx [:request :params])
+                 slug (:slug params)
                  errors (reduce merge {}
                                 [(when-not (contains? params :name)
                                    [:name "Must have name attr"])
                                  (when (zero? (count (get params :name)))
-                                   [:name "Name can not be empty"])])
-                 account-update {:slug (:slug params)
+                                   [:name "Name can not be empty"])
+                                 (when (= slug "admin")
+                                   [:name "Can't change the name of the Admin."])])
+                 account-update {:slug slug
                                  :name (:name params)}]
              (when-not (seq errors)
                (accounts/update-account (h/db ctx) account-update))


also remove start and end time from each leg.

--- src/otp_api_proxy/core.clj
+++ src/otp_api_proxy/core.clj
@@ -254,9 +254,10 @@
             maxduration (reduce max durations)
             minduration (reduce min durations)]
         (-> fst
-            (dissoc :duration)
-            (dissoc :startTime)
-            (dissoc :endTime)
+            (dissoc :startTime :endTime :duration)
+            ;; TODO: summarize the min/max duration for each leg??
+            (assoc :legs (map #(dissoc % :startTime :endTime )
+                              (:legs fst)))
             (assoc :minDuration minduration)
             (assoc :maxDuration maxduration)
             (assoc :countWithThisRouteSequence num-itins))))))


add :start option to #'buffer-cue.

add :start option to #'buffer-cue.

--- src/overtone/sc/buffer.clj
+++ src/overtone/sc/buffer.clj
@@ -242,6 +242,8 @@

   :n-chans     - Number of channels for the buffer
                  Default 2
+  :start       - Start frame in file.
+                 Default 0
   :size        - Buffer size
                  Default 65536

@@ -252,13 +254,15 @@
   (let [path (resolve-tilde-path path)
         arg-map (merge (apply hash-map args)
                        {:n-chans 2
+                        :start 0
                         :size 65536})
-        {:keys [n-chans size]} arg-map
+        {:keys [n-chans start size]} arg-map
         buf (buffer size n-chans)]
-    (snd "/b_read" (:id buf) path 0 -1 0 1)
+    (snd "/b_read" (:id buf) path start -1 0 1)
     (with-meta
       (assoc buf
         :path path
+        :start start
         :open? (atom true))
       {:type ::buffer-cue})))


Improve message when author challenge is incomplete

--- tutorial.vent/src/tutorial/vent/frontend/main.cljs
+++ tutorial.vent/src/tutorial/vent/frontend/main.cljs
@@ -28,7 +28,13 @@
       (html
         [:div
          [:span.user__name
-          (or (:name user) (str "ERROR: Name missing!"))]
+          (cond
+            (not user)
+            "User Not Specified: Complete more challenges"
+            (not (:name user))
+            "Unknown Name"
+            :else
+            (:name user))]
          [:a.user__username
           {:href "javascript:;"
            :onClick (fn [e]


Fixed bug with visualization

Fixed bug with visualization

--- visualization/src/cortex_visualization/nn/core.clj
+++ visualization/src/cortex_visualization/nn/core.clj
@@ -90,8 +90,8 @@
   "Labels are expected to be an array of integers"
   [data integer-labels title]
   (let [data-transposed (m/transpose data)
-        x-vals (m/eseq (m/get-row data 0))
-        y-vals (m/eseq (m/get-row data 1))]
+        x-vals (m/eseq (m/get-row data-transposed 0))
+        y-vals (m/eseq (m/get-row data-transposed 1))]
     (doto (inc-charts/scatter-plot x-vals y-vals :group-by integer-labels :title title)
       inc-core/view)))

@@ -109,4 +109,4 @@
         labels (mapv index-of-label softmax-labels)
         _ (println (format "tsne-ifying %d samples" (m/row-count data)))
         tsne-data (tsne/tsne samples 2 :iters tsne-iterations)]
-    (scatter-plot-data tsne-data labels title)))
+    (scatter-plot-data (m/array :vectorz tsne-data) labels title)))


documentazione script interattivo

documentazione script interattivo

--- ws/soldipubblici.clj
+++ ws/soldipubblici.clj
@@ -3,8 +3,13 @@
 ;; **
 ;;; # GufoVolante
 ;;;
+;;; ![](https://github.com/d-cent/gufovolante/raw/master/doc/gufo-volante-kokkola.png)
+;;;
 ;;; ## Terminale interattivo per analisi di dati da soldipubblici.gov.it
-;;;
+;;;
+;;; Per eseguire i blocchi di operazioni usare `SHIFT+INVIO`, per completare il nome
+;;; delle funzioni disponibili usare `CTRL+SPAZIO`.
+;;;
 ;;; Sviluppo in fase sperimentale, per maggiori informazioni la mailinglist pubblica e'
 ;;;
 ;;; Archivio: https://lists.dyne.org/lurker/list/soldipubblici.it.html
@@ -14,17 +19,11 @@
 ;;; Codice libero ed open source: https://github.com/d-cent/gufovolante
 ;;;
 ;;; Questa ricerca e' legata al progetto D-CENT http://dcentproject.eu
-;;;
-;;;
-;;; ```
-;;;   Copyright (c) Denis Roio. All rights reserved.
-;;;   The use and distribution terms for this software are covered by the
-;;;   Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
-;;;   which can be found in the file epl-v10.html at the root of this distribution.
-;;;   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.
-;;; ```
+;;;
+;;;    Copyright (c) 2016 Dyne.org, scritto da Denis Roio (@jaromil)
+;;;    GufoVolante e' software libero distribuito secondo la Eclipse
+;;;    Public License (come Clojure) in versione 1.0.
+;;;
 ;; **

 ;; @@


varchar(200) -> varchar(999)

varchar(200) -> varchar(999)

--- src/pg_demo/table_defs.clj
+++ src/pg_demo/table_defs.clj
@@ -57,7 +57,7 @@
               PRIORITY_ASSESSMENT numeric,
               CLOSE_USER_ID numeric,
               CLOSE_DATE timestamp,
-              CLOSE_NOTES varchar(200),
+              CLOSE_NOTES varchar(999),
               DATE_LOCKED timestamp,
               UD_TEXT_1 varchar(100),
               UD_TEXT_2 varchar(100),
@@ -1079,13 +1079,13 @@
               SORT_ID numeric,
               LITERATURE_ID numeric,
               JOURNAL varchar(80),
-              AUTHOR varchar(200),
+              AUTHOR varchar(999),
               TITLE varchar(500),
               VOL varchar(15),
               YEAR varchar(4),
               PGS varchar(30),
               DELETED timestamp,
-              AUTHOR_J varchar(200),
+              AUTHOR_J varchar(999),
               JOURNAL_J varchar(80),
               TITLE_J varchar(500),
               DLP_REVISION_NUMBER numeric NOT NULL,
@@ -1278,15 +1278,15 @@
               BLOBSIZE numeric,
               SORT_ID numeric,
               FILETYPE varchar(300),
-              KEYWORDS varchar(200),
+              KEYWORDS varchar(999),
               NOTES varchar(1000),
               LAM_ID numeric(10),
               LAM_NOTES_ATTACHMENT_ID numeric(10),
               DELETED timestamp,
-              DOCUMENTUM_ID varchar(200),
+              DOCUMENTUM_ID varchar(999),
               INCL_REG_SUB numeric,
               ESM_REPORT_ID numeric,
-              KEYWORDS_J varchar(200),
+              KEYWORDS_J varchar(999),
               NOTES_J varchar(1000),
               DLP_REVISION_NUMBER numeric NOT NULL,
               REVISION_DELETE_FLAG numeric,
@@ -1886,7 +1886,7 @@
               MALFUNCTION numeric,
               MALFUNCTION_TYPE numeric,
               REPROCESSED_REUSE numeric,
-              REPROCESSOR_NAME_ADDRESS varchar(200),
+              REPROCESSOR_NAME_ADDRESS varchar(999),
               UD_TEXT_1 varchar(100),
               UD_TEXT_2 varchar(100),
               UD_TEXT_3 varchar(100),
@@ -2192,10 +2192,10 @@
               SEQ_NUM numeric NOT NULL,
               REF_NO varchar(100),
               REF_TYPE_ID numeric,
-              NOTES varchar(200),
+              NOTES varchar(999),
               REF_CASE_ID numeric,
               SORT_ID numeric,
-              NOTES_J varchar(200),
+              NOTES_J varchar(999),
               DELETED timestamp,
               DLP_REVISION_NUMBER numeric NOT NULL,
               REVISION_DELETE_FLAG numeric,
@@ -2631,7 +2631,7 @@
           "CREATE TABLE rm_cfg_dsr_template_variables (
               ENTERPRISE_ID numeric NOT NULL,
               ID numeric NOT NULL,
-              VARIABLE_NAME varchar(200),
+              VARIABLE_NAME varchar(999),
               SQL_QUERY varchar(4000),
               REPORT_RELATED numeric(1),
               DELETED timestamp,
@@ -2765,7 +2765,7 @@
               FOOTER varchar(80),
               CREATION_DATE numeric,
               LS_GROUPINGS varchar(300),
-              DESCRIPTION varchar(200),
+              DESCRIPTION varchar(999),
               LAST_MODIFIED_TIME timestamp,
               XT_ROW3 numeric(10),
               XT_COLUMN3 numeric(10),
@@ -2939,8 +2939,8 @@
               PLACE_HOLDER varchar(40),
               SQL_QUERY varchar(4000),
               DELETED timestamp,
-              ORDERBY_CLAUSE1 varchar(200),
-              ORDERBY_CLAUSE2 varchar(200),
+              ORDERBY_CLAUSE1 varchar(999),
+              ORDERBY_CLAUSE2 varchar(999),
               SQL_QUERY_J varchar(4000),
               PRIMARY KEY (ENTERPRISE_ID,PLACE_ID)
           )" }
@@ -3053,7 +3053,7 @@
               SHOW numeric,
               LETTER_SCHED varchar(30),
               ACTION_SCHED numeric,
-              LETTER_PATH varchar(200),
+              LETTER_PATH varchar(999),
               BLOBSIZE numeric,
               REG_RPT_COVER numeric,
               DELETED timestamp,
@@ -3256,8 +3256,8 @@
     { "rm_cl_jpn_drug_code_type"
           "CREATE TABLE rm_cl_jpn_drug_code_type (
               DRUG_CODE_ID numeric NOT NULL,
-              DRUG_CODE varchar(200),
-              DRUG_CODE_J varchar(200),
+              DRUG_CODE varchar(999),
+              DRUG_CODE_J varchar(999),
               DELETED timestamp,
               PRIMARY KEY (DRUG_CODE_ID)
           )" }
@@ -3344,7 +3344,7 @@
     { "rm_cl_usage_of_device"
           "CREATE TABLE rm_cl_usage_of_device (
               ID numeric NOT NULL,
-              USAGE_OF_DEVICE varchar(200),
+              USAGE_OF_DEVICE varchar(999),
               DELETED timestamp,
               PRIMARY KEY (ID)
           )" }
@@ -3444,7 +3444,7 @@
               TRACKING_NUM varchar(30),
               EVENT varchar(250),
               BODY_SYS varchar(250),
-              STATUS_TEXT varchar(200),
+              STATUS_TEXT varchar(999),
               GENERATION_ERROR varchar(1000),
               SUBMIT_NOTES varchar(1000),
               NON_SUBMIT_REASON varchar(1000),
@@ -3453,10 +3453,10 @@
               COMMENT_TYPE_ID numeric(10),
               REF_TYPE_ID numeric,
               SOURCE_REPORT_ID numeric,
-              DOCUMENTUM_ID varchar(200),
+              DOCUMENTUM_ID varchar(999),
               MARK_AS_SUBMITTED numeric(1),
               NOTIFICATION numeric,
-              DOCUMENTUM_ID_PUBLISH varchar(200),
+              DOCUMENTUM_ID_PUBLISH varchar(999),
               PROD_SEQ_NUM numeric,
               SCHEDULED_BY_ID numeric,
               REPORT_FORM_TYPE numeric,
@@ -3649,7 +3649,7 @@
           "CREATE TABLE rm_lm_attachment_type (
               ENTERPRISE_ID numeric NOT NULL,
               ATTACHMENT_ID numeric NOT NULL,
-              ATTACHMENT_DESC varchar(200),
+              ATTACHMENT_DESC varchar(999),
               DISPLAY numeric(1),
               PROTECTED numeric(1),
               DELETED timestamp,
@@ -4259,7 +4259,7 @@
               HOLIDAY_ID numeric NOT NULL,
               HOLIDAY_NAME varchar(100),
               HOLIDAY_DATE timestamp,
-              DESCRIPTION varchar(200),
+              DESCRIPTION varchar(999),
               PROTECTED numeric(1),
               DELETED timestamp,
               PRIMARY KEY (ENTERPRISE_ID,HOLIDAY_ID)
@@ -4542,10 +4542,10 @@
           "CREATE TABLE rm_lm_lic_category (
               ENTERPRISE_ID numeric NOT NULL,
               CATEGORY_ID numeric NOT NULL,
-              CATEGORY_J varchar(200),
+              CATEGORY_J varchar(999),
               E2B_CODE numeric,
               DISPLAY numeric,
-              CATEGORY varchar(200),
+              CATEGORY varchar(999),
               PROTECTED numeric,
               DELETED timestamp,
               PRIMARY KEY (ENTERPRISE_ID,CATEGORY_ID)
@@ -4615,12 +4615,12 @@
               ENTERPRISE_ID numeric NOT NULL,
               LITERATURE_ID numeric NOT NULL,
               JOURNAL varchar(80),
-              AUTHOR varchar(200),
+              AUTHOR varchar(999),
               TITLE varchar(250),
               VOL varchar(15),
               YEAR varchar(4),
               PGS varchar(30),
-              AUTHOR_J varchar(200),
+              AUTHOR_J varchar(999),
               JOURNAL_J varchar(80),
               TITLE_J varchar(250),
               DELETED timestamp,
@@ -4680,7 +4680,7 @@
           "CREATE TABLE rm_lm_medical_device_info (
               ENTERPRISE_ID numeric NOT NULL,
               MEDICAL_DEVICE_INFO_ID numeric NOT NULL,
-              MEDICAL_DEVICE_INFO varchar(200),
+              MEDICAL_DEVICE_INFO varchar(999),
               PROTECTED numeric(1) NOT NULL,
               DISPLAY numeric(1) NOT NULL,
               DELETED timestamp,
@@ -5108,7 +5108,7 @@
           "CREATE TABLE rm_lm_report_forms (
               ENTERPRISE_ID numeric NOT NULL,
               REPORT_FORM_ID numeric NOT NULL,
-              FORM_DESC varchar(200) NOT NULL,
+              FORM_DESC varchar(999) NOT NULL,
               AGENCY_ID numeric,
               RPT_TYPE numeric,
               HIDDEN numeric,
@@ -5153,10 +5153,10 @@
               RPT_CATEGORY_ID numeric NOT NULL,
               RPT_CATEGORY varchar(3),
               REPORT_FORM_ID numeric,
-              DESCRIPTION_J varchar(200),
+              DESCRIPTION_J varchar(999),
               E2B_CODE numeric,
               DISPLAY numeric,
-              DESCRIPTION varchar(200),
+              DESCRIPTION varchar(999),
               PROTECTED numeric,
               CATEGORY_FILTER numeric,
               DELETED timestamp,


Hint that pressing space at a leaf node replays the event.

--- src/mash_commander/set/set_mode.cljs
+++ src/mash_commander/set/set_mode.cljs
@@ -118,6 +118,10 @@
       (and (not (empty? (:letters line)))
            (= "Backspace" key))
       :mashing
+      ;; Space at a leaf node replays the node
+      (and (contains? word-trie "")
+           (= " " key))
+      :mashing
       ;; Other keys disabled
       :else :disabled)))


update misaki.compiler.default.core/compile* to use  function

--- src/misaki/compiler/default/core.clj
+++ src/misaki/compiler/default/core.clj
@@ -233,7 +233,7 @@
   [#^String output-filename template-sexp]
   {:pre [(string? output-filename) (sequential? template-sexp)]}
   (let [compile-fn (-> template-sexp meta :format get-compile-fn)]
-    (write-file (str (:public-dir *config*) output-filename)
+    (write-file (path (:public-dir *config*) output-filename)
                 (compile-fn template-sexp))
     true))


CLJ-2063 - report explain errors in order from longest to shortest path

Signed-off-by: Stuart Halloway <4dc50fc3bc007be011b5445f3f79298b9eeb51b7@cognitect.com>

--- src/main/clojure/clojure/spec/alpha.clj
+++ src/main/clojure/clojure/spec/alpha.clj
@@ -214,9 +214,9 @@
   "Default printer for explain-data. nil indicates a successful validation."
   [ed]
   (if ed
-    (do
+    (let [problems (sort-by #(- (count (:path %))) (::problems ed))]
       ;;(prn {:ed ed})
-      (doseq [{:keys [path pred val reason via in] :as prob}  (::problems ed)]
+      (doseq [{:keys [path pred val reason via in] :as prob} problems]
         (when-not (empty? in)
           (print "In:" (pr-str in) ""))
         (print "val: ")


CLJ-2085 - Add the top level spec and value to explain-data

Signed-off-by: Stuart Halloway <4dc50fc3bc007be011b5445f3f79298b9eeb51b7@cognitect.com>

--- src/main/clojure/clojure/spec/alpha.clj
+++ src/main/clojure/clojure/spec/alpha.clj
@@ -197,7 +197,9 @@
 (defn explain-data* [spec path via in x]
   (let [probs (explain* (specize spec) path via in x)]
     (when-not (empty? probs)
-      {::problems probs})))
+      {::problems probs
+       ::spec spec
+       ::value x})))

 (defn explain-data
   "Given a spec and a value x which ought to conform, returns nil if x


feat: cmdline disable validation support

--- src/main/clojure/pdok/featured/core.clj
+++ src/main/clojure/pdok/featured/core.clj
@@ -93,6 +93,7 @@
    [nil "--no-projectors"]
    [nil "--no-timeline"]
    [nil "--no-state" "Use only with no nesting and action :new"]
+   [nil "--disable-validation"]
    [nil "--projection PROJ" "RD / ETRS89 / SOURCE"]
    ["-r" "--replay [N/root-collection]" "Replay last N events or all events from root-collection tree from persistence to projectors"]
    [nil "--clear-timeline-changelog" "Clear timeline changelog for dataset"]


Support insert-all! in CLJS

Support insert-all! in CLJS

--- src/main/clojurescript/clara/rules.cljs
+++ src/main/clojurescript/clara/rules.cljs
@@ -190,6 +190,14 @@
   [& facts]
   (eng/insert-facts! facts false))

+(defn insert-all!
+  "Behaves the same as insert!, but accepts a sequence of facts to be inserted. This can be simpler and more efficient for
+   rules needing to insert multiple facts.
+
+   See the doc in insert! for details on insert behavior.."
+  [facts]
+  (eng/insert-facts! facts false))
+
 (defn insert-unconditional!
   "To be executed within a rule's right-hand side, this inserts a new fact or facts into working memory.


Reduced size of parameter maps in unit tests

--- test/compojure/http/request.clj
+++ test/compojure/http/request.clj
@@ -7,7 +7,7 @@
   (:import java.io.ByteArrayInputStream))

 (defn- random-params []
-  (random-map random-keyword #(re-rand #"\w+")))
+  (random-map random-keyword #(re-rand #"\w+") 1 10))

 (defn- naively-encode
   "Encode a map of parameters without urlencoding them first."


Added more session tests

Added more session tests

--- test/compojure/http/session.clj
+++ test/compojure/http/session.clj
@@ -53,17 +53,38 @@
 (defmethod session-cookie ::mock [new? session]
   "mock-session-data")

-(defn- mock-session-response
-  [request response]
+(defn- mock-session-response [response]
   (let [handler (-> (constantly response) (with-session ::mock))]
-    (handler request)))
+    (handler {})))

 (deftest new-session-cookie
-  (let [response (mock-session-response {} {})]
+  (let [response (mock-session-response {})]
     (is (= (get-in response [:headers "Set-Cookie"])
            "compojure-session=mock-session-data; path=/"))))

 (deftest response-session-cookie
-  (let [response (mock-session-response {} {:session {}})]
+  (let [response (mock-session-response {:session {}})]
     (is (= (get-in response [:headers "Set-Cookie"])
            "compojure-session=mock-session-data; path=/"))))
+
+(declare mock-store)
+
+(derive ::mock-update ::mock)
+
+(defmethod write-session ::mock-update [session]
+  (set! mock-store session))
+
+(defn- mock-session-update [request response]
+  (let [handler (-> (constantly response) (with-session ::mock-update))]
+    (handler {})))
+
+(deftest session-write-new
+  (binding [mock-store nil]
+    (mock-session-update {} {:session {:foo "bar"}})
+    (is (= mock-store {:foo "bar"}))))
+
+(deftest session-write-update
+  (binding [mock-store nil]
+    (mock-session-update {:session {:foo "bar"}}
+                         {:session {:foo "baz"}})
+    (is (= mock-store {:foo "baz"}))))


Add test for blob/with-algorithm.

Add test for blob/with-algorithm.

--- test/vault/blob/digest_test.clj
+++ test/vault/blob/digest_test.clj
@@ -12,6 +12,12 @@

 (def blob-id-str
   "sha256:97df3588b5a3f24babc3851b372f0ba71a9dcdded43b14b9d06961bfc1707d9d")
+
+
+(deftest blob-digest-algorithm
+  (is (not (nil? blob/*digest-algorithm*)))
+  (blob/with-algorithm :sha1
+    (is (= :sha1 blob/*digest-algorithm*))))

 (deftest hash-id-comparison