more card implementation

more card implementation

--- src/node/game/cards.cljs
+++ src/node/game/cards.cljs
@@ -2,7 +2,8 @@
   (:require-macros [game.macros :refer [effect req msg]])
   (:require [game.core :refer [pay gain lose draw move damage shuffle-into-deck trash purge add-prop
                                set-prop resolve-ability system-msg end-run unregister-event mill run
-                               gain-agenda-point pump access-bonus shuffle! runner-install] :as core]
+                               gain-agenda-point pump access-bonus shuffle! runner-install
+                               play-instant] :as core]
             [clojure.string :refer [join]]
             [game.utils :refer [has?]]))

@@ -129,10 +130,10 @@
    {:recurring 1}

    "Clone Chip"
-   {:abilities [{:prompt "Choose an program to install" :msg (msg "installs " (:title target))
+   {:abilities [{:prompt "Choose a program to install" :msg (msg "installs " (:title target))
                  :choices (req (filter #(and (has? % :type "Program")
                                              (<= (:cost %) (:credit runner))) (:discard runner)))
-                 :effect (effect (runner-install target) (trash card))}]}
+                 :effect (effect (gain :click 1) (runner-install target) (trash card))}]}

    "Clone Retirement"
    {:msg "remove 1 bad publicity" :effect (effect (lose :bad-publicity 1))
@@ -179,6 +180,10 @@
     :events {:runner-turn-begins {:msg "gain 2 [Credits]" :counter-cost 2
                                   :effect #(do (gain %1 :runner :credit 2)
                                                (when (zero? (:counter %3)) (trash %1 :runner %3)))}}}
+
+   "Data Dealer"
+   {:abilities [{:cost [:click 1] :effect (effect (gain :credit 10))
+                 :msg "forfeit an Agenda and gain 10 [Credits]"}]}

    "Data Folding"
    {:events {:runner-turn-begins {:req (req (>= (:memory runner) 2)) :msg "gain 1 [Credits]"
@@ -643,6 +648,9 @@
    "Paper Tripping"
    {:req (req (not (:spent-click runner-reg))) :effect (effect (lose :tag :all))}

+   "Parasite"
+   {:events {:runner-turn-begins {:effect (effect (add-prop card :counter 1))}}}
+
    "Paricia"
    {:recurring 2}

@@ -751,6 +759,13 @@
    "Sahasrara"
    {:recurring 2}

+   "Same Old Thing"
+   {:abilities [{:cost [:click 2]
+                 :prompt "Choose an event to install" :msg (msg "play " (:title target))
+                 :choices (req (filter #(and (has? % :type "Event")
+                                             (<= (:cost %) (:credit runner))) (:discard runner)))
+                 :effect (effect (gain :click 1) (play-instant target) (trash card))}]}
+
    "Scorched Earth"
    {:req (req tagged) :effect (effect (damage :meat 4))}

@@ -758,11 +773,12 @@
    {:recurring 2}

    "Self-modifying Code"
-   {:abilities [{:prompt "Choose an program to install" :msg (msg "installs " (:title target))
+   {:abilities [{:prompt "Choose a program to install" :msg (msg "installs " (:title target))
                  :choices (req (filter #(and (has? % :type "Program")
                                              (<= (:cost %) (- (:credit runner) 2))) (:deck runner)))
                  :cost [:credit 2]
-                 :effect (effect (runner-install target) (trash card) (shuffle! :deck))}]}
+                 :effect (effect (gain :click 1) (runner-install target) (trash card)
+                                 (shuffle! :deck))}]}

    "Sentinel Defense Program"
    {:events {:damage {:req (req (= target :brain)) :msg "to do 1 net damage"


Fix conflicting schema requirements for offset reset.

--- src/onyx/tasks/kafka.clj
+++ src/onyx/tasks/kafka.clj
@@ -48,7 +48,7 @@
     topic :- s/Str
     group-id :- s/Str
     zookeeper :- s/Str
-    offset-reset :- (s/enum :smallest :largest)
+    offset-reset :- (s/enum :earliest :latest)
     deserializer-fn :- os/NamespacedKeyword
     task-opts :- {s/Any s/Any}]
    (consumer task-name (merge {:kafka/topic topic


Test what the nonce is

Test what the nonce is

--- test/caesium/magicnonce/secretbox_test.clj
+++ test/caesium/magicnonce/secretbox_test.clj
@@ -22,4 +22,6 @@
     (is (= (+ s/noncebytes
               (alength ^bytes st/ptext)
               s/macbytes)
-           (alength ^bytes ctext)))))
+           (alength ^bytes ctext)))
+    (is (= (range s/noncebytes)
+           (take s/noncebytes ctext)))))


Query for marker-mid value

Query for marker-mid value

--- src/planviz/components.cljs
+++ src/planviz/components.cljs
@@ -280,6 +280,7 @@
       ;; for display
       :edge/selected?
       :edge/number
+      :edge/marker-mid                                      ;can be cancel, cancelled or check_mark
       {:edge/from ?node} {:edge/to ?node}])
   Object
   (render [this]


Refactor the "child" callbacks from handshake test

Really just trimming it down a bit to try to make it a bit more
readable.

Fixed one bug that involved trying to read a keyword as a string. Now I
get a different stack trace at the end of the test. Along with the same
test failures that have been part of the past couple of commits.

--- test/frereth_cp/message/handshake_test.clj
+++ test/frereth_cp/message/handshake_test.clj
@@ -11,6 +11,9 @@
             [manifold.deferred :as dfrd]
             [manifold.stream :as strm])
   (:import io.netty.buffer.Unpooled))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; Helper functions

 ;;;; TODO: Consolidate these next 2 to eliminate duplication
 (defn srvr->client-consumer
@@ -58,6 +61,139 @@
             (dfrd/error! succeeded? problem)))
         (message/parent->! server-io bs)))))

+(defn server-mock-child
+  [server-atom chzbrgr-length bs]
+  (let [prelog (utils/pre-log "Server's child callback")
+        incoming (if-not (keyword? bs)
+                   (edn/read-string (String. bs))
+                   bs)
+        _ (log/debug prelog
+                     (str "Matching '" incoming
+                          "', a " (class incoming)) )
+        rsp (condp = incoming
+              ::ohai! ::orly?
+              ::yarly ::kk
+              ::icanhazchzbrgr? ::kk
+              ::kthxbai ::kk
+              ::specs/normal ::specs/normal)]
+    (log/info prelog
+              "Server received"
+              incoming
+              "\nwhich triggers"
+              rsp)
+    (if (not= rsp ::specs/normal)
+      (let [actual (.getBytes (pr-str rsp))]
+        (m-t/try-multiple-sends message/child->!
+                                prelog
+                                5
+                                @server-atom
+                                actual
+                                "Message buffered to child"
+                                "Giving up on forwarding to child"
+                                {::response rsp
+                                 ::request incoming}))
+      (message/close! @server-atom))
+    (when (= incoming ::icanhazchzbrgr?)
+      ;; One of the main points is that this doesn't need to be a lock-step
+      ;; request/response.
+      (log/info prelog "Client requested chzbrgr. Send out of lock-step")
+      (let [chzbrgr (byte-array (range chzbrgr-length))]
+        (m-t/try-multiple-sends message/child->!
+                                prelog
+                                5
+                                @server-atom
+                                chzbrgr
+                                "Buffered chzbrgr to child"
+                                "Giving up on sending chzbrgr"
+                                {})))))
+
+(defn mock-client-child
+  [client-atom client-state succeeded? chzbrgr-length bs]
+  (is bs)
+  (let [s (if-not (keyword? bs)
+            (String. bs)
+            ;; It's wasteful to convert this to a string just
+            ;; so I can read the next line.
+            ;; Then again, this entire approach is broken and needs
+            ;; to be revisited.
+            (pr-str bs))
+        ;; This approach was wishful thinking. I've been getting
+        ;; lucky up to now, because it happened to work.
+        ;; Now that I'm getting close to a working implementation,
+        ;; I'm receiving a real stream of bytes instead of the distinct
+        ;; messages that I was receiving initially.
+        ;; That is what I want, but it complicates this test.
+        ;; TODO: Need to cope with this.
+        incoming (edn/read-string s)
+        prelog (utils/pre-log "Handshake Client: child callback")]
+    (is (< 0 (count s)))
+    (is incoming)
+    (log/info prelog
+              (str "Client State: "
+                   @client-state
+                   "\nreceived: "
+                   incoming ", a " (class incoming)))
+    (let [next-message
+          (condp = @client-state
+            0 (do
+                (is (= incoming ::orly?))
+                ::yarly)
+            1 (do
+                (is (= incoming ::kk))
+                ::icanhazchzbrgr?)
+            2 (do
+                (is (= incoming ::kk))
+                ;; This is the protocol-level ACK
+                ;; (which is different than the CurveCP
+                ;; ACK message) associated
+                ;; with the chzbrgr request
+                ;; No response to send for this
+                nil)
+            3 (do
+                ;; This is based around an implementation
+                ;; detail that the message stream really consists
+                ;; of either
+                ;; a) the same byte array sent by the other side
+                ;; b) several of those byte arrays, if the block
+                ;; is too big to send all at once.
+                ;; TODO: don't rely on that.
+                ;; It really would be more efficient for the other
+                ;; side to batch up the ACK and this response
+                (is (b-t/bytes= incoming (byte-array (range chzbrgr-length))))
+                ::kthxbai)
+            4 (do
+                (is (= incoming ::kk))
+                (log/info "Client child callback is done")
+                (dfrd/success! succeeded? ::kthxbai)
+                (try
+                  (message/close! @client-atom)
+                  (catch RuntimeException ex
+                    ;; CIDER doesn't realize that this is a failure.
+                    ;; I blame something screwy in the testing
+                    ;; harness. I *do* see this error message
+                    ;; and the stack trace.
+                    (log/error ex "This really shouldn't pass")
+                    (is (not ex))))
+                nil))]
+      (swap! client-state inc)
+      ;; Hmm...I've wound up with a circular dependency
+      ;; on the io-handle again.
+      ;; Q: Is this a problem with my architecture, or just
+      ;; a testing artifact?
+      (when next-message
+        (let [actual (.getBytes (pr-str next-message))]
+          (m-t/try-multiple-sends message/child->!
+                                  prelog
+                                  5
+                                  @client-atom
+                                  actual
+                                  (str "Buffered bytes from child")
+                                  "Giving up on sending message from child"
+                                  {}))))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; Tests functions
+
 (deftest handshake
   (let [prelog (utils/pre-log "Handshake test")]
     (log/info prelog
@@ -80,83 +216,8 @@
           ;; Although this *does* take me back to the beginning, where
           ;; I was trying to figure out ways to gen the tests based upon
           ;; a protocol defined by something like spec.
-          cheezburgr-length 182
-          client-child-cb (fn [bs]
-                            (is bs)
-                            (let [s (String. bs)
-                                  ;; This approach was wishful thinking. I've been getting
-                                  ;; lucky up to now, because it happened to work.
-                                  ;; Now that I'm getting close to a working implementation,
-                                  ;; I'm receiving a real stream of bytes instead of the distinct
-                                  ;; messages that I was receiving initially.
-                                  ;; That is what I want, but it complicates this test.
-                                  ;; TODO: Need to cope with this.
-                                  incoming (edn/read-string s)
-                                  prelog (utils/pre-log "Handshake Client: child callback")]
-                              (is (< 0 (count s)))
-                              (is incoming)
-                              (log/info prelog
-                                        (str "Client State: "
-                                             @client-state
-                                             "\nreceived: "
-                                             incoming ", a " (class incoming)))
-                              (let [next-message
-                                    (condp = @client-state
-                                      0 (do
-                                          (is (= incoming ::orly?))
-                                          ::yarly)
-                                      1 (do
-                                          (is (= incoming ::kk))
-                                          ::icanhazchzbrgr?)
-                                      2 (do
-                                          (is (= incoming ::kk))
-                                          ;; This is the protocol-level ACK
-                                          ;; (which is different than the CurveCP
-                                          ;; ACK message) associated
-                                          ;; with the chzbrgr request
-                                          ;; No response to send for this
-                                          nil)
-                                      3 (do
-                                          ;; This is based around an implementation
-                                          ;; detail that the message stream really consists
-                                          ;; of either
-                                          ;; a) the same byte array sent by the other side
-                                          ;; b) several of those byte arrays, if the block
-                                          ;; is too big to send all at once.
-                                          ;; TODO: don't rely on that.
-                                          ;; It really would be more efficient for the other
-                                          ;; side to batch up the ACK and this response
-                                          (is (b-t/bytes= incoming (byte-array (range cheezburgr-length))))
-                                          ::kthxbai)
-                                      4 (do
-                                          (is (= incoming ::kk))
-                                          (log/info "Client child callback is done")
-                                          (dfrd/success! succeeded? ::kthxbai)
-                                          (try
-                                            (message/close! @client-atom)
-                                            (catch RuntimeException ex
-                                              ;; CIDER doesn't realize that this is a failure.
-                                              ;; I blame something screwy in the testing
-                                              ;; harness. I *do* see this error message
-                                              ;; and the stack trace.
-                                              (log/error ex "This really shouldn't pass")
-                                              (is (not ex))))
-                                          nil))]
-                                (swap! client-state inc)
-                                ;; Hmm...I've wound up with a circular dependency
-                                ;; on the io-handle again.
-                                ;; Q: Is this a problem with my architecture, or just
-                                ;; a testing artifact?
-                                (when next-message
-                                  (let [actual (.getBytes (pr-str next-message))]
-                                    (m-t/try-multiple-sends message/child->!
-                                                            prelog
-                                                            5
-                                                            @client-atom
-                                                            actual
-                                                            (str "Buffered bytes from child")
-                                                            "Giving up on sending message from child"
-                                                            {}))))))
+          chzbrgr-length 182
+          client-child-cb (partial mock-client-child client-atom client-state succeeded? chzbrgr-length)

           server-atom (atom nil)
           server-parent-cb (fn [bs]
@@ -164,48 +225,7 @@
                                        "Sending a" (class bs) "to server's parent")
                              (let [sent (strm/try-put! server->client bs time-out ::timed-out)]
                                (is (not= @sent ::timed-out))))
