(PE-5498) Include activity service in console-services

--- configs/pe-console-services/pe-console-services.clj
+++ configs/pe-console-services/pe-console-services.clj
@@ -5,8 +5,8 @@
                  [puppetlabs/classifier-ui "{{{pe-classifier-ui-version}}}"]
                  [puppetlabs/pe-rbac-service "{{{pe-rbac-version}}}"]
                  [puppetlabs/rbac-ui "{{{pe-rbac-ui-version}}}"]
-                 ;[puppetlabs/pe-activity-service "{{{pe-classifier-version}}}"]
-                 ;[puppetlabs/pe-trapperkeeper-proxy "{{{pe-trapperkeeper-proxy}}}"]
+                 [puppetlabs/pe-activity-service "{{{pe-activity-service-version}}}"]
+                 ;[puppetlabs/pe-trapperkeeper-proxy "{{{pe-trapperkeeper-proxy-version}}}"]
                  [puppetlabs/trapperkeeper-webserver-jetty9 "0.7.0"]]

   :uberjar-name "console-services-release.jar"


Enable parallel builds.

Enable parallel builds.

--- scripts/figwheel.clj
+++ scripts/figwheel.clj
@@ -13,7 +13,7 @@
      :compiler
      {:main 'uxbox.main
       :asset-path "js"
-      :parallel-build false
+      :parallel-build true
       :optimizations :none
       ;; :closure-defines {"uxbox.repo.core.url"
       ;;                   "https://test.uxbox.io/api"}


Add angle physical quantity

Add angle physical quantity

--- src/test_utils/fracture_diagnostics.cljc
+++ src/test_utils/fracture_diagnostics.cljc
@@ -2,7 +2,9 @@
   #?(:cljs (:require [test-utils.core :as tuc])
      :clj (:require (test-utils [core :as tuc]))))

-(def physical-quantities [:density
+(def physical-quantities [:angle
+                          :duration
+                          :density
                           :energy
                           :force
                           :length
@@ -17,7 +19,9 @@
 (defn rand-physical-quantity []
   (rand-nth physical-quantities))

-(def quantity-unit-map {:density                [:lb-per-cu-ft :kg-per-m3]
+(def quantity-unit-map {:angle                  [:deg]
+                        :duration               [:min]
+                        :density                [:lb-per-cu-ft :kg-per-m3]
                         :energy                 [:ft-lb :J]
                         :force                  [:lbf :N]
                         :length                 [:ft :m]
@@ -33,6 +37,8 @@
 (defn rand-unit [physical-quantity]
   (rand-nth (get quantity-unit-map physical-quantity)))

+(def rand-angle-unit :deg)
+(def rand-duration-unit :min)
 (def rand-density-unit (fn []  (rand-unit :density)))
 (def rand-energy-unit (fn [] (rand-unit :energy)))
 (def rand-force-unit (fn [] (rand-unit :force)))
@@ -241,7 +247,7 @@
   (tuc/draw-normal 92.2 2.4))

 (defn typical-azimuth [plot-angle]
-  (tuc/draw-normal plot-angle 1.24))
+  (make-measurement (tuc/draw-normal plot-angle 1.24) :deg))

 (defn make-line-generator [[m b]]
   (fn [t]
@@ -633,7 +639,9 @@
        :hp (power-as (typical-power :W) :hp)))))

 (def quantity-generate-measurement-map
-  {:density                typical-density
+  {:angle                  (fn [& _] (typical-azimuth (rand-nth (range 360))))
+   :duration               (fn [& _] (make-measurement (rand-nth (range 60)) :min))
+   :density                typical-density
    :energy                 typical-total-pump-energy
    :force                  typical-force
    :length                 typical-stage-length
@@ -650,14 +658,16 @@
         measurement (generate-measurement-f unit)]
     [measurement (measurement-as-f measurement (first (remove (partial = unit) units)))]))

-(generate-measurement-pair (set (quantity-unit-map :slurry-rate))
-                           rand-slurry-rate-unit typical-slurry-rate slurry-rate-as)
+(generate-measurement-pair (set (quantity-unit-map :density))
+                           rand-density-unit typical-density density-as)

 (defn rand-measurement
   ([]
    (rand-measurement (rand-physical-quantity)))
   ([physical-quantity]
-   (println physical-quantity)
    ((quantity-generate-measurement-map physical-quantity) (rand-unit physical-quantity))))

-(rand-measurement)
+((quantity-generate-measurement-map :angle))
+((quantity-generate-measurement-map :angle) (rand-unit :angle))
+(rand-measurement :angle)
+(generate-measurement-pair #{:deg} (fn [] :deg) (fn [] (typical-azimuth (rand-nth 360))) identity)


Remove old REPL comments.

Remove old REPL comments.

--- src/oc/email/lib/sparkline.clj
+++ src/oc/email/lib/sparkline.clj
@@ -164,15 +164,4 @@
   (sl/sparkline-html [1.1 2.1 3.2 3.3 5.8 4.7])
   (sl/sparkbar-html [1100 2100 3200 3300 5800] :red)

-  ; Export
-  (def c (sl/sparkchart :line [1.1 2.1 3.2 3.3] :black))
-  (def b (java.io.ByteArrayOutputStream.))
-  (ChartUtilities/writeChartAsPNG b c 80 26)
-  ; Crop
-  (import '[javax.imageio ImageIO])
-  (def ba (.toByteArray b))
-  (def bis (java.io.ByteArrayInputStream. ba))
-  (def bi (ImageIO/read bis)) ; 80x26 buffered image
-  (def cropped (.getSubimage bi 6 6 69 15))
-  (ImageIO/write cropped "png" (java.io.File. "./crop.png"))
 )


The key :moving-board can be empty, get it out of the if-let or it will fail the whole update.

--- src/oc/storage/api/entries.clj
+++ src/oc/storage/api/entries.clj
@@ -153,12 +153,11 @@
   (timbre/info "Updating entry for:" entry-for)
   (if-let* [org (:existing-org ctx)
             board (:existing-board ctx)
-            old-board (:moving-board ctx)
             user (:user ctx)
             entry (:existing-entry ctx)
             updated-entry (:updated-entry ctx)
             updated-result (entry-res/update-entry! conn (:uuid updated-entry) updated-entry user)]
-    (do
+    (let [old-board (:moving-board ctx)]
       ;; If we are moving the entry from a draft board, check if we need to remove the board itself.
       (when old-board
         (let [remaining-entries (entry-res/list-all-entries-by-board conn (:uuid old-board))]


Refactor function for style string parsing

--- src/day8/re_frame/trace/app_state.cljs
+++ src/day8/re_frame/trace/app_state.cljs
@@ -6,7 +6,8 @@
             [cljs.pprint :refer [pprint]]))

 (defn string->css [css-string]
-  (->> (map #(str/split % #":") (str/split (get css-string "style") #";"))
+  (->> (str/split (get css-string "style") #";")
+       (map #(str/split % #":"))
        (reduce (fn [acc [property value]]
                  (assoc acc (keyword property) value)) {})))


- removed calculator from component Server. - reduced on level of nested keys.

--- src/de/otto/tesla/stateful/serving.clj
+++ src/de/otto/tesla/stateful/serving.clj
@@ -7,11 +7,11 @@
 ;; The serving component is the frontend of the system.
 ;; It accepts requests and returns the data to be used by consuming systems.
 ;; For the moment a simple, blocking implementation with an embedded jetty is chosen.
-(defrecord Server [config calculator]
+(defrecord Server [config]
   component/Lifecycle
   (start [self]
     (log/info "-> starting server")
-    (let [port (Integer. (get-in self [:config :config :server-port]))
+    (let [port (Integer. (get-in config [:config :server-port]))
           all-routes (rts/routes (:routes self))
           server (jetty/run-jetty all-routes {:port port :join? false})]
       (.setGracefulShutdown server 100)


Drop restart-pred-fn and use :lifecycle/handle-exception

--- src/onyx_jepsen/simple_job.clj
+++ src/onyx_jepsen/simple_job.clj
@@ -1,6 +1,12 @@
 (ns onyx-jepsen.simple-job
   (:require [taoensso.timbre :refer [info error debug fatal]]))

+;; TODO, tighten up to test whether onyx-bookkeeper handles all its exceptions properly
+(defn handle-exception [event lifecycle lf-kw exception]
+  :restart)
+
+(def restart-calls
+  {:lifecycle/handle-exception handle-exception})

 (defn add-read-ledgers [job batch-size zk-addr ledgers-root-path password ledger-ids]
   (let [read-ledger-task-names (mapv (fn [id]
@@ -29,7 +35,6 @@
                          :bookkeeper/deserializer-fn :onyx.compression.nippy/zookeeper-decompress
                          :bookkeeper/password-bytes password
                          :bookkeeper/no-recovery? true
-                         :onyx/restart-pred-fn :onyx-peers.functions.functions/restartable?
                          :onyx/max-peers 1
                          :onyx/batch-size batch-size
                          :onyx/doc "Reads a sequence from a BookKeeper ledger"})
@@ -37,10 +42,12 @@
                       ledger-ids))
         (update :lifecycles
                 into
-                (mapv (fn [task]
-                        {:lifecycle/task task
-                         :lifecycle/calls :onyx.plugin.bookkeeper/read-ledgers-calls})
-                      read-ledger-task-names)))))
+                (mapcat (fn [task]
+                          [{:lifecycle/task task
+                            :lifecycle/calls ::restart-calls}
+                           {:lifecycle/task task
+                            :lifecycle/calls :onyx.plugin.bookkeeper/read-ledgers-calls}])
+                        read-ledger-task-names)))))

 (defn build-job [job-num {:keys [batch-size] :as params} zk-addr ledgers-root-path ledger-ids]
   (let [password (.getBytes "INSECUREDEFAULTPASSWORD")
@@ -48,7 +55,6 @@
                         :onyx/plugin :onyx.plugin.bookkeeper/write-ledger
                         :onyx/type :output
                         :onyx/medium :bookkeeper
-                        :onyx/restart-pred-fn :onyx-peers.functions.functions/restartable?
                         :bookkeeper/serializer-fn :onyx.compression.nippy/zookeeper-compress
                         :bookkeeper/password-bytes password
                         :bookkeeper/ensemble-size 3
@@ -61,10 +67,13 @@
                         :onyx/fn :onyx-peers.functions.functions/add-job-num
                         :jepsen/job-num job-num
                         :onyx/params [:jepsen/job-num]
-                        :onyx/restart-pred-fn :onyx-peers.functions.functions/restartable?
                         :onyx/type :function
                         :onyx/batch-size batch-size}]
              :lifecycles [{:lifecycle/task :persist
+                           :lifecycle/calls ::restart-calls}
+                          {:lifecycle/task :identity-log
+                           :lifecycle/calls ::restart-calls}
+                          {:lifecycle/task :persist
                            :lifecycle/calls :onyx.plugin.bookkeeper/write-ledger-calls}]
              :workflow [[:identity-log :persist]]
              :task-scheduler :onyx.task-scheduler/balanced}]


ring.util.request docs typo?

ring.util.request docs typo?

--- ring-core/src/ring/util/request.clj
+++ ring-core/src/ring/util/request.clj
@@ -1,5 +1,5 @@
 (ns ring.util.request
-  "Devive information from a request map.")
+  "Derive information from a request map.")

 (defn request-url
   "Return the full URL of the request."


Added base.

Added base.

--- src/overtunes/songs/at_all.clj
+++ src/overtunes/songs/at_all.clj
@@ -28,11 +28,14 @@
 (def II (triad ionian 1))
 (def V (triad ionian 4))

-(def progression [I {} II {} II V I V])
+(defn lower [note] (- note 12))

-(defn rythm-n-bass# [timing chords]
+(def progression [I I II II II V I V])
+
+(defn rythm-n-bass# [timing [chord & chords]]
   (do
-    (at (timing 0) (chord# (first chords)))
-    (rythm-n-bass# (from timing 4) (rest chords))))
+    (at (timing 0) (note# (lower (:i chord))))
+    (at (timing 2) (chord# chord))
+    (rythm-n-bass# (from timing 4) chords)))

 (rythm-n-bass# (bpm 130) (cycle progression))


Story ID: GEM-225 Summary: - added support for changing log level

--- src/untangled/client/logging.cljs
+++ src/untangled/client/logging.cljs
@@ -1,9 +1,22 @@
 (ns untangled.client.logging
   (:require cljs.pprint
             [om.next :refer [*logger*]]
-            [goog.log :as glog]))
+            [goog.log :as glog]
+            [goog.debug.Logger.Level :as level]))

 ; TODO: A function to set logging level
+
+(defn set-level [log-level]
+  "Takes a keyword (:all, :debug, :info, :warn, :error, :none) and changes the log level accordingly.
+  Note that the log levels are listed from least restrictive level to most restrictive."
+  (.setLevel *logger*
+    (case log-level
+      :all (level/getPredefinedLevel "ALL")
+      :debug (level/getPredefinedLevel "DEBUG")
+      :info (level/getPredefinedLevel "INFO")
+      :warn (level/getPredefinedLevel "WARN")
+      :error (level/getPredefinedLevel "ERROR")
+      :none (level/getPredefinedLevel "NONE"))))

 (defn value-message
   "Include a pretty-printed cljs value as a string with the given text message."


Made real benchmark runner default.

Made real benchmark runner default.

--- src/validation_benchmark/core.clj
+++ src/validation_benchmark/core.clj
@@ -133,18 +133,18 @@
                    (read-string (slurp results-path))
                    chart-path)
     (let [benchmarks (prepare-benchmarks alternatives inputs)
-          quick? true
+          quick? false
           bench-fn (let [b (if quick?
                              criterium/quick-benchmark*
                              criterium/benchmark*)
                          opts nil]
                      #(stdout->file bench-out-path
                                     (summarize (b % opts))))
-          bench-fn (fn [f]
-                     (let [start (System/nanoTime)]
-                       (f)
-                       {:mean (- (System/nanoTime) start)
-                        :standard-deviation 0.0}))
+;;           bench-fn (fn [f]
+;;                      (let [start (System/nanoTime)]
+;;                        (f)
+;;                        {:mean (- (System/nanoTime) start)
+;;                         :standard-deviation 0.0}))
           results (run-benchmarks benchmarks bench-fn)]
       (save-results results results-path)
       (final-summary groups results chart-path))))


refactor: for -> map

refactor: for -> map


Add more examples

Add more examples

--- src/clojure/clojure_walkthrough/cjia/ch08_xx.clj
+++ src/clojure/clojure_walkthrough/cjia/ch08_xx.clj
@@ -441,3 +441,101 @@
 (shelly :greet "Nancy") ;; "Hello there, Nancy"

 ;; Referring to this (TBC)
+
+(declare ^:dynamic this)
+
+(defn new-object [klass]
+  (let [state (ref {})]
+    (fn thiz [command & args]
+      (case command
+        :class klass
+        :class-name (klass :name)
+        :set! (let [[k v] args]
+                (dosync (alter state assoc k v))
+                nil)
+        :get (let [[key] args] (@state key))
+        (let [method (klass :method command)]
+          (if-not method
+            (throw (RuntimeException.
+                    (str "Unable to respond to " command))))
+          (binding [this thiz]
+            (apply method args)))))))
+
+(defclass Person
+  (method age [] (* 2 10))
+  (method about [diff]
+          (str "I was born about " (+ diff (this :age)) " years ago")))
+
+(def shelly (Person :new))
+
+(shelly :about 2) ; "I was born about 22 years ago"
+
+;; Class inheritance
+(defclass Woman
+  (extends Person)
+  (method greet [v] (str "Hello, " v))
+  (method age [] (* 2 9)))
+
+(defn parent-class-spec [sexprs]
+  (let [extends-spec (filter #(= 'extends (first %)) sexprs)
+        extends (first extends-spec)]
+    (if (empty? extends)
+      'OBJECT
+      (last extends))))
+
+(parent-class-spec '((extends Person)
+                     (method age [] (* 2 9)))) ;; Person
+
+(var map) ; #'clojure.core/map
+
+(defmacro defclass [class-name & specs]
+  (let [parent-class (parent-class-spec specs)
+        fns (or (method-specs specs) {})]
+    `(def ~class-name (new-class '~class-name #'~parent-class ~fns))))
+
+(defn new-class [class-name parent methods]
+  (fn klass [command & args]
+    (case command
+      :name (name class-name)
+      :parent parent
+      :new (new-object klass)
+      :method (let [[method-name] args]
+                (find-method method-name methods)))))
+
+(def OBJECT (new-class :OBJECT nil {}))
+
+(defclass Person
+  (method age [] (* 2 10))
+  (method about [diff]
+          (str "I was born about " (+ diff (this :age)) " years ago")))
+
+(defclass Woman
+  (extends Person)
+  (method greet [v] (str "Hello, " v))
+  (method age [] (* 2 9)))
+
+(def donna (Woman :new))
+
+(donna :greet "Shelly") ;; "Hello, Shelly"
+
+(donna :age) ;; 18
+
+;; (donna :about 3) ;; Unable respond to :about ..
+
+(defn find-method [method-name klass]
+  (or ((klass :methods) method-name)
+      (if-not (= #'OBJECT klass)
+        (find-method method-name (klass :parent)))))
+
+(defn new-class [class-name parent methods]
+  (fn klass [command & args]
+    (case command
+      :name (name class-name)
+      :parent parent
+      :new (new-object klass)
+      :methods methods
+      :method (let [[method-name] args]
+                (find-method method-name klass)))))
+
+;; (donna :about 3)
+


Change order of clauses in query to avoid massive waste

--- src/braid/core/server/db/thread.clj
+++ src/braid/core/server/db/thread.clj
@@ -66,9 +66,9 @@
   (d/q '[:find [?user-id ...]
          :in $ ?thread-id
          :where
-         [?user :user/id ?user-id]
+         [?thread :thread/id ?thread-id]
          [?user :user/open-thread ?thread]
-         [?thread :thread/id ?thread-id]]
+         [?user :user/id ?user-id]]
        (db/db)
        thread-id))


Fix a bug in ensure keys

Fix a bug in ensure keys

--- src/circle/backend/action/nodes.clj
+++ src/circle/backend/action/nodes.clj
@@ -16,9 +16,10 @@
 (defn ensure-keypair
   "If the node does not contain keypair-name, upload the keys to EC2. Node must already have private keys"
   [node]
+  {:pre [(-> node :public-key)]}
   (if (not (:keypair-name node))
-    (let [keypair-name (str "keypair-" (-> keys :public-key (sha1)))]
-      (ec2/import-keypair keypair-name (:public-key keys))
+    (let [keypair-name (str "keypair-" (-> node :public-key (sha1)))]
+      (ec2/import-keypair keypair-name (:public-key node))
       (merge {:keypair-name keypair-name} node))
     node))


Allow server start up again.

Allow server start up again.

--- src/circle/backend/build/config.clj
+++ src/circle/backend/build/config.clj
@@ -187,7 +187,7 @@
         actions (load-actions job)
         url (-> project :vcs_url)
         repo (git/default-repo-path url)
-        vcs_revision (or vcs_revision (git/latest-local-commit repo))]
+        vcs-revision (or vcs-revision (git/latest-local-commit repo))]
     (assert job-name)
     (->>
      {:notify_emails notify


Update intro.clj

Update intro.clj

fix link to 4clojure and https-ize those that work

--- src/clj/clojuredocs/pages/intro.clj
+++ src/clj/clojuredocs/pages/intro.clj
@@ -165,10 +165,10 @@
        "New to Clojure and not sure where to start? Here are a few good resources to get you off on the right foot:"]
       [:ul.getting-started-resources
        [:li [:a {:href "https://changelog.com/posts/rich-hickeys-greatest-hits/"} "Rich Hickey's Greatest Hits (videos)"]]
-       [:li [:a {:href "http://www.braveclojure.com"} "Clojure for the Brave and True"]]
-       [:li [:a {:href "http://aphyr.com/posts/301-clojure-from-the-ground-up-welcome"}
+       [:li [:a {:href "https://www.braveclojure.com"} "Clojure for the Brave and True"]]
+       [:li [:a {:href "https://aphyr.com/posts/301-clojure-from-the-ground-up-welcome"}
              "Clojure from the Ground Up"]]
-       [:li [:a {:href "http://4clojure.org"} "4Clojure (learn Clojure interactively)"]]
+       [:li [:a {:href "https://4clojure.oxal.org/"} "4Clojure (learn Clojure interactively)"]]
        [:li [:a {:href "http://clojurescriptkoans.com/"} "ClojureScript Koans"]]
        [:li [:a {:href "https://repl.it/languages/clojure"} "Run Clojure code live in your browser"]]]
       [:p "There's no denying that Clojure is just so "


swap! is good enough here

swap! is good enough here

--- src/cljs/asciinema_player/core.cljs
+++ src/cljs/asciinema_player/core.cljs
@@ -186,7 +186,7 @@

 (defn process-event [state dispatch [event-name & args]]
   (if-let [handler (get event-handlers event-name)]
-    (reset! state (handler @state dispatch args))
+    (swap! state handler dispatch args)
     (print (str "unhandled event: " event-name))))

 (defn create-player-with-state [state dom-node]


WIP: Cant add users

WIP: Cant add users

--- src/cljs/browser_rotation/core.cljs
+++ src/cljs/browser_rotation/core.cljs
@@ -10,9 +10,66 @@
 ;; -------------------------
 ;; Views

+(defn k [pair]
+  (-> pair keys first))
+
+(defn value [pair]
+  (-> pair vals first))
+
+(defn browser-links [n]
+  (->> [{:chrome "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcSx_ewOJFxPKntWJvSsEqSs1bOrbgV6OEzdG-D2lxIU1tJXIjGcRAjbvfdA" }
+        {:firefox "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcRl842DwO1aFB0s2RjP2NOIatW34mTWmXpZeL8bfcvHR82cAz-yGGSuxh1c" }
+        {:safari "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcShE2MlWD_XfWH8DnMlckF_e9Y4OougOzzDiL_9OMP_pGjtMfYAp4TJlOzg" }
+        {:ie "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcSX1WBUmFYhJDHSA6qxeoFCN8h2zl3SLOcrXOdBmVc5Jaz3GcsAq4qeArHi" }
+        {:opera "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcSc3W-bMSPcREOssHYIso-Wh8KGQylj4FAOUG_zGNIjrik04NdvRSUxlF4G" }]
+    cycle
+    (drop n)
+    (take 5)
+    vec))
+
+(defn browser-cycle [user i]
+  ^{:key user}
+  [:tr
+   [:td user]
+   (for [link (browser-links i)]
+     [:td
+      ^{:key (k link)}
+      [:img {:id i :src (value link) :width 100 :height 100 }]])])
+
+(defn add-user [users text]
+  (swap! users conj text))
+
+(defn atom-input [users]
+   [:input {:type "text"
+            :placeholder "Developer name"
+            :on-key-down #(case (.-which %)
+                           13 (add-user users (-> % .-target .-value))) }])
+
+(defn browser-rotation [users]
+  (let [days ["Monday" "Tuesday" "Wednesday" "Thursday" "Friday"]]
+       [users (atom ["Kristoffer"
+                     "Lennart"
+                     "Dennis"
+                     "Victoria"
+                     "Martin"
+                     "Mikael"
+                     "Kalle"])]
+    [:div
+    [atom-input @users]
+    [:table
+     [:tr
+      [:th]
+      (for [day days]
+        ^{:key day} [:th day])
+        (map-indexed
+          (fn [i user]
+            [browser-cycle user i]) users)]]]))
+
 (defn home-page []
   [:div [:h2 "Welcome to browser-rotation"]
-   [:div [:a {:href "#/about"} "go to about page"]]])
+   [:div [:a {:href "#/about"} "go to about page"]]
+   [:h3 "Browser schedule"]
+   [:div [browser-rotation]]])

 (defn about-page []
   [:div [:h2 "About browser-rotation"]


Added [Credit] to list of replacement symbols to simplify auto-pump functionality.

--- src/cljs/netrunner/cardbrowser.cljs
+++ src/cljs/netrunner/cardbrowser.cljs
@@ -23,6 +23,7 @@
 (defn add-symbols [card-text]
   (-> card-text
       (make-span "\\[Credits\\]" "credit")
+      (make-span "\\[Credit\\]" "credit")
       (make-span "\\[Click\\]" "click")
       (make-span "\\[Subroutine\\]" "subroutine")
       (make-span "\\[Recurring Credits\\]" "recurring-credit")


add devcard for timeline

add devcard for timeline

--- src/cljs/searchbot/devcards/mg.cljs
+++ src/cljs/searchbot/devcards/mg.cljs
@@ -5,6 +5,8 @@
             [om-tools.core :refer-macros [defcomponent]]
             [sablono.core :as html :refer-macros [html]]
             [searchbot.chart.metricgraphics :as mg]
+            [searchbot.charts :as charts]
+            [searchbot.widgets :as widgets]
             ))

 (defcard bar1
@@ -13,3 +15,34 @@
   [{:val 10 :key "A"}
    {:val 200 :key "B"}]
   {:inspect-data true})
+
+
+
+(defcard timeline
+  (dc/om-root widgets/widgets)
+  {:widgets
+   [
+    [
+    {:type "es-chart" :cursor "agg"
+     :id "time_line"
+     :agg-key "TIMEAGG" :agg-top "traffic_over_time"
+     :agg-view ["key" "key" "doc_count"]
+     :draw-fn "draw-line"
+     :chart {:bounds {:x "10%" :y "5%" :width "80%" :height "70%"}
+             :plot "line"
+             :x-axis  "key"
+             :x-order "key"
+             :y-axis  "value"
+             :c-axis  "type"}}
+     ]
+    ]
+
+   :agg {:div {:width "90%" :height 400}
+         :TIMEAGG
+         {:aggregations
+          {:traffic_over_time
+;;            {"buckets" [{ "doc_count" 1 "key" "2016-08-15T05:00:00.000Z"}]}
+           {:buckets [{ :doc_count 1 :key "2016-08-15T05:00:00.000Z"}]}
+           }}}
+   }
+  )


Update types.clj

Update types.clj

This was slightly confusing...the field is supposed to be nullable if the `stuct-field` function is to be believed.

--- src/clojure/sparkling/sql/types.clj
+++ src/clojure/sparkling/sql/types.clj
@@ -61,7 +61,7 @@
   (DataTypes/createStructField name type nullable?))

 (defn struct-type
-  "Creates a struct type, expect each item in fields to be a map with the keys :name :type and :optional?
+  "Creates a struct type, expect each item in fields to be a map with the keys :name :type and :nullable?
   where name is a string, type is a DataType and optional is a boolean"
   [fields]
   (DataTypes/createStructType (into-array (map struct-field fields))))


inspecting data in communicator

inspecting data in communicator


gui: file handling project tree

gui: file handling project tree

* use add node function

--- src/gui/handler.clj
+++ src/gui/handler.clj
@@ -143,39 +143,45 @@

 (defn handler-open-file
   [_]
-  (let [file (choose-file
-               :filters [["MPA (*.mpf)"
-                          ["mpf"]
-                          ["Folders" #(.isDirectory %)]]]
-               :success-fn (fn [fc file] (.getAbsolutePath file)))]
-    (if (file-is-open? file)
-      nil
-      (add-node (list tree-of-projects) (file2node (tools/path-conformer file))))))
+  (std-catch
+	  (let [file (choose-file
+	               :filters [["MPA (*.mpf)"
+	                          ["mpf"]
+	                          ["Folders" #(.isDirectory %)]]]
+	               :success-fn (fn [fc file] (.getAbsolutePath file)))]
+	    (if (file-is-open? file)
+	      nil
+	      (add-node (list tree-of-projects) (file2node (tools/path-conformer file)))))
+  (catch Exception e nil)))

 (defn handler-create-new-project
   [_]
-  (let [f (choose-file
-            :type :save
-            :filters [["MPA/LWB (*.mpf)"
-                       ["mpf"]
-                       ["Folders" #(.isDirectory %)]]])
-        dir (tools/path-conformer(.getParent f))
-        name (.getName f)
-        file (if (and
-                   (= (last (str/split name #"\.")) "mpf")
-                   (< 1 (count (str/split name #"\."))))
-               name
-               (str name ".mpf"))
-        new-node (Node.
-                   (str/replace file #"\.mpf" "")
-                   ""
-                   (str dir "/" file)
-                   nil)]
-    (if (file-is-open? (str dir "/" file))
-      nil
-      (do
-        (add-node (list tree-of-projects) new-node)
-        (save-project new-node)))))
+  (std-catch
+	  (let [f (choose-file
+	            :type :save
+	            :filters [["MPA/LWB (*.mpf)"
+	                       ["mpf"]
+	                       ["Folders" #(.isDirectory %)]]])
+	        dir (tools/path-conformer(.getParent f))
+	        name (.getName f)
+	        file (if (and
+	                (= (last (str/split name #"\.")) "mpf")
+	                (< 1 (count (str/split name #"\."))))
+	            name
+	            (str name ".mpf"))
+	        new-node (Node.
+	                   (str/replace file #"\.mpf" "")
+	                   ""
+	                   (str dir "/" file)
+	                   nil)]
+	    (if (file-is-open? (str dir "/" file))
+	      nil
+        (if (std-catch (slurp (str dir "/" file)) (catch Exception e nil))
+          (alert "This file already exists.")
+          (do
+            (add-node (list tree-of-projects) new-node)
+            (save-project new-node)))))
+   (catch Exception e nil)))

 (defn handler-add-new-proposition
   [_]


More gurps stuff.

More gurps stuff.

--- src/main/clj/clojure_club/gurps/mbastian.clj
+++ src/main/clj/clojure_club/gurps/mbastian.clj
@@ -1,10 +1,83 @@
 (ns clojure-club.gurps.mbastian
   (:require [clojure.java.io :as io]
-            [clojure.data.xml :as xml]))
+            [clojure.data.xml :as xml]
+            [clojure.string :as cs]
+            [clojure.string :as s]
+            [clojure.edn :as edn]))

 (def x (->> "clojure_club/gurps/basic_set.adq" io/resource slurp xml/parse-str))

-(loop [[{:keys [tag attrs content] :as f} :as l] [x] res #{} depth 0]
-  (if (and f (< depth 5000))
-    (recur (into (pop l) content) (conj res tag) (inc depth))
-    res))
+(defn numeric-attr [{:keys [tag content]}]
+  {tag (some-> content first)})
+
+(defn string-attr [{:keys [tag content]}]
+  {tag (some-> content first cs/trim)})
+
+(defmulti parse-adq :tag)
+
+(defmethod parse-adq :advantage_list [{:keys [content]}]
+  (map parse-adq content))
+
+(defmethod parse-adq :advantage [{:keys [content]}]
+  {:advantage (apply merge (map parse-adq content))})
+
+(defmethod parse-adq :base_points [m] (numeric-attr m))
+(defmethod parse-adq :points_per_level [m] (numeric-attr m))
+(defmethod parse-adq :levels [m] (numeric-attr m))
+(defmethod parse-adq :amount [m] (numeric-attr m))
+(defmethod parse-adq :cr [m] (numeric-attr m))
+(defmethod parse-adq :percentage [m] (numeric-attr m))
+;(defmethod parse-adq :modifier [m] (numeric-attr m))
+
+(defmethod parse-adq :name [m] (string-attr m))
+(defmethod parse-adq :reference [m] (string-attr m))
+(defmethod parse-adq :notes [m] (string-attr m))
+(defmethod parse-adq :affects [m] (string-attr m))
+(defmethod parse-adq :damage [m] (string-attr m))
+(defmethod parse-adq :usage [m] (string-attr m))
+(defmethod parse-adq :attribute [m] (string-attr m))
+
+(defmethod parse-adq :type [{:keys [content]}]
+  {:type (set (map cs/trim (cs/split (first content) #",")))})
+
+(defmethod parse-adq :specialization [{:keys [tag content attrs]}]
+  ;how do these attrs work?
+  {:specialization (first content)})
+
+(defmethod parse-adq :categories [{:keys [content]}]
+  {:categories (set (map parse-adq content))})
+
+(defmethod parse-adq :category [{:keys [content]}]
+  (first content))
+
+(defmethod parse-adq :prereq_list [{:keys [content attrs]}]
+  {:prerequisites
+   (set (map parse-adq content))})
+
+(defmethod parse-adq :modifier [{:keys [content attrs]}]
+  {:modifier (apply merge (map parse-adq content))})
+
+(defmethod parse-adq :dr_bonus [{:keys [content attrs]}]
+  {:dr_bonus (map parse-adq content)})
+
+(defmethod parse-adq :cost_reduction [{:keys [content attrs]}]
+  {:cost_reduction (map parse-adq content)})
+
+(defmethod parse-adq :melee_weapon [{:keys [tag content]}]
+  {tag (map parse-adq content)})
+
+(defmethod parse-adq :cost [{:keys [content attrs]}]
+  {:cost [(some-> content first edn/read-string) (keyword (:type attrs))]})
+
+(defmethod parse-adq :skill_bonus [{:keys [content]}]
+  {:skill-bonus (map parse-adq content)})
+
+(defmethod parse-adq :attribute_bonus [{:keys [content]}]
+  {:attribute_bonus (map parse-adq content)})
+
+(defmethod parse-adq :default [{:keys [tag content]}]
+  (if (= :default tag)
+    {:default (map parse-adq content)}
+    (prn tag)))
+
+(parse-adq x)


Block forever

Block forever

--- src/icecap/core.clj
+++ src/icecap/core.clj
@@ -27,4 +27,6 @@
 (defn -main
   "Run the (development) server."
   [& args]
-  (run))
+  (run)
+  ;; block forever:
+  @(future))


A little REST stub

A little REST stub

--- src/icecap/rest.clj
+++ src/icecap/rest.clj
@@ -1,19 +1,47 @@
 (ns icecap.rest
   "The REST API for icecap."
-  (:require [compojure.core :refer [defroutes context GET POST DELETE]]
+  (:require [clojure.core.async :refer [<!!]]
+            [compojure.core :refer [defroutes context GET POST DELETE]]
             [icecap.codec :refer [safebase64-decode]]
+            [icecap.crypto :as crypto]
+            [icecap.store.api :refer [create! retrieve delete!]]
+            [taoensso.nippy :as nippy]
+            [prone.debug :refer [debug]]
             [prone.middleware :refer [wrap-exceptions]]
             [ring.middleware.defaults :refer [wrap-defaults api-defaults secure-api-defaults]]
             [ring.middleware.format :refer [wrap-restful-format]]
             [ring.middleware.reload :refer [wrap-reload]]))

+(defn create-cap
+  [cap & {store :store kdf :kdf scheme :scheme}]
+  (let [cap (crypto/make-cap)
+        {index :index key :key} (crypto/hardcoded-derive kdf cap)
+        encoded-plan (nippy/freeze)
+        encrypted-plan (crypto/encrypt scheme key encoded-plan)
+        ]))
+
+(defn get-cap
+  [cap & {store :store kdf :kdf scheme :scheme}]
+  (let [{index :index key :key} (crypto/hardcoded-derive kdf cap)
+        blob (<!! (retrieve store index))
+        encoded-plan (crypto/decrypt scheme key blob)
+        plan (nippy/thaw encoded-plan)
+        sub-results nil] ;; (execute plan)
+    ;; FIXME: maybe it would be better to write this with ->>?
+    (into [] sub-results)))
+
+(defn delete-cap
+  [cap & {store :store}]
+  (delete! store cap))
+
 (defroutes routes
   (context "/v0/caps" []
-           (POST "/" [] "POST")
-           (context "/:enc-cap-id" [enc-cap-id]
-                    (let [cap-id (safebase64-decode enc-cap-id)]
-                      (GET "/" [] "GET")
-                      (DELETE "/" [] "DELETE")))))
+           (POST "/" request (debug))
+           (context "/:encoded-cap" [encoded-cap :as {store :store kdf :kdf scheme :scheme}]
+                    (GET "/" [] (<!! (get-cap (safebase64-decode encoded-cap)
+                                              :store store :kdf kdf :scheme scheme)))
+                    (DELETE "/" [] (<!! (delete-cap (safebase64-decode encoded-cap)
+                                                    :store store))))))

 (defn ^:private wrap-components
   "Adds some components to each request map."


Non-greedy match on segment

Non-greedy match on segment

--- src/clj/cglossa/search/cwb/speech.clj
+++ src/clj/cglossa/search/cwb/speech.clj
@@ -93,7 +93,7 @@
               ;; keys if they do in fact have media files, so line-key might be nil.
               line-key          (second (re-find #"<who_line_key\s+(\d+)>" result*))
               segments          (->> result*
-                                     (re-seq #"<sync_end.+?>(.+)</sync_end")
+                                     (re-seq #"<sync_end.+?>(.+?)</sync_end")
                                      (map second)
                                      ;; Remove line key attribute tags, since they would only
                                      ;; confuse the client code


Removed hardcoded rain resolution

Removed hardcoded rain resolution

--- src/clj/forma/hadoop/jobs/scatter.clj
+++ src/clj/forma/hadoop/jobs/scatter.clj
@@ -197,7 +197,7 @@
                  (?- (hfs-seqfile rain-path)
                      (mk-filter vcf-path
                                 (new-adjusted-precl-tap
-                                 ts-pail-path "1000" "32" t-res))))
+                                 ts-pail-path s-res "32" t-res))))

               reli-step
               ([:tmp-dirs reli-path]


add info to pending badge

add info to pending badge

--- src/cljs/salava/badge/ui/pending.cljs
+++ src/cljs/salava/badge/ui/pending.cljs
@@ -8,6 +8,7 @@
             [salava.badge.ui.modal :as bm]
             [salava.core.time :refer [date-from-unix-time]]
             [reagent.session :as session]
+            [salava.core.ui.popover :refer [info]]
             #_[salava.metabadge.ui.metabadge :as mb]))

@@ -78,7 +79,7 @@
   (fn []
     [:div.col-md-12
      [:div.dropdown
-       [:a.dropdown-toggle {:data-toggle "dropdown" :type "button" } (case @(cursor state [:visibility])
+       [info "Set your badge visibility" "left"][:a.dropdown-toggle {:data-toggle "dropdown" :type "button" } (case @(cursor state [:visibility])
                                                                        "public" [:i.fa.fa-globe]
                                                                        "private" [:i.fa.fa-lock]
                                                                        "internal" [:i.fa.fa-group]


Give newly added card an ID to allow them to pop up in a modal. Very naive assignment.

--- src/cljs/y_om/components/columns.cljs
+++ src/cljs/y_om/components/columns.cljs
@@ -18,10 +18,14 @@
 (defn submit-card [owner data state ref]
   (let [element (om/get-node owner ref)
         text (. element -value)]
-    (if-not (string/blank? text)
-      (do (om/transact! data :cards #(conj % {:task text}))
-          (set! (.-value element) "")
-          (utils/toggle-component-state owner state)))))
+    (when (not (string/blank? text))
+      (let [next-id (->> (:cards @data)
+                  last
+                  :id)]
+        (println next-id)
+        (om/transact! data :cards #(conj % {:task text :id next-id}))
+        (set! (.-value element) "")
+        (utils/toggle-component-state owner state)))))

 (defn rename-column [owner data state ref]
   (let [element (om/get-node owner ref)


Fix missing import

Fix missing import

--- src/dato/lib/core.clj
+++ src/dato/lib/core.clj
@@ -1,4 +1,5 @@
-(ns dato.lib.core)
+(ns dato.lib.core
+  (:import [java.util Date]))

 (defn -main []
-  (println "Loading Dato separately at " (Date.)))
+  (println "Loading Dato separately at" (Date.)))


Add traverse fn

Add traverse fn

--- src/deepfns/core.cljc
+++ src/deepfns/core.cljc
@@ -268,3 +268,61 @@
        (fn? fs) (apply fs mcoll)
        :else
        (map (constantly fs) mcoll)))))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; traverse
+
+(declare traverse)
+
+(defn- eval-entries
+  ([seed fs m]
+   (not-empty
+     (reduce (fn [acc f]
+               (f acc m))
+       seed fs))))
+
+(defn- apply-entries
+  ([seed fs]
+   (fn [m & ms]
+     (if (not-empty ms)
+       (map (partial eval-entries seed fs) (cons m ms))
+       (eval-entries seed fs m)))))
+
+(defn- lst-traverse
+  ([f]
+   (fn [result m]
+     (if-let [v (f m)]
+       (conj result v)
+       result))))
+
+(defn- assc-traverse
+  ([k f]
+   (fn [result m]
+     (if-some [v (f m)]
+       (assoc result k v)
+       result))))
+
+(defn traverse
+  "Takes an applicative and uses that to traverse a datastructure, accumulating
+  the results into the applicative as it goes."
+  ([f]
+   (cond
+     (map? f) (apply-entries {}
+                  (map (fn [[k v]]
+                         (assc-traverse k (traverse v)))
+                    f))
+     (seq? f) (apply-entries '()
+                    (map (comp lst-traverse traverse) f))
+     (vector? f) (apply-entries []
+                      (map (comp lst-traverse traverse) f))
+     (set? f) (apply-entries #{}
+                   (map (comp lst-traverse traverse) f))
+     (fn? f) f
+     (keyword? f) f
+     :else
+     (constantly f))))
+
+(def <=>
+  "An alias for traverse"
+  traverse)


re-align paragraph

re-align paragraph

--- src/pc/views/blog/blue_ocean_made_of_ink.clj
+++ src/pc/views/blog/blue_ocean_made_of_ink.clj
@@ -21,7 +21,7 @@
      [:p [:a {:href "http://www.teslamotors.com/blog/all-our-patent-are-belong-you"} "Elon Musk"]
          " said that about Telsa last year.
          Prototyping stands on similar shores.
-         For every single designer or developer using an app to prototype their product, there are hundreds using pen and paper."]]
+         For every single designer or developer using an app to prototype their product, there are hundreds more using paper."]]

     [:article
      [:h3 "Can we compete with paper?"]


Updated tests for time-utils module

Updated tests for time-utils module

--- test/emender_jenkins/time_utils_test.clj
+++ test/emender_jenkins/time_utils_test.clj
@@ -24,16 +24,16 @@
     (clojure.test/function? function-name))

-(deftest test-minutes-to-seconds-existence
-    "Check that the emender-jenkins.time-utils/minutes-to-seconds definition exists."
-    (testing "if the emender-jenkins.time-utils/minutes-to-seconds definition exists."
-        (is (callable? 'emender-jenkins.time-utils/minutes-to-seconds))))
+(deftest test-minutes->seconds-existence
+    "Check that the emender-jenkins.time-utils/minutes->seconds definition exists."
+    (testing "if the emender-jenkins.time-utils/minutes->seconds definition exists."
+        (is (callable? 'emender-jenkins.time-utils/minutes->seconds))))

-(deftest test-seconds-to-ms-existence
-    "Check that the emender-jenkins.time-utils/seconds-to-ms definition exists."
-    (testing "if the emender-jenkins.time-utils/seconds-to-ms definition exists."
-        (is (callable? 'emender-jenkins.time-utils/seconds-to-ms))))
+(deftest test-seconds->ms-existence
+    "Check that the emender-jenkins.time-utils/seconds->ms definition exists."
+    (testing "if the emender-jenkins.time-utils/seconds->ms definition exists."
+        (is (callable? 'emender-jenkins.time-utils/seconds->ms))))

 (deftest test-compute-sleep-amount-existence
@@ -52,22 +52,22 @@
 ; Function behaviours
 ;

-(deftest test-minutes-to-seconds
-    "Check the function emender-jenkins.time-utils/minutes-to-seconds."
-    (testing "the function emender-jenkins.time-utils/minutes-to-seconds."
+(deftest test-minutes->seconds
+    "Check the function emender-jenkins.time-utils/minutes->seconds."
+    (testing "the function emender-jenkins.time-utils/minutes->seconds."
         (are [x y] (= x y)
-               0 (minutes-to-seconds 0)
-              60 (minutes-to-seconds 1)
-             120 (minutes-to-seconds 2)
-            3600 (minutes-to-seconds 60))))
+               0 (minutes->seconds 0)
+              60 (minutes->seconds 1)
+             120 (minutes->seconds 2)
+            3600 (minutes->seconds 60))))

-(deftest test-seconds-to-ms
-    "Check the function emender-jenkins.time-utils/seconds-to-ms."
-    (testing "the function emender-jenkins.time-utils/seconds-to-ms."
+(deftest test-seconds->ms
+    "Check the function emender-jenkins.time-utils/seconds->ms."
+    (testing "the function emender-jenkins.time-utils/seconds->ms."
         (are [x y] (= x y)
-               0 (seconds-to-ms 0)
-            1000 (seconds-to-ms 1)
-            2000 (seconds-to-ms 2))))
+               0 (seconds->ms 0)
+            1000 (seconds->ms 1)
+            2000 (seconds->ms 2))))

 (deftest test-compute-sleep-amount
     "Check the function emender-jenkins.time-utils/compute-sleep-amount."


Remove unnecessary str call

Remove unnecessary str call

--- src/puppetlabs/ezbake/core.clj
+++ src/puppetlabs/ezbake/core.clj
@@ -290,7 +290,7 @@
   [project build-target]
     (if (= build-target "pe")
       (str "pe-" (name project))
-      (str (name project))))
+      (name project)))

 (defn generate-terminus-map
   [dependencies build-target]


(PDB-5138) engine: add a few hopefully helpful comments

--- src/puppetlabs/puppetdb/query_eng/engine.clj
+++ src/puppetlabs/puppetdb/query_eng/engine.clj
@@ -1389,6 +1389,9 @@
   (->> projections
        (filter (comp :queryable? val))
        keys
+       ;; Maybe this could/should be set rather than sort.  Could make
+       ;; some of the other code/logic simpler, unless it really does
+       ;; need to be sorted...
        sort))

 (defn projectable-fields
@@ -1645,7 +1648,11 @@
   (let [[column & path] (map formatter/maybe-strip-escaped-quotes
                              (su/dotted-query->path field))]
     (if (some #(re-matches #"^\d+$" %) path)
+      ;; This path is taken for match() operators that match indexes,
+      ;; i.e.  facts.foo.match("\d+") because by this point they'll be
+      ;; plain integer path components.
       {:node (assoc node :value ["?" "?"] :field column :array-in-path true)
+       ;; https://www.postgresql.org/docs/11/arrays.html#ARRAYS-INPUT
        :state (reduce conj state [(doto (PGobject.)
                                     (.setType "text[]")
                                     (.setValue (str "{" (string/join "," (map #(string/replace % "'" "''") path)) "}")))


Get more verbose

Get more verbose

--- src/korhal/core.clj
+++ src/korhal/core.clj
@@ -50,10 +50,13 @@

 (defn korhal-gameUpdate [this]

+  (println 'updating')
+
   ;; spawn a drone
   (for [unit (.getMyUnits (:api @this))]
     (when (= (.getTypeID unit) (.getID jnibwapi.types.UnitType$UnitTypes/Zerg_Larva))
       (when (and (>= (.. (:api @this) getSelf getMinerals) 50) (not (:morphed-drone this)))
+        (println 'morphing a drone')
         (.morph (:api @this) (.getID unit) (.getID jnibwapi.types.UnitType$UnitTypes/Zerg_Drone))
         (swap-keys (.state this) :morphed-drone true))))

@@ -61,6 +64,7 @@
   (for [unit (.getMyUnits (:api @this))]
     (when (= (.getTypeID unit) (.getID jnibwapi.types.UnitType$UnitTypes/Zerg_Drone))
       (when (and (.isIdle unit) (not (= (.getID unit) (:pool-drone @this))))
+        (println 'collecting minerals')
         (let [mineral? (fn [unit] (= (.getTypeID unit) (.getID jnibwapi.types.UnitType$UnitTypes/Resource_Mineral_Field)))
               mineral (first (filter mineral? (.getNeutralUnits (:api @this))))]
         (.rightClick (.getID unit) (.getID mineral)))))))


Simplify reverb by making add tolerate input-less synths.

--- src/klangmeister/sound/synthesis.cljs
+++ src/klangmeister/sound/synthesis.cljs
@@ -89,11 +89,14 @@
   "Add together synths by connecting them all to the same gain."
   [& synths]
   (fn [context at duration]
-    (let [{downstream-input :input downstream-output :output} (-> (gain 1.0) (run-with context at duration))]
+    (let [{upstream-input :input upstream-output :output} (-> (gain 1.0) (run-with context at duration))
+          {downstream-input :input downstream-output :output} (-> (gain 1.0) (run-with context at duration))]
       (doseq [synth synths]
         (let [{:keys [input output]} (-> synth (run-with context at duration))]
-          (-> output (.connect downstream-input))))
-      (section downstream-input downstream-output))))
+          (-> output (.connect downstream-input))
+          (when input
+            (-> upstream-output (.connect input)))))
+      (section upstream-input downstream-output))))

 ; Noise
@@ -202,13 +205,7 @@
     (convolver logarithmic-decay)))

 (defn reverb
-  ([] (reverb 0.3))
+  ([]
+   (reverb 0.3))
   ([wetness]
-   (fn [context at duration]
-     (let [{upstream-input :input upstream-output :output} (-> (gain 1.0) (run-with context at duration))
-           {downstream-input :input downstream-output :output} (-> (gain 1.0) (run-with context at duration))
-           {wet-input :input wet-output :output} (-> (connect-> wet (gain wetness)) (run-with context at duration))]
-       (-> upstream-output (.connect wet-input))
-       (-> wet-output (.connect downstream-input))
-       (-> upstream-output (.connect downstream-input))
-       (section upstream-input downstream-output)))))
+   (add (gain 1.0) (connect-> wet (gain wetness)))))


added block resolution

added block resolution

--- src/selmer/template_parser.clj
+++ src/selmer/template_parser.clj
@@ -1,6 +1,7 @@
 (ns selmer.template-parser
   (:require [clojure.java.io :refer [reader]]
-            [selmer.util :refer :all]))
+            [selmer.util :refer :all]
+            [clojure.set :refer [difference]]))

 (declare preprocess-template)

@@ -32,6 +33,22 @@

       templates)))

+(defn find-block [template parent-template block-name]
+  )
+
+(defn fill-blocks [template templates block-map]
+  (println template block-map)
+  (let [blocks (difference (set (get-in templates [template :blocks]))
+                           (set (keys block-map)))
+        block-map (into block-map (map vector blocks (repeat template)))
+        parent (get-in templates [template :extends])]
+    (if parent (recur parent templates block-map) block-map)))
+
+(defn find-root [template templates]
+  (if-let [parent (get-in templates [template :extends])]
+    (recur parent templates)
+    template))
+
 (defn preprocess-template [filename & [templates]]
   (with-open [rdr (reader (str (resource-path) filename))]
     (loop [templates (assoc (or templates {}) filename {})
@@ -44,4 +61,7 @@
           (read-char rdr))
         templates))))

-#_(preprocess-template "templates/inheritance/inherit-c.html")+#_(let [template "templates/inheritance/inherit-c.html"
+        templates (preprocess-template template)]
+    (find-root template templates)
+    (fill-blocks template templates {}))


Don't navigate back after saving profile

Signed-off-by: Andrey Shovkoplyas <b713972e59b8e606e23253c4a13e948139fea4d1@gmail.com>

--- src/status_im/ui/screens/profile/events.cljs
+++ src/status_im/ui/screens/profile/events.cljs
@@ -78,7 +78,6 @@
                               (if photo-path
                                 {:photo-path photo-path}))]
       (handlers/merge-fx cofx
-                         {:dispatch [:navigate-back]}
                          (clear-profile)
                          (accounts-events/account-update cleaned-edit)))))


Corrected path for min build

Corrected path for min build

--- src/leiningen/new/figwheel/project.clj
+++ src/leiningen/new/figwheel/project.clj
@@ -32,7 +32,7 @@
                          :cache-analysis true }}
              {:id "min"
               :source-paths ["src"]
-              :compiler {:output-to "resources/public/{{sanitized}}.min.js"
+              :compiler {:output-to "resources/public/compiled/{{sanitized}}.js"
                          :optimizations :advanced
                          :pretty-print false}}]}


remove hack for CLJS-2385 since that was merged

--- src/main/shadow/build/cljs_hacks.cljc
+++ src/main/shadow/build/cljs_hacks.cljc
@@ -363,17 +363,6 @@
 (defmethod parse '.
   [_ env [_ target field & member+ :as form] _ opts]
   (disallowing-recur (analyze-dot env target field member+ form opts)))
-
-;; thheller: changed tag inference to always use tag on form first
-;; destructured bindings had meta in their :init
-;; https://dev.clojure.org/jira/browse/CLJS-2385
-(defn get-tag [e]
-  (if-some [tag (-> e :form meta :tag)]
-    tag
-    (if-some [tag (-> e :tag)]
-      tag
-      (-> e :info :tag)
-      )))

 ;; cljs.analyzer/parse-type, cleaned up since I couldnt follow it otherwise
 ;; removed one resolve-var call


Параметр шаблона бутстрапа, нужный для отладки тем css


Add failing integration test for get-page-list

--- test/comic_reader/sites/integration_test.clj
+++ test/comic_reader/sites/integration_test.clj
@@ -12,7 +12,7 @@
                      :url "http://mangafox.me/manga/6mm_no_taboo/",
                      :id "6mm_no_taboo"}]
       (is (= (some #{comic-6mm}
-                  comics)
+                   comics)
              comic-6mm))))

   (let [comics (get-comic-list manga-reader)]
@@ -33,3 +33,16 @@
   (let [chapters (get-chapter-list manga-reader "the-gamer")]
     (is (>= (count chapters)
             97))))
+
+(deftest ^:integration get-page-list-test
+  (let [pages (get-page-list manga-fox {:name "The Gamer",
+                                        :url "http://mangafox.me/manga/the_gamer/v01/c001/1.html"
+                                        :id "the_gamer"})]
+    (is (= (count pages)
+           24)))
+
+  (let [pages (get-page-list manga-fox {:name "The Gamer",
+                                        :url "http://www.mangareader.net/the-gamer/1"
+                                        :id "the-gamer"})]
+    (is (= (count pages)
+           23))))


Don't interfere with app's cljs-devtools prefs

Also properly set :initial-hierarchy-depth-budget

--- src/day8/re_frame/trace/app_db.cljs
+++ src/day8/re_frame/trace/app_db.cljs
@@ -1,15 +1,11 @@
 (ns day8.re-frame.trace.app-db
+  (:require-macros [day8.re-frame.trace.macros :refer [with-cljs-devtools-prefs]])
   (:require [reagent.core :as r]
             [clojure.string :as str]
-            [devtools.formatters.core :as cljs-devtools]
+            [devtools.prefs]
+            [devtools.formatters.core]
             [day8.re-frame.trace.localstorage :as localstorage]
             [day8.re-frame.trace.components :as components]))
-
-(devtools.prefs/set-pref! :header-style "")
-
-;; Hide the index spans on the left hand of collections. Shows how many elements in a collection.
-(devtools.prefs/set-pref! :none-style "display: none")
-(devtools.prefs/set-pref! :index-tag [:span :none-style])

 (defn string->css [css-string]
   "This function converts jsonml css-strings to valid css maps for hiccup.
@@ -21,9 +17,27 @@
        (reduce (fn [acc [property value]]
                  (assoc acc (keyword property) value)) {})))

-(def config {:initial-hierarchy-depth-budget false})
+(declare jsonml->hiccup)

-(declare jsonml->hiccup)
+(def default-cljs-devtools-prefs @devtools.prefs/default-config)
+
+(def customized-cljs-devtools-prefs
+  {:header-style ""
+   :none-style   "display: none"
+   :index-tag    [:span :none-style] ;;; Hide the index spans on the left hand of collections. Shows how many elements in a collection.
+   :initial-hierarchy-depth-budget false})
+
+(def effective-cljs-devtools-prefs (merge default-cljs-devtools-prefs customized-cljs-devtools-prefs))
+
+(defn make-devtools-api-call [api-fn & args]
+  (with-cljs-devtools-prefs effective-cljs-devtools-prefs
+    (apply api-fn args)))
+
+(defn cljs-devtools-header [& args]
+  (apply make-devtools-api-call devtools.formatters.core/header-api-call args))
+
+(defn cljs-devtools-body [& args]
+  (apply make-devtools-api-call devtools.formatters.core/body-api-call args))

 (defn data-structure [jsonml]
   (let [expanded? (r/atom false)]
@@ -35,10 +49,10 @@
                :on-click #(swap! expanded? not)}
         [:button.expansion-button (if @expanded? "▼" "▶")]]
        (jsonml->hiccup (if @expanded?
-                         (cljs-devtools/body-api-call
+                         (cljs-devtools-body
                            (.-object (get jsonml 1))
                            (.-config (get jsonml 1)))
-                         (cljs-devtools/header-api-call
+                         (cljs-devtools-header
                            (.-object (get jsonml 1))
                            (.-config (get jsonml 1)))))])))

@@ -81,7 +95,7 @@
           (and @expanded?
                (or (string? data)
                    (number? data))) [:div {:style {:margin "10px 0"}} data]
-          @expanded? (jsonml->hiccup (cljs-devtools/header-api-call data config)))]])))
+          @expanded? (jsonml->hiccup (cljs-devtools-header data)))]])))

 (defn render-state [data]
   (let [subtree-input (r/atom "")


eastwood

eastwood

--- src/open_company/resources/company.clj
+++ src/open_company/resources/company.clj
@@ -1,6 +1,5 @@
 (ns open-company.resources.company
-  (:require [clojure.string :as string]
-            [clojure.set :as cset]
+  (:require [clojure.set :as cset]
             [medley.core :as med]
             [schema.core :as s]
             [defun :refer (defun defun-)]


improve logging

improve logging

--- src/babel/forest.clj
+++ src/babel/forest.clj
@@ -64,7 +64,8 @@
 there is only one child for each parent, and that single child is the
 head of its parent. generate (above) 'decorates' each returned lightning bolt
 of this function with complements."
-  (log/debug (str "lighting-bolt@" depth ": grammar:" (string/join ", " (map :rule grammar))))
+  (log/debug (str "lighting-bolt@" depth ": " (strip-refs spec)))
+  (log/trace (str "lighting-bolt@" depth ": grammar:" (string/join ", " (map :rule grammar))))
   (let [maxdepth 3 ;; maximum depth of a lightning bolt: H1 -> H2 -> H3 where H3 must be a lexeme, not a phrase.
         index (if (future? index) @index index)
         lexicon (if (future? lexicon) @lexicon lexicon)
@@ -75,11 +76,11 @@
                                                        (unifyc spec rule))
                                                      (if parent (get-head-phrases-of parent index)
                                                          grammar))))
-        debug (log/debug (str "grammar size: " (.size grammar)))
-        debug (log/debug (str "candidate-parents size: " (if (nil? candidate-parents)
+        debug (log/trace (str "grammar size: " (.size grammar)))
+        debug (log/trace (str "candidate-parents size: " (if (nil? candidate-parents)
                                                            "no candidate-parents"
                                                            (.size candidate-parents))))
-        debug (log/debug (str "candidate-parents: " (if (nil? candidate-parents)
+        debug (log/trace (str "candidate-parents: " (if (nil? candidate-parents)
                                                       "no candidate-parents"
                                                       (string/join "," (map #(get-in % [:rule])
                                                                             candidate-parents)))))
@@ -130,7 +131,7 @@
             complement-candidate-lexemes (if cached cached (flatten (vals lexicon)))]
         (let [semantics (get-in spec [:synsem :sem])]
           (if (not (nil? semantics))
-            (if (not (nil? semantics)) (log/debug (str "  with semantics:" semantics)))))
+            (if (not (nil? semantics)) (log/debug (str "  with semantics:" (strip-refs semantics))))))
         (log/trace (str " immediate parent:" (get-in immediate-parent [:rule])))
         (if (map? complement-candidate-lexemes)
           (log/error (str "complement-candidate-lexemes is unexpectedly a map with keys:"


whitespace

whitespace

--- src/cljs/server.cljs
+++ src/cljs/server.cljs
@@ -2,7 +2,6 @@
   (:require-macros [cljs.core.async.macros :as m :refer [go alt!]])
   (:require [cljs.nodejs :as nodejs]
             [cljs.core.async :refer [chan close! timeout put! map<]]))
-

 (enable-console-print!)


Controller reporters

Controller reporters

--- src/keechma/controller_manager.cljs
+++ src/keechma/controller_manager.cljs
@@ -43,7 +43,7 @@
                        (assoc :name name)
                        (assoc :running (fn [] (get-in @app-db [:internal :running-controllers name]))))
         with-started (keechma.controller/start controller params app-db-snapshot)]
-    (reporter :app :out :controller :start nil :info)
+    (reporter :app :out :controller [(:name controller) :start] params :info)
     (reset! app-db with-started)
     (keechma.controller/handler controller app-db in-chan out-chan)
     (assoc-in @app-db [:internal :running-controllers name] controller)))
@@ -51,13 +51,13 @@
 (defn ^:private stop-controller [reporter app-db-snapshot controller config]
   (let [name (:name config)
         with-stopped (keechma.controller/stop controller (:params controller) app-db-snapshot)]
-    (reporter :app :out :controller :stop nil :info)
+    (reporter :app :out :controller [(:name controller) :stop] nil :info)
     (close! (:in-chan controller))
     (assoc-in with-stopped [:internal :running-controllers]
               (dissoc (get-in with-stopped [:internal :running-controllers]) name))))

 (defn ^:private restart-controller [reporter app-db-snapshot controller running-controller config]
-  (reporter :app :out :controller :restart nil :info)
+  (reporter :app :out :controller [(:name running-controller) :restart] nil :info)
   (let [stop (partial stop-controller reporter)
         start (partial start-controller reporter)]
     (-> app-db-snapshot


Use print-str to realise lazy sequences.

--- src/kolmogorov_music/kolmogorov.clj
+++ src/kolmogorov_music/kolmogorov.clj
@@ -9,24 +9,24 @@
   )

 (defmacro description-length [expr]
-  (-> expr str count))
+  (-> expr print-str count))

 (fact "Kolmogorov description length is how long its string representation is."
-  (description-length (repeat 65 \A)) => 14)
+  (description-length (repeat 65 \A)) => 13)

 (defn value-length [value]
-  (->> value (apply str) count))
+  (-> value print-str count))

 (fact "Kolmogorov value length is how long the string representation of what it evaluates to is."
-  (value-length (repeat 65 \A)) => 65)
+  (value-length (repeat 65 \A)) => 131)

 (defmacro randomness [expr]
   `(/ (description-length ~expr) (value-length ~expr)))

 (fact "Kolmogorov randomness is the compression ratio between the description and the value."
-  (randomness (repeat 65 \A)) => 14/65)
+  (randomness (repeat 65 \A)) => 13/131)

 (defmacro random? [expr]


Use protocols/records although I think I may be incurring a performance hit because of it, misc cleanup.

--- src/main/clojure/clj_print/core.clj
+++ src/main/clojure/clj_print/core.clj
@@ -84,17 +84,17 @@
   "Returns a keyword representative of the document source's
    type."
   {:since "1.0"}
-  [src]
-  (cond (try (.. (io/file src) exists) (catch Throwable t)) :file
-        (try (URL. src) (catch Throwable t)) :url
+  [source]
+  (cond (try (.. (io/file source) exists) (catch Throwable t)) :file
+        (try (URL. source) (catch Throwable t)) :url
         :else nil))

 (defn- choose-flavor
   "Attempts to guess the appropriate DocFlavor for the document.
    Returns nil if no suitable DocFlavor is found."
   {:since "1.0"}
-  [src]
-  (condp = (choose-source-key src)
+  [source]
+  (condp = (choose-source-key source)
     :file (:autosense flavors/input-streams)
     :url (:autosense flavors/urls)
     nil))
@@ -158,6 +158,25 @@
 ;;  :attrs #{(Copies. 5) MediaTray/MAIN}
 ;;  :listener listeners/basic}

+(defprotocol ISubmit
+  "Protocl to be used by implementations of a JobSpec that
+   supports submission to a PrintService."
+  (submit [this]))
+
+(defprotocol INotify
+  "Protocol to be used by implementations that inform on
+   the submission of a job."
+  (notify [this]))
+
+(defrecord JobSpec [doc printer job attrs listener]
+  ISubmit
+  (submit [this]
+    (let [{{obj :obj} :doc} this
+          {:keys [^DocPrintJob job attrs]} this]
+      (.. job (print @obj (make-set attrs :request)))))
+  INotify
+  (notify [this] (println (str "Job:n" (with-out-str (pprint this) "submitted.")))))
+
 (defn job
   "Returns a job-spec map that is the result of
    assoc'ing required values to it. The values are:
@@ -177,18 +196,19 @@
   {:since "0.0.1"}
   [job-spec]
   (if (:doc job-spec)
-    (let [{:keys [doc ^PrintService printer attrs ^PrintJobtListener listener]
+    (let [{{doc-attrs :attrs} :doc} job-spec
+          {:keys [doc ^PrintService printer attrs ^PrintJobtListener listener]
            :or {printer (printer :default)
                 attrs #{MediaTray/MAIN}
                 listener listeners/basic}} job-spec]
-      (if (and (valid-attrs (:attrs (:job job-spec)) :doc)
+      (if (and (valid-attrs doc-attrs :doc)
                (valid-attrs attrs :job))
-        {:doc (assoc doc :obj (make-doc doc))
-         :printer printer
-         :attrs attrs
-         :listener listener
-         :job (doto (.. printer createPrintJob)
-                (.addPrintJobListener listener))}))))
+        (map->JobSpec {:doc (assoc doc :obj (make-doc doc))
+                       :printer printer
+                       :attrs attrs
+                       :listener listener
+                       :job (doto (.. printer createPrintJob)
+                              (.addPrintJobListener listener))})))))

 (defn submit
   "Submits the job object in job-spec for printing."


Bugfix

Bugfix


Faster test.

Faster test.

--- test/onyx/coordinator/simulation_tests/coordinator_simulant_tests.clj
+++ test/onyx/coordinator/simulation_tests/coordinator_simulant_tests.clj
@@ -3,7 +3,7 @@
             [clojure.core.async :refer [chan <!! >!! tap]]
             [com.stuartsierra.component :as component]
             [simulant.sim :as sim]
-            [simulant.util :refer [tx-ent e hours->msec getx]]
+            [simulant.util :refer [tx-ent e hours->msec getx] :as u]
             [datomic.api :as d]
             [onyx.system :as s]
             [onyx.coordinator.extensions :as extensions]
@@ -74,7 +74,7 @@
 (defn generate-peer-executions [test peer peers]
   (let [model (-> test :model/_tests first)
         limit (:test/duration test)]
-    (->> (reductions + (repeatedly (constantly 1)))
+    (->> (range 0 limit 5000)
          (take-while (fn [t] (< t limit)))
          (mapcat #(generate-execution test peer peers %)))))

@@ -119,7 +119,7 @@
 (def coordinator-test
   (sim/create-test sim-conn coordinator-model
                    {:db/id (d/tempid :test)
-                    :test/duration (hours->msec 4)}))
+                    :test/duration (hours->msec 1)}))

 (alter-var-root #'system component/stop)


remove expectations

remove expectations

--- ssclj/jar/test/com/sixsq/slipstream/ssclj/resources/event_schema_test.clj
+++ ssclj/jar/test/com/sixsq/slipstream/ssclj/resources/event_schema_test.clj
@@ -1,7 +1,7 @@
 (ns com.sixsq.slipstream.ssclj.resources.event-schema-test
   (:require
+    [clojure.test :refer [deftest are is]]
     [schema.core :as s]
-    [expectations :refer :all]
     [com.sixsq.slipstream.ssclj.resources.event :refer :all]
     [com.sixsq.slipstream.ssclj.resources.common.crud :as crud]))

@@ -25,17 +25,19 @@
                   :severity    "critical"
                   })

-(expect valid-event (crud/validate valid-event))
-
 (defn valid? [event] (nil? (s/check Event event)))
 (defn invalid? [event] (complement valid?))

-(expect (valid? valid-event))
+(deftest check-event
+  (is (= valid-event (crud/validate valid-event)))
+  (is (valid? valid-event)))

-(expect valid? (from-each [valid-severity ["critical" "high" "medium" "low"]]
-                          (assoc valid-event :severity valid-severity)))
-(expect (invalid? (assoc valid-event :severity "unknown-severity")))
+(deftest check-severity
+  (doseq [valid-severity ["critical" "high" "medium" "low"]]
+    (is (valid? (assoc valid-event :severity valid-severity))))
+  (is (invalid? (assoc valid-event :severity "unknown-severity"))))

-(expect valid? (from-each [valid-type ["state" "alarm"]]
-                          (assoc valid-event :type valid-type)))
-(expect (invalid? (assoc valid-event :type "unknown")))
+(deftest check-type
+  (doseq [valid-type ["state" "alarm"]]
+    (is (valid? (assoc valid-event :type valid-type))))
+  (is (invalid? (assoc valid-event :type "unknown-type"))))


(PDB-3302) Use metrics to tell if gc has happened

--- test/puppetlabs/puppetdb/integration/db_garbage_collection/report_ttl.clj
+++ test/puppetlabs/puppetdb/integration/db_garbage_collection/report_ttl.clj
@@ -1,7 +1,15 @@
 (ns puppetlabs.puppetdb.integration.db-garbage-collection.report-ttl
   (:require [clojure.test :refer :all]
             [puppetlabs.puppetdb.integration.fixtures :as int]
-            [puppetlabs.puppetdb.cheshire :as json]))
+            [puppetlabs.puppetdb.cheshire :as json]
+            [metrics.counters :as counter]
+            [puppetlabs.puppetdb.cli.services :as pdb-services]
+            [metrics.counters :as counters]
+            [puppetlabs.puppetdb.testutils :as tu]))
+
+(defn read-gc-count-metric []
+  ;; metrics are global, so...
+  (counters/value (:report-purges pdb-services/admin-metrics)))

 (deftest ^:integration report-ttl
   (with-open [pg (int/setup-postgres)]
@@ -16,15 +24,22 @@
     (testing "Sleep for one second to make sure we have a ttl to exceed"
       (Thread/sleep 1000))

-    (with-open [pdb (int/run-puppetdb pg {:database {:report-ttl "1s"}})
-                ps (int/run-puppet-server [pdb] {})]
+    (let [initial-gc-count (counters/value (:report-purges pdb-services/admin-metrics))]
+      (with-open [pdb (int/run-puppetdb pg {:database {:report-ttl "1s"}})
+                  ps (int/run-puppet-server [pdb] {})]
+        (let [start-time (System/currentTimeMillis)]
+          (loop []
+            (cond
+              (> (- (System/currentTimeMillis) start-time) tu/default-timeout-ms)
+              (throw (ex-info "Timeout waiting for pdb gc to happen" {}))

-      ;; TODO: this is really fragile, it would be better if there were some way
-      ;; to tell that the GC had finished.  We could maybe scrape the logs if this
-      ;; proves too fragile.
-      (testing "sleep 5 seconds to allow GC to complete"
-        (Thread/sleep 5000))
+              (> (read-gc-count-metric) initial-gc-count)
+              true ;; gc happened

-      (testing "Verify that the report has been deleted"
-        (is (= 0 (count (int/pql-query pdb "reports { certname = 'ttl-agent' }"))))))))
+              :default
+              (do
+                (Thread/sleep 250)
+                (recur)))))

+        (testing "Verify that the report has been deleted"
+          (is (= 0 (count (int/pql-query pdb "reports { certname = 'ttl-agent' }")))))))))


CMR-3304: Added a check.

CMR-3304: Added a check.

--- umm-spec-lib/src/cmr/umm_spec/xml_to_umm_mappings/echo10/data_contact.clj
+++ umm-spec-lib/src/cmr/umm_spec/xml_to_umm_mappings/echo10/data_contact.clj
@@ -153,4 +153,4 @@
                       (parse-additional-center doc data-centers "ProcessingCenter" "PROCESSOR"))]
     (if (seq (remove nil? data-centers))
       data-centers
-      [u/not-provided-data-center])))
+      (when apply-default? [u/not-provided-data-center]))))


Fix request construction, add get parameters in :query-params key

--- src/googlica/core.clj
+++ src/googlica/core.clj
@@ -47,13 +47,7 @@
              (partition 2)
              (filter second)
              (map vec)
-             (into m)))
-    ~'(defn body->get-params
-        [b]
-        (str "?" (str/join "&"
-                           (mapv (fn [[k v]]
-                                   (str k "=" v)) ;;TODO urlencode
-                                 b))))])
+             (into m)))])

 (defn split-required-params
@@ -122,21 +116,20 @@
   (let [query-params (->> parameters
                           (filter (fn [[_ v]] (= (:location v) "query")))
                           (mapv   (fn [[k _]] (name k))))
-        body `(~'?assoc ~'{"key" *api-key*}
-               ~@(mapcat (fn [p] [p (->kebab-case-symbol p)]) query-params))
         method (-> http-method str/lower-case keyword)
-        query-params-str (if (= method :post)
-                           ""
-                           `(~'body->get-params ~body))
-        base-request {:method method
-                      :url `(~'str ~'base-url
-                             ~@(generate-path path parameters)
-                             ~query-params-str)}]
-    (if (= method :post)
-      (assoc base-request
-             :content-type "application/json"
-             :body body)
-      base-request)))
+        body {}] ;; TODO implement body for POSTs
+    {:method method
+     :url `(~'str ~'base-url
+            ~@(generate-path path parameters))
+     :content-type :json
+     :body body
+     ;; Generate code to build the query params map with only the parameters
+     ;; that are not nil (so have been passed in)
+     :query-params `(~'?assoc
+                     ~'{"key" *api-key*}
+                     ~@(mapcat (fn [p]
+                                 [p (->kebab-case-symbol p)])
+                               query-params))}))

 (defn generate-function-from-method


Add more descriptive argument names.

Add more descriptive argument names.

The constructors can be confusing with multiple arguments, now the code is
really verbose, but at least can guess what it does from the function signature.

--- src/guangyin/core.clj
+++ src/guangyin/core.clj
@@ -95,10 +95,8 @@
    (if (string? x)
        (Duration/parse x)
        (Duration/from x)))
-  ([a b]
-   (if (integer? a)
-       (Duration/of a b)
-       (Duration/between a b))))
+  ([start-inclusive end-exclusive]
+   (Duration/between start-inclusive end-exclusive)))

 (defn period
   ([x]
@@ -153,11 +151,17 @@
      string? (OffsetTime/parse x)
      keyword? (offset-time-keywords x)
      :else (OffsetTime/from x)))
-  ([a b]
-   (pred-cond a
-     local-time? (OffsetTime/of a (zone-offset b))
-     instant? (OffsetTime/ofInstant a (zone-id b))
-     :else (OffsetTime/parse a b)))
+  ([time-or-instant-or-text offset-or-zone-or-formatter]
+   (pred-cond time-or-instant-or-text
+     local-time? (OffsetTime/of
+                   time-or-instant-or-text
+                   (zone-offset offset-or-zone-or-formatter))
+     instant? (OffsetTime/ofInstant
+                time-or-instant-or-text
+                (zone-id offset-or-zone-or-formatter))
+     :else (OffsetTime/parse
+             time-or-instant-or-text
+             offset-or-zone-or-formatter)))
   ([hour minute second nano-of-second offset]
    (OffsetTime/of hour minute second nano-of-second offset)))

@@ -172,17 +176,24 @@
      string? (LocalDateTime/parse x)
      keyword? (local-date-time-keywords x)
      :else (LocalDateTime/from x)))
-  ([a b]
-   (cond
-     (and (local-date? a) (local-time? b)) (LocalDateTime/of a b)
-     (instant? a) (LocalDateTime/ofInstant a (zone-id b))
-     :else (LocalDateTime/parse a b)))
+  ([date-or-instant-or-text time-or-zone-or-formatter]
+   (pred-cond date-or-instant-or-text
+     local-date? (LocalDateTime/of
+                   date-or-instant-or-text
+                   time-or-zone-or-formatter)
+     instant? (LocalDateTime/ofInstant
+                date-or-instant-or-text
+                (zone-id time-or-zone-or-formatter))
+     :else (LocalDateTime/parse
+             date-or-instant-or-text
+             time-or-zone-or-formatter)))
   ([year month day-of-month hour minute]
    (LocalDateTime/of year month day-of-month hour minute))
   ([year month day-of-month hour minute second]
    (LocalDateTime/of year month day-of-month hour minute second))
   ([year month day-of-month hour minute second nano-of-second]
-   (LocalDateTime/of year month day-of-month hour minute second nano-of-second)))
+   (LocalDateTime/of year month day-of-month hour minute second
+                     nano-of-second)))

 (defn offset-date-time
   ([]
@@ -195,11 +206,17 @@
      string? (OffsetDateTime/parse x)
      keyword? (offset-date-time-keywords x)
      :else (OffsetDateTime/from x)))
-  ([a b]
-   (pred-cond a
-     local-date-time? (OffsetDateTime/of a (zone-offset b))
-     instant? (OffsetDateTime/ofInstant a (zone-id b))
-     :else (OffsetDateTime/parse a b)))
+  ([date-time-or-instant-or-text offset-or-zone-or-formatter]
+   (pred-cond date-time-or-instant-or-text
+     local-date-time? (OffsetDateTime/of
+                        date-time-or-instant-or-text
+                        (zone-offset offset-or-zone-or-formatter))
+     instant? (OffsetDateTime/ofInstant
+                date-time-or-instant-or-text
+                (zone-id offset-or-zone-or-formatter))
+     :else (OffsetDateTime/parse
+             date-time-or-instant-or-text
+             offset-or-zone-or-formatter)))
   ([date time offset]
    (OffsetDateTime/of date time offset))
   ([year month day-of-month hour minute second nano-of-second offset]
@@ -216,11 +233,17 @@
      zone-id? (ZonedDateTime/now x)
      string? (ZonedDateTime/parse x)
      :else (ZonedDateTime/from x)))
-  ([a b]
-   (pred-cond a
-     local-date-time? (ZonedDateTime/of a (zone-id b))
-     instant? (ZonedDateTime/ofInstant a (zone-id b))
-     :else (ZonedDateTime/parse a b)))
+  ([date-time-or-instant-or-text zone-or-formatter]
+   (pred-cond date-time-or-instant-or-text
+     local-date-time? (ZonedDateTime/of
+                        date-time-or-instant-or-text
+                        (zone-id zone-or-formatter))
+     instant? (ZonedDateTime/ofInstant
+                date-time-or-instant-or-text
+                (zone-id zone-or-formatter))
+     :else (ZonedDateTime/parse
+             date-time-or-instant-or-text
+             zone-or-formatter)))
   ([local-date-time zone preferred-zone]
    (ZonedDateTime/ofLocal local-date-time zone preferred-zone))
   ([year month day-of-month hour minute second nano-of-second zone]
@@ -252,10 +275,10 @@
      zone-id? (YearMonth/now x)
      string? (YearMonth/parse x)
      :else (YearMonth/from x)))
-  ([a b]
-   (if (integer? a)
-       (YearMonth/of a b)
-       (YearMonth/parse a b))))
+  ([year-or-text month-or-formatter]
+   (if (integer? year-or-text)
+       (YearMonth/of year-or-text month-or-formatter)
+       (YearMonth/parse year-or-text month-or-formatter))))

 (defn get-field
   [accessor field]
@@ -281,10 +304,10 @@
      zone-id? (MonthDay/now x)
      string? (MonthDay/parse x)
      :else (MonthDay/from x)))
-  ([a b]
-   (if (integer? a)
-       (MonthDay/of a b)
-       (MonthDay/parse a b))))
+  ([month-or-text day-or-formatter]
+   (if (integer? month-or-text)
+       (MonthDay/of month-or-text day-or-formatter)
+       (MonthDay/parse month-or-text day-or-formatter))))

 (defn day-of-week
   ([]
@@ -301,10 +324,10 @@
    (Clock/systemDefaultZone))
   ([x]
    (Clock/system (zone-id x)))
-  ([a b]
-   (if (instant? a)
-       (Clock/fixed a (zone-id b))
-       (Clock/offset a (duration b)))))
+  ([instant-or-clock zone-or-duration]
+   (if (instant? instant-or-clock)
+       (Clock/fixed instant-or-clock (zone-id zone-or-duration))
+       (Clock/offset instant-or-clock (duration zone-or-duration)))))

 (defn date-time-formatter
   ([x]
@@ -312,58 +335,64 @@
      date-time-formatter? x
      string? (DateTimeFormatter/ofPattern x)
      keyword? (date-time-formatter-keywords x)))
-  ([a b]
-   (if (string? a)
-       (DateTimeFormatter/ofPattern a b)
-       (let [f (format-style-keywords b)]
+  ([pattern-or-type locale-or-style]
+   (if (string? pattern-or-type)
+       (DateTimeFormatter/ofPattern pattern-or-type locale-or-style)
+       (let [f (format-style-keywords locale-or-style)]
          (when (nil? f)
-           (throw (IllegalArgumentException. (str "Invalid format style: " b))))
-         (case a
+           (throw (IllegalArgumentException.
+                    (str "Invalid format style: " locale-or-style))))
+         (case pattern-or-type
            :date (DateTimeFormatter/ofLocalizedDate f)
            :time (DateTimeFormatter/ofLocalizedTime f)
-           :date-time (DateTimeFormatter/ofLocalizedDateTime f)))))
-  ([type s1 s2]
-   (let [datef (format-style-keywords s1)
-         timef (format-style-keywords s2)]
+           :date-time (DateTimeFormatter/ofLocalizedDateTime f)
+           (throw (IllegalArgumentException.
+                    (str "Invalid format type: " pattern-or-type)))))))
+  ([type date-style time-style]
+   (let [datef (format-style-keywords date-style)
+         timef (format-style-keywords time-style)]
      (when-not (= type :date-time)
-       (throw (IllegalArgumentException. (str "Invalid format type: " type)))
+       (throw (IllegalArgumentException.
+                (str "Invalid format type: " type)))
      (when (nil? datef)
-       (throw (IllegalArgumentException. (str "Invalid format style: " s1))))
+       (throw (IllegalArgumentException.
+                (str "Invalid format style: " date-style))))
      (when (nil? timef)
-       (throw (IllegalArgumentException. (str "Invalid format style: " s2))))
-     (DateTimeFormatter/ofLocalizedDateTime datef timef)))))
+       (throw (IllegalArgumentException.
+                (str "Invalid format style: " time-style))))
+     (DateTimeFormatter/ofLocalizedDateTime date-style time-style)))))

 (defn years
-  [x]
-  (Period/ofYears x))
+  [years]
+  (Period/ofYears years))

 (defn months
-  [x]
-  (Period/ofMonths x))
+  [months]
+  (Period/ofMonths months))

 (defn weeks
-  [x]
-  (Period/ofWeeks x))
+  [weeks]
+  (Period/ofWeeks weeks))

 (defn days
-  [x]
-  (Period/ofDays x))
+  [days]
+  (Period/ofDays days))

 (defn hours
-  [x]
-  (Duration/ofHours x))
+  [hours]
+  (Duration/ofHours hours))

 (defn minutes
-  [x]
-  (Duration/ofMinutes x))
+  [minutes]
+  (Duration/ofMinutes minutes))

 (defn seconds
-  [x]
-  (Duration/ofMinutes x))
+  [seconds]
+  (Duration/ofSeconds seconds))

 (defn nanos
-  [x]
-  (Duration/ofNanos x))
+  [nanos]
+  (Duration/ofNanos nanos))

 (defn plus
   ([] 0)


cleans

cleans


make queue-starting work (almost)

make queue-starting work (almost)

--- src/gangway/util.clj
+++ src/gangway/util.clj
@@ -24,12 +24,9 @@
    :genius {:name "queue.genius-in"
             :worker-fn gangway.worker/do-work}})

-(defn start-queue! [system [k q]]
-  (let [n (:name q)
-        worker-fn (:worker-fn q)]
-    (msg/start n)
-    (when worker-fn
-      (msg/listen n (partial worker-fn (:db-conn system))))))
+(defn start-queue! [system {n :name worker :worker}]
+  (msg/start n)
+  (msg/listen n (partial worker system)))

 (defn queue-definitions [qid]
   (let [n (name qid)]
@@ -43,9 +40,9 @@
   (let [qids (get-in system [:flare :queues])
         queues (reduce (fn start-queues!- [c v]
                          (assoc c v (queue-definitions v)))
-                       {} qids)]
-    #_
-    (dorun (map (partial start-queue! system) queues))
+                       {} qids)
+        qs (flatten (for [qsys queues] (vals (second qsys))))]
+    (dorun (map (partial start-queue! system) qs))
     (assoc-in system [:gangway :queues] queues)))

 ;; TODO: handle exceptions


Fix a missing space in error message

Fix a missing space in error message

--- src/tabular/grafter/tabular/common.clj
+++ src/tabular/grafter/tabular/common.clj
@@ -232,7 +232,7 @@
   (fn [destination dataset opts]
     (when-not (dataset? dataset)
       (throw (IllegalArgumentException.
-              (str "Could not write dataset to" destination " as " (class dataset)
+              (str "Could not write dataset to " destination " as " (class dataset)
                    " is not a valid Dataset.  This error usually occurs if you try and generate tabular data from a graft"))))
     (get-format destination opts)))


Test code generated by defview rather than generated JS objects

This allows the tests to be more clear and readable. It also makes
very obvious what defview actually generates depending on its input.

--- src/test/workflo/macros/view_test.cljs
+++ src/test/workflo/macros/view_test.cljs
@@ -3,54 +3,127 @@
             [om.next :as om]
             [workflo.macros.view :refer-macros [defview]]))

-(defview MinimalView)
+(deftest minimal-view-definition
+  (is (= (macroexpand-1
+          '(defview MinimalView))
+         '(do
+            (om.next/defui MinimalView)
+            (def minimal-view
+              (om.next/factory MinimalView {}))))))

-(deftest minimal-view-works
-  (and (is (not (nil? MinimalView)))
-       (is (not (nil? minimal-view)))))
+(deftest view-definition-with-props
+  (is (= (macroexpand-1
+          '(defview View
+             [user [name email]]
+             (key name)))
+         '(do
+            (om.next/defui View
+              static om.next/IQuery
+              (query [this]
+                [:user/name :user/email]))
+            (def view
+              (om.next/factory View
+                {:keyfn (fn [props]
+                          (let [{:keys [user/name
+                                        user/email]} props]
+                            name))}))))))

-(defview MinimalViewWithKey
-  (key (str (:foo props) "-baz")))
+(deftest view-definition-with-computed-props
+  (is (= (macroexpand-1
+          '(defview View
+             [user [name email]]
+             [on-click]
+             (key name)))
+         '(do
+            (om.next/defui View
+              static om.next/IQuery
+              (query [this]
+                [:user/name :user/email]))
+            (def view
+              (om.next/factory View
+                {:keyfn
+                 (fn [props]
+                   (let [{:keys [user/name user/email]} props
+                         {:keys [on-click]} (om/get-computed props)]
+                     name))}))))))

-(deftest minimal-view-with-key-fn-works
-  (let [view (minimal-view-with-key {:foo "bar"})]
-    (is (= (.-key view) "bar-baz"))))
+(deftest view-definition-with-implicit-ident-and-keyfn-via-db-id
+  (is (= (macroexpand-1
+          '(defview View
+             [db [id]]))
+         '(do
+            (om.next/defui View
+              static om.next/IQuery
+              (query [this]
+                [:db/id])
+              static om.next/Ident
+              (ident [this props]
+                (let [{:keys [db/id]} props]
+                  [:db/id id])))
+            (def view
+              (om.next/factory View
+                {:keyfn (fn [props]
+                          (let [{:keys [db/id]} props]
+                            id))}))))))

-(defview ViewWithQuery
-  (query [:foo :bar]))
+(deftest view-definition-with-simple-keyfn-is-correct
+  (is (= (macroexpand-1
+          '(defview View
+             (key :foo)))
+         '(do
+            (om.next/defui View)
+            (def view
+              (om.next/factory View
+                {:keyfn (fn [props] :foo)}))))))

-(deftest view-with-query-works
-  (is (= [:foo :bar] (om/get-query ViewWithQuery))))
+(deftest view-definition-with-overriden-query-and-keyfn
+  (is (= (macroexpand-1
+          '(defview View
+             (query [:custom :query])
+             (key :custom)))
+         '(do
+            (om.next/defui View
+              static om.next/IQuery
+              (query [this]
+                [:custom :query]))
+            (def view
+              (om.next/factory View
+                {:keyfn (fn [props] :custom)}))))))

-(defview ViewWithProps
-  [user [name email]]
-  (ident [:user/by-name name])
-  (get-name name)
-  (get-email email))
+(deftest view-definition-with-overriden-ident
+  (is (= (macroexpand-1
+          '(defview View
+             [db [id] user [name]]
+             (ident [:user/by-name name])))
+         '(do
+            (om.next/defui View
+              static om.next/IQuery
+              (query [this]
+                [:db/id :user/name])
+              static om.next/Ident
+              (ident [this props]
+                (let [{:keys [db/id user/name]} props]
+                  [:user/by-name name])))
+            (def view
+              (om.next/factory View
+                {:keyfn (fn [props]
+                          (let [{:keys [db/id user/name]} props]
+                            id))}))))))

-(comment
-  (deftest view-with-props-works
-    (let [view (view-with-props {:user/name "Jeff"
-                                 :user/email "jeff@jeff.org"})]
-      (println (.-prototype (type view)))
-      (println (.-om$isComponent view))
-      (and (is (= "Jeff" (.get-name view)))
-           (is (= "jeff@jeff.org" (.get-email view))))))
-
-  (deftest foo
-    (cljs.pprint/pprint
-     (macroexpand-1
-      '(defview ViewWithProps
-         [user [name email {friends ...}]
-          foo
-          bar [baz [yeah _]]
-          [foo _]
-          {[ruux _] ...}
-          {[ruux _] User}
-          {[ruux _] 5}]
-         (ident [:user/by-name name])
-         (key name)
-         (validate foo)
-         (query-params {:foo :bar})
-         (get-name name foo bar)
-         (get-email email))))))
+(deftest view-definition-with-raw-function
+  (is (= (macroexpand-1
+          '(defview View
+             [user [name]]
+             (.on-click [this]
+              (js/alert name))))
+         '(do
+            (om.next/defui View
+              static om.next/IQuery
+              (query [this]
+                [:user/name])
+              Object
+              (on-click [this]
+                (let [{:keys [user/name]} (om/props this)]
+                  (js/alert name))))
+            (def view
+              (om.next/factory View {}))))))


fixed the jumping icon

fixed the jumping icon

--- src/turbo_eureka/ios/core.cljs
+++ src/turbo_eureka/ios/core.cljs
@@ -32,6 +32,7 @@
       (let [[val c] (alts! [input closer])]
         (when-not (or (= c closer) (nil? val))
           (try
+            (println val)
             (some-> @webview (.postMessage val))
             (catch :default e
               (.trace js/console e)))
@@ -68,7 +69,8 @@
                                                 :onPanResponderMove (animated-event #js[nil, #js{:dx (.-x (:pan @drag-model)) :dy (.-y (:pan @drag-model))}])
                                                 :onPanResponderRelease #(let [drop-position {:x (-> % .-nativeEvent .-pageX) :y (-> % .-nativeEvent .-pageY)}
                                                                               drop-event {:item (:selected-item @m/model) :at drop-position}]
-                                                                          (a/put! action-channel [:selection-view/drop-item drop-event]))})]
+                                                                          (a/put! action-channel [:selection-view/drop-item drop-event])
+                                                                          (.start (animated-spring (:pan @drag-model) #js {:toValue {:x 0 :y 0}})))})]

     (fn [action-channel]
       (let [dragging? (:dragging? @drag-model)


Use bytes= instead of array-eq

Use bytes= instead of array-eq

--- test/caesium/crypto/sign_test.clj
+++ test/caesium/crypto/sign_test.clj
@@ -15,8 +15,8 @@
 (deftest generate-signing-keys-test
   (let [kp1 (s/generate-signing-keys)
         kp2 (s/generate-signing-keys)]
-    (is (not (u/array-eq (:public kp1) (:public kp2))))
-    (is (not (u/array-eq (:secret kp1) (:secret kp2))))))
+    (is (not (bb/bytes= (:public kp1) (:public kp2))))
+    (is (not (bb/bytes= (:secret kp1) (:secret kp2))))))

 (def sign-resource (comp hex-resource (partial str "vectors/sign/")))
 (def seed (sign-resource "seed"))
@@ -28,11 +28,11 @@

 (deftest pair-from-secret-test
   (let [kp (s/generate-signing-keys seed)]
-    (is (u/array-eq public (:public kp)))
-    (is (u/array-eq secret (:secret kp)))))
+    (is (bb/bytes= public (:public kp)))
+    (is (bb/bytes= secret (:secret kp)))))

 (deftest detached-sign-test
-  (is (u/array-eq signature (s/sign message secret))))
+  (is (bb/bytes= signature (s/sign message secret))))

 (deftest detached-verify-test
   (is (nil? (s/verify signature message public)))
@@ -45,10 +45,10 @@
          (s/verify other-sig message public)))))

 (deftest signed-test
-  (is (u/array-eq signed (s/signed message secret))))
+  (is (bb/bytes= signed (s/signed message secret))))

 (deftest signed-verify-test
-  (is (u/array-eq message (s/verify signed public)))
+  (is (bb/bytes= message (s/verify signed public)))
   (is (thrown-with-msg?
        RuntimeException #"^Signature validation failed$"
        (let [{pk :public sk :secret} (s/generate-signing-keys)


Listener test passes with latest change to ops parsing

--- test/clj/libx/listeners_test.cljc
+++ test/clj/libx/listeners_test.cljc
@@ -63,8 +63,9 @@
       (is (every? (into #{} ent-2)
                   (into #{} (:added ops-2)))))
     (testing "ops-0 :removed"
-      (is (= (:removed (l/ops state-0)) [[123 :attr/a "state-0"]
-                                         [123 :attr/logical-insert [123 :attr/a "state-0"]]])))
+      (is (= (:removed (l/ops state-0)) [])))
+      ;(is (= (:removed (l/ops state-0)) [[123 :attr/a "state-0"]
+      ;                                   [123 :attr/logical-insert [123 :attr/a "state-0"]]])))
     (testing "ops-0 :added"
       (is (= (set (:added (l/ops state-0)))
              (set (conj background-facts [123 :attr/b "state-0"])))))


Handle options preflight request for new invitee endpoint

--- src/rsvp_backend/handlers/invitee.clj
+++ src/rsvp_backend/handlers/invitee.clj
@@ -9,13 +9,16 @@
 (defn new-invitee
   [request]
   (let [query (:query (:params request))
+        request-method (:request-method request)
         keywordized-req-body (clj-walk/keywordize-keys (:body request))
         code (Long/parseLong (:code keywordized-req-body))
         updated-req-body (assoc keywordized-req-body :code code)
         resp (db/create-invitee updated-req-body)]
-    (if (= resp "AWS_ERROR")
-      (res/status (res/response {:status "AWS_ERROR"}) 500)
-      (res/response {:status "SUCCESS" :data {:code code}}))))
+    (if (= request-method :options)
+      (res/response {:status "OPTIONS_SUCCESS"})
+      (if (= resp "AWS_ERROR")
+        (res/status (res/response {:status "AWS_ERROR"}) 500)
+        (res/response {:status "SUCCESS" :data {:code code}})))))

 (defn get-invitee
   [request]


put more info into the manifest of jars we build

--- src/leiningen/jar.clj
+++ src/leiningen/jar.clj
@@ -3,13 +3,17 @@
   (:require [leiningen.compile :as compile]
             [lancet])
   (:use [leiningen.pom :only [pom]]
-        [clojure.contrib.duck-streams :only [spit]]))
+        [clojure.contrib.duck-streams :only [spit]]
+        [clojure.contrib.str-utils :only [str-join]]))

 (defn make-manifest [project]
   (doto (str (:root project) "/Manifest.txt")
-    (spit (if (:main project)
-            (str "Main-Class: " (:main project) "\n")
-            ""))))
+    (spit (str-join "\n"
+                    ["Created-By: Leiningen"
+                     (str "Built-By: " (System/getProperty "user.name"))
+                     (str "Build-Jdk: " (System/getProperty "java.version"))
+                     (when-let [main (:main project)]
+                       (str "Main-Class: " main))]))))

 (defn jar
   "Create a $PROJECT.jar file containing the compiled .class files as well as


No need to skip dev-deps when creating jar.

--- src/leiningen/jar.clj
+++ src/leiningen/jar.clj
@@ -199,7 +199,7 @@
                deps (memoize deps)]
        (when (zero? (compile/compile project))
          (let [jar-path (get-jar-filename project jar-name)
-               deps-fileset (deps project true)]
+               deps-fileset (deps project)]
            (write-jar project jar-path (filespecs project deps-fileset))
            (println "Created" jar-path)
            jar-path))))


Fixed typo in triple

Fixed typo in triple

--- resources/rules/post_identifier_merge/temp/abstraction/gene_or_gene_product_abstraction.clj
+++ resources/rules/post_identifier_merge/temp/abstraction/gene_or_gene_product_abstraction.clj
@@ -11,7 +11,7 @@

          (?/has_indirect_template_restriction owl/someValuesFrom ?/gene)
          (?/has_indirect_template_restriction owl/onProperty obo/pr#has_gene_template) ; PR:has_gene_template
-         (?/gene_product rdfs/subClassOf? /has_indirect_template_restriction))
+         (?/gene_product rdfs/subClassOf ?/has_indirect_template_restriction))

   :options {:magic-prefixes [["franzOption_clauseReorderer" "franz:identity"]]}
   }


Fix prefixexp-fn to work with statements containing binary operators

--- src/luaclj/parser.clj
+++ src/luaclj/parser.clj
@@ -165,7 +165,9 @@
     ))

 (defn prefixexp-fn [& args]
-  (first args))
+  (if (next args)
+    (second args)
+    (first args)))

 (defn varlist-fn [& args]
   (cons :varlist (leave :even args))
@@ -383,7 +385,7 @@
 (defn functiondef-fn [& args]
   (let [fn-args (vec (first (second args)))
         fn-body (second (second args))]
-  `(fn ~fn-args ~fn-body)))
+    `(fn ~fn-args ~fn-body)))

 (defn tableconstructor-fn [& args]
   (println "table:" args)
@@ -421,29 +423,74 @@

 (comment

-
-(luaclj.util/process-return
+(proteus/let-mutable
+    (retval
+      nil
+      some_fn ^:local (clojure.core/fn
+                [arg1 arg2]
+                (set! retval 3 #_(+ retval 4))
+                retval)
+      _
+      (some_fn 3 5)))
+
+
+
+
+  (try (proteus/let-mutable
+    (retval
+      0
+      some_fn (clojure.core/fn
+                [arg1 arg2]
+                (let-mutable []
+                  (set! retval 3 #_(+ retval 4))
+                  retval))
+      _
+      (some_fn 3 5)))
+      (catch Exception ex (clojure.stacktrace/print-stack-trace ex)))
+
+
+(let*
+  [retval (new proteus.Containers$O nil)
+   some_fn (new proteus.Containers$O nil)
+   _ (new proteus.Containers$O
+          (do
+            (do
+              (. retval set 0) nil)
+            (do (. some_fn set
+                   (let* [retval (. retval x) some_fn (. some_fn x)]
+                     (fn* ([arg1 arg2]
+                           (let* []
+                             (set! retval (+ retval 4))
+                             retval)))))
+                nil)
+            ((. some_fn x) 3 5)))])
+(let*
+  [retval (new proteus.Containers$O nil)
+   some_fn (new proteus.Containers$O nil)
+   _ (new proteus.Containers$O
+          (do
+            (do
+              (. retval set 0) nil)
+            (do (. some_fn set
+                   (fn* ([arg1 arg2]
+                         (let* []
+                           (do (. retval set (. clojure.lang.Numbers (add (. retval x) 4))) nil) (. retval x))))) nil) ((. some_fn x) 3 5)))])
   (proteus/let-mutable
-   [test1
-    nil
-    _
-    ^:stat (do
-     ^:stat (set! test1 ^:stat (clojure.core/fn test1 [] ^:stat (return 5)))
-     ^:stat (return (test1)))]))
-(proteus/let-mutable
-  [G__63738 nil]
-  (proteus/let-mutable
-    [test1 nil
-     _ (clojure.core/when-not G__63738
-         (do
-           (clojure.core/when-not G__63738
-             (set! test1
-                   (clojure.core/when-not G__63738
-                     (clojure.core/fn test1 []
-                       (clojure.core/when-not G__63738
-                         (set! G__63738 [5]))))))
-           (clojure.core/when-not G__63738 (set! G__63738 [(test1)]))))])
-  (if G__63738 (clojure.core/first G__63738) nil))
+      (retval
+        nil
+        some_fn
+        nil
+        _
+        (do
+          (set! retval 0)
+          (set!
+              some_fn
+              ^:local (clojure.core/fn
+                [arg1 arg2]
+                (let-mutable []
+                  (set! retval (+ retval 4))
+                  retval)))
+          ^:stat (some_fn 3 5))))

 (try (anonymous-chunk)
       (catch Exception ex (clojure.stacktrace/print-stack-trace ex)))
@@ -451,6 +498,7 @@
   (pprint (lua-parser (slurp "resources/test/function1.lua")))

 (def test-fn (eval (insta/transform transform-map (lua-parser (slurp "resources/test/function.lua")))))
+((eval (insta/transform transform-map (lua-parser (slurp "resources/test/function3.lua")))))
 ((eval (insta/transform transform-map (lua-parser (slurp "resources/test/function2.lua")))))
 (try
   ((eval (insta/transform transform-map (lua-parser (slurp "resources/test/function1.lua")))))
@@ -464,7 +512,9 @@
   (try (pprint (insta/transform transform-map (lua-parser (slurp "resources/test/break.lua"))))
        (catch Exception ex (clojure.stacktrace/print-stack-trace ex)))

-
+  (try (pprint (insta/transform transform-map (lua-parser (slurp "resources/test/function3.lua"))))
+       (catch Exception ex (clojure.stacktrace/print-stack-trace ex)))
+
   (try (pprint (insta/transform transform-map (lua-parser (slurp "resources/test/function2.lua"))))
        (catch Exception ex (clojure.stacktrace/print-stack-trace ex)))
  (pprint (insta/transform transform-map (lua-parser (slurp "resources/test/basic.lua"))))