Host state change input event #27

Host state change input event #27

--- src/flatgui/samples/forms/hellowindow.clj
+++ src/flatgui/samples/forms/hellowindow.clj
@@ -13,7 +13,8 @@
             [flatgui.widgets.window :as window]
             [flatgui.widgets.checkbox :as checkbox]
             [flatgui.widgets.label :as label]
-            [flatgui.widgets.panel :as panel]))
+            [flatgui.widgets.panel :as panel]
+            [flatgui.inputchannels.host :as host]))

 (def nogreeting-text "Not now")

@@ -47,10 +48,19 @@
        :position-matrix (m/translation 1.0 0.75)
        :evolvers {:text greeting-evolver}})))

+(fg/defevolverfn :clip-size
+  (if (host/host-event? component)
+    (let [host-size (host/get-host-size component)
+          _ (println "Host-size = " host-size)]
+      (m/defpoint (:w host-size) (:h host-size)))
+    old-clip-size))
+
+
 (def root-panel
   (fg/defcomponent
     panel/panel
     :main
-    {:clip-size (m/defpoint 40 23 0)
-     :background (awt/color 9 17 26)}
+    {:clip-size (m/defpoint 4 2)
+     :background (awt/color 9 17 26)
+     :evolvers {:clip-size clip-size-evolver}}
     hello-window))


HTMl generation delayed to the last key press

--- src-cljs/main.cljs
+++ src-cljs/main.cljs
@@ -25,14 +25,24 @@
 ; try to detect iOS
 (def ios-detected (.match (.-userAgent js/navigator) "(iPad|iPod|iPhone)"))

+(def timer nil)
+
+(def timerDelay
+  ; TODO: also test for Android
+  (if ios-detected 800 400))
+
 (defn update-preview
   "Updates the preview"
   []
   (do
-    (show $dashed-line)
-    (show $input-elems)
-    (inner $preview
-           (.makeHtml md-converter (val $draft)))))
+    (js/clearTimeout timer)
+    (def timer
+      (js/setTimeout
+        #(do
+           (show $dashed-line)
+           (show $input-elems)
+           (inner $preview
+                  (.makeHtml md-converter (val $draft)))) timerDelay))))

 ; set focus to the draft textarea (if there is one)
 (when $action


Sort the child actx.

Sort the child actx.

--- src/cbfg/core.cljs
+++ src/cbfg/core.cljs
@@ -184,11 +184,10 @@
      "
"
      "
"
      (if (not-empty children)
-       ["
" (mapv (fn [child-actx-bool]
-                       ["
" (vis-html-actx vis (first child-actx-bool)
-                                              positions actx-ch-ch-infos)
+       ["
" (mapv (fn [child-actx]
+                       ["
" (vis-html-actx vis child-actx positions actx-ch-ch-infos)
                         "
"])
-                     children)
+                     (sort #(compare (last %1) (last %2)) (keys children)))
         "
"]
        [])
      "
"]))


Thicker stroke-weight for last delta.

Thicker stroke-weight for last delta.

--- src/cbfg/core.cljs
+++ src/cbfg/core.cljs
@@ -58,13 +58,13 @@
                                 (assoc-in [:actxs child-actx]
                                           {:children {} :wait-chs {}})
                                 (assoc-in [:actxs actx :children child-actx] true)))
-                [{:detla :actx-appear :actx child-actx}]))
+                [{:delta :actx-new :actx child-actx}]))
     :after (fn [vis actx args]
              (let [[child-actx result] args]
                (swap! vis #(-> %
                                (dissoc-in [:actxs child-actx])
                                (dissoc-in [:actxs actx :children child-actx])))
-               [{:delta :actx-disappear :actx child-actx}]))}
+               [{:delta :actx-remove :actx child-actx}]))}
    "aclose"
    {:before (fn [vis actx args]
               (let [[ch] args] nil))
@@ -175,8 +175,11 @@
      "</div>"]))

 (defn vis-svg-actxs [vis positions deltas]
-  (let [line-height 21
-        stroke-width 1]
+  (let [stroke-width 1
+        line-height 21
+        chs (:chs vis)
+        ch-y (fn [ch] (* line-height (+ 0.5 (get positions (:id (get chs ch))))))
+        actx-y (fn [actx] (* line-height (+ 0.5 (get positions (last actx)))))]
     ["<defs>"
      "<marker id='triangle'"
      " viewBox='0 0 10 10' refX='0' refY='5'"
@@ -185,28 +188,32 @@
      " orient='auto'>"
      " <path d='M 0 0 L 10 5 L 0 10 z'/>"
      "</defs>"
-     (map (fn [actx-actx-info]
-            (let [[actx actx-info] actx-actx-info
-                  actx-id (last actx)
-                  actx-position (+ 0.5 (get positions actx-id))
-                  wait-chs (:wait-chs actx-info)
-                  chs (:chs vis)]
-              (mapv (fn [kv]
-                      (let [[ch wait-kind] kv
-                            ch-info (get chs ch)
-                            ch-id (:id ch-info)
-                            ch-position (+ 0.5 (get positions ch-id))]
-                        (if (= :put wait-kind)
-                          ["<line x1='500' y1='" (* actx-position line-height)
-                           "' x2='600' y2='" (* ch-position line-height)
-                           "' stroke='green' stroke-width='" stroke-width
-                           "' marker-end='url(#triangle)'/>"]
-                          ["<line x1='600' y1='" (* ch-position line-height)
-                           "' x2='500' y2='" (* actx-position line-height)
-                           "' stroke='red' stroke-width='" stroke-width
-                           "' marker-end='url(#triangle)'/>"])))
-                    wait-chs)))
-          (:actxs vis))]))
+     (mapv (fn [actx-actx-info]
+             (let [[actx actx-info] actx-actx-info]
+               (mapv (fn [ch-wait-kind]
+                       (let [[ch wait-kind] ch-wait-kind]
+                         (if (= :put wait-kind)
+                           ["<line x1='500' y1='" (actx-y actx)
+                            "' x2='600' y2='" (ch-y ch)
+                            "' stroke='green' stroke-width='1' marker-end='url(#triangle)'/>"]
+                           ["<line x1='600' y1='" (ch-y ch)
+                            "' x2='500' y2='" (actx-y actx)
+                            "' stroke='red' stroke-width='1' marker-end='url(#triangle)'/>"])))
+                     (:wait-chs actx-info))))
+           (:actxs vis))
+     (mapv (fn [delta]
+             (when (get chs (:ch delta))
+               (case (:delta delta)
+                 :put ["<line x1='500' y1='" (actx-y (:actx delta))
+                       "' x2='600' y2='" (ch-y (:ch delta))
+                       "' stroke='green' stroke-width='2' marker-end='url(#triangle)'/>"]
+                 :take ["<line x1='600' y1='" (ch-y (:ch delta))
+                        "' x2='500' y2='" (actx-y (:actx delta))
+                        "' stroke='red' stroke-width='2' marker-end='url(#triangle)'/>"]
+                 :actx-new nil
+                 :actx-remove nil
+                 nil)))
+           deltas)]))

 ;; ------------------------------------------------


One-liners.

One-liners.

--- src/cbfg/core.cljs
+++ src/cbfg/core.cljs
@@ -17,15 +17,13 @@

 ;; ------------------------------------------------

-(defn get-el-value [elId]
-  (.-value (gdom/getElement elId)))
-
-(defn set-el-innerHTML [elId v]
-  (set! (.-innerHTML (gdom/getElement elId)) v))
+(defn get-el-value [elId] (.-value (gdom/getElement elId)))
+
+(defn set-el-innerHTML [elId v] (set! (.-innerHTML (gdom/getElement elId)) v))

 (defn listen [el type]
   (let [out (chan)]
-    (gevents/listen el type (fn [e] (put! out e)))
+    (gevents/listen el type #(put! out %))
     out))

 (defn dissoc-in [m [k & ks :as keys]]


(maint) delete obsolete comment + unused constant

--- src/puppetlabs/trapperkeeper/services.clj
+++ src/puppetlabs/trapperkeeper/services.clj
@@ -7,8 +7,6 @@
             [puppetlabs.kitchensink.core :refer [select-values keyset]]
             [puppetlabs.trapperkeeper.services-internal :as si]))

-;; Look into re-using an existing protocol for the life cycle instead of
-;; creating our own; just didn't want to introduce the dependency for now.
 (defprotocol Lifecycle
   "Lifecycle functions for a service.  All services satisfy this protocol, and
   the lifecycle functions for each service will be called at the appropriate
@@ -36,7 +34,6 @@
   (service-map [this] "The map of service functions for the graph"))

 (def lifecycle-fn-names (map :name (vals (:sigs Lifecycle))))
-(def tk-service-fn-names (map :name (vals (:sigs Service))))

 (defmacro service
   "Create a Trapperkeeper ServiceDefinition.


Implements cache invalidation

Implements cache invalidation

--- reports/src/reports/scheduler.clj
+++ reports/src/reports/scheduler.clj
@@ -18,7 +18,9 @@
          report (exp/doexport exportType baseURL sid opts)
          path (s/join "/" (take-last 2 (s/split (.getAbsolutePath report) #"/")))]
     (dosync
-      (alter cache conj {reportId path}))
+      (alter cache conj {{:id reportId
+                          :surveyId sid
+                          :baseURL baseURL} path}))
     (qs/delete-job (j/key reportId))))

@@ -37,7 +39,7 @@
       false true))

 (defn- report-id [m]
-  "Returns the `id` plus hashCode of a 'stringified' version of a map"
+  "Generates a unique identifier based on the map"
   (format "id%s" (hash (str m))))

 (defn- schedule-job [params]
@@ -56,9 +58,15 @@
     {"status" "OK"
      "message" "PROCESSING"}))

+(defn- get-report-by-id [rid]
+  (let [found (filter #(= rid (:id %)) (keys @cache))]
+    (if (empty? found)
+      nil
+      (@cache (nth found 0)))))
+
 (defn generate-report [params]
   "Returns the cached report for the given parameters, or schedules the report for execution"
-  (if-let [f (@cache (report-id params))]
+  (if-let [f (get-report-by-id (report-id params))]
    {"status" "OK"
     "file" f}
    (schedule-job params)))
@@ -66,4 +74,9 @@

 (defn invalidate-cache [params]
   "Invalidates (remove) a given file from the cache"
-  params)+  (let [baseURL (params "baseURL")]
+    (doseq [sid (params "surveyIds")]
+    (dosync
+      (doseq [k (keys @cache) :when (and (= (k :baseURL) baseURL) (= (str sid) (k :surveyId)))]
+      (alter cache dissoc k))))
+    {"status" "OK"}))


adds another test for comparable

adds another test for comparable

--- test/clj/clojure/lang/comparable_test.clj
+++ test/clj/clojure/lang/comparable_test.clj
@@ -1,8 +1,14 @@
 (ns clojure.lang.comparable-test
-  (:refer-clojure :only [])
+  (:refer-clojure :only [deftype])
   (:require [clojure.test             :refer :all]
             [clojure.lang.comparable  :refer [compare]]
-            [clojure.lang.equivalence :refer [=]]))
+            [clojure.lang.equivalence :refer [=]]
+            [clojure.lang.icomparable :refer [IComparable]]))
+
+(deftype Apple []
+  IComparable
+  (-compare-to [this other]
+    10))

 (deftest compare-test
   (testing "returns -1 if lhs is nil"
@@ -11,4 +17,7 @@
   (testing "returns 1 if rhs is nil"
     (is (= 1 (compare :something nil))))

+  (testing "calls -compare-to on the lhs"
+    (is (= 10 (compare (Apple.) :something))))
+
   )


Tuned test values.

Tuned test values.


Add take function as take-segments! should work the way it did

--- test/onyx/plugin/input_benchmark_test.clj
+++ test/onyx/plugin/input_benchmark_test.clj
@@ -110,6 +110,17 @@
                          (range messages-per-partition))))))
     (println "Successfully wrote messages")))