-          server-child-cb (fn [bs]
-                            (let [prelog (utils/pre-log "Server's child callback")
-                                  incoming (edn/read-string (String. bs))
-                                  _ (log/debug prelog
-                                               (str "Matching '" incoming
-                                                    "', a " (class incoming)) )
-                                  rsp (condp = incoming
-                                        ::ohai! ::orly?
-                                        ::yarly ::kk
-                                        ::icanhazchzbrgr? ::kk
-                                        ::kthxbai ::kk
-                                        ::specs/normal ::specs/normal)]
-                              (log/info prelog
-                                        "Server received"
-                                        incoming
-                                        "\nwhich triggers"
-                                        rsp)
-                              (if (not= rsp ::specs/normal)
-                                (let [actual (.getBytes (pr-str rsp))]
-                                  (m-t/try-multiple-sends message/child->!
-                                                          prelog
-                                                          5
-                                                          @server-atom
-                                                          actual
-                                                          "Message buffered to child"
-                                                          "Giving up on forwarding to child"
-                                                          {::response rsp
-                                                           ::request incoming}))
-                                (message/close! @server-atom))
-                              (when (= incoming ::icanhazchzbrgr?)
-                                ;; One of the main points is that this doesn't need to be a lock-step
-                                ;; request/response.
-                                (log/info prelog "Client requested chzbrgr. Send out of lock-step")
-                                (let [chzbrgr (byte-array (range cheezburgr-length))]
-                                  (m-t/try-multiple-sends message/child->!
-                                                          prelog
-                                                          5
-                                                          @server-atom
-                                                          chzbrgr
-                                                          "Buffered chzbrgr to child"
-                                                          "Giving up on sending chzbrgr"
-                                                          {})))))]
+          server-child-cb (partial server-mock-child server-atom chzbrgr-length)]
       (dfrd/on-realized succeeded?
                         (fn [good]
                           (log/info "----------> Test should have passed <-----------"))


Fall back to s/explain-printer when failed to analyze errors

--- src/pinpointer/core.cljc
+++ src/pinpointer/core.cljc
@@ -100,30 +100,30 @@
    (if ed
      (let [{:keys [::s/problems ::s/value] :as ed} (correct-paths ed)
            nproblems (count problems)]
-       (binding [*colorize-fn* (choose-colorize-fn colorize)]
-         (newline)
-         (print-headline nproblems)
-         (hline)
-         (doseq [[i problem trace] (map vector
-                                        (range)
-                                        problems
-                                        (trace/traces ed))
-                 :let [[line & lines] (format-data value trace)]]
-           (printf " (%d/%d)\n\n" (inc i) nproblems)
-           (println "     Input:" line)
-           (doseq [line lines]
-             (println "          :" line))
-           (let [[line & lines] (as-> (:pred problem) it
-                                  (simplify-spec it)
-                                  (with-out-str (fipp/pprint it))
-                                  (str/split it #"\n"))]
-             (println "  Expected:" line)
+       (if-let [traces (try (trace/traces ed) (catch Throwable _ nil))]
+         (binding [*colorize-fn* (choose-colorize-fn colorize)]
+           (newline)
+           (print-headline nproblems)
+           (hline)
+           (doseq [[i problem trace] (map vector (range) problems traces)
+                   :let [[line & lines] (format-data value trace)]]
+             (printf " (%d/%d)\n\n" (inc i) nproblems)
+             (println "     Input:" line)
              (doseq [line lines]
-               (println "          :" line)))
-           (when-let [reason (:reason problem)]
-             (println "    Reason:" reason))
-           (newline)
-           (hline))))
+               (println "          :" line))
+             (let [[line & lines] (as-> (:pred problem) it
+                                    (simplify-spec it)
+                                    (with-out-str (fipp/pprint it))
+                                    (str/split it #"\n"))]
+               (println "  Expected:" line)
+               (doseq [line lines]
+                 (println "          :" line)))
+             (when-let [reason (:reason problem)]
+               (println "    Reason:" reason))
+             (newline)
+             (hline)))
+         (do (println "\n(Failed to analyze the spec errors, and will fall back to s/explain-printer)\n")
+             (s/explain-printer ed))))
      (println "Success!!"))))

 (defn pinpoint


Make initial state from main coord (0,0)

--- src/icfp2014/compiler.clj
+++ src/icfp2014/compiler.clj
@@ -302,6 +302,8 @@
   [fns]
   ;; This depends on the initial state we want
   (let [code [[:ldc 0 "; #main"]
+              [:ldc 0]
+              [:cons]
               (load-global 'step)
               [:cons]
               [:rtn "; end main"]]


Restore the world works for simple case.

--- src/rewindable/core.cljs
+++ src/rewindable/core.cljs
@@ -7,6 +7,12 @@
             [goog.events :as gevents]))

 (enable-console-print!)
+
+(defn acopy [asrc adst]
+  (loop [idx 0]
+    (when (< idx (alength asrc))
+      (aset adst idx (aget asrc idx))
+      (recur (inc idx)))))

 (defn listen-el [el type]
   (let [out (chan)]
@@ -36,7 +42,40 @@
     (recur))
   (go-loop []
     (<! rtw-ch)
-    (reset! agw (ago-snapshot @last-snapshot))
+    (let [ss (ago-snapshot @last-snapshot)
+          agos-ss (:agos ss)
+          agos-cur (:agos @agw)
+          nxt-agos
+          (loop [ss-buf-ids (sort (keys agos-ss))
+                 cur-buf-ids (sort (keys agos-cur))
+                 acc-nxt-agos {}]
+            (let [ss-buf-id (first ss-buf-ids)
+                  cur-buf-id (first cur-buf-ids)]
+              (cond
+               (= nil ss-buf-id cur-buf-id) acc-nxt-agos
+
+               (and ss-buf-id ; In ss but not in cur.
+                    (or (nil? cur-buf-id) (< ss-buf-id cur-buf-id)))
+               (recur (rest ss-buf-ids)
+                      cur-buf-ids
+                      (assoc acc-nxt-agos ss-buf-id (get agos-ss ss-buf-id)))
+
+               (and cur-buf-id ; In cur but not in ss.
+                    (or (nil? ss-buf-id) (< cur-buf-id ss-buf-id)))
+               (recur ss-buf-ids
+                      (rest cur-buf-ids)
+                      acc-nxt-agos)
+
+               (= ss-buf-id cur-buf-id) ; In both cur and ss.
+               (let [sma-ss (get agos-ss ss-buf-id)
+                     sma-cur (get agos-cur cur-buf-id)]
+                 (acopy sma-ss sma-cur)
+                 (recur (rest ss-buf-ids)
+                        (rest cur-buf-ids)
+                        (assoc acc-nxt-agos cur-buf-id sma-cur)))
+
+               :else (println "UNEXPECTED case in snapshot revive"))))]
+      (swap! agw #(assoc % :agos nxt-agos)))
     (recur))
   (ago agw
        (loop [num-hi 0]


(MAINT) Improve test to use new logging util fn

The new TK release includes a `with-logged-event-maps` macro
that allowed me to remove some unnecessary cruft from a test.

--- test/clj/puppetlabs/trapperkeeper/services/webserver/jetty9_service_test.clj
+++ test/clj/puppetlabs/trapperkeeper/services/webserver/jetty9_service_test.clj
@@ -750,22 +750,19 @@

 (deftest double-stop-test
   (testing "if the stop lifecycle is called more than once, we handle that gracefully and quietly"
-    (let [log-messages (atom [])]
-      (tk-log-testutils/with-logging-to-atom tk-log/root-logger-name log-messages
-        (let [app (tk-bootstrap/bootstrap-services-with-config
-                   [jetty9-service]
-                   {:webserver {:port 8080}})]
-          (tk-app/stop app)
-          (tk-app/stop app)))
+    (tk-log-testutils/with-logged-event-maps log-events
+      (let [app (tk-bootstrap/bootstrap-services-with-config
+                 [jetty9-service]
+                 {:webserver {:port 8080}})]
+        (tk-app/stop app)
+        (tk-app/stop app))
       ;; we previously had a bug where we could try to unregister mbeans multiple
       ;; times if our tk-j9 stop lifecycle function was called more than once.
       ;; in that case, Jetty would log tons of nasty exceptions at warning level.
       ;; this test just validates that that is not happening.
       (let [log-event-filter #(or (= :warn (:level %))
                                   (= :error (:level %)))
-            mbean-err-logs (->> @log-messages
-                                (map tk-log-testutils/event->map)
-                                (filter log-event-filter))]
+            mbean-err-logs (filter log-event-filter @log-events)]
         (is (= 0 (count mbean-err-logs)))))))

 (deftest warn-if-sslv3-supported-test


video framerate command

video framerate command

--- src/sormilla/drone_comm.clj
+++ src/sormilla/drone_comm.clj
@@ -21,6 +21,7 @@
 (def hover           [:pcmd 0 0.0 0.0 0.0 0.0])
 (def comm-reset      [:comwdg])

+(defn video-frame-rate [rate] [:config "video:codec_fps" rate])
 (defn move [pitch roll yaw alt] [:pcmd 1 roll pitch alt yaw])

 ;;


Bind agent to metlog-common 0.1.0

Bind agent to metlog-common 0.1.0

--- metlog-agent/project.clj
+++ metlog-agent/project.clj
@@ -6,13 +6,14 @@

   :scm {:dir ".."}

-  :dependencies [[metlog-common "0.1.0-SNAPSHOT"]
-                 [org.clojure/clojure "1.8.0"]
+  :dependencies [[org.clojure/clojure "1.8.0"]
                  [clj-time "0.14.4"]
                  [clj-http "3.1.0"
                   :exclusions [com.fasterxml.jackson.core/jackson-core]]
                  [overtone/at-at "1.2.0"]
-                 [com.cognitect/transit-clj "0.8.285"]]
+                 [com.cognitect/transit-clj "0.8.285"]
+
+                 [metlog-common "0.1.0"]]

   :main ^:skip-aot metlog-agent.core
   :target-path "target/%s"
@@ -31,7 +32,7 @@
   :release-tasks [["vcs" "assert-committed"]
                   ["change" "version" "leiningen.release/bump-version" "release"]
                   ["vcs" "commit"]
-                  ["vcs" "tag" "metlog-vault-" "--no-sign"]
+                  ["vcs" "tag" "metlog-agent-" "--no-sign"]
                   ["tar"]
                   ["change" "version" "leiningen.release/bump-version"]
                   ["vcs" "commit"]


Update util.clj

Update util.clj

--- src/swagger_gen/util.clj
+++ src/swagger_gen/util.clj
@@ -14,4 +14,3 @@
   "Normalize a definition like #/definitions/Card into Card"
   [type-ref]
   (clojure.string/replace-first type-ref #"#/definitions/" ""))
-


Make `with-parser` composable

Make `with-parser` composable

--- src/taoensso/carmine.clj
+++ src/taoensso/carmine.clj
@@ -53,9 +53,11 @@

 (defmacro with-parser
   "Wraps body so that replies to any wrapped Redis commands will be parsed with
-  (parser-fn reply)."
+  (parser-fn reply). Composable."
   [parser-fn & body]
-  `(binding [protocol/*parser* ~parser-fn] ~@body))
+  `(if-let [current-parser# protocol/*parser*]
+     (binding [protocol/*parser* (comp current-parser# ~parser-fn)] ~@body)
+     (binding [protocol/*parser* ~parser-fn] ~@body)))

 (defmacro with-mparser
   "Wraps body so that multi-bulk (vector) replies to any wrapped Redis commands


[#59] `db-client*`: use DACPC *as a provider* (@MichaelBlume)

rather than attempting to getCredentials from it up-front

--- src/taoensso/faraday.clj
+++ src/taoensso/faraday.clj
@@ -98,13 +98,13 @@
        (let [creds (or creds (:credentials client-opts)) ; Deprecated opt
              _ (assert (or (nil? creds)    (instance? AWSCredentials         creds)))
              _ (assert (or (nil? provider) (instance? AWSCredentialsProvider provider)))
-             ^AWSCredentialsProvider provider provider
              ^AWSCredentials aws-creds
              (when-not provider
                (cond
                  creds      creds ; Given explicit AWSCredentials
-                 access-key (BasicAWSCredentials. access-key secret-key)
-                 :else      (.getCredentials (DefaultAWSCredentialsProviderChain.))))
+                 access-key (BasicAWSCredentials. access-key secret-key)))
+             ^AWSCredentialsProvider provider
+             (or provider (when-not aws-creds (DefaultAWSCredentialsProviderChain.)))
              client-config
              (doto-cond [g (ClientConfiguration.)]
                proxy-host      (.setProxyHost         g)


Item API enhancements & housekeeping

Item API enhancements & housekeeping

--- src/taoensso/faraday.clj
+++ src/taoensso/faraday.clj
@@ -43,6 +43,7 @@
              ScanRequest
              ScanResult
              UpdateItemRequest
+             UpdateItemResult
              UpdateTableRequest
              WriteRequest]
             com.amazonaws.ClientConfiguration
@@ -186,12 +187,13 @@

 (defn- expected-values "{attr cond} -> {attr ExpectedAttributeValue}"
   [expected]
-  (utils/fmap
-   #(case %
-      (true  ::exists)     (ExpectedAttributeValue. true)
-      (false ::not-exists) (ExpectedAttributeValue. false)
-      (ExpectedAttributeValue. (clj-val->db-val %)))
-   expected))
+  (when (seq expected)
+    (utils/fmap
+     #(case %
+        (true  ::exists)     (ExpectedAttributeValue. true)
+        (false ::not-exists) (ExpectedAttributeValue. false)
+        (ExpectedAttributeValue. (clj-val->db-val %)))
+     expected)))

 ;;;; Coercion - objects

@@ -218,6 +220,7 @@
   GetItemResult       (as-map [r] (am-item-result r (.getItem r)))
   PutItemResult       (as-map [r] (am-item-result r (.getAttributes r)))
   DeleteItemResult    (as-map [r] (am-item-result r (.getAttributes r)))
+  UpdateItemResult    (as-map [r] (am-item-result r (.getAttributes r)))
   QueryResult         (as-map [r] (am-query|scan-result r))
   ScanResult          (as-map [r] (am-query|scan-result r))
   KeysAndAttributes
@@ -227,7 +230,7 @@
      (when-let [c (.getConsistentRead  result)] {:consistent c})
      (when-let [k (.getKeys            result)] {:keys (utils/fmap as-map (into [] k))})))

-  ;; TODO CreateTableResult, ListTablesResult, UpdateItemResult, UpdateTableResult
+  ;; TODO CreateTableResult, ListTablesResult, UpdateTableResult

   BatchGetItemResult
   (as-map [result]
@@ -327,28 +330,50 @@
   (as-map
    (.putItem (db-client creds)
     (doto (PutItemRequest.)
-      (.setTableName table)
-      (.setItem      (clj-item->db-item item))
-      (.setExpected  (when expected (expected-values expected)))
+      (.setTableName    (name table))
+      (.setItem         (clj-item->db-item item))
+      (.setExpected     (expected-values expected))
       (.setReturnValues (utils/enum return))))))

-;;;; TODO Continue code walk-through below
+(defn delete-item
+  "Deletes an item from a table by its hash key, {<attr> <match-value>}.
+  See `put-item` for option docs."
+  [creds table hash-key & [{:keys [return expected]
+                            :or   {return :none}}]]
+  (as-map
+   (.deleteItem (db-client creds)
+     (doto (DeleteItemRequest.)
+       (.setTableName    (name table))
+       (.setKey          (clj-item->db-item hash-key))
+       (.setExpected     (expected-values expected))
+       (.setReturnValues (utils/enum return))))))

 (defn get-item
-  "Retrieves an item from a table by its hash key."
-  ;; TODO hash-key should be specified as a map of {:attr-name value}. Huh??
-  [creds table hash-key]
+  "Retrieves an item from a table by its hash key, {<attr> <match-value>}."
+  [creds table hash-key & [{:keys [consistent? attrs-to-get]}]]
   (as-map
    (.getItem (db-client creds)
     (doto (GetItemRequest.)
-      (.setTableName table)
-      (.setKey (clj-item->db-item hash-key))))))
-
-(defn delete-item
-  "Deletes an item from a table by its hash key."
-  [creds table hash-key]
-  (.deleteItem (db-client creds)
-   (DeleteItemRequest. table (clj-item->db-item hash-key))))
+      (.setTableName      (name table))
+      (.setKey            (clj-item->db-item hash-key))
+      (.setConsistentRead  consistent?)
+      (.setAttributesToGet attrs-to-get)))))
+
+(defn update-item
+  "Updates an item in a table by its hash key, {<attr> <match-value>}.
+  See `put-item` for option docs."
+  [creds table hash-key update-map & [{:keys [return expected]
+                                       :or   {return :none}}]]
+  (as-map
+   (.updateItem (db-client creds)
+     (doto (UpdateItemRequest.)
+       (.setTableName        (name table))
+       (.setKey              (clj-item->db-item hash-key))
+       (.setAttributeUpdates nil) ; TODO
+       (.setExpected         (expected-values expected))
+       (.setReturnValues     (utils/enum return))))))
+
+;;;; TODO Continue code walk-through below

 ;;;; API - batch ops


use correct header names

use correct header names

--- src/yeller/clojure/ring.clj
+++ src/yeller/clojure/ring.clj
@@ -5,8 +5,8 @@

 (defn request-info [request]
   {:request-method (s/upper-case (name (:request-method request)))
-   :user-agent (-> request :headers (get "User-Agent"))
-   :referrer (-> request :headers (get "Referer"))})
+   :user-agent (-> request :headers (get "user-agent"))
+   :referrer (-> request :headers (get "referer"))})

 (defn format-extra [options request]
   {:url (req/request-url request)


tentative "functional" structure using core.async

--- src/mediakeys/hotkeys.clj
+++ src/mediakeys/hotkeys.clj
@@ -4,75 +4,6 @@

 (import [com.tulskiy.keymaster.common Provider HotKeyListener])
 (import [javax.swing KeyStroke])
-
-(defn make-keystroke [keystroke]
-    (KeyStroke/getKeyStroke keystroke))
-
-(def current-keys (atom DEFAULT_KEYS))
-
-(defn register-keys! [^Provider provider keys]
-    (observable
-        (fn [s]
-            (doseq [[action hotkey] keys
-                    keystroke [(make-keystroke hotkey)]]
-                (.register provider keystroke
-                    (proxy [HotKeyListener] []
-                        (onHotKey [event]
-                            (next! s action))))))))
-
-(def provider (atom (Provider/getCurrentProvider false)))
-
-(defn key-config! [key-changes]
-    (map key-changes
-        (fn [key-update]
-            (swap! current-keys #(merge % key-update))
-            (save-keys! @current-keys)
-            @current-keys)))
-
-(defn keypress-events! [key-changes]
-    (-> key-changes
-        key-config!
-        (mapcat (fn [all-keys]
-            (let [new-provider (Provider/getCurrentProvider false)
-                  result (register-keys! new-provider all-keys)]
-                  (doto @provider
-                      (.reset)
-                      (.stop))
-                  (reset! provider new-provider)
-                  result)))))
-
-(def new-provider!
-    (let [provider (atom nil)]
-        (fn [_]
-            (when @provider
-                (doto @provider
-                    (.reset)
-                    (.stop)))
-            (reset! provider
-                (Provider/getCurrentProvider false))
-            @provider)))
-
-(defn register-keys [^Provider provider keys]
-    (let [return (chan)]
-        (doseq [[action hotkey] keys
-                 keystroke [(make-keystroke hotkey)]]
-                (.register provider keystroke
-                    (proxy [HotKeyListener] []
-                        (onHotKey [event]
-                            (put! return action)))))
-        return))
-
-; (defn mapcat< [f channel]
-;     (let [return (chan)]
-;         (go-loop []
-;             (let [value channel]
-;                 (if value)))))
-
-;  mapcat-last<
-;   somehow use an atom bound when return is made and reset it as part of the
-;   "macro" loop somehow
-;
-;

 (def not-nil? (comp not nil?))

@@ -89,14 +20,49 @@
                     (recur))))
         return))

-(def numbers (chan))
+(def new-provider!
+    (let [provider (atom nil)]
+        (fn [ ]
+            (when @provider
+                (doto @provider
+                    (.reset)
+                    (.stop)))
+            (reset! provider
+                (Provider/getCurrentProvider false))
+            @provider)))

-(doseq [i (range 10)]
-    (put! numbers i))
+(def new-keys!
+    (let [keys (atom nil)]
+        (fn [key-update]
+            (swap! keys #(merge key-update))
+            @keys)))

-(defn silly-double [number]
-    (let [c (chan)]
-        (put! c (* 2 number))
-        c))
+(defn register-keys [^Provider provider keys]
+    (let [return (chan)]
+        (doseq [[action hotkey] keys
+                 keystroke [(make-keystroke hotkey)]]
+                (.register provider keystroke
+                    (proxy [HotKeyListener] []
+                        (onHotKey [event]
+                            (put! return action)))))
+        return))

-(def dubs (flatmap< silly-double numbers))+(defn keypress-channel! [key-changes]
+    (let [old-keys (new-keys! { })]
+        (try
+            (let [keys (new-keys! key-changes)
+                  provider (new-provider!)
+                  channel (register-keys provider keys)]
+                (save-keys! keys)
+                channel)
+        (catch java.lang.Exception e
+            (println "here's the exception, catch it more specifically")
+            (.printStackTrace e)
+            (new-keys! old-keys)
+            (register-keys (new-provider!) old-keys)
+            ; TODO grab that^ channel before returning it,
+            ; and pass some error info into it
+            ))))
+
+(def keypress-events! (partial flatmap< keypress-channel!))
+


whitespace

whitespace

--- src/babel/espanol/morphology.cljc
+++ src/babel/espanol/morphology.cljc
@@ -183,7 +183,6 @@
                       :vosotros vosotros
                       :ustedes ustedes
                       })
-
       (and
        (= (get-in word '(:infl)) :preterito)
        (string? (get-in word '(:espanol))))


factor out tenses into separate functions from (get-string)

--- src/babel/francais/morphology.clj
+++ src/babel/francais/morphology.clj
@@ -1,6 +1,5 @@
 (ns babel.francais.morphology
   (:refer-clojure :exclude [get-in merge resolve]))
-
 (require '[babel.stringutils :refer :all])
 (require '[babel.francais.morphology.nouns :as nouns])
 (require '[clojure.core :as core])
@@ -9,17 +8,239 @@
 (require '[clojure.tools.logging :as log])
 (require '[dag-unify.core :refer (copy dissoc-paths fail? get-in merge ref? strip-refs unifyc)])

-
+(declare analyze)
 (declare get-string)
 (declare suffix-of)

-(defn analyze [surface-form lookup-fn]
-  "return the map incorporating the lexical information about a surface form..."
-  (lookup-fn surface-form))
+(defn conditional [word]
+  (let [infinitive (get-in word '(:français))
+        ar-type (try (re-find #"ar$" infinitive)
+                     (catch Exception e
+                       (throw (Exception. (str "Can't regex-find on non-string: " infinitive " from word: " word)))))
+        er-type (re-find #"[eé]r$" infinitive)
+        ir-type (re-find #"ir$" infinitive)
+        re-type (re-find #"re$" infinitive)
+        stem (string/replace infinitive #"[iaeé]r$" "")
+        stem (if re-type
+               ;; prendre -> prend
+               (string/replace infinitive #"re$" "")
+               stem)
+        last-stem-char-is-i (re-find #"ir$" infinitive)
+        last-stem-char-is-e (re-find #"er$" infinitive)
+        person (get-in word '(:agr :person))
+        number (get-in word '(:agr :number))]
+    ;; QUI COMINCIA IL FUTURO FRANCESE
+    (cond
+
+     (and (= person :1st) (= number :sing) er-type)
+     (str stem "erai")
+     (and (= person :1st) (= number :sing) ir-type)
+     (str stem "iré")
+     (and (= person :1st) (= number :sing) re-type)
+     (str stem "rai")
+
+     (and (= person :2nd) (= number :sing) ir-type)
+     (str stem "iras")
+     (and (= person :2nd) (= number :sing) er-type)
+     (str stem "eras")
+     (and (= person :2nd) (= number :sing) re-type)
+     (str stem "ras")
+
+     (and (= person :3rd) (= number :sing) ir-type)
+     (str stem "ira")
+     (and (= person :3rd) (= number :sing) er-type)
+     (str stem "era")
+     (and (= person :3rd) (= number :sing) re-type)
+     (str stem "ra")
+
+     (and (= person :1st) (= number :plur) er-type)
+     (str stem "erons")
+     (and (= person :1st) (= number :plur) ir-type)
+     (str stem "irons")
+     (and (= person :1st) (= number :plur) re-type)
+     (str stem "rons")
+
+     ;; <second person plural future>
+     (and (= person :2nd) (= number :plur) er-type)
+     (str stem "erez")
+     (and (= person :2nd) (= number :plur) ir-type)
+     (str stem "irez")
+     (and (= person :2nd) (= number :plur) re-type)
+     (str stem "rez")
+     ;; </second person plural future>
+
+     ;; <third person plural future>
+     (and (= person :3rd) (= number :plur)
+          er-type)
+     (str stem "eront")
+     (and (= person :3rd) (= number :plur)
+          ir-type)
+     (str stem "iront")
+     (and (= person :3rd) (= number :plur)
+          re-type)
+     (str stem "ront")
+     ;; </third person plural future>
+
+     :else
+     (throw (Exception. (str "get-string: futuro regular inflection: don't know what to do with input argument: " (strip-refs word)))))))
+
+(defn imperfect [word]
+  (let [infinitive (get-in word '(:français))
+        ar-type (try (re-find #"ar$" infinitive)
+                     (catch Exception e
+                       (throw (Exception. (str "Can't regex-find on non-string: " infinitive " from word: " word)))))
+        er-type (re-find #"er$" infinitive)
+        ir-type (re-find #"ir$" infinitive)
+        stem (string/replace infinitive #"[iae]r$" "")
+        last-stem-char-is-i (re-find #"ir$" infinitive)
+        last-stem-char-is-e (re-find #"er$" infinitive)
+        person (get-in word '(:agr :person))
+        number (get-in word '(:agr :number))]
+    (cond
+     (and (= person :1st) (= number :sing) er-type)
+     (str stem "ais")
+
+     (and (= person :1st) (= number :sing) ir-type)
+     (str stem "íssais")
+
+     (and (= person :2nd) (= number :sing) er-type)
+     (str stem "ais")
+
+     (and (= person :2nd) (= number :sing) ir-type)
+     (str stem "íssais")
+
+     (and (= person :3rd) (= number :sing) er-type)
+     (str stem "ait")
+
+     (and (= person :3rd) (= number :sing) ir-type)
+     (str stem "íssait")
+
+     (and (= person :1st) (= number :plur) er-type)
+     (str stem "ions")
+
+     (and (= person :1st) (= number :plur) ir-type)
+     (str stem "íssions")
+
+     ;; <second person plural imperfecto>
+
+     (and (= person :2nd) (= number :plur) er-type)
+     (str stem "iez")
+
+     (and (= person :2nd) (= number :plur) ir-type)
+     (str stem "íssiez")
+
+     ;; </second person plural imperfecto>
+
+     ;; <third person plural imperfecto>
+     (and (= person :3rd) (= number :plur)
+          er-type)
+     (str stem "aient")
+
+     (and (= person :3rd) (= number :plur)
+          ir-type)
+     (str stem "íssaient")
+     ;; </third person plural imperfecto>
+
+     :else
+     (throw (Exception. (str "get-string-1: imperfecto regular inflection: don't know what to do with input argument: " (strip-refs word)))))))
+
+(defn present [word]
+  (let [infinitive (get-in word '(:français))
+        ar-type (try (re-find #"ar$" infinitive)
+                     (catch Exception e
+                       (throw (Exception. (str "Can't regex-find on non-string: " infinitive " from word: " word)))))
+        er-type (re-find #"[eé]r$" infinitive)
+        ir-type (re-find #"ir$" infinitive)
+        re-type (re-find #"re$" infinitive)
+        stem (string/replace infinitive #"[iaeé]r$" "")
+        stem (if re-type
+               (string/replace infinitive #"re$" "")
+               stem)
+        last-stem-char-is-i (re-find #"ir$" infinitive)
+        last-stem-char-is-e (re-find #"er$" infinitive)
+        person (get-in word '(:agr :person))
+        number (get-in word '(:agr :number))
+        g-stem (re-find #"[g]er$" infinitive)
+        ]
+    ;;QUI COMINCIANO I VERBI FRANCESI REGOLARI
+    (cond
+     (and (= person :1st) (= number :sing) er-type)
+     (str stem "e")
+
+     (and (= person :1st) (= number :sing) ir-type)
+     (str stem "is")
+
+     (and (= person :1st) (= number :sing) re-type)
+     (str stem "")
+
+     (and (= person :2nd) (= number :sing) er-type)
+     (str stem "es")
+
+     (and (= person :2nd) (= number :sing) ir-type)
+     (str stem "is")
+
+     (and (= person :2nd) (= number :sing) re-type)
+     (str stem "s")
+
+     (and (= person :3rd) (= number :sing) er-type)
+     (str stem "e")
+
+     (and (= person :3rd) (= number :sing) ir-type)
+     (str stem "it")
+
+     (and (= person :3rd) (= number :sing) re-type)
+     (str stem "")
+
+     (and (= person :1st) (= number :plur) er-type g-stem)
+     (str stem "eons")
+
+     (and (= person :1st) (= number :plur) er-type)
+     (str stem "ons")
+
+     (and (= person :1st) (= number :plur) ir-type)
+     (str stem "issons")
+
+     (and (= person :1st) (= number :plur) re-type)
+     (let [stem (string/replace stem #"d$" "")]
+       (str stem "ons"))
+
+     ;; <second person plural present>
+     (and (= person :2nd) (= number :plur) er-type)
+     (str stem "ez")
+
+     (and (= person :2nd) (= number :plur) ir-type)
+     (str stem "issez")
+
+     (and (= person :2nd) (= number :plur) re-type)
+     (str stem "ez")
+
+     ;; </second person plural present>
+
+     ;; <third person plural present>
+     (and (= person :3rd) (= number :plur)
+          er-type)
+     (str stem "ent")
+     (and (= person :3rd) (= number :plur)
+          ir-type)
+     (str stem "issent")
+     (and (= person :3rd) (= number :plur)
+          re-type)
+     (let [stem (string/replace stem #"d$" "")]
+       (str stem "nent"))
+
+     ;; </third person plural present>
+
+     ;; agreement is underspecified, but an infinitive form (the :français key) exists, so just return that infinitive form.
+     (and (= (get-in word [:agr]) :top)
+          (string? (get-in word [:français])))
+     (get-in word [:français])
+
+     :else
+     (throw (Exception. (str "get-string: present regular inflection: don't know what to do with input argument: " (strip-refs word) " (er-type: " er-type "; ir-type: " ir-type "; re-type: " re-type))))))

 ;; pass'e compos'e begins here
 (defn passe-compose [word]
-  (let [infinitive (get-in word '(:français :français))
+  (let [infinitive (get-in word '(:français))
         er-type (re-find #"[eé]r$" infinitive) ;; c.f. italiano -are
         re-type (re-find #"re$" infinitive) ;; c.f. italian -ere
         ir-type (re-find #"ir$" infinitive) ;; c.f. italian -ire
@@ -31,29 +252,14 @@
         last-stem-char-is-e (re-find #"er$" infinitive)
                  person (get-in word '(:agr :person))
         number (get-in word '(:agr :number))
-        g-stem (re-find #"[g]er$" infinitive)]
+        passe-compose-suffix "é"
+        ]
     (cond
-     ;;
-     ;; conjugate irregular passato: option 1) using :passato-stem
-     (and (= :past (get-in word '(:infl)))
-          (get-in word '(:passato-stem)))
-     (let [irregular-passato (get-in word '(:passato-stem))]
-       (str irregular-passato (suffix-of word)))
-
-     ;; conjugate irregular passato: option 2) using :passato
-     (and (= :past (get-in word '(:infl)))
-          (get-in word '(:passato)))
-     (let [irregular-passato (get-in word '(:passato))
-           butlast (nth (re-find #"(.*).$" irregular-passato) 1)]
-       (str butlast (suffix-of word)))
-
-     ;; conjugate regular passato
-     (= :past (get-in word '(:infl)))
-     {:infinitive infinitive
-      :er-type er-type
-      :ir-type ir-type
-      :re-type re-type
-      :g-stem g-stem})))
+     (get-in word [:passato])
+     (get-in word [:passato])
+
+     ;; regular
+     true (str stem passe-compose-suffix))))

 ;; TODO: this is an overly huge method that needs to be rewritten to be easier to understand and maintain.
 ;; TODO: lots of redundant code with other languages than French: refactor.
@@ -170,316 +376,31 @@

            (= true (get-in word [:exception]))
            (get-in word [:français])
+
+           (and
+            (= (get-in word '(:infl)) :past))
+           (passe-compose word)

            (and
             (= (get-in word '(:infl)) :present)
             (string? (get-in word '(:français))))
-           (let [infinitive (get-in word '(:français))
-                 ar-type (try (re-find #"ar$" infinitive)
-                              (catch Exception e
-                                (throw (Exception. (str "Can't regex-find on non-string: " infinitive " from word: " word)))))
-                 er-type (re-find #"[eé]r$" infinitive)
-                 ir-type (re-find #"ir$" infinitive)
-                 re-type (re-find #"re$" infinitive)
-                 stem (string/replace infinitive #"[iaeé]r$" "")
-                 stem (if re-type
-                        (string/replace infinitive #"re$" "")
-                        stem)
-                 last-stem-char-is-i (re-find #"ir$" infinitive)
-                 last-stem-char-is-e (re-find #"er$" infinitive)
-                 person (get-in word '(:agr :person))
-                 number (get-in word '(:agr :number))
-                 g-stem (re-find #"[g]er$" infinitive)
-                 ]
-             ;;QUI COMINCIANO I VERBI FRANCESI REGOLARI
-             (cond
-
-              (and (= person :1st) (= number :sing) er-type)
-              (str stem "e")
-
-              (and (= person :1st) (= number :sing) ir-type)
-              (str stem "is")
-
-              (and (= person :1st) (= number :sing) re-type)
-              (str stem "")
-
-              (and (= person :2nd) (= number :sing) er-type)
-              (str stem "es")
-
-              (and (= person :2nd) (= number :sing) ir-type)
-              (str stem "is")
-
-              (and (= person :2nd) (= number :sing) re-type)
-              (str stem "s")
-
-              (and (= person :3rd) (= number :sing) er-type)
-              (str stem "e")
-
-              (and (= person :3rd) (= number :sing) ir-type)
-              (str stem "it")
-
-              (and (= person :3rd) (= number :sing) re-type)
-              (str stem "")
-
-              (and (= person :1st) (= number :plur) er-type g-stem)
-              (str stem "eons")
-
-              (and (= person :1st) (= number :plur) er-type)
-              (str stem "ons")
-
-              (and (= person :1st) (= number :plur) ir-type)
-              (str stem "issons")
-
-              (and (= person :1st) (= number :plur) re-type)
-              (let [stem (string/replace stem #"d$" "")]
-                (str stem "ons"))
-
-              ;; <second person plural present>
-
-              (and (= person :2nd) (= number :plur) er-type)
-              (str stem "ez")
-
-              (and (= person :2nd) (= number :plur) ir-type)
-              (str stem "issez")
-
-              (and (= person :2nd) (= number :plur) re-type)
-              (str stem "ez")
-
-              ;; </second person plural present>
-
-              ;; <third person plural present>
-              (and (= person :3rd) (= number :plur)
-                   er-type)
-              (str stem "ent")
-              (and (= person :3rd) (= number :plur)
-                   ir-type)
-              (str stem "issent")
-              (and (= person :3rd) (= number :plur)
-                   re-type)
-              (let [stem (string/replace stem #"d$" "")]
-                (str stem "nent"))
-
-              ;; </third person plural present>
-
-              ;; agreement is underspecified, but an infinitive form (the :français key) exists, so just return that infinitive form.
-              (and (= (get-in word [:agr]) :top)
-                   (string? (get-in word [:français])))
-              (get-in word [:français])
-
-              :else
-              (throw (Exception. (str "get-string: present regular inflection: don't know what to do with input argument: " (strip-refs word) " (er-type: " er-type "; ir-type: " ir-type "; re-type: " re-type)))))
+           (present word)
+
            (and
             (= (get-in word '(:infl)) :futuro)
             (string? (get-in word '(:français))))
-           (let [infinitive (get-in word '(:français))
-                 ar-type (try (re-find #"ar$" infinitive)
-                              (catch Exception e
-                                (throw (Exception. (str "Can't regex-find on non-string: " infinitive " from word: " word)))))
-                 er-type (re-find #"[eé]r$" infinitive)
-                 ir-type (re-find #"ir$" infinitive)
-                 re-type (re-find #"re$" infinitive)
-                 stem (string/replace infinitive #"[iaeé]r$" "")
-                 stem (if re-type
-                        ;; prendre -> prend
-                        (string/replace infinitive #"re$" "")
-                        stem)
-                 last-stem-char-is-i (re-find #"ir$" infinitive)
-                 last-stem-char-is-e (re-find #"er$" infinitive)
-                 person (get-in word '(:agr :person))
-                 number (get-in word '(:agr :number))]
-             ;; QUI COMINCIA IL FUTURO FRANCESE
-             (cond
-
-              (and (= person :1st) (= number :sing) er-type)
-              (str stem "erai")
-              (and (= person :1st) (= number :sing) ir-type)
-              (str stem "iré")
-              (and (= person :1st) (= number :sing) re-type)
-              (str stem "rai")
-
-              (and (= person :2nd) (= number :sing) ir-type)
-              (str stem "iras")
-              (and (= person :2nd) (= number :sing) er-type)
-              (str stem "eras")
-              (and (= person :2nd) (= number :sing) re-type)
-              (str stem "ras")
-
-              (and (= person :3rd) (= number :sing) ir-type)
-              (str stem "ira")
-              (and (= person :3rd) (= number :sing) er-type)
-              (str stem "era")
-              (and (= person :3rd) (= number :sing) re-type)
-              (str stem "ra")
-
-              (and (= person :1st) (= number :plur) er-type)
-              (str stem "erons")
-              (and (= person :1st) (= number :plur) ir-type)
-              (str stem "irons")
-              (and (= person :1st) (= number :plur) re-type)
-              (str stem "rons")
-
-              ;; <second person plural future>
-              (and (= person :2nd) (= number :plur) er-type)
-              (str stem "erez")
-              (and (= person :2nd) (= number :plur) ir-type)
-              (str stem "irez")
-              (and (= person :2nd) (= number :plur) re-type)
-              (str stem "rez")
-              ;; </second person plural future>
-
-              ;; <third person plural future>
-              (and (= person :3rd) (= number :plur)
-                   er-type)
-              (str stem "eront")
-              (and (= person :3rd) (= number :plur)
-                   ir-type)
-              (str stem "iront")
-              (and (= person :3rd) (= number :plur)
-                   re-type)
-              (str stem "ront")
-              ;; </third person plural future>
-
-              :else
-              (throw (Exception. (str "get-string: futuro regular inflection: don't know what to do with input argument: " (strip-refs word))))))
-
-           ;;QUI COMINCIA IL CONDIZIONALE FRANCESE
+           (future word)
+
            (and
             (= (get-in word '(:infl)) :conditional)
             (string? (get-in word '(:français))))
-           (let [infinitive (get-in word '(:français))
-                 ar-type (try (re-find #"ar$" infinitive)
-                              (catch Exception e
-                                (throw (Exception. (str "Can't regex-find on non-string: " infinitive " from word: " word)))))
-                 er-type (re-find #"[eé]r$" infinitive)
-                 ir-type (re-find #"ir$" infinitive)
-                 re-type (re-find #"re$" infinitive)
-                 stem (string/replace infinitive #"i?[iaeé]r$" "")
-                 stem (if re-type
-                        (string/replace infinitive #"re$" "")
-                        stem)
-                 last-stem-char-is-i (re-find #"ir$" infinitive)
-                 last-stem-char-is-e (re-find #"er$" infinitive)
-                 is-care-or-gare? (re-find #"[cg]ar$" infinitive)
-                 person (get-in word '(:agr :person))
-                 number (get-in word '(:agr :number))]
-
-             (cond
-
-              (and (= person :1st) (= number :sing) er-type)
-              (str stem "erais")
-              (and (= person :1st) (= number :sing) ir-type)
-              (str stem "irais")
-              (and (= person :1st) (= number :sing) re-type)
-              (str stem "rais")
-
-              (and (= person :2nd) (= number :sing) ir-type)
-              (str stem "erais")
-              (and (= person :2nd) (= number :sing) er-type)
-              (str stem "irais")
-              (and (= person :2nd) (= number :sing) re-type)
-              (str stem "rais")
-
-              (and (= person :3rd) (= number :sing) ir-type)
-              (str stem "erait")
-              (and (= person :3rd) (= number :sing) er-type)
-              (str stem "irait")
-              (and (= person :3rd) (= number :sing) re-type)
-              (str stem "rait")
-
-              (and (= person :1st) (= number :plur) er-type)
-              (str stem "erions")
-              (and (= person :1st) (= number :plur) ir-type)
-              (str stem "irions")
-              (and (= person :1st) (= number :plur) re-type)
-              (str stem "rions")
-
-              (and (= person :2nd) (= number :plur) er-type)
-              (str stem "eriez")
-              (and (= person :2nd) (= number :plur) ir-type)
-              (str stem "iriez")
-              (and (= person :2nd) (= number :plur) re-type)
-              (str stem "riez")
-
-              ;; </second person plural conditional>
-
-              ;; <third person plural conditional>
-              (and (= person :3rd) (= number :plur)
-                   er-type)
-              (str stem "eraient")
-              (and (= person :3rd) (= number :plur)
-                   ir-type)
-              (str stem "iraient")
-              (and (= person :3rd) (= number :plur)
-                   re-type)
-              (str stem "raient")
-
-              ;; </third person plural conditional>
-              :else
-              (throw (Exception. (str "get-string-1: conditional regular inflection: don't know what to do with input argument: " (strip-refs word))))))
+           (conditional word)

            ;;QUI COMINCIA L’ IMPERFETTO
            (and
             (= (get-in word '(:infl)) :imperfetto)
             (string? (get-in word '(:français))))
-           (let [infinitive (get-in word '(:français))
-                 ar-type (try (re-find #"ar$" infinitive)
-                              (catch Exception e
-                                (throw (Exception. (str "Can't regex-find on non-string: " infinitive " from word: " word)))))
-                 er-type (re-find #"er$" infinitive)
-                 ir-type (re-find #"ir$" infinitive)
-                 stem (string/replace infinitive #"[iae]r$" "")
-                 last-stem-char-is-i (re-find #"ir$" infinitive)
-                 last-stem-char-is-e (re-find #"er$" infinitive)
-                 person (get-in word '(:agr :person))
-                 number (get-in word '(:agr :number))]
-             (cond
-              (and (= person :1st) (= number :sing) er-type)
-              (str stem "ais")
-
-              (and (= person :1st) (= number :sing) ir-type)
-              (str stem "íssais")
-
-              (and (= person :2nd) (= number :sing) er-type)
-              (str stem "ais")
-
-              (and (= person :2nd) (= number :sing) ir-type)
-              (str stem "íssais")
-
-              (and (= person :3rd) (= number :sing) er-type)
-              (str stem "ait")
-
-              (and (= person :3rd) (= number :sing) ir-type)
-              (str stem "íssait")
-
-              (and (= person :1st) (= number :plur) er-type)
-              (str stem "ions")
-
-              (and (= person :1st) (= number :plur) ir-type)
-              (str stem "íssions")
-
-              ;; <second person plural imperfecto>
-
-              (and (= person :2nd) (= number :plur) er-type)
-              (str stem "iez")
-
-              (and (= person :2nd) (= number :plur) ir-type)
-              (str stem "íssiez")
-
-
-              ;; </second person plural imperfecto>
-
-              ;; <third person plural imperfecto>
-              (and (= person :3rd) (= number :plur)
-                   er-type)
-              (str stem "aient")
-
-              (and (= person :3rd) (= number :plur)
-                   ir-type)
-              (str stem "íssaient")
-              ;; </third person plural imperfecto>
-
-              :else
-              (throw (Exception. (str "get-string-1: imperfecto regular inflection: don't know what to do with input argument: " (strip-refs word))))))
+           (imperfect word)

            (and
             (get-in word '(:a))
@@ -521,9 +442,6 @@
    (string? input)
    input

-   (get-in input [:français])
-   (string/trim (str (get-string (get-in input [:français]))))
-
    (and (map? input)
         (get-in input [:a])
         (get-in input [:b]))
@@ -797,3 +715,7 @@
                 )]
     suffix))

+(defn analyze [surface-form lookup-fn]
+  "return the map incorporating the lexical information about a surface form..."
+  (lookup-fn surface-form))
+


WIP - Evolution du bot CSB en Clojure avec l'objectif d'améliorer le classement en ligue argent

--- clojure/codingame/competition/coders-strike-back/src/coders_strike_back/Player.clj
+++ clojure/codingame/competition/coders-strike-back/src/coders_strike_back/Player.clj
@@ -1,4 +1,4 @@
-(ns coders-strike-back.Player
+(ns Player
   (:gen-class))

 (defn inc-atom [curr-val] (inc curr-val))
@@ -37,6 +37,7 @@
 (defn compute-boost [next-checkpoint-distance next-checkpoint-angle]
   (cond
     (>= (Math/abs next-checkpoint-angle) 90) "0"
+    (<= next-checkpoint-distance 800) (compute-boost-from-angle next-checkpoint-angle)
     (<= (Math/abs next-checkpoint-angle) 18) "100"
     true (compute-boost-from-angle next-checkpoint-angle)))

@@ -69,10 +70,10 @@
             nextCheckpointDist (read) nextCheckpointAngle (read)
             opponentX (read) opponentY (read)
             opponent-distance (distance x y opponentX opponentY)]
-      ; nextCheckpointX: x position of the next check point
-      ; nextCheckpointY: y position of the next check point
-      ; nextCheckpointDist: distance to the next checkpoint
-      ; nextCheckpointAngle: angle between your pod orientation and the direction of the next checkpoint
+        ; nextCheckpointX: x position of the next check point
+        ; nextCheckpointY: y position of the next check point
+        ; nextCheckpointDist: distance to the next checkpoint
+        ; nextCheckpointAngle: angle between your pod orientation and the direction of the next checkpoint

         (swap! game-loop-counter inc-atom)
         (if (> @last-shield-usage 0)
@@ -107,14 +108,14 @@
         (print " ")
         (reset! last-boost-value
                 (compute-action
-                                 nextCheckpointX nextCheckpointY
-                                 nextCheckpointDist nextCheckpointAngle
-                                 x y
-                                 opponentX opponentY
-                                 boost-used?
-                                 game-loop-counter
-                                 max-shield-usage
-                                 last-shield-usage
-                                 last-boost-value))
+                  nextCheckpointX nextCheckpointY
+                  nextCheckpointDist nextCheckpointAngle
+                  x y
+                  opponentX opponentY
+                  boost-used?
+                  game-loop-counter
+                  max-shield-usage
+                  last-shield-usage
+                  last-boost-value))
         (print @last-boost-value))
       (println ""))))


Convert the URL to top format before parsing

--- src/circle/backend/github_url.clj
+++ src/circle/backend/github_url.clj
@@ -85,6 +85,6 @@
 (defn parse
   "Returns the username and project from a github url"
   [url]
-  (let [resp (re-find #"https://github.com/([^/]+)/([^/]+)" url)]
+  (let [resp (re-find #"https://github.com/([^/]+)/([^/]+)" (->top url))]
     {:username (get resp 1)
      :project (get resp 2)}))


fix accidental reflection

fix accidental reflection

--- src/clj/com/rpl/specter/impl.cljc
+++ src/clj/com/rpl/specter/impl.cljc
@@ -108,8 +108,9 @@
 #?(
    :clj
    (defmacro exec-select* [this & args]
-     (let [hinted (with-meta this {:tag 'com.rpl.specter.protocols.RichNavigator})]
-       `(.select* ~hinted ~@args)))
+     (let [hinted (with-meta (gensym) {:tag 'com.rpl.specter.protocols.RichNavigator})]
+       `(let [~hinted ~this]
+          (.select* ~hinted ~@args))))

    :cljs
@@ -120,8 +121,9 @@
 #?(
    :clj
    (defmacro exec-transform* [this & args]
-     (let [hinted (with-meta this {:tag 'com.rpl.specter.protocols.RichNavigator})]
-       `(.transform* ~hinted ~@args)))
+     (let [hinted (with-meta (gensym) {:tag 'com.rpl.specter.protocols.RichNavigator})]
+       `(let [~hinted ~this]
+          (.transform* ~hinted ~@args))))

    :cljs


Gagarin.

Gagarin.

--- src/clj/game/cards-identities.clj
+++ src/clj/game/cards-identities.clj
@@ -76,6 +76,10 @@
    "Gabriel Santiago: Consummate Professional"
    {:events {:successful-run {:msg "gain 2 [Credits]" :once :per-turn
                               :effect (effect (gain :credit 2)) :req (req (= target :hq))}}}
+
+   "Gagarin Deep Space: Expanding the Horizon"
+   {:events {:pre-access-card {:req (req (= (second (:zone target)) :remote))
+                               :effect (effect (access-cost-bonus [:credit 1]))}}}

    "GRNDL: Power Unleashed"
    {:effect (effect (gain :credit 5 :bad-publicity 1))}


remove whitespace

remove whitespace

--- src/clj_money/models/entities.clj
+++ src/clj_money/models/entities.clj
@@ -51,7 +51,7 @@
       (if (validation/valid? validated)
         (->> validated
              before-save
-             (create-entity s ))
+             (create-entity s))
         validated))))

 (defn select


Fix min-width error

Fix min-width error

--- src/cljs/gc_api_browser/core.cljs
+++ src/cljs/gc_api_browser/core.cljs
@@ -41,7 +41,7 @@
                               default-headers)))))
         om/IRender
         (render [_]
-          (dom/div #js {:style #js {:min-width "760px"
+          (dom/div #js {:style #js {:minWidth "760px"
                                     :margin "0 auto"}}
                    (dom/header nil
                                (dom/h2 #js {:className "u-text-light u-margin-Am u-text-center"} (get-in app [:request :text])))


Add second type of drag cells behaviour.

--- src/cljs/nonojure/puzzleview.cljs
+++ src/cljs/nonojure/puzzleview.cljs
@@ -1,7 +1,7 @@
 (ns nonojure.puzzleview
   (:require
    [dommy.utils :as utils]
-   [dommy.core :as dommy :refer [listen!]]
+   [dommy.core :as dommy :refer [listen! attr]]
    [jayq.util :refer [log]])
   (:use-macros
    [dommy.macros :only [node sel sel1]]))
@@ -20,6 +20,40 @@

 (def current-fill-style (atom nil)) ;one of [:empty :crossed :filled nil]

+(def base-cell (atom nil))
+(def last-cell (atom nil))
+
+(def board (atom nil))
+
+(def drag-type (atom :rect)) ; possible values :rect, :by-one
+
+
+(defn range-inc [a b]
+  (range (min a b) (inc (max a b))))
+
+(defn attr-int [cell attribute]
+  (js/parseInt (attr cell attribute) 10))
+
+;;; Board functions
+
+(defn init-board! [board width height]
+  (let [state (->> (repeat width :empty)
+                   vec
+                   (repeat height)
+                   vec)]
+    (reset! board state)))
+
+(defn change-cell-in-board! [board x y new-state]
+  (swap! board assoc-in [y x] new-state))
+
+(defn update-region-of-board! [board [from-x from-y] [to-x to-y] new-state]
+  (let [cells-to-change (for [x (range-inc from-x to-x)
+                              y (range-inc from-y to-y)]
+                          [y x])
+        new-board (reduce #(assoc-in %1 %2 new-state) @board cells-to-change)]
+    (reset! board new-board)))
+
+
 (defn pad [nums beg end value]
   (-> []
       (into (repeat beg value))
@@ -56,7 +90,9 @@
          num-tds-left (pad num-tds pad-length 0 [:td.nothing])
          num-tds-right(pad num-tds 0 pad-length [:td.nothing])
          cells (for [c (range row-length)]
-                 [:td {:class (str "cell c" c " r" row-num)}])]
+                 [:td {:class (str "cell c" c " r" row-num)
+                       :data-x c
+                       :data-y row-num}])]
     (-> [(keyword (str "tr.row.row" row-num)) {:class ""}]
       (into num-tds-left)
       (into (add-thick-class cells))
@@ -150,7 +186,7 @@

 (defn check-solution []
   "Returns true if current state of puzzle is a valid solution, false otherwise"
-  (let [problem (cljs.reader/read-string (dommy/attr (sel1 :#puzzle-table) "problem-def"))
+  (let [problem (cljs.reader/read-string (attr (sel1 :#puzzle-table) "problem-def"))
         hor-prob (get problem :left)
         ver-prob (get problem :top)
         hor-size (count ver-prob)
@@ -195,7 +231,7 @@
   (let [wrong (check-solution)
         rows-wrong (get wrong :rows-wrong)
         cols-wrong (get wrong :cols-wrong)
-        problem-def (dommy/attr (sel1 :#puzzle-table) "problem-def")
+        problem-def (attr (sel1 :#puzzle-table) "problem-def")
         server-id (get problem-def :id)]
     (if (and (empty? rows-wrong)
              (empty? cols-wrong))
@@ -216,6 +252,12 @@
     :empty (do (dommy/remove-class! cell "cell-clicked")
                (dommy/remove-class! cell "cell-rightclicked"))))

+(defn update-cells-region-style! [[from-x from-y] [to-x to-y] style-fn]
+  (doseq [x (range-inc from-x to-x)
+          y (range-inc from-y to-y)
+          :let [cell (sel1 (str ".r" y ".c" x))]]
+        (change-cell-style! cell (style-fn x y))))
+
 (defn cell-style [cell]
   (cond (dommy/has-class? cell "cell-clicked") :filled
         (dommy/has-class? cell "cell-rightclicked") :crossed
@@ -239,13 +281,37 @@

 (defn handle-mouse-down-on-cell [evt]
   (let [cell (.-target evt)
-        style (new-cell-style-after-click cell (button evt))]
+        style (new-cell-style-after-click cell (button evt))
+        x (attr-int cell :data-x)
+        y (attr-int cell :data-y)]
     (reset! current-fill-style style)
-    (change-cell-style! cell style)))
+    (change-cell-style! cell style)
+    (change-cell-in-board! board x y style)
+    (reset! base-cell [x y])
+    (reset! last-cell [x y])))

 (defn handle-mouse-enter-on-cell [evt]
   (when-let [style @current-fill-style]
-    (change-cell-style! (.-target evt) style)))
+    (let [cell (.-target evt)
+          x (attr-int cell :data-x)
+          y (attr-int cell :data-y)
+          state @board]
+      (if (= @drag-type :rect)
+        (do (update-cells-region-style! @base-cell @last-cell (fn [x y] (get-in state [y x])))
+            (update-cells-region-style! @base-cell [x y] (fn [_ _] style)))
+        (do (change-cell-style! cell style)
+            (change-cell-in-board! board x y style)))
+      (reset! last-cell [x y]))))
+
+(defn handle-mouse-up-on-cell [evt]
+  (when (= :rect @drag-type)
+    (when-let [style @current-fill-style]
+     (let [cell (.-target evt)
+           cur-x (attr-int cell :data-x)
+           cur-y (attr-int cell :data-y)]
+       (update-region-of-board! board @base-cell [cur-x cur-y] style))))
+  (reset! current-fill-style nil)
+  (reset! base-cell nil))

 (defn disable-context-menu [evt]
   (.preventDefault evt)
@@ -253,25 +319,25 @@

 (defn handle-number-click [evt]
   (let [cell (.-target evt)
-        coord (dommy/attr cell :data-coord)
+        coord (attr cell :data-coord)
         query (str "td[data-coord*='" coord "']")]
     (doseq [el (sel query)]
       (dommy/toggle-class! el "num-clicked"))))
-

 (defn add-handlers []
   (listen! [(sel1 :#puzzle-table) :.cell]
                  :mousedown handle-mouse-down-on-cell
                  :contextmenu disable-context-menu
                  :mouseenter handle-mouse-enter-on-cell
-                 :mouseup #(reset! current-fill-style nil))
-  (listen! (sel1 :#button-done) :click done-handler)
+                 :mouseup handle-mouse-up-on-cell)
   (listen! [(sel1 :#puzzle-table) :.num]
                  :mousedown handle-number-click
                  :contextmenu disable-context-menu)
+  (listen! (sel1 :#button-done) :click done-handler)
   (listen! (sel1 :#button-clear) :click clear-puzzle))

 (defn show [nono]
+  (init-board! board (count (:left nono)) (count (:top nono)))
   (dommy/replace! (sel1 :#puzzle-table) (create-template nono))
   (add-handlers)
   (dommy/remove-class! (sel1 :.puzzle-container) "hidden"))
@@ -279,5 +345,5 @@
 (defn ^:export init []
   (when (and js/document
              (aget js/document "getElementById"))
-    (dommy/prepend! (sel1 :#puzzle-view) (create-template (nonojure.random/generate-puzzle 8 10)))
-    (add-handlers)))
+    (dommy/prepend! (sel1 :#puzzle-view) (node [:div#puzzle-table]))
+    (show (nonojure.random/generate-puzzle 8 10))))


Add regression test for «scale-layout»

Add regression test for «scale-layout»

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

--- src/conexp/tests/layouts/util.clj
+++ src/conexp/tests/layouts/util.clj
@@ -39,10 +39,17 @@

 (deftest test-scale-layout
   (with-testing-data [layout test-layouts]
-    (is (= (enclosing-rectangle (vals (positions (scale-layout [0 0]
-                                                               [100 100]
-                                                               layout))))
-           [0 0 100 100]))))
+    (let [scaled-layout (scale-layout [0 0] [100 100] layout)]
+      (is (= (enclosing-rectangle (vals (positions scaled-layout)))
+             [0 0 100 100]))
+      (is (= (connections layout)
+             (connections scaled-layout)))
+      (is (= (lattice layout)
+             (lattice scaled-layout)))
+      (is (= (upper-labels layout)
+             (upper-labels scaled-layout)))
+      (is (= (lower-labels layout)
+             (lower-labels scaled-layout))))))

 ;;;


Fix up namespace.

Fix up namespace.

--- src/onyx/plugin/kafka.clj
+++ src/onyx/plugin/kafka.clj
@@ -1,37 +1,28 @@
 (ns onyx.plugin.kafka
-  (:require [clojure.core.async :as a :refer [chan >!! <!! close! timeout sliding-buffer]]
-            [franzy.admin.cluster :as k-cluster]
+  (:require [franzy.admin.cluster :as k-cluster]
             [franzy.admin.zookeeper.client :as k-admin]
-            [franzy.admin.partitions :as k-partitions]
             [franzy.serialization.serializers :refer [byte-array-serializer]]
             [franzy.serialization.deserializers :refer [byte-array-deserializer]]
             [franzy.clients.producer.client :as producer]
             [franzy.clients.producer.protocols :refer [send-async! send-sync!]]
             [franzy.clients.producer.types :refer [make-producer-record]]
-            [franzy.clients.consumer.protocols :as proto]
             [franzy.clients.consumer.client :as consumer]
             [franzy.clients.producer.callbacks :refer [send-callback]]
             [franzy.common.metadata.protocols :as metadata]
-            [franzy.clients.consumer.protocols :refer [assign-partitions! commit-offsets-sync!
-                                                       poll! seek-to-offset!] :as cp]
-            [onyx.log.curator :as zk]
+            [franzy.clients.consumer.protocols :refer [assign-partitions! seek-to-offset!] :as cp]
             [onyx.compression.nippy :refer [zookeeper-compress zookeeper-decompress]]
             [taoensso.timbre :as log :refer [fatal info]]
-            [onyx.static.uuid :refer [random-uuid]]
             [onyx.static.default-vals :refer [arg-or-default]]
             [onyx.plugin.protocols :as p]
-            [onyx.static.uuid :refer [random-uuid]]
             [onyx.static.util :refer [kw->fn]]
-            [onyx.extensions :as extensions]
-            [onyx.types :as t]
             [onyx.tasks.kafka]
             [schema.core :as s]
             [onyx.api])
-  (:import (org.apache.kafka.clients.consumer ConsumerRecords ConsumerRecord)
-           (org.apache.kafka.clients.consumer KafkaConsumer ConsumerRebalanceListener Consumer)
-           (franzy.clients.consumer.client FranzConsumer)
+  (:import [org.apache.kafka.clients.consumer ConsumerRecords ConsumerRecord]
+           [org.apache.kafka.clients.consumer KafkaConsumer ConsumerRebalanceListener Consumer]
+           [franzy.clients.consumer.client FranzConsumer]
            [java.util.concurrent.atomic AtomicLong]
-           (org.apache.kafka.clients.producer Callback)
+           [org.apache.kafka.clients.producer Callback]
            [franzy.clients.producer.types ProducerRecord]
            [org.apache.kafka.common TopicPartition]))


Generate sproc 3rd argument ARRAY faster, simpler

--- src/poky/kv/jdbc/util.clj
+++ src/poky/kv/jdbc/util.clj
@@ -133,17 +133,13 @@
 ;; ======== MULTI

 (defn- mget-sproc-conds
-  "Returns"
+  "Returns tuple of [cond-sql cond-params] for conditions
+  cond-sql is a string representation of PG array for sproc's 3rd argument"
   [conds]
-  (loop [[row & conds] conds
-         sql (list)
-         params (list)]
-    (if row
-      (let [qs (wrap-join \[ \, \] (repeat (count row) "[?, ?]"))]
-        (recur conds
-               (conj sql qs)
-               (concat params (mapcat (juxt (comp name key) val) row))))
-      [sql params])))
+  (let [pairs (map #(wrap-join \[ \, \] (repeat (count %) "[?, ?]")) conds)
+        ks (map name (mapcat keys conds))
+        vs (mapcat vals conds)]
+    [(pg-array pairs) (interleave ks vs)]))

 (defn- mget-sproc
   "Returns the SQL params vector (ie [sql & params]) for the stored procedure,
@@ -157,7 +153,7 @@
         sql (wrap-join "SELECT * FROM mget(" \, \)
                        ["?"
                         (pg-array (repeat (count conds) "?"))
-                        (pg-array cond-sql)])]
+                        cond-sql])]
     (apply vector sql bucket
            (concat (map :key conds)
                    cond-params))))


Split clj and cljs code into more distinct sections, rather than have them interspersed.

--- src/re_frame/loggers.cljc
+++ src/re_frame/loggers.cljc
@@ -13,21 +13,22 @@
 ;; By default, re-frame uses the functions provided by js/console.
 ;; Use set-loggers! to change these defaults.

-(def ^:private loggers
-  (atom {:log       #?(:cljs (js/console.log.bind   js/console)
-                       :clj  (partial log :info))
-         :warn      #?(:cljs (js/console.warn.bind  js/console)
-                       :clj  (partial log :warn))
-         :error     #?(:cljs (js/console.error.bind js/console)
-                       :clj  (partial log :error))
-         :group     #?(:cljs (if (.-group js/console) ;; console.group does not exist  < IE 11
-                               (js/console.group.bind js/console)
-                               (js/console.log.bind   js/console))
-                       :clj  (partial log :info))
-         :groupEnd  #?(:cljs (if (.-groupEnd js/console) ;; console.groupEnd does not exist  < IE 11
-                               (js/console.groupEnd.bind js/console)
-                               #())
-                       :clj  #())}))
+;; XXX should loggers be put in the registrar ??
+(def ^:private loggers (atom #?(:cljs {:log       (js/console.log.bind   js/console)
+                                       :warn      (js/console.warn.bind  js/console)
+                                       :error     (js/console.error.bind js/console)
+                                       :group     (if (.-group js/console)         ;; console.group does not exist  < IE 11
+                                                    (js/console.group.bind js/console)
+                                                    (js/console.log.bind   js/console))
+                                       :groupEnd  (if (.-groupEnd js/console)        ;; console.groupEnd does not exist  < IE 11
+                                                    (js/console.groupEnd.bind js/console)
+                                                    #())})
+                             ;; clojure versions
+                             #?(:clj {:log      (partial log :info)
+                                      :warn     (partial log :warn)
+                                      :error    (partial log :error)
+                                      :group    (partial log :info)
+                                      :groupEnd  #()})))

 (defn console
   [level & args]


s/resolve-mode/resolve-blend-mode/

s/resolve-mode/resolve-blend-mode/

--- src/rosado/processing.clj
+++ src/rosado/processing.clj
@@ -343,11 +343,11 @@
   :burn       - Darker areas are applied, increasing contrast, ignores lights.
                 Called \"Color Burn\" in Illustrator and Photoshop."
   ([x y width height dx dy dwidth dheight mode]
-     (let [mode (resolve-mode mode)]
+     (let [mode (resolve-blend-mode mode)]
        (.blend *applet* (int x) (int y) (int width) (int height)
                (int dx) (int dy) (int dwidth) (int dheight) (int mode))))
   ([^PImage src x y width height dx dy dwidth dheight mode]
-     (let [mode (resolve-mode mode)]
+     (let [mode (resolve-blend-mode mode)]
        (.blend *applet* src (int x) (int y) (int width) (int height)
                (int dx) (int dy) (int dwidth) (int dheight) (int mode)))))

@@ -376,7 +376,7 @@
   :burn       - Darker areas are applied, increasing contrast, ignores lights.
                 Called \"Color Burn\" in Illustrator and Photoshop."
   [c1 c2 mode]
-  (let [mode (resolve-mode mode)]
+  (let [mode (resolve-blend-mode mode)]
     (PApplet/blendColor (int c1) (int c2) (int mode))))

 (defn blue


Updated utils module - new utility functions

--- src/zg/utils.clj
+++ src/zg/utils.clj
@@ -14,9 +14,14 @@
     "Various utility function used by other modules.")

 (defn third
-    "Simple utility function - returns third item from a given sequence."
+    "Simple utility function - returns third item from a given sequence, nil if third item does not exist."
     [coll]
     (nth coll 2 nil))
+
+(defn fourth
+    "Simple utility function - returns fourth item from a given sequence, nil if third item does not exist."
+    [coll]
+    (nth coll 3 nil))

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


Renamed vectorify to vectorize

Renamed vectorify to vectorize

--- src/semantic_csv/core.clj
+++ src/semantic_csv/core.clj
@@ -277,9 +277,9 @@
 ;; One of the first things we'll need is a function that takes a sequence of maps and turns it into a sequence
 ;; of vectors given column name order:

-;; ## vectorify
-
-(defn vectorify
+;; ## vectorize
+
+(defn vectorize
   "Take a sequence of maps, and transform them into a sequence of vectors. Options:

   * `:header` - The header to be used. If not specified, this defaults to `(-> data first keys)`. Only
@@ -292,7 +292,7 @@
     keyword names such that the `:` is removed from their string representation. Passing a falsey value will
     leave the header unaltered in the output."
   ([data]
-   (vectorify {} data))
+   (vectorize {} data))
   ([{:keys [header prepend-header format-header]
      :or {prepend-header true format-header impl/stringify-keyword}}
     data]
@@ -311,7 +311,7 @@
 ;;
 ;;     => (let [data [{:this "a" :that "b"}
 ;;                    {:this "x" :that "y"}]]
-;;          (vectorify data))
+;;          (vectorize data))
 ;;     (["this" "that"]
 ;;      ["a" "b"]
 ;;      ["x" "y"])
@@ -320,7 +320,7 @@
 ;;
 ;;     => (let [data [{:this "a" :that "b"}
 ;;                    {:this "x" :that "y"}]]
-;;          (vectorify {:header [:that :this]
+;;          (vectorize {:header [:that :this]
 ;;                      :preprend-header false}
 ;;                     data))
 ;;     (["b" "a"]
@@ -332,7 +332,7 @@
 (defn format-with
   "Formats the values in `data` entries. First argument is a map of `colname -> format-fn` to be applied to
   entries for the given column name. Optional second argument is an options hash, with which you can specify
-  an option for `:ignore-first`, useful for when you've already applied `vectorify` and don't want to run the
+  an option for `:ignore-first`, useful for when you've already applied `vectorize` and don't want to run the
   format functions on the header row."
   ([formatters data]
    (format-with formatters {} data))
@@ -349,7 +349,7 @@
 ;;     => (let [data [{:this "a" :that "b"}
 ;;                    {:this "x" :that "y"}]]
 ;;          (->> data
-;;               vectorify
+;;               vectorize
 ;;               (format-with {:this (partial str "val-")}
 ;;                            {:ignore-first true})))
 ;;     (["this" "that"]
@@ -387,7 +387,7 @@
 ;;           (fn [row]
 ;;             (assoc row :jazz (* (:this row)
 ;;                                 (:that row)))))
-;;         vectorify
+;;         vectorize
 ;;         ; clojure-csv doesn't like non string values
 ;;         (format-all-with str)
 ;;         ; Convert into row strings


RP + DM | 25 | Fix email configuration when launching app

--- src/stonecutter/email.clj
+++ src/stonecutter/email.clj
@@ -11,9 +11,6 @@

 (defn null-sender [email-address subject body] nil)
 (defn null-renderer [email-data] {:subject nil :body nil})
-
-(defn configure-email [path]
-  (reset! email-script-path path))

 (defn send! [template email-address email-data]
   (let [{:keys [subject body]} ((template @template-to-renderer-map) email-data)]
@@ -33,3 +30,7 @@
                 (str email-address)
                 (str subject)
                 (str body))))
+
+(defn configure-email [path]
+  (initialise! null-sender
+               {:confirmation null-renderer}))


CMR-3424 Re-orders ACL creation to make test work with synchronous ingest

--- access-control-app/int_test/cmr/access_control/int_test/acl_crud_test.clj
+++ access-control-app/int_test/cmr/access_control/int_test/acl_crud_test.clj
@@ -270,15 +270,14 @@
         token2 (e/login (u/conn-context) "user2")
         group1 (u/ingest-group token {:name "group1"} ["user1"])
         group1-concept-id (:concept_id group1)
+        _ (ac/create-acl (u/conn-context) {:group_permissions [{:group_id group1-concept-id
+                                                                :permissions ["create"]}]
+                                           :provider_identity {:provider_id "PROV2"
+                                                               :target "CATALOG_ITEM_ACL"}})
         _ (ac/update-acl (u/conn-context)
                          (:concept-id fixtures/*fixture-system-acl*)
                          {:system_identity {:target "ANY_ACL"}
                           :group_permissions [{:user_type "guest" :permissions ["read"]}]})
-        _ (ac/create-acl (u/conn-context) {:group_permissions [{:group_id group1-concept-id
-                                                                :permissions ["create"]}]
-                                           :provider_identity {:provider_id "PROV2"
-                                                               :target "CATALOG_ITEM_ACL"}})
-        _ (u/wait-until-indexed)
         resp1 (ac/create-acl (merge {:token token} (u/conn-context)) (assoc-in catalog-item-acl
                                                                                [:catalog_item_identity :provider_id] "PROV2"))]


add transcribed tab snippet

add transcribed tab snippet