+(defn take-until-nothing!
+  [ch timeout-ms]
+   (loop [ret []]
+     (let [tmt (if timeout-ms (timeout timeout-ms) (chan))
+           [v c] (alts!! [ch tmt] :priority true)]
+       (if (= c tmt)
+         ret
+         (if (and v (not= v :done))
+           (recur (conj ret v))
+           (conj ret :done))))))
+
 (deftest ^:benchmark kafka-input-test
   (let [test-topic (str "onyx-test-" (java.util.UUID/randomUUID))
         {:keys [env-config peer-config]} (read-config (clojure.java.io/resource "config.edn")
@@ -131,7 +142,7 @@
            job-id (:job-id job-ret)
            start-time (System/currentTimeMillis)
            read-nothing-timeout 10000
-           read-segments (onyx.plugin.core-async/take-segments! out read-nothing-timeout)]
+           read-segments (take-until-nothing! out read-nothing-timeout)]
        (is (= (* n-partitions messages-per-partition) (count read-segments)))
        (let [run-time (- (System/currentTimeMillis) start-time read-nothing-timeout)
              n-messages-total (* n-partitions messages-per-partition)]


Correct typo in `midje-repl-help` text

Correct typo in `midje-repl-help` text

--- src/midje/repl.clj
+++ src/midje/repl.clj
@@ -26,7 +26,7 @@
   (println "(check-facts)                 ; check in current namespace")
   (println "(check-facts <ns> <ns>...)    ; check given namespaces")
   (println "(check-facts :all)            ; check all loaded facts")
-  (println "(check-facts-matching <pred>) ; <pred> matches on fact metadata")
+  (println "(check-matching-facts <pred>) ; <pred> matches on fact metadata")
   (println "(check-facts-named <name>)    ; regex or substring match.")
   (println)
   (println "(recheck-fact)                ; Check just-checked fact again.")


adding states-with-deps

adding states-with-deps

--- src/mount/core.clj
+++ src/mount/core.clj
@@ -72,6 +72,22 @@
        (map second)
        (filter mount-state?)))

+
+;;TODO ns based for now. need to be _state_ based
+(defn- add-deps [{:keys [ns] :as state} all]
+  (let [refers (ns-refers ns)
+        any (set all)
+        deps (filter (comp any val) refers)]
+    (assoc state :deps deps)))
+
+(defn states-with-deps []
+  (let [all (find-all-states)]
+    (->> (map (comp #(add-deps % all)
+                    #(select-keys % [:name :order :ns])
+                    meta)
+              all)
+         (sort-by :order))))
+
 (defn- bring [states fun order]
   (->> states
        (sort-by (comp :order meta) order)


Some docs

Some docs

--- src/pundit/api.clj
+++ src/pundit/api.clj
@@ -79,16 +79,22 @@

 ; User auth

-(defn login [user pwd]
+(defn login
+  "Authenticates `user` with `pwd`, returns a session token."
+  [user pwd]
   (:session-token
     (GET "login"
          (dissoc *auth* :token)
          {:username user :password pwd})))

-(defn logout! []
+(defn logout!
+  "Logs out the currently logged in user."
+  []
   (POST! "logout" *auth* {}))

-(defn whoami []
+(defn whoami
+  "Returns the currently logged in user."
+  []
   (GET "users/me" *auth*))

 ; Querying


3rd declension

3rd declension

--- src/xanny/quiz.clj
+++ src/xanny/quiz.clj
@@ -74,34 +74,47 @@
 (def pronunciation {:consonants {} :vowels {} :dipthongs {}})

 (def cases {:nom {:sg {1 {:fem "-a" :masc "-a"}
-                       2 {:masc "-us" :neut "-um"}}
+                       2 {:masc "-us" :neut "-um"}
+                       3 {:masc "" :fem "-us" :neut "-us"}}
                   :pl {1 {:fem "-ae" :masc "-ae"}
-                       2 {:masc "-i" :neut "-a"}}}
+                       2 {:masc "-i" :neut "-a"}
+                       3 {:masc "-es" :fem "-es" :neut "-a"}}}

             :gen {:sg {1 {:fem "-ae" :masc "-ae"}
-                       2 {:masc "-i" :neut "-i"}}
+                       2 {:masc "-i" :neut "-i"}
+                       3 {:masc "-is" :fem "-is" :neut "-is"}}
                   :pl {1 {:fem "-arum" :masc "-arum"}
-                       2 {:masc "-orum" :neut "-orum"}}}
+                       2 {:masc "-orum" :neut "-orum"}
+                       3 {:masc "-um" :fem "-um" :neut "-um"}}}

             :dat {:sg {1 {:fem "-ae" :masc "-ae"}
-                       2 {:masc "-o" :neut "-o"}}
+                       2 {:masc "-o" :neut "-o"}
+                       3 {:masc "-i" :fem "-i" :neut "-i"}}
                   :pl {1 {:fem "-is" :masc "-is"}
-                       2 {:masc "-is" :neut "-is"}}}
+                       2 {:masc "-is" :neut "-is"}
+                       3 {:masc "-ibus" :fem "-ibus" :neut "-ibus"}}}

             :acc {:sg {1 {:fem "-am" :masc "-am"}
-                       2 {:masc "-um" :neut "-um"}}
+                       2 {:masc "-um" :neut "-um"}
+                       3 {:masc "-em" :fem "-em" :neut "-em"}}
                   :pl {1 {:fem "-as " :masc "-as"}
-                       2 {:masc "-os" :neut "-a"}}}
+                       2 {:masc "-os" :neut "-a"}
+                       3 {:masc "-es" :fem "-es" :neut "-a"}}}

             :abl {:sg {1 {:fem "-a" :masc "-a"}
-                       2 {:masc "-o" :neut "-o"}}
+                       2 {:masc "-o" :neut "-o"}
+                       3 {:masc "-e" :fem "-e" :neut "-e"}}
                   :pl {1 {:fem "-is" :masc "-is"}
-                       2 {:masc "-is" :neut "-is"}}}
+                       2 {:masc "-is" :neut "-is"}
+                       3 {:masc "-ibus" :fem "-ibus" :neut "-ibus"}}}

+
             :voc {:sg {1 {:fem "-a" :masc "-a"}
-                       2 {:masc "-e" :neut "-um"}}
+                       2 {:masc "-e" :neut "-um"}
+                       3 {:masc "" :fem "-us" :neut "-us"}} ;the vocative is the same as nominative except for -us/-ius words
                   :pl {1 {:fem "-ae" :masc "-ae"}
-                       2 {:masc "-i" :neut "-a"}}}})
+                       2 {:masc "-i" :neut "-a"}
+                       3 {:masc "-es" :fem "-es" :neut "-a"}}}})

 (def vowels ["a" "e" "i" "o" "u"])


updates jet to include implementation of onStartAsync() (#785)

--- waiter/project.clj
+++ waiter/project.clj
@@ -41,7 +41,7 @@
                  [io.grpc/grpc-core "1.20.0"
                   :exclusions [com.google.guava/guava]
                   :scope "test"]
-                 [twosigma/jet "0.7.10-20190518_074946-g399eb7b"
+                 [twosigma/jet "0.7.10-20190607_230136-gaa94652"
                   :exclusions [org.mortbay.jetty.alpn/alpn-boot]]
                  [twosigma/clj-http "1.0.2-20180124_201819-gcdf23e5"
                   :exclusions [commons-codec commons-io org.clojure/tools.reader potemkin slingshot]]


Turning off access logging by default.

Turning off access logging by default.

--- dev-system/src/cmr/dev_system/system.clj
+++ dev-system/src/cmr/dev_system/system.clj
@@ -100,7 +100,7 @@

 (def use-access-log?
   "Indicates whether the servers will use the access log."
-  true)
+  false)

 (defn- set-web-server-options
   "Modifies the app server instances to configure web server options. Takes the system


do not fire initial callback in history's listen

--- examples/_common/middleware/history.cljs
+++ examples/_common/middleware/history.cljs
@@ -15,7 +15,7 @@
             token - new token
             browser-event? - true if event was initiated by action in browser, e.g. clicking Back button
             event-data - data which was passed from replace-token/push-token
-          Fires the initial callback. Returns a function which stops listening.")
+          Returns a function which stops listening.")
   (replace-token [this token] [this token event-data]
                  "Replace token and fire an event with additional data passed (data is nil if not specified);
                  do nothing if current token is already equal to the specified one.")
@@ -30,11 +30,10 @@
 (defrecord -History [-goog-history]
   HistoryProtocol
   (listen
-    [this callback]
+    [_this callback]
     (let [key (goog.events/listen -goog-history EventType/NAVIGATE #(callback (.-token %)
                                                                               (.-isNavigation %)
                                                                               *-history-event-data*))]
-      (callback (token this) true nil)
       #(goog.events/unlistenByKey key)))

   (replace-token [this new-token] (replace-token this new-token nil))
@@ -110,7 +109,10 @@
                               (replace-token history (::token new-state)))))

                (reset! unlisten
-                       (listen history #(dispatch-signal [::on-history-event {:token %1 :browser-event? %2 :event-data %3}]))))
+                       (listen history #(dispatch-signal [::on-history-event {:token %1 :browser-event? %2 :event-data %3}])))
+
+               ; initial signal
+               (dispatch-signal [::on-history-event {:token (token history) :browser-event? true :event-data nil}]))

              :on-stop
              (do


Apply grayscale filter on filtered items (webkit)

--- frontend/styles/faceboard/css/people.clj
+++ frontend/styles/faceboard/css/people.clj
@@ -11,6 +11,8 @@
       :perspective-origin "50% 50%"]
      (>> people-scaffold
        [:visibility :hidden])
+     (>> separator
+       [:margin-top (px 100)])
      (>> people-layout
        (>> person-card
          [:position :absolute
@@ -19,7 +21,9 @@
          (>> person-card-zoom
            [:transition (str "transform 0.3s " ease-out-back)])
          (>> &.filtered
-           [:opacity 0.2
+           [:opacity 0.3
+            :-webkit-filter "grayscale(1)"
+            :filter "grayscale(1)"
             :z-index 0])
          (>> &.expandable
            [:cursor :pointer])


difficila -> difficile

difficila -> difficile

--- src/babel/italiano/morphology/adjectives.cljc
+++ src/babel/italiano/morphology/adjectives.cljc
@@ -24,6 +24,11 @@
    {:replace-with "o"
     :unify-with {:synsem {:cat :adjective
                           :agr {:gender :fem
+                                :number :sing}}}}
+   #"a$"
+   {:replace-with "e"
+    :unify-with {:synsem {:cat :adjective
+                          :agr {:gender :fem
                                 :number :sing}}}}})

 (def plural-to-singular-adj-fem-plur


Make handlers execute properly.

Make handlers execute properly.

--- src/circleci/backend/proto/src/proto/main.clj
+++ src/circleci/backend/proto/src/proto/main.clj
@@ -8,19 +8,19 @@
   (:import org.xeustechnologies.jtar.TarInputStream)
   (:require [clojure.string :as string]))

-(def handlers '[repo-handler autotools-handler])
+(def handlers [repo-handler autotools-handler])

 (defn run-handlers
   "Run all the handlers on a definition"
   [config]
-  (for [h handlers] (h config)))
+  (doseq [h handlers] (do (println config) (h config) (println h))))

-(defn process-handlers
+(defn process-configurations
   "For each project definition, run all the handlers on it"
   [configurations]
-  (functor/fmap run-handlers configurations))
+  (map run-handlers (vals configurations)))

 (defn autotools-handler
@@ -28,7 +28,7 @@
     subdir :subdir
     configurations :configurations
     autoconf-version :autoconf-version}]
-  (println "autotools handler")
+  (println "do autotools")
   (when (= type "autotools") (println "autotools")))

 (defn shell-out [& args]
@@ -38,7 +38,8 @@
 (defn download
   "Download a file, and save it to a known filename"
   [remote-file local-file]
-  (shell-out "curl" remote-file "-o" local-file "-s"))
+ ; (shell-out "curl" remote-file "-o" local-file "-s")
+  (shell-out "cp" "scratch/saved.tar.bz2" local-file))

 (defn untar
   "Untar a file, into directory"
@@ -55,7 +56,7 @@
     (first (string/split (-> tis
                              .getNextEntry
                              .getName)
-                         "/"))))
+                         #"/"))))

 (defn repo-handler
@@ -72,14 +73,13 @@

 (defn init [& argv]
   (proto.repl/init)
-  (-> argv
-      first
-      io/reader
-      slurp
-      yaml/parse-string
-      process-handlers
-      println))
+  (def configuration (-> argv
+                          first
+                          io/reader
+                          slurp
+                          yaml/parse-string))
+  (process-configurations configuration))

-;;
+
 (defn -main []
   (init *command-line-args*))


label shortened

label shortened

--- src/cljs/swarmpit/component/service/list.cljs
+++ src/cljs/swarmpit/component/service/list.cljs
@@ -38,7 +38,7 @@
   (case value
     "running" (label/green value)
     "not running" (label/info value)
-    "partly running" (label/yellow value)))
+    "partly running" (label/yellow "running")))

 (defn- render-status [item]
   (let [update-status (get-in item [:status :update])]


added todos for routing behavior tests

added todos for routing behavior tests

--- examples/friend-list/test/unit/runner.cljs
+++ examples/friend-list/test/unit/runner.cljs
@@ -1,11 +1,13 @@
 (ns unit.runner
   (:require [cljs.test]
             [doo.runner :refer-macros [doo-tests]]
+            [unit.spec]
             [unit.controller]
             [unit.reconciler]
             [unit.view-model]))

 (doo-tests
+  'unit.spec
   'unit.controller
   'unit.reconciler
   'unit.view-model)


Tightening the constraint on the ensure of greg->abs

--- examples/dream_date.clj
+++ examples/dream_date.clj
@@ -80,7 +80,7 @@
 (defconstrainedfn gregorian->absolute
   "Given a Gregorian date, calculate the total number of days
    since the start of the calendar."
-  ([date] [:day :month :year]
+  ([date] [map? :day :month :year]
      (gregorian->absolute (:day date) (:month date) (:year date)))
   ([day month year] [all-positive? => (= (quot % 365) year)]
      (+ day


Feedback for code review

Feedback for code review

--- scheduler/src/cook/mesos/data_locality.clj
+++ scheduler/src/cook/mesos/data_locality.clj
@@ -15,6 +15,7 @@
                           (pc/map-vals (fn [cost] (-> cost (min maximum-cost) (max 0)))
                                        host->cost)))
            (reset! data-local-costs))))
+
   (defn get-data-local-costs
     "Returns the current cost for jobs to run on each host"
     []


Keymap changes

Keymap changes

--- src-frontend/cljs/cljs_webrepl/editor.cljs
+++ src-frontend/cljs/cljs_webrepl/editor.cljs
@@ -28,9 +28,7 @@
         editor  (reset! editor (js/CodeMirror.fromTextArea element cm-opts))]
     (.setValue editor text)
     (when on-change
-      (.on editor "change" on-change))
-    (when on-key-down
-      (.on editor "keydown" on-key-down))))
+      (.on editor "change" on-change))))

 (defn cm-will-update [node editor [_ _ text]]
   (debugf "Update")
@@ -43,7 +41,7 @@
     true)
   (reset! editor nil))

-(defn cm-render [_ text]
+(defn cm-render [props text]
   [:textarea {:value text :read-only true}])

 (defn codemirror [props text]
@@ -62,16 +60,21 @@
   (-> (.getValue editor)
       (str/includes? "\n")))

-(defn make-submit [{:keys [submit] :as props}]
+(defn wrap-on-change [{:keys [on-change]}]
+  (when on-change
+    (fn [cm]
+      (on-change (.getValue cm)))))
+
+(defn wrap-on-submit [{:keys [on-submit] :as props}]
   (fn [cm]
-    (submit (.getValue cm))))
+    (on-submit (.getValue cm))))

-(defn make-history-prev [{:keys [history-prev state] :as props}]
+(defn wrap-history-prev [{:keys [history-prev state] :as props}]
   (fn [cm]
     (.setValue cm (:input (history-prev)))
     (.refresh cm)))

-(defn make-history-next [{:keys [history-next state] :as props}]
+(defn wrap-history-next [{:keys [history-next state] :as props}]
   (fn [cm]
     (.setValue cm (:input (history-next)))
     (.refresh cm)))
@@ -82,23 +85,35 @@
       js/CodeMirror.Pass
       (f cm))))

-(defn editor [props value]
-  (let [history-next (make-history-next props)
-        history-prev (make-history-prev props)
-        submit       (make-submit props)
+(defn insert-pair [cm pair]
+  (debugf "I!")
+  (doto cm
+    (.replaceSelection "()")
+    (.execCommand "goCharLeft")))
+
+(defn editor [props text]
+  (let [on-change    (wrap-on-change props)
+        history-next (wrap-history-next props)
+        history-prev (wrap-history-prev props)
+        on-submit    (wrap-on-submit props)
         extra-keys   {:Up         (-> history-prev wrap-ignore-multi)
                       :Down       (-> history-next wrap-ignore-multi)
                       :Ctrl-Up    history-prev
                       :Ctrl-Down  history-next
-                      :Enter      (-> submit wrap-ignore-multi)
-                      :Ctrl-Enter submit}]
+                      :Enter      (-> on-submit wrap-ignore-multi)
+                      :Ctrl-Enter on-submit
+                      :Shift-9    #(insert-pair % "()")
+                      "["         #(insert-pair % "[]")
+                      "Shift-{"   #(insert-pair % "{}")
+                      "Shift-'"   #(insert-pair % "\"\"")}]
     (fn []
-      [codemirror
-       {:editable?  true
-        :numbers?   false
-        :focus?     true
-        :extra-keys extra-keys}
-       value])))
+      [codemirror (-> {:editable?  true
+                       :numbers?   false
+                       :focus?     true
+                       :extra-keys extra-keys
+                       :on-change  on-change}
+                      (merge (dissoc props :on-change)))
+       text])))

 (defn code [text]
   [codemirror {:read-only? true :mode "clojure"} text])


Speed up atomic-name-fs

Speed up atomic-name-fs

--- src/angelic/search/implicit/dash_astar.clj
+++ src/angelic/search/implicit/dash_astar.clj
@@ -458,7 +458,7 @@

 (declare get-ocs)

-(defn atomic-name-fs [n] (util/match [[:Atomic ~fs] n] fs))
+(defn atomic-name-fs [n] (assert (= :Atomic (first n))) (second n))
 (defn log-input [fs inp-set] (if *state-abstraction* (fs/get-logger fs inp-set) inp-set))

 (defn get-input-key [fs inp-set] (if *state-abstraction* (fs/extract-context fs inp-set) inp-set))


Remove debug logging statements and fix dependency on it

--- src/cider_ci/builder/jobs/dependencies.clj
+++ src/cider_ci/builder/jobs/dependencies.clj
@@ -3,6 +3,8 @@
 ; See the "LICENSE.txt" file provided with this software.

 (ns cider-ci.builder.jobs.dependencies
+  (:refer-clojure :exclude [str keyword])
+  (:require [cider-ci.utils.core :refer [keyword str]])
   (:require
     [cider-ci.builder.repository :as repository]
     [cider-ci.builder.spec :as spec]
@@ -121,9 +123,7 @@

 (defn- evaluate-dependencies [job]
   (if-let [dependencies (->> job :depends_on (map second) seq)]
-    (do
-      (logging/debug 'dependencies dependencies)
-      (reduce evaluate-dependency job dependencies))
+    (reduce evaluate-dependency job dependencies)
     job))

 ;##############################################################################
@@ -132,7 +132,8 @@
   (->> jobs
        (map evaluate-name-clash)
        (map evaluate-key-clash)
-       (map evaluate-dependencies)))
+       (map evaluate-dependencies)
+       doall))

 (defn fulfilled? [job]
   (-> job


rename to img

rename to img

--- src/cljs/infinitelives/pixi/resources.cljs
+++ src/cljs/infinitelives/pixi/resources.cljs
@@ -85,7 +85,6 @@
 ;; setup a pixi texture cache keyed by the tail of its filename
 (defn- register!
   [url texture-hash]
-  (log "register!" url texture-hash)
   (swap! !texture-store assoc (string/url-keyword url) texture-hash)
   texture-hash)

@@ -96,19 +95,21 @@

 (defn load [url]
   (let [c (chan)
-        i (js/Image.)]
-    (set! (.-crossOrigin i) "")
-    (set! (.-onload i)
+        img (js/Image.)]
+    (set! (.-crossOrigin img) "")
+    (set! (.-onload img)
           #(put! c [url
                     {:linear (js/PIXI.Texture.
-                              (js/PIXI.BaseTexture. i js/PIXI.SCALE_MODES.LINEAR))
+                              (js/PIXI.BaseTexture. img js/PIXI.SCALE_MODES.LINEAR))
                      :nearest (js/PIXI.Texture.
-                               (js/PIXI.BaseTexture. i js/PIXI.SCALE_MODES.NEAREST))
-                     :image i}
+                               (js/PIXI.BaseTexture. img js/PIXI.SCALE_MODES.NEAREST))
+                     :image img}
                     ]))
-    (set! (.-onerror i) #(put! c [url nil]))
-    (set! (.-onabort i) #(js/alert "abort"))
-    (set! (.-src i) url)
+    (set! (.-onerror img) #(put! c [url nil]))
+    (set! (.-onabort img) #(js/alert "abort"))
+
+    ;; trigger load
+    (set! (.-src img) url)
     c))

 (defmethod resources/load "png" [url] (load url))


calendar fix for months and years modes

calendar fix for months and years modes

--- src/cljs/re_form/inputs/calendar_impl.cljs
+++ src/cljs/re_form/inputs/calendar_impl.cljs
@@ -184,7 +184,8 @@
                        (swap! state (fn [s]
                                       (-> s
                                           (assoc-in [:cal :m] m)
-                                          (assoc :mode :days)))))]
+                                          (assoc :mode :days)
+                                          (assoc :detached true)))))]
     (fn []
       [:table
        [:thead
@@ -204,7 +205,8 @@
                        (swap! state (fn [x]
                                       (-> x
                                           (assoc-in [:cal :y] y)
-                                          (assoc :mode :days)))))]
+                                          (assoc :mode :days)
+                                          (assoc :detached true)))))]
     (fn []
       (let [y (get-in @state [:cal :y])]
         [:table


Add Node column to Tasks table

Add Node column to Tasks table

--- src/cljs/swarmpit/component/task/list.cljs
+++ src/cljs/swarmpit/component/task/list.cljs
@@ -81,6 +81,8 @@
 (def render-metadata
   {:table {:summary [{:name      "Task"
                       :render-fn (fn [item] (render-item-name item))}
+                     {:name      "Node"
+                      :render-fn (fn [item] (:nodeName item))}
                      {:name      "CPU Usage"
                       :tooltip   "Task cpu usage per Limit (resource/node)"
                       :render-fn (fn [item] (render-item-cpu-usage item))}
@@ -180,4 +182,4 @@
                      render-metadata
                      onclick-handler
                      toolbar-render-metadata)
-        (form-filters filterOpen? filter)))))+        (form-filters filterOpen? filter)))))


Fix documentation.

Fix documentation.

--- src/main/clojure/clojure/tools/logging.clj
+++ src/main/clojure/clojure/tools/logging.clj
@@ -13,7 +13,7 @@
 (ns ^{:author "Alex Taggart"
       :doc "Logging macros which delegate to a specific logging implementation. At
             runtime a specific implementation is selected from, in order, slf4j,
-            Apache commons-logging, slf4j, log4j, and finally java.util.logging."}
+            Apache commons-logging, log4j, and finally java.util.logging."}
   clojure.tools.logging
   [:use
    [clojure.string :only [trim-newline]]


formatting

formatting

--- backend/project.clj
+++ backend/project.clj
@@ -2,19 +2,22 @@
   :description "LambdaCD-Plugin that provides a modern UI for your pipeline."
   :url "https://github.com/sroidl/lambda-ui"
   :license {:name "Apache License 2.0"
-            :url "http://www.apache.org/licenses/LICENSE-2.0"}
+            :url  "http://www.apache.org/licenses/LICENSE-2.0"}
   :dependencies [[org.clojure/clojure "1.7.0"]
                  [lambdacd "0.9.0"]
                  [compojure "1.5.0"]
                  [http-kit "2.1.18"]
                  [org.clojure/data.json "0.2.6"]
                  ]
-  :main lambdaui.core
-  :test-paths ["test" "example"]
+
+  :test-paths ["test"]
+
   :deploy-repositories [["clojars" {:creds :gpg}]
                         ["releases" :clojars]
-			["snapshots" :clojars]]
+                        ["snapshots" :clojars]]
   :profiles {:dev {:dependencies [[lambdacd-git "0.1.2"]
                                   [ring-server "0.4.0"]]
-                   :main lambdaui.core
+
+                   :aot [lambdaui.core]
+                   :main         lambdaui.core
                    }})


[#522] Update backend dependencies

[#522] Update backend dependencies

--- backend/project.clj
+++ backend/project.clj
@@ -1,4 +1,4 @@
-(defproject org.akvo/lumen "0.6-SNAPSHOT"
+(defproject org.akvo/lumen "0.7-SNAPSHOT"
   :description "Akvo Lumen backend"
   :url "https://github.com/akvo/akvo-lumen"
   :license {:name "GNU Affero General Public License 3.0"
@@ -22,8 +22,8 @@
                  [org.clojure/clojure "1.8.0"]
                  [org.clojure/data.csv "0.1.3"]
                  [org.immutant/web "2.1.6"]
-                 [org.postgresql/postgresql "9.4.1212"]
-                 [org.slf4j/slf4j-nop "1.7.23"]
+                 [org.postgresql/postgresql "42.0.0"]
+                 [org.slf4j/slf4j-nop "1.7.24"]
                  [ragtime/ragtime.jdbc "0.6.4"]
                  [ring "1.5.1"]
                  [ring/ring-defaults "0.2.3"]
@@ -54,7 +54,7 @@
                                     [reloaded.repl "0.2.3"]
                                     [org.clojure/tools.namespace "0.2.11"]
                                     [org.clojure/tools.nrepl "0.2.12"]
-                                    [eftest "0.1.2"]
+                                    [eftest "0.1.3"]
                                     [com.gearswithingears/shrubbery "0.4.1"]
                                     [kerodon "0.8.0"]]
                    :source-paths   ["dev/src"]


tweak inspect UI

tweak inspect UI

making runtime more generic and UI based on its supported ops, only
display tap if actually supported

--- src/main/shadow/cljs/ui/pages/inspect.cljs
+++ src/main/shadow/cljs/ui/pages/inspect.cljs
@@ -161,49 +161,64 @@
            (refresh-ui [[::oid oid]])
            )}))))

-(defmutation select-runtime [{:keys [rid] :as params}]
+(defn get-state-ref []
+  (::fa/state-atom env/app))
+
+(defn ensure-runtime-init [rid pending-tx callback]
+  (let [state-ref (get-state-ref)]
+    (if (get-in @state-ref [::rid rid ::supported-ops])
+      (callback)
+
+      (do (swap! state-ref update-in [::rid rid] merge {::rid rid})
+          (fc/transact! env/app pending-tx)
+          (call! {:op :request-supported-ops :rid rid}
+            {:runtime-not-found
+             (fn [msg]
+               ;; FIXME: redirect somewhere neutral
+               (js/console.warn "runtime-not-found" rid))
+
+             :supported-ops
+             (fn [{:keys [ops] :as msg}]
+               (swap! state-ref assoc-in [::rid rid ::supported-ops] ops)
+               (refresh-ui [[::rid rid]])
+               (callback))})))))
+
+(defmutation select-runtime-page [{:keys [rid] :as params}]
   (action [{:keys [state] :as env}]
-    (let [[_ previous-rid] (get-in @state [::ui-model/page-inspect 1 ::runtime])]
+    (swap! state update-in [::runtime-page rid] merge {::rid rid ::runtime [::rid rid]})))
+
+(defmutation select-runtime-tap-page [{:keys [rid] :as params}]
+  (action [{:keys [state] :as env}]
+    (swap! state update-in [::tap-page rid] merge {::rid rid ::runtime [::rid rid]})
+
+    ;; FIXME: allow having multiple active?
+    (let [previous-rid (::active-rid @state)]

       (swap! state
         (fn [state]
           (-> state
-              (assoc-in [::ui-model/page-inspect 1 ::runtime] [::rid rid])
-              ;; FIXME: rid may still be empty when routing to this page
-              ;; before :request-runtimes finished. :clj will always have id 1
-              (update-in [::rid rid] merge {::rid rid})
-              (update-in [::rid rid] dissoc ::object)
-              (update-in [::rid rid] assoc ::nav-stack []))))
-
-      ;; FIXME: this should happen on initial :request-runtimes
-      (call! {:op :request-supported-ops :rid rid}
-        {:runtime-not-found
-         (fn [msg]
-           (js/console.log "runtime-not-found" msg))
-
-         :supported-ops
-         (fn [{:keys [ops] :as msg}]
-           (swap! state assoc-in [::rid rid ::supported-ops] ops)
-           (refresh-ui [[::rid rid]])
-
-           (when (contains? ops :request-tap-history)
-
-             (when (not= rid previous-rid)
-               (when previous-rid ;; may be nil
-                 (cast! {:op :tap-unsubscribe :rid previous-rid}))
-               (cast! {:op :tap-subscribe :rid rid}))
-
-             (call! {:op :request-tap-history :rid rid :num 100}
-               {:tap-history
-                (fn [{:keys [rid oids] :as msg}]
-                  (let [data @state]
-                    (doseq [oid oids
-                            :when (not (get-in data [::oid oid :summary]))]
-                      (add-new-tap-obj state rid oid)))
-
-                  (swap! state assoc-in [::rid rid ::objects] (as-idents ::oid oids))
-                  (refresh-ui [[::rid rid]])
-                  )})))}))))
+              (assoc ::active-rid rid)
+              (update-in [::tap-page rid] dissoc ::object)
+              (update-in [::tap-page rid] assoc ::nav-stack []))))
+
+      (when (contains? (get-in @state [::rid rid ::supported-ops]) :request-tap-history)
+        (when (not= rid previous-rid)
+          (when previous-rid ;; may be nil
+            (cast! {:op :tap-unsubscribe :rid previous-rid}))
+          (cast! {:op :tap-subscribe :rid rid}))
+
+        (call! {:op :request-tap-history :rid rid :num 100}
+          {:tap-history
+           (fn [{:keys [rid oids] :as msg}]
+             (let [data @state]
+               (doseq [oid oids
+                       :when (not (get-in data [::oid oid :summary]))]
+                 (add-new-tap-obj state rid oid)))
+
+             (swap! state assoc-in [::tap-page rid ::objects] (as-idents ::oid oids))
+             (refresh-ui [[::tap-page rid]])
+             )}))
+      )))

 (defmutation unselect-object [{:keys [oid] :as params}]
   (action [{:keys [state] :as env}]
@@ -345,6 +360,16 @@
                     {::rid rid
                      ::runtime-info runtime-info}))
              (into []))]
+
+    (doseq [{:keys [rid]} runtimes]
+      (call!
+        {:op :request-supported-ops
+         :rid rid}
+        {:supported-ops
+         (fn [{:keys [ops] :as msg}]
+           (swap! state assoc-in [::rid rid ::supported-ops] ops)
+           (refresh-ui [[::rid rid]]))}))
+
     (swap! state fam/merge-component Page {::runtimes db-data})))

 (defmethod handle-tool-msg :runtime-not-found
@@ -593,7 +618,8 @@
    :query
    (fn []
      [::rid
-      ::runtime-info])}
+      ::runtime-info
+      ::supported-ops])}

   (html/div "runtime" (pr-str props)))

@@ -831,7 +857,7 @@
     (html/div {:style {:height "120px"}}
       (html/input {:ref (util/comp-fn this ::editor-ref attach-codemirror)}))))

-(defsc RuntimePage
+(defsc RuntimeTapPage
   [this {::keys [rid] :as props}]
   {:ident
    (fn []
@@ -945,6 +971,31 @@
       (when (contains? supported-ops :eval-clj)
         (ui-runtime-eval this props)))))

+(def ui-runtime-tap-page (fc/factory RuntimeTapPage {}))
+
+(defsc RuntimePage
+  [this {::keys [rid] :as props}]
+  {:ident
+   (fn []
+     [::runtime-page rid])
+
+   :query
+   (fn []
+     [::rid
+      {::runtime [::runtime-info
+                  ::supported-ops]}])}
+
+  (let [{::keys [runtime]} props
+        {::keys [runtime-info supported-ops]} runtime]
+    (html/fragment
+      (html/div
+        (html/h1 "Runtime Overview"))
+
+      (html/div (pr-str runtime-info))
+      (html/div (pr-str supported-ops))
+      (html/div {:className "flex-1"}
+        ))))
+
 (def ui-runtime-page (fc/factory RuntimePage {}))

 (defsc Page [this {::keys [runtimes runtime] :as props}]
@@ -966,7 +1017,15 @@
       (html/div
         {:key rid
          :className "p-2 border font-mono"}
-        (html/a {:href (str "/inspect/" rid)} (pr-str runtime-info))))))
+        (html/div
+          (pr-str runtime-info))
+        (html/div {:className "py-8"}
+          (let [ops (::supported-ops runtime)]
+            (when (contains? ops :tap-subscribe)
+              (html/a {:className "p-4 text-l rounded bg-blue-300"
+                       :href (str "/inspect/" rid "/tap")} "Tap"))
+
+            ))))))

 (def ui-page (fc/factory Page {}))

@@ -976,9 +1035,15 @@
   {:class Page
    :factory ui-page})

-(routing/register ::ui-model/root-router ::rid
+(routing/register ::ui-model/root-router ::runtime-page
   {:class RuntimePage
    :factory ui-runtime-page})
+
+(routing/register ::ui-model/root-router ::tap-page
+  {:class RuntimeTapPage
+   :factory ui-runtime-tap-page})
+
+

 (defn route [tokens]
   (if-not @tool-ref
@@ -998,9 +1063,24 @@
            {:router ::ui-model/root-router
             :ident [::ui-model/page-inspect 1]})])

-      (let [[rid & more] tokens
+      (let [[rid view & more] tokens
             rid (js/parseInt rid)]
-        (fc/transact! env/app
-          [(select-runtime {:rid rid})
-           (routing/set-route {:router ::ui-model/root-router
-                               :ident [::rid (js/parseInt rid)]})])))))
+
+        (ensure-runtime-init rid
+          [(routing/set-route
+             {:router ::ui-model/root-router
+              :ident [::ui-model/page-loading 1]})]
+          (fn []
+            (cond
+              (nil? view)
+              (fc/transact! env/app
+                [(select-runtime-page {:rid rid})
+                 (routing/set-route {:router ::ui-model/root-router
+                                     :ident [::runtime-page rid]})])
+
+              (= "tap" view)
+              (fc/transact! env/app
+                [(select-runtime-tap-page {:rid rid})
+                 (routing/set-route {:router ::ui-model/root-router
+                                     :ident [::tap-page rid]})])
+              )))))))


schema validation on scraper parsing

schema validation on scraper parsing

--- src/philly_show_checker/server/scraper.clj
+++ src/philly_show_checker/server/scraper.clj
@@ -1,5 +1,6 @@
 (ns philly-show-checker.server.scraper
   (:require [philly-show-checker.server.db                     :as db]
+            [schema.core                                       :as s]
             [clojure.string                                    :as string]
             [clojurewerkz.quartzite.scheduler                  :as scheduler]
             [clojurewerkz.quartzite.jobs                       :as jobs]
@@ -13,14 +14,22 @@
   [^clojure.lang.Symbol venue-name]
   (symbol (string/join "" (map string/capitalize (string/split (name venue-name) #"-")))))

+(def ParseResult
+  {(s/required-key :headliner) s/Str
+   (s/optional-key :openers)   (s/maybe [s/Str])
+   (s/required-key :venue)     s/Str
+   (s/required-key :price)     s/Num})
+
 (defmacro defscraper
   [venue-name url html-parser-fn]
   (let [job-name (->scraper-job-name venue-name)]
     `(do
        (jobs/defjob ~job-name
          [ctx#]
-         (let [resp# @(http-client/get ~url)]
-           (db/store-scraper-results (~html-parser-fn resp#))))
+         (let [resp# @(http-client/get ~url)
+               parse-result# (~html-parser-fn resp#)]
+           (s/validate ParseResult parse-result#)
+           (db/store-scraper-results parse-result#)))
        (swap! jobs assoc ~(keyword venue-name) ~job-name))))

 (defscraper union-transfer


Add behaviour to duplicate button on layers sidebar.

--- src/uxbox/ui/workspace/sidebar/layers.cljs
+++ src/uxbox/ui/workspace/sidebar/layers.cljs
@@ -283,7 +283,7 @@
         shapes-by-id (rum/react wb/shapes-by-id-l)
         page (rum/react (focus-page (:page workspace)))
         close #(rs/emit! (dw/toggle-flag :layers))
-        ;; copy #(rs/emit! (dw/copy-selected))
+        duplicate #(rs/emit! (dw/duplicate-selected))
         group #(rs/emit! (dw/group-selected))
         delete #(rs/emit! (dw/delete-selected))
         dragel (volatile! nil)]
@@ -304,7 +304,7 @@
                 (rum/with-key key))))]]
       [:div.layers-tools
        [:ul.layers-tools-content
-        [:li.clone-layer #_{:on-click copy} i/copy]
+        [:li.clone-layer {:on-click duplicate} i/copy]
         [:li.group-layer {:on-click group} i/folder]
         [:li.delete-layer {:on-click delete} i/trash]]]])))


Added more assertions into test-format-month-3 and test-format-day-3 tests

--- test/clj_calendar/format_datetime_test.clj
+++ test/clj_calendar/format_datetime_test.clj
@@ -124,7 +124,13 @@
         (are [x y] (= x y)
               "2 months ago" (format-month 2 1)
               "2 months ago" (format-month 2 2)
-              "2 months ago" (format-month 2 100))))
+              "2 months ago" (format-month 2 100)
+              "4 months ago" (format-month 4 1)
+              "4 months ago" (format-month 4 2)
+              "4 months ago" (format-month 4 100)
+              "100 months ago" (format-month 100 1)
+              "100 months ago" (format-month 100 2)
+              "100 months ago" (format-month 100 100))))

 (deftest test-format-day-1
     "Check the function clj-calendar.format-datetime/format-day."
@@ -146,7 +152,13 @@
         (are [x y] (= x y)
               "2 days and one hour ago"  (format-day 2 1)
               "2 days and 2 hours ago"   (format-day 2 2)
-              "2 days and 100 hours ago" (format-day 2 100))))
+              "2 days and 100 hours ago" (format-day 2 100)
+              "4 days and one hour ago"  (format-day 4 1)
+              "4 days and 2 hours ago"   (format-day 4 2)
+              "4 days and 100 hours ago" (format-day 4 100)
+              "100 days and one hour ago"  (format-day 100 1)
+              "100 days and 2 hours ago"   (format-day 100 2)
+              "100 days and 100 hours ago" (format-day 100 100))))

 (deftest test-format-hours-1
     "Check the function clj-calendar.format-datetime/format-hours."


more TODO

more TODO

--- test/com/billpiel/mem_tracer/core_test.clj
+++ test/com/billpiel/mem_tracer/core_test.clj
@@ -578,19 +578,16 @@
 - profiling features
   x use joda
   x arg cardinality
-- have all core fns optionally take an arg
-  - ws
-  - rec
-  - ws ns and rec ns fns should not take atoms
-- aliases for core fns
+x aliases for core fns
+- have all core rec fns optionally take an arg
 - never return ws or recs from core fns
+- deep trace (inside fn)
 - cursors
    - bisect recording trees to find bugs
 - split ns and fn name in trace rec and output
 - some kind of string output length limit options?
 - trace individual fns
 - show file and line num in output
-- deep trace (inside fn)
 - wrap args that are funcs
  - and deep search values for funcs?
 - wrap returns that are funcs


Eliminate unused reqiure

Eliminate unused reqiure

--- ClojureScript/replete/src/replete/core.cljs
+++ ClojureScript/replete/src/replete/core.cljs
@@ -8,7 +8,6 @@
             [cljs.analyzer :as ana]
             [cljs.compiler :as c]
             [cljs.env :as env]
-            [cljs.reader :as edn]
             [cognitect.transit :as t]
             [clojure.string :as s]))


use (vals) where possible

use (vals) where possible

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -148,8 +148,7 @@
                       (let [comps-map (comp-paths-to-bolts-map bolt-at model (+ 1 depth) max-depth)]
                         (when (not (some empty? (vals comps-map)))
                           (let [comp-paths (keys comps-map)
-                                comp-bolts (mapfn #(get comps-map %)
-                                                  comp-paths)]
+                                comp-bolts (vals comps-map)]
                             (mapfn #(do-defaults (assoc-in bolt path %) model)
                                    (add-comps bolt-at
                                               model
@@ -167,8 +166,7 @@
    (mapfn (fn [bolt]
             (let [comps-map (comp-paths-to-bolts-map bolt model 0 max-total-depth)
                   comp-paths (keys comps-map)
-                  comp-bolts (mapfn #(get comps-map %)
-                                    comp-paths)]
+                  comp-bolts (vals comps-map)]
               ;; filter by the following constraint:
               ;; that for every path that points to a complement of a bolt,
               ;; there is a non-empty set of bolts that satisfies


throw exception if no complements found for a bolt: indicates a problem with the grammar, lexicon, or both

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -191,10 +191,12 @@
   [bolt path model]
   (let [complements (gen (get-in bolt path) model 0 nil path)]
     (if (empty? complements)
-      (log/warn (str "(improve grammar): no complements found for: "
-                     ((:morph-ps model) bolt)
-                     "; spec=" (show-spec
-                                (get-in bolt path))))
+      (let [error-message
+            (str "(improve grammar): no complements found for: "
+                 ((:morph-ps model) bolt) "; path: [" (string/join "/" path) "]"
+                 "; spec=" (show-spec
+                            (get-in bolt path)))]
+        (throw (Exception. error-message)))
       (->>
        ;; set of all complements at _path_ for _bolt_:
        complements
@@ -213,7 +215,6 @@
 (defn get-lexemes [model spec]
   "Get lexemes matching the spec. Use a model's index if available, where the index is a function that we call with _spec_ to get a set of indices. otherwise use the model's entire lexeme."
   (->>
-
    (if (= false (get-in spec [:phrasal] false))
      (if-let [index-fn (:index-fn model)]
        (index-fn spec)


s/trace/debug/

s/trace/debug/

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -259,7 +259,7 @@
                                        (and (not-fail? (unify (get-in lexeme [:synsem] :top)
                                                               bolt-child-synsem))))
                                      complement-candidate-lexemes))]
-    (log/trace (str "lexical-complements (post-over):"
+    (log/debug (str "lexical-complements (post-over):"
                     (string/join ","
                                  (map #((:morph language-model) %)
                                       lexical-complements))))


more cleanup

more cleanup

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -160,13 +160,12 @@
 bolt, from deepest and working upward to the top. Return a lazy
 sequence of having added all possible complements at each node in the
 bolt."
-  (let [bolts (reduce concat bolt-groups)]
-    (lazy-mapcat
-     (fn [bolt]
-       (add-all-comps-with-paths [bolt] language-model total-depth
-                                 (find-comp-paths-in (bolt-depth bolt))
-                                 truncate-children max-total-depth))
-     bolts)))
+  (lazy-mapcat
+   (fn [bolt]
+     (add-all-comps-with-paths [bolt] language-model total-depth
+                               (find-comp-paths-in (bolt-depth bolt))
+                               truncate-children max-total-depth))
+   (reduce concat bolt-groups)))

 ;; TODO: make this non-recursive by using mapcat.
 (defn add-all-comps-with-paths [bolts language-model total-depth comp-paths truncate-children max-total-depth]


use dag_unify/get-in

use dag_unify/get-in

--- src/babel/italiano.cljc
+++ src/babel/italiano.cljc
@@ -1,11 +1,15 @@
 (ns babel.italiano
+  (:refer-clojure :exclude [get-in])
   (:require
    [babel.engine :as engine]
    [babel.italiano.grammar :refer [medium]]
    [babel.italiano.morphology :as morph :refer [fo]]
    [babel.generate :as generate :refer [try-hard-to]]
    [babel.parse :as parse]
-   [clojure.string :as string]))
+   [clojure.repl :refer [doc]]
+   [clojure.string :as string]
+   [dag_unify.core :refer (get-in strip-refs)]))
+
 (def lexicon (:lexicon medium))

 (defn analyze


add docstrings to test functions

add docstrings to test functions

--- src/cake/tasks/test.clj
+++ src/cake/tasks/test.clj
@@ -47,7 +47,9 @@
                             actual)))
       form)))

-(defn test-opts []
+(defn test-opts
+  "figure out whichs tests to run based on cake's command line options"
+  []
   (let [args (into (:test *opts*) (:autotest *opts*))]
     (merge {:tags #{} :functions #{} :namespaces #{}}
            (if (empty? args)
@@ -58,17 +60,16 @@
                                              :else         :namespaces)))
                        set)))))

+(defn report-assertion-fail
+  "report a test failure"
+  [name {:keys [file line message expected actual]}]
+  (println (ansi/style (format "FAIL in (%s) (%s:%d)" name file line) :red))
+  (when [message] (println message))
+  (println "expected:\n" expected "\nactual:\n" (actual-diff actual)))

-
-(defn report-fail [name m]
-  (println (ansi/style (format "FAIL in (%s) (%s:%d)" name (:file m) (:line m)) :red))
-  (when-let [message (:message m)]
-    (println message))
-  (println "expected:\n" (:expected m))
-  (println "actual:\n" (actual-diff (:actual m))))
-
-(defn report-error
-  "this is a hack of clj-stacktrace.repl/pst-on"
+;; this is a hack of clj-stacktrace.repl/pst-on
+(defn report-assertion-error
+  "report a test error"
   [name m]
   (letfn [(find-source-width [excp]
             (let [this-source-width (st-utils/fence
@@ -86,33 +87,39 @@
       (if-let [cause (:cause exec)]
         (#'st/pst-cause-on *out* true cause source-width)))))

-(defn report-test [ns test-result]
+(defn report-test
+  "reports an error or a failure for a test, or prints *out* if it exists."
+  [ns test-result]
   (let [[name {:keys [out assertions]}] test-result
         {:keys [pass fail error]} (group-by :type assertions)]
     (when (or out fail error)
       (println)
       (println (ansi/style (str "cake test " ns "/" name) :yellow))
       (when out (print out))
-      (when fail (doall (map (partial report-fail name) fail)))
-      (when error (doall (map (partial report-error name) error))))))
+      (when fail (doall (map (partial report-assertion-fail name) fail)))
+      (when error (doall (map (partial report-assertion-error name) error))))))

-(defn report-ns [ns results]
+(defn accumulate-assertions [acc [name {:keys [assertions]} :as all]]
+  (let [acc (update-in acc [:test-count] inc)]
+    (let [grouped (group-by :type assertions)
+          fail-count (count (:fail grouped))
+          pass-count (count (:pass grouped))
+          error-count (count (:error grouped))]
+      (-> acc
+          (update-in [:fail-count] + fail-count)
+          (update-in [:pass-count] + pass-count)
+          (update-in [:error-count] + error-count)
+          (update-in [:assertion-count] + fail-count pass-count error-count)))))
+
+(defn report-ns
+  "generate a summary for the namespace with `results`"
+  [ns results]
   (print (ansi/style (apply str (repeat 40 "-")) :white))
   (println (ansi/style (str"\ncake test " ns) :cyan))
   (doseq [test-result (doall (:tests results))]
     (report-test ns test-result))
   (let [{:keys [fail-count pass-count error-count assertion-count test-count] :as aggregate}
-        (reduce (fn [acc [name {:keys [assertions]}]]
-                  (let [acc (update-in acc [:test-count] inc)]
-                    (let [grouped (group-by :type assertions)
-                          fail-count (count (:fail grouped))
-                          pass-count (count (:pass grouped))
-                          error-count (count (:error grouped))]
-                      (-> acc
-                          (update-in [:fail-count] + fail-count)
-                          (update-in [:pass-count] + pass-count)
-                          (update-in [:error-count] + error-count)
-                          (update-in [:assertion-count] + fail-count pass-count error-count)))))
+        (reduce accumulate-assertions
                 {:ns ns, :test-count 0, :assertion-count 0, :pass-count 0, :fail-count 0, :error-count 0}
                 (:tests results))]
     (println (format "\nRan %s tests containing %s assertions."
@@ -127,14 +134,16 @@
                            :red)))
     aggregate))

-(defn run-project-tests [& opts]
+(defn run-project-tests
+  "run the tests based on the command line options"
+  [& opts]
   (with-test-classloader
     (bake-ns (:use bake.test clojure.test
                    [clojure.string :only [join]]
                    [bake.core :only [with-context in-project-classloader?]])
              (let [start (System/currentTimeMillis)
                    {:keys [ns-count test-count assertion-count pass-count fail-count error-count]}
-                   (reduce (fn [acc {:keys [ns test-count assertion-count pass-count fail-count error-count]}]
+                   (reduce (fn [acc {:keys [ns test-count assertion-count pass-count fail-count error-count] :as this-all}]
                              (-> acc
                                  (update-in [:ns-count] + 1)
                                  (update-in [:test-count] + test-count)


Status endpoint created.

Status endpoint created.

--- src/clj/medusa/core.clj
+++ src/clj/medusa/core.clj
@@ -14,6 +14,7 @@
                              [credentials :as creds])))

 (defroutes app
+  (GET "/status" [] "ok")
   (ANY "/login" []
        (resource/login))
   (ANY "/logout" []


CLJS-524: allow *-array fns to accept any seqable

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -2233,10 +2233,9 @@

 (defn int-array
   ([size-or-seq]
-     (cond
-      (number? size-or-seq) (int-array size-or-seq nil)
-      (seq? size-or-seq) (into-array size-or-seq)
-      :else (throw (js/Error. "int-array called with something other than size or ISeq"))))
+     (if (number? size-or-seq)
+       (int-array size-or-seq nil)
+       (into-array size-or-seq)))
   ([size init-val-or-seq]
      (let [a (make-array size)]
        (if (seq? init-val-or-seq)
@@ -2254,10 +2253,9 @@

 (defn long-array
   ([size-or-seq]
-     (cond
-      (number? size-or-seq) (long-array size-or-seq nil)
-      (seq? size-or-seq) (into-array size-or-seq)
-      :else (throw (js/Error. "long-array called with something other than size or ISeq"))))
+     (if (number? size-or-seq)
+       (long-array size-or-seq nil)
+       (into-array size-or-seq)))
   ([size init-val-or-seq]
      (let [a (make-array size)]
        (if (seq? init-val-or-seq)
@@ -2275,10 +2273,9 @@

 (defn double-array
   ([size-or-seq]
-     (cond
-      (number? size-or-seq) (double-array size-or-seq nil)
-      (seq? size-or-seq) (into-array size-or-seq)
-      :else (throw (js/Error. "double-array called with something other than size or ISeq"))))
+     (if (number? size-or-seq)
+       (double-array size-or-seq nil)
+       (into-array size-or-seq)))
   ([size init-val-or-seq]
      (let [a (make-array size)]
        (if (seq? init-val-or-seq)
@@ -2296,10 +2293,9 @@

 (defn object-array
   ([size-or-seq]
-     (cond
-      (number? size-or-seq) (object-array size-or-seq nil)
-      (seq? size-or-seq) (into-array size-or-seq)
-      :else (throw (js/Error. "object-array called with something other than size or ISeq"))))
+     (if (number? size-or-seq)
+       (object-array size-or-seq nil)
+       (into-array size-or-seq)))
   ([size init-val-or-seq]
      (let [a (make-array size)]
        (if (seq? init-val-or-seq)


* src/cljs/cljs/core.cljs: tag predicate fns w/ boolean return type

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -208,12 +208,12 @@
   (-remove-watch [this key]))

 ;;;;;;;;;;;;;;;;;;; fundamentals ;;;;;;;;;;;;;;;
-(defn identical?
+(defn ^boolean identical?
   "Tests if 2 arguments are the same object"
   [x y]
   (cljs.core/identical? x y))

-(defn =
+(defn ^boolean =
   "Equality. Returns true if x equals y, false if not. Compares
   numbers and collections in a type-independent manner.  Clojure's immutable data
   structures define -equiv (and thus =) as a value, not an identity,
@@ -221,7 +221,7 @@
   [x y]
   (-equiv x y))

-(defn nil?
+(defn ^boolean nil?
   "Returns true if x is nil, false otherwise."
   [x]
   (identical? x nil))
@@ -594,45 +594,45 @@
 (defn hash [o]
   (-hash o))

-(defn empty?
+(defn ^boolean empty?
   "Returns true if coll has no items - same as (not (seq coll)).
   Please use the idiom (seq x) rather than (not (empty? x))"
   [coll] (not (seq coll)))

-(defn coll?
+(defn ^boolean coll?
   "Returns true if x satisfies ICollection"
   [x]
   (if (nil? x)
     false
     (satisfies? ICollection x)))

-(defn set?
+(defn ^boolean set?
   "Returns true if x satisfies ISet"
   [x]
   (if (nil? x)
     false
     (satisfies? ISet x)))

-(defn associative?
+(defn ^boolean associative?
  "Returns true if coll implements Associative"
   [x] (satisfies? IAssociative x))

-(defn sequential?
+(defn ^boolean sequential?
   "Returns true if coll satisfies ISequential"
   [x] (satisfies? ISequential x))

-(defn counted?
+(defn ^boolean counted?
   "Returns true if coll implements count in constant time"
   [x] (satisfies? ICounted x))

-(defn map?
+(defn ^boolean map?
   "Return true if x satisfies IMap"
   [x]
   (if (nil? x)
     false
     (satisfies? IMap x)))

-(defn vector?
+(defn ^boolean vector?
   "Return true if x satisfies IVector"
   [x] (satisfies? IVector x))

@@ -652,59 +652,59 @@

 (def ^:private lookup-sentinel (js-obj))

-(defn false?
+(defn ^boolean false?
   "Returns true if x is the value false, false otherwise."
   [x] (cljs.core/false? x))

-(defn true?
+(defn ^boolean true?
   "Returns true if x is the value true, false otherwise."
   [x] (cljs.core/true? x))

-(defn undefined? [x]
+(defn ^boolean undefined? [x]
   (cljs.core/undefined? x))

-(defn instance? [t o]
+(defn ^boolean instance? [t o]
   (js* "(~{o} != null && (~{o} instanceof ~{t} || ~{o}.constructor === ~{t} || ~{t} === Object))"))

-(defn seq?
+(defn ^boolean seq?
   "Return true if s satisfies ISeq"
   [s]
   (if (nil? s)
     false
     (satisfies? ISeq s)))

-(defn boolean [x]
+(defn ^boolean boolean [x]
   (if x true false))

-(defn string? [x]
+(defn ^boolean string? [x]
   (and (goog/isString x)
        (not (or (= (.charAt x 0) \uFDD0)
                 (= (.charAt x 0) \uFDD1)))))

-(defn keyword? [x]
+(defn ^boolean keyword? [x]
   (and (goog/isString x)
        (= (.charAt x 0) \uFDD0)))

-(defn symbol? [x]
+(defn ^boolean symbol? [x]
   (and (goog/isString x)
        (= (.charAt x 0) \uFDD1)))

-(defn number? [n]
+(defn ^boolean number? [n]
   (goog/isNumber n))

-(defn fn? [f]
+(defn ^boolean fn? [f]
   (goog/isFunction f))

-(defn ifn? [f]
+(defn ^boolean ifn? [f]
   (or (fn? f) (satisfies? IFn f)))

-(defn integer?
+(defn ^boolean integer?
   "Returns true if n is an integer.  Warning: returns true on underflow condition."
   [n]
   (and (number? n)
        (js* "(~{n} == ~{n}.toFixed())")))

-(defn contains?
+(defn ^boolean contains?
   "Returns true if key is present in the given collection, otherwise
   returns false.  Note that for numerically indexed collections like
   vectors and arrays, this tests if the numeric key is within the
@@ -723,7 +723,7 @@
              (contains? coll k))
     [k (-lookup coll k)]))

-(defn distinct?
+(defn ^boolean distinct?
   "Returns true if no two of the arguments are ="
   ([x] true)
   ([x y] (not (= x y)))
@@ -852,7 +852,7 @@
   ([x y] (js* "(~{x} / ~{y})")) ;; FIXME: waiting on cljs.core//
   ([x y & more] (reduce / (/ x y) more)))

-(defn <
+(defn ^boolean <
   "Returns non-nil if nums are in monotonically increasing order,
   otherwise false."
   ([x] true)
@@ -864,7 +864,7 @@
          (cljs.core/< y (first more)))
        false)))

-(defn <=
+(defn ^boolean <=
   "Returns non-nil if nums are in monotonically non-decreasing order,
   otherwise false."
   ([x] true)
@@ -876,7 +876,7 @@
        (cljs.core/<= y (first more)))
      false)))

-(defn >
+(defn ^boolean >
   "Returns non-nil if nums are in monotonically decreasing order,
   otherwise false."
   ([x] true)
@@ -888,7 +888,7 @@
        (cljs.core/> y (first more)))
      false)))

-(defn >=
+(defn ^boolean >=
   "Returns non-nil if nums are in monotonically non-increasing order,
   otherwise false."
   ([x] true)
@@ -997,7 +997,7 @@
   "Bitwise shift right"
   [x n] (cljs.core/bit-shift-right x n))

-(defn ==
+(defn ^boolean ==
   "Returns non-nil if nums all have the equivalent
   value (type-independent), otherwise false"
   ([x] true)
@@ -1009,14 +1009,14 @@
        (== y (first more)))
      false)))

-(defn pos?
+(defn ^boolean pos?
   "Returns true if num is greater than zero, else false"
   [n] (cljs.core/pos? n))

-(defn zero? [n]
+(defn ^boolean zero? [n]
   (cljs.core/zero? n))

-(defn neg?
+(defn ^boolean neg?
   "Returns true if num is less than zero, else false"
   [x] (cljs.core/neg? x))

@@ -1219,7 +1219,7 @@

 (set! cljs.core.List/EMPTY (EmptyList. nil))

-(defn reversible? [coll]
+(defn ^boolean reversible? [coll]
   (satisfies? IReversible coll))

 (defn rseq [coll]
@@ -1271,7 +1271,7 @@
   [x seq]
   (Cons. nil x seq))

-(defn list? [x]
+(defn ^boolean list? [x]
   (satisfies? IList x))

 (extend-type string
@@ -1480,7 +1480,7 @@
  [obj f & args]
  (with-meta obj (apply f (meta obj) args)))

-(defn not=
+(defn ^boolean not=
   "Same as (not (= obj1 obj2))"
   ([x] false)
   ([x y] (not (= x y)))
@@ -1491,7 +1491,7 @@
   "If coll is empty, returns nil, else coll"
   [coll] (when (seq coll) coll))

-(defn every?
+(defn ^boolean every?
   "Returns true if (pred x) is logical true for every x in coll, else
   false."
   [pred coll]
@@ -1500,7 +1500,7 @@
    (pred (first coll)) (recur pred (next coll))
    :else false))

-(defn not-every?
+(defn ^boolean not-every?
   "Returns false if (pred x) is logical true for every x in
   coll, else true."
   [pred coll] (not (every? pred coll)))
@@ -1514,24 +1514,24 @@
     (when (seq coll)
       (or (pred (first coll)) (recur pred (next coll)))))

-(defn not-any?
+(defn ^boolean not-any?
   "Returns false if (pred x) is logical true for any x in coll,
   else true."
   [pred coll] (not (some pred coll)))

-(defn even?
+(defn ^boolean even?
   "Returns true if n is even, throws an exception if n is not an integer"
    [n] (if (integer? n)
         (zero? (bit-and n 1))
         (throw (js/Error. (str "Argument must be an integer: " n)))))

-(defn odd?
+(defn ^boolean odd?
   "Returns true if n is odd, throws an exception if n is not an integer"
   [n] (not (even? n)))

 (defn identity [x] x)

-(defn complement
+(defn ^boolean complement
   "Takes a fn f and returns a fn that takes the same arguments as f,
   has the same effects, if any, and returns the opposite truth value."
   [f]
@@ -3510,7 +3510,7 @@
   (-realized? [d]
     (:done @state)))

-(defn delay?
+(defn ^boolean delay?
   "returns true if x is a Delay created with delay"
   [x] (instance? cljs.core.Delay x))

@@ -3521,7 +3521,7 @@
     (deref x)
     x))

-(defn realized?
+(defn ^boolean realized?
   "Returns true if a value has been produced for a promise, delay, future or lazy sequence."
   [d]
   (-realized? d))
@@ -3611,7 +3611,7 @@
   ^{:private true}
   global-hierarchy (atom (make-hierarchy)))

-(defn isa?
+(defn ^boolean isa?
   "Returns true if (= child parent), or child is directly or indirectly derived from
   parent, either via a Java type inheritance relationship or a
   relationship established via derive. h must be a hierarchy obtained


Seems to work now

Seems to work now

Printed an aubergine

--- src/cljs/game/sprs.cljs
+++ src/cljs/game/sprs.cljs
@@ -14,7 +14,7 @@
     [cloj.resources.html    :as rmhtml]

     [cloj.math.misc         :refer [cos-01 log-base-n ceil floor num-digits]]
-    [cloj.math.vec2         :as v2 :refer [v2]]
+    [cloj.math.vec2         :as v2 :refer [vec2]]
     [cloj.math.vec3         :as v3 :refer [vec3]]

     [cloj.system            :refer [get-resource-manager
@@ -41,7 +41,7 @@
        [x y w h])
      (width [_] w)
      (height [_] h)
-     (img [_] (rman/img img))))
+     (img [_] img)))

   ([img id x y w h]
    (mk-spr img id [x y w h])))
@@ -64,8 +64,9 @@
   (reduce (fn [m v]
             (assoc m v (k->file-name v))) {} spr-keys))

+
 (defn load-sprs [rman sprs]
-  (let [spr-chan (->> (map #((rman/load-img! rman % (k->file-name  %))) (keys sprs) )
+  (let [spr-chan (->> (map #(rman/load-img! rman % (k->file-name  %)) (keys sprs) )
                       (async/merge)
                       (async/into ()))
         ret-chan (chan) ]
@@ -75,34 +76,44 @@
             (->>
               (<! spr-chan)
               (mapcat  (fn [i]
-                         (let [img      (rman/img i)
-                               spr-list ((rman/id i) sprs) ]
-                           (map (fn [ [id & dims ] ] [id (mk-spr img id dims)] ) spr-list  ))))
+                         (->
+                           (fn [[sprite-id dims]]
+                             [sprite-id (mk-spr (rman/img i) sprite-id dims)])
+                           (map ((rman/id i) sprs)))))
               (into {}))))
     ret-chan))

-(defn mk-spr-printer [spr-seq])
-
+(defn mk-spr-printer [rend sprs]
+  (reify
+    rp/IRenderBackend
+    (spr! [this img-key pos]
+      (let [i-img (img-key sprs)]
+        (println img-key)
+        (println (type i-img ))
+        (rp/spr! rend i-img pos)))))

 (do
   (def system (mk-system "game" "game-canvas"))
-
-  (let [rman (get-resource-manager system)
-        rend (get-render-engine system)
-        spr-ch (load-sprs rman spr-data) ]
-
-    (go
-      (let [sprs (<! spr-ch)]
-        (println "loaded")
-        )
-      )
+  (def rman (get-resource-manager system))
+  (def rend (get-render-engine system))
+  (def spr-ch (load-sprs rman spr-data))

-
-    )
-
-
-  )
+
+  (go
+    (let [sprs (<! spr-ch)
+          spr-printer (mk-spr-printer rend sprs)
+          ]
+      (println "loaded")
+      (doseq [k (keys sprs)]
+        (println k)
+        (println (type (k sprs)))
+        (println (rman/dims  (k sprs))))
+      (rp/clear! rend [0 0 1])
+      (rp/spr! spr-printer :aubergine (vec2 10 10))
+      ))
+
+  (println "started loading "))

 ;;; }}}


Remove Unsused Util Import

Remove Unsused Util Import

--- src/cljs/lens/core.cljs
+++ src/cljs/lens/core.cljs
@@ -18,8 +18,7 @@
             [lens.item-dialog :refer [item-dialog]]
             [lens.alert :as alert :refer [alert alert!]]
             [lens.workbook :refer [workbook]]
-            [lens.workbooks :refer [workbooks]]
-            [lens.util :as util]))
+            [lens.workbooks :refer [workbooks]]))

 (enable-console-print!)
 (s/set-fn-validation! js/enableSchemaValidation)


Fix latex repr of contexts

Fix latex repr of contexts

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

--- src/conexp/io/latex.clj
+++ src/conexp/io/latex.clj
@@ -35,7 +35,7 @@
                  (println "\\[")
                  (println (str "\\begin{array}{l||*{" (count (attributes this)) "}{c|}}"))
                  (doseq [m (attributes this)]
-                   (print (str "& " m)))
+                   (print (str "& \\text{" m "}")))
                  (println "\\\\\\hline\\hline")
                  (doseq [g (objects this)]
                    (print (str g))


keywordizing node

keywordizing node

--- src/docker/provider.clj
+++ src/docker/provider.clj
@@ -86,7 +86,7 @@
 (defmethod translate :docker [{:keys [machine docker system-id] :as spec}]
   "Convert the general model into a docker specific one"
   (let [{:keys [node]} docker]
-    (into [node system-id]
+    (into [(keyword node) system-id]
           (-> (merge machine docker)
               (mappings {:mount-bindings :binds :cpus :cpu-shares})
               (transform {:port-bindings to-binds :exposed-ports empty-hashes-map


Handle esprima's exceptions.

Handle esprima's exceptions.

--- src/harnocode/core.cljs
+++ src/harnocode/core.cljs
@@ -144,14 +144,17 @@
     (string/join "\n" result)))              ; img must be resized by now, no need in w

 (defn validate [code img w]
-  (let [ast-before (js->clj (js/esprima.parse code))
-        harnocode  (harnify code img w)
-        ast-after  (js->clj (js/esprima.parse harnocode))
-        _ (println "-----")
-        msg        (if (= ast-before ast-after)
-                    "OK"
-                    (str "Differs: " (js/escodegen.generate ast-after)) "\nFAIL")]
-    (println msg)))
+  (try
+    (let [ast-before (js->clj (js/esprima.parse code))
+          harnocode  (harnify code img w)
+          ast-after  (js->clj (js/esprima.parse harnocode))
+          _ (println "-----")
+          msg        (if (= ast-before ast-after)
+                      "OK"
+                      (str "Differs: " (js/escodegen.generate ast-after)) "\nFAIL")]
+      (println msg))
+    (catch js/Error e
+      (println "Parse error: " e))))

 ;; TODO: add unused tokens


Changed from reset! to swap!

Changed from reset! to swap!

--- src/loudmoauth/core.clj
+++ src/loudmoauth/core.clj
@@ -42,7 +42,7 @@
   [provider]
   (let [provider-data (p/provider-reverse-lookup provider @lma/providers)
         state (keyword (:state provider-data))]
-      (reset! lma/providers (dissoc @lma/providers state))))
+      (swap! lma/providers dissoc @lma/providers state)))

 ;Reverser match on provider name instead of state
 ;Here we either supply our key or don't. If no key, just return (first tokens)


Move a document comment

Move a document comment

--- src/magician/string.clj
+++ src/magician/string.clj
@@ -1,7 +1,7 @@
+;;;; Magician's extensions to the String class.
+
 (ns magician.string
   (:require [clojure.string]))
-
-;;;; Magician's extensions to the String class.

 (defn palindrome?
   "Returns true if a string is a palindrome.


Remove now redundant 'true' within try branch of healthy?

--- src/party/discovery.clj
+++ src/party/discovery.clj
@@ -55,7 +55,6 @@
   (boolean
     (try
       (.queryForNames *service-discovery*)
-      true
       (catch Exception e
         (warn e "Service discovery failed to get service names from Zookeeper")))))


Improve readability

Improve readability

Change-Id: I42973ff14651de94c01faca6e78c29c2d61484b3

--- src/qcast/feed/feed.clj
+++ src/qcast/feed/feed.clj
@@ -63,9 +63,9 @@

 ;;; Interface

-(defn serve [media data]
+(defn serve [media-type data]
   (let [entries (map :data data)
-        items (map #(feed-item media %) entries)
+        items (map #(feed-item media-type %) entries)
         change-date (or (:publish-date (first entries)) 0)
         channel (feed-channel change-date)
         extensions [:atom :itunes :simple-chapters]]


Fix wrongly placed preventDefault that prevented typing into input fields

--- src/reabledit/core.cljs
+++ src/reabledit/core.cljs
@@ -20,13 +20,16 @@
 (defn handle-editing-mode-key-down
   [e ui-state id]
   (if (= 13 (.-keyCode e))
-    (do (swap! ui-state dissoc :edit-mode)
-        ;; Dirty as fudge, but what can you do with Reagent?
-        (.focus (.getElementById js/document id)))
+    (do
+      (.preventDefault e)
+      (swap! ui-state dissoc :edit-mode)
+      ;; Dirty as fudge, but what can you do with Reagent?
+      (.focus (.getElementById js/document id)))
     nil))

 (defn handle-selection-mode-key-down
   [e rows cols ui-state]
+  (.preventDefault e)
   (let [keycode (.-keyCode e)
         current-row (first (:selected @ui-state))
         current-col (second (:selected @ui-state))
@@ -42,7 +45,6 @@

 (defn handle-key-down
   [e rows cols ui-state id]
-  (.preventDefault e)
   (if (:edit-mode @ui-state)
     (handle-editing-mode-key-down e ui-state id)
     (handle-selection-mode-key-down e rows cols ui-state)))


Ugh, reorder combine after smap*.

Ugh, reorder combine after smap*.

--- src/riemann/streams.clj
+++ src/riemann/streams.clj
@@ -142,13 +142,6 @@
           (call-rescue (expire event) [true-stream])
           (call-rescue event [false-stream]))))))

-(defn combine
-  "Returns a function which takes a seq of events.
-  Combines events with f, then forwards the result to children."
-  [f & children]
-  (deprecated "combine is deprecated in favor of smap or smap*"
-              (apply smap* f children)))
-
 (defn smap*
   "Streaming map: less magic. Calls children with (f event).
   Unlike smap, passes on nil results to children. Example:
@@ -169,6 +162,13 @@
     (let [value (f event)]
       (when-not (nil? value)
         (call-rescue value children)))))
+
+(defn combine
+  "Returns a function which takes a seq of events.
+  Combines events with f, then forwards the result to children."
+  [f & children]
+  (deprecated "combine is deprecated in favor of smap or smap*"
+              (apply smap* f children)))

 (defn smapcat
   "Streaming mapcat. Calls children with each event in (f event), which should


removed superfluous prn statement

removed superfluous prn statement

--- src/tile_game/board.clj
+++ src/tile_game/board.clj
@@ -162,6 +162,5 @@
 (defn solve-next [board]
   (if-not (solved? board)
     (let [next (+ 1 (count (solved-tiles board)))]
-      (prn :solve-next next)
       (solve-tile board next))))


Functions read-words-for-pattern, read-words-with-status, and read-deleted-words should accept dictionary type as required parameter

--- src/zg/db_interface.clj
+++ src/zg/db_interface.clj
@@ -98,30 +98,40 @@
             [])))

 (defn read-words-for-pattern
-    [pattern]
+    "Read all words that are like specified pattern from both dictionaries
+     (dictionary-type is nil) or from selected dictionary (dictionary-type is specified)."
+    [pattern dictionary-type]
     (try
         (jdbc/query db-spec/zg-db
-                        ["select * from dictionary where word like ? order by word" (str "%" pattern "%")])
+                        ["select * from dictionary where word like ? and dictionary=? order by word"
+                        (str "%" pattern "%") (dictionary-type->char dictionary-type)])
         (catch Exception e
             (println e)
             nil)))

 (defn read-words-with-status
-    [status]
+    "Read all words with specified status (deleted/active) from both dictionaries
+     (dictionary-type is nil) or from selected dictionary (dictionary-type is specified)."
+    [status dictionary-type]
     (try
         (jdbc/query db-spec/zg-db
-                        ["select * from dictionary where deleted = ? order by word" (status->int status)])
+                        ["select * from dictionary where deleted = ? and dictionary=? order by word"
+                        (status->int status) (dictionary-type->char dictionary-type)])
         (catch Exception e
             (println e)
             [])))

 (defn read-deleted-words
-    []
-    (read-words-with-status :deleted))
+    "Read all deleted words from both dictionaries (dictionary-type is nil) or
+     from selected dictionary (dictionary-type is specified)."
+    [dictionary-type]
+    (read-words-with-status :deleted dictionary-type))

 (defn read-active-words
-    []
-    (read-words-with-status :undeleted))
+    "Read all undeleted words from both dictionaries (dictionary-type is nil) or
+     from selected dictionary (dictionary-type is specified)."
+    [dictionary-type]
+    (read-words-with-status :undeleted dictionary-type))

 (defn read-changes-statistic
     []


+(def verb coach)

+(def verb coach)

--- test/babel/test/en.cljc
+++ test/babel/test/en.cljc
@@ -21,6 +21,7 @@

 (def medium (grammar/medium))
 (def small (grammar/small))
+(def verbcoach (grammar/verbcoach))

 (deftest generate-irregular-present-1
   (let [form {:english {:a {:cat :verb,


re-enable tests

re-enable tests

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -596,12 +596,11 @@
         simple (unify base-spec
                       {:synsem {:sem {:aspect :simple}}})]
     ;; simple present:
-;    (is (= "io mangio" (morph (generate simple))))
+    (is (= "io mangio" (morph (generate simple))))

     ;; progressive present:
-    (is (= "io sto mangiando" (morph (generate progressive))))
-    ))
-
-
-
-
+    (is (= "io sto mangiando" (morph (generate progressive))))))
+
+
+
+


add future tests for sort-by-qname

add future tests for sort-by-qname

--- test/cljam/t_sorter.clj
+++ test/cljam/t_sorter.clj
@@ -18,9 +18,17 @@
                           (sam/writer tmp-coordinate-sorted-sam-file)) => nil
       (sorter/sort-by-pos (bam/reader test-bam-file)
                           (bam/writer tmp-coordinate-sorted-bam-file)) => nil
+      (sorter/sort-by-qname (sam/reader test-sam-file)
+                            (sam/writer tmp-queryname-sorted-sam-file)) =future=> nil
+      (sorter/sort-by-qname (bam/reader test-bam-file)
+                            (bam/writer tmp-queryname-sorted-bam-file)) =future=> nil
       (sorter/sorted-by? (sam/reader test-sam-file)) => falsey
       (sorter/sorted-by? (sam/reader tmp-coordinate-sorted-sam-file)) => truthy
       (sorter/sorted-by? (bam/reader tmp-coordinate-sorted-bam-file)) => truthy
+      (sorter/sorted-by? (sam/reader tmp-queryname-sorted-sam-file)) =future=> truthy
+      (sorter/sorted-by? (bam/reader tmp-queryname-sorted-bam-file)) =future=> truthy
       (sorter/sort-order (sam/reader test-sam-file)) => sorter/order-unknown
       (sorter/sort-order (sam/reader tmp-coordinate-sorted-sam-file)) => sorter/order-coordinate
-      (sorter/sort-order (bam/reader tmp-coordinate-sorted-bam-file)) => sorter/order-coordinate))
+      (sorter/sort-order (bam/reader tmp-coordinate-sorted-bam-file)) => sorter/order-coordinate
+      (sorter/sort-order (sam/reader tmp-queryname-sorted-sam-file)) =future=> sorter/order-queryname
+      (sorter/sort-order (bam/reader tmp-queryname-sorted-bam-file)) =future=> sorter/order-queryname))