deep-trace2 -- fn-meta

deep-trace2 -- fn-meta

--- src/com/billpiel/sayid/deep_trace2.clj
+++ src/com/billpiel/sayid/deep_trace2.clj
@@ -191,7 +191,7 @@
              (apply merge))))

 (defn capture-fn
-  [path [log src-map] f fn-meta]
+  [path [log src-map fn-meta] f]
   (fn [& args]
     (let [sub-src-map (-> path path->sym src-map)
           form (:orig sub-src-map)
@@ -200,8 +200,8 @@
                     (assoc :name (if (seq? form) (first form) form)
                            :form form
                            :path' path
-                           :parent-name "outer-func" ;; TODO outer func name
-                           :ns nil                   ;;TODO
+                           :parent-name (:name fn-meta)
+                           :ns (-> fn-meta :ns str symbol)
                            :args (vec args)          ;;TODO
                            :arg-map  (delay (zipmap (-> src-map
                                                         :xp
@@ -252,7 +252,7 @@
 (defn xpand-fn
   [head form path]
   (cons
-   (list 'capture-fn path '$$ head {}) ;; TODO fn-meta
+   (list 'capture-fn path '$$ head)
    (rest form)))

 (defn xpand-macro
@@ -291,7 +291,7 @@
       (cond (util/macro? head) (xpand-macro head
                                             (xpand* (macroexpand form) path)
                                             path')
-            (= 'if head) (xpand-if (xpand** form path')
+            (= 'if head) (xpand-if (xpand** form path')  ;; TODO the rest of the special forms
                                    path')
             (special-symbol? head) (xpand** form path')
             :else (xpand-fn head
@@ -299,10 +299,11 @@
                             path')))
     form))

+;; TODO should take coll of forms?
 (defn xpand
-  [form]
+  [form parent-fn-meta]
   (let [expr-map (mk-expr-mapping form)]
-    `(let [~'$$ [(atom []) '~expr-map]
+    `(let [~'$$ [(atom []) '~expr-map '~parent-fn-meta]
            ~'$return ~(xpand* form)]
        (record-trace-tree ~'$$)
        ~'$return)))
@@ -311,7 +312,7 @@
 (def trace (atom nil))

 (defn log->tree1
-  [log src-map]
+  [log src-map fn-meta]
   (loop [[[path val & tags] & tail] log
          agg {}]
     (if path
@@ -325,7 +326,8 @@
                                      :return val
                                      :path path
                                      :tags tags
-                                     :src-map sub-map}))]
+                                     :src-map sub-map
+                                     :fn-meta fn-meta}))]
         (recur tail
                agg'))
       (-> agg
@@ -336,7 +338,7 @@

 (defn tree1->trace-tree
   [tree parent src-map]
-  (let [{:keys [form return children tags path]} tree
+  (let [{:keys [form return children tags fn-meta path]} tree
         trace-tree (if (-> tags
                            first
                            #{:fn})
@@ -345,8 +347,8 @@
                             :name (if (seq? form) (first form) form)
                             :form form
                             :path' path
-                            :parent-name "outer-func" ;; TODO outer func name
-                            :ns nil                   ;;TODO
+                            :parent-name (:name fn-meta)
+                            :ns (-> fn-meta :ns str symbol)
                             :args []                  ;;TODO
                             :arg-map {}               ;;TODO
                                         ; :src-map src-map
@@ -362,15 +364,32 @@
                  children))))

 (defn record-trace-tree
-  [[log src-map]]
+  [[log src-map fn-meta]]
   (swap! (:children trace/*trace-log-parent*)
          conj
          (-> @log
-             (log->tree1 src-map)
+             (log->tree1 src-map fn-meta)
              (tree1->trace-tree trace/*trace-log-parent*
                                 src-map))))

- #_ (-> (xpand '(let [a 1
+;;TODO trace multi-arity works??
+(defn deep-tracer
+  [{:keys [workspace qual-sym meta' ns']} original-fn] ;; original-fn and workspace not used! IS THAT RIGHT??
+  (let [src (-> qual-sym
+                symbol
+                util/hunt-down-source)
+        xsrc (clojure.walk/macroexpand-all src)
+        get-fn (fn [[d s f & r]] (if (and (= d 'def)
+                                          (symbol? s)
+                                          (-> f nil? not)
+                                          (nil? r))
+                                   (throw (Exception. (format "Expected a defn form, but got this (%s %s ..."
+                                                              d s)))))
+        traced-form  (get-fn (xpand src meta'))]
+    (util/eval-in-ns (-> ns' str symbol)
+                     traced-form)))
+
+ #_ (-> #spy/d (xpand '(let [a 1
                          b 2]
                      (if false
                        a
@@ -379,11 +398,12 @@

 #_ (binding [trace/*trace-log-parent* (trace/mk-tree :id-prefix "root" :parent {})]
      (def tree trace/*trace-log-parent*)
-     (-> #spy/d (xpand '(let [a 1]
+     (-> (xpand '(let [a 1]
                    (-> a
                        inc
                        dec
-                       nil?)))
+                       nil?))
+                {:name "ofunc" :ns "ns1"})
          eval))

 #_ (binding [trace/*trace-log-parent* (trace/mk-tree :id-prefix "root" :parent {})]


That last commit was definitely the wine talking.

--- src/leiningen/core.clj
+++ src/leiningen/core.clj
@@ -51,21 +51,19 @@

 (def no-project-needed (atom #{"new" "help" "version"}))

+(defn task-not-found [& _]
+  (abort "That's not a task. Use \"lein help\" to list all tasks."))
+
 (defn resolve-task [task]
   (let [task-ns (symbol (str "leiningen." task))
-        task (symbol task)
-        ;; code is expecting a var, so it derefs. fake with an atom.
-        error-fn (atom (fn [& _]
-                         (abort
-                          (str task " is not a task. Use \"help\" "
-                               "to list all tasks."))))]
+        task (symbol task)]
     (try
      (when-not (find-ns task-ns)
        (require task-ns))
      (or (ns-resolve task-ns task)
-         error-fn)
+         #'task-not-found)
      (catch java.io.FileNotFoundException e
-       error-fn))))
+       #'task-not-found))))

 (defn- hookize [v]
   (when-not (::hooks (meta @v))


Add protocol descriptions

Add protocol descriptions

--- src/cylon/authentication/protocols.clj
+++ src/cylon/authentication/protocols.clj
@@ -3,13 +3,16 @@
 (ns cylon.authentication.protocols)

 (defprotocol RequestAuthenticator
-  ;; Determine if given credentials (found in request)
-  (authenticate [_ req]))
+  (authenticate [_ request]
+    "Return (as a map) any credentials that can be determined from the
+    given Ring request"))

 (extend-protocol RequestAuthenticator
   nil
-  (authenticate [_ req] nil))
+  (authenticate [_ request] nil))

 (defprotocol AuthenticationHandshake
-  (initiate-authentication-handshake [_ request])
+  (initiate-authentication-handshake [_ request]
+    "Return a Ring response that redirects the user-agent into an
+    interaction to establish its authenticity")
   (get-outcome [_ request]))


more fine tuning

more fine tuning

--- src/lights/my_show.clj
+++ src/lights/my_show.clj
@@ -207,6 +207,25 @@
     )
   )

+  (if (= interface "audio6")
+    (do
+      (show/add-midi-control-to-var-mapping
+        "Komplete Audio 6" 9 0 :audio-drums :min -10 :max 50)
+
+      (show/add-midi-control-to-var-mapping
+        "Komplete Audio 6" 9 1 :audio-bass :max 50)
+
+      (show/add-midi-control-to-var-mapping
+        "Komplete Audio 6" 9 2 :audio-solo :max 50)
+
+      (show/add-midi-control-to-var-mapping
+        "Komplete Audio 6" 9 3 :audio-voice :min -120 :max 50)
+
+      (show/add-midi-control-to-var-mapping
+        "Komplete Audio 6" 9 4 :audio-percussion :max 50)
+    )
+  )
+
   (if (= interface "automap")
     (do
       (show/add-midi-control-to-var-mapping
@@ -223,7 +242,7 @@
       (show/add-midi-control-to-var-mapping
         "Automap MIDI" 10 27 :lightness-max-front :min 0 :max 100)
       (show/add-midi-control-to-var-mapping
-        "Automap MIDI" 10 24 :lightness-min-general :min -100 :max 0
+        "Automap MIDI" 10 24 :lightness-min-general :min 0 :max 100
           :transform-fn (fn [v] (- 0 v)))

       ; Defaults
@@ -424,7 +443,8 @@
         :short-name "Sparkle scene"
         ))

-  (ct/set-cue! (:cue-grid *show*) 0 2
+
+  (ct/set-cue! (:cue-grid *show*) 0 8
     (cues/cue :color  (fn [_] (afterglow.effects/scene
       "Blue and red"
         (afterglow.effects.color/color-effect
@@ -441,6 +461,7 @@
         (global-color-effect (params/build-color-param :h :main-hue :s 100 :l light-param))
       )
     ))))
+
   (ct/set-cue! (:cue-grid *show*) 1 1
     (cues/cue :color  (fn [_] (afterglow.effects/scene
       "Sine All"


Implement first version of super-reduce

Implement first version of super-reduce

--- src/distributed_transducers_poc/rc.clj
+++ src/distributed_transducers_poc/rc.clj
@@ -30,6 +30,11 @@
                     (.withPayload (generate-string {:function f})))]
     (parse-result (.invoke client request))))

+(defmacro super-reduce [f xs]
+  `(invoke-lambda (pr-str (s/fn [] (reduce ~f ~xs))) "distributed-transducers-poc" "eu-west-1"))
+
+;(super-reduce + (range 100000))
+
 ;(invoke-lambda (pr-str (s/fn [] (map #(* 2 %) [3 4 5]))) "distributed-transducers-poc" "eu-west-1")

 ;(let [f (generate-string {:command (pr-str (s/fn [] (+ 2 3)))})]


Make it possible to inline checkboxes and radio buttons.

--- src/om_forms/core.cljs
+++ src/om_forms/core.cljs
@@ -85,20 +85,14 @@
   [warning]
   [:label {:class "warning"} warning])

-(defn add-class
-  [opts class]
-  (as-> opts $
-        (apply hash-map $)
-        (update-in $ [:class] #(if % (str/join " " [% class]) class))
-        (mapcat identity $)))
-
-(defn align-controls
+(defn unlabeled-control
   [inline & xs]
   (if inline
     xs
-    (list (when (form-horizontal?)
-            [:div {:class (label-column-class)}])
-          (input-column xs))))
+    [:div.form-group
+     (list (when (form-horizontal?)
+             [:div {:class (label-column-class)}])
+           (input-column xs))]))

 (defn labeled-control
   [inline form-group-class label dom-id & xs]
@@ -146,7 +140,6 @@
   [args]
   (let [[options [rest-args]] (split-with (comp keyword? first) (partition-all 2 args))]
     [(apply hash-map (mapcat identity options)) (or rest-args [])]))
-

 (defn input*
   [tag attrs label cursor korks {:keys [valid? validation-error-fn in-progress warn-fn help inline large]} & inner]
@@ -212,7 +205,7 @@
 (defn form-buttons
   [& buttons]
   [:div.form-group.form-buttons
-   (apply align-controls false buttons)])
+   (apply unlabeled-control false buttons)])

 (defn button
   [& args]
@@ -251,22 +244,21 @@
         dom-id (gen-dom-id cursor korks)
         valid (or (nil? valid?) (valid? korks))]
     (list
-      [:div.form-group
-       (align-controls
-         inline
-         [:div {:class (str "checkbox" (when-not valid " has-error") (when inline " checkbox-inline"))}
-          [:label
-           [:input
-            (merge-attrs {:on-change #(do
-                                       (om/update! cursor korks (.. % -target -checked)))
-                          :checked   (get-in cursor korks)
-                          :type      "checkbox"
-                          :id        dom-id}
-                         attrs
-                         {})]
-           label]]
-         (when-let [validation-error (and validation-error-fn (validation-error-fn korks))]
-           (error-label validation-error)))])))
+      (unlabeled-control
+        inline
+        [:div {:class (str "checkbox" (when-not valid " has-error") (when inline " checkbox-inline"))}
+         [:label
+          [:input
+           (merge-attrs {:on-change #(do
+                                      (om/update! cursor korks (.. % -target -checked)))
+                         :checked   (get-in cursor korks)
+                         :type      "checkbox"
+                         :id        dom-id}
+                        attrs
+                        {})]
+          label]]
+        (when-let [validation-error (and validation-error-fn (validation-error-fn korks))]
+          (error-label validation-error))))))

 (defn radio                                                 ;; TODO: Extract common method for `radio` and `checkbox`.
   [& args]
@@ -274,24 +266,23 @@
         dom-id (gen-dom-id cursor korks)
         valid (or (nil? valid?) (valid? korks))]
     (list
-      [:div.form-group
-       (align-controls
-         inline
-         [:div {:class (str "radio" (when-not valid " has-error") (when inline " radio-inline"))}
-          [:label
-           [:input
-            (merge-attrs {:on-change #(when (.. % -target -checked)
-                                       (om/update! cursor korks value))
-                          :checked   (= value (get-in cursor korks))
-                          :type      "radio"
-                          :id        dom-id
-                          :name      dom-id
-                          :value     value}
-                         attrs
-                         {})]
-           label]]
-         (when-let [validation-error (and validation-error-fn (validation-error-fn korks))]
-           (error-label validation-error)))])))
+      (unlabeled-control
+        inline
+        [:div {:class (str "radio" (when-not valid " has-error") (when inline " radio-inline"))}
+         [:label
+          [:input
+           (merge-attrs {:on-change #(when (.. % -target -checked)
+                                      (om/update! cursor korks value))
+                         :checked   (= value (get-in cursor korks))
+                         :type      "radio"
+                         :id        dom-id
+                         :name      dom-id
+                         :value     value}
+                        attrs
+                        {})]
+          label]]
+        (when-let [validation-error (and validation-error-fn (validation-error-fn korks))]
+          (error-label validation-error))))))

 (defn select
   [& args]


track indentation, disallow starting delimiters and tabs outside of strings

--- src/parinfer/core.cljs
+++ src/parinfer/core.cljs
@@ -54,20 +54,25 @@

 ;; Push operations

-(defmulti push-char
-  (fn [stack [i ch]] ch)
+(defmulti push-char*
+  (fn [stack [x-pos ch]] ch)
   :hierarchy #'char-hierarchy)

-(defmethod push-char :open
-  [stack [i ch]]
-  (cond
-    (in-escape? stack) (pop stack)
-    (in-code? stack) (conj stack [i ch])
-    :else stack))
-
-(defmethod push-char :close
-  [stack [i ch]]
-  (println (valid-closer? stack ch) (in-code? stack))
+(defmethod push-char* "\t"
+  [stack [x-pos ch]]
+  (cond
+    (not (in-str? stack)) (throw (str "no tabs allowed outside strings"))
+    :else stack))
+
+(defmethod push-char* :open
+  [stack [x-pos ch]]
+  (cond
+    (in-escape? stack) (pop stack)
+    (in-code? stack) (conj stack [x-pos ch])
+    :else stack))
+
+(defmethod push-char* :close
+  [stack [x-pos ch]]
   (cond
     (in-escape? stack) (pop stack)
     (in-code? stack) (if (valid-closer? stack ch)
@@ -77,52 +82,97 @@
                          (throw (str "no matching open delimiter for " ch))))
     :else stack))

-(defmethod push-char ";"
-  [stack [i ch]]
-  (cond
-    (in-escape? stack) (pop stack)
-    (in-code? stack) (conj stack [i ch])
-    :else stack))
-
-(defmethod push-char "\n"
-  [stack [i ch]]
+(defmethod push-char* ";"
+  [stack [x-pos ch]]
+  (cond
+    (in-escape? stack) (pop stack)
+    (in-code? stack) (conj stack [x-pos ch])
+    :else stack))
+
+(defmethod push-char* "\n"
+  [stack [x-pos ch]]
   (let [s0 (cond-> stack (in-escape? stack) pop)
         s1 (cond-> s0 (in-comment? s0) pop)]
     s1))

-(defmethod push-char "\\"
-  [stack [i ch]]
-  (cond
-    (in-escape? stack) (pop stack)
-    :else (conj stack [i ch])))
-
-(defmethod push-char "\""
-  [stack [i ch]]
+(defmethod push-char* "\\"
+  [stack [x-pos ch]]
+  (cond
+    (in-escape? stack) (pop stack)
+    :else (conj stack [x-pos ch])))
+
+(defmethod push-char* "\""
+  [stack [x-pos ch]]
   (cond
     (in-escape? stack) (pop stack)
     (in-str? stack) (pop stack)
-    :else (conj stack [i ch])))
-
-(defmethod push-char :default
-  [stack [i ch]]
-  (cond
-    (in-escape? stack) (pop stack)
-    :else stack))
+    :else (conj stack [x-pos ch])))
+
+(defmethod push-char* :default
+  [stack [x-pos ch]]
+  (cond
+    (in-escape? stack) (pop stack)
+    :else stack))
+
+(defn whitespace? [ch]
+  (re-find #"[\s,]" ch))
+
+(defn close-delims
+  ([result] (close-delims result 0))
+  ([result x-pos]
+   ;; TODO: close all delimiters that are >= x-pos, and insert at insertion point
+   (assoc result :track-indent? false)))
+
+(defn push-char
+  [{:keys [stack track-indent? line-no] :as result} [x-pos ch]]
+
+  (let [;; Insert closing delimiters if required.
+        should-close? (and track-indent?
+                           (in-code? stack)
+                           (not (whitespace? ch))
+                           (not= ";" ch)
+                           (or (not (isa? char-hierarchy ch :close))
+                               (throw (str "cannot start line with closing delimiter: " ch))))
+        result (cond-> result should-close? (close-delims x-pos))
+
+        ;; Update the delimiter stack with this character.
+        result (update-in result [:stack] push-char* [x-pos ch])
+        stack (:stack result)
+
+        ;; Add potential insert point for closing delimiters if required.
+        insert (when (and (seq stack)
+                          (in-code? stack)
+                          (not (whitespace? ch)))
+                 {:line-no line-no
+                  :x-pos x-pos})
+        result (cond-> result insert (assoc :insert insert))]
+    result))

 ;; main parsers

+(def empty-result
+  {:lines []
+   :line-no -1
+   :track-indent? false
+   :insert {:line nil :col nil}
+   :stack []})
+
 (defn parse-line
-  ([line] (parse-line [] line))
-  ([stack line] (reduce push-char stack (map-indexed vector (str line "\n")))))
+  ([line] (parse-line empty-result line))
+  ([{:keys [stack lines line-no] :as result} line]
+   (let [result (assoc result
+                  :track-indent? (and (seq stack) (not (in-str? stack)))
+                  :lines (conj lines line)
+                  :line-no (inc line-no))
+         result (reduce push-char result (map-indexed vector (str line "\n")))]
+     result)))

 (defn parse-text
-  ([text] (parse-text [] text))
-  ([stack text] (reduce parse-line stack (split-lines text))))
-
-
-(defn add-trailing-closers
-  [lines]
-  )
+  ([text] (parse-text empty-result text))
+  ([result text]
+   (let [result (reduce parse-line result (split-lines text))
+         result (cond-> result (seq (:stack result)) close-delims)]
+     result)))

 ;; EVENTS
 ;; when editing current line, prevent invalid closers
@@ -133,12 +183,12 @@

 (defn update-text!
   [cursor-index text]
-  (println cursor-index)
   (try
     (let [stack (parse-text text)]
       (swap! app-state assoc :stack stack)
       (swap! app-state assoc :text text))
     (catch :default e
+      (println "EXCEPTION:" e)
       nil ;; don't update the text
       )))


Use approx of sqrt2 to avoid rounding error in nav-2d

--- src/edu/berkeley/ai/domains/nav_2d.clj
+++ src/edu/berkeley/ai/domains/nav_2d.clj
@@ -257,7 +257,7 @@
 		  (fn [[cur-x cur-y]] [dst rew])
 		  (envs/make-simple-condition (constantly true) true))]))]
     {:class ::NavRegionsTraverse :env (util/safe-get parent-hla :env)
-     :optimistic-description desc :pessimistic-description [:pess] ; desc
+     :optimistic-description desc :pessimistic-description (angelic/parse-description [:pess] nil nil) ; desc
      :primitives (util/safe-get parent-hla :primitives)
      :src src :dst dst :rew rew}))


network-reset should find the incoming plan (network-id) and not assume that the cached one is being used.

--- src/planviz/server.clj
+++ src/planviz/server.clj
@@ -972,11 +972,15 @@
                                   (dissoc plan-details :plan :parts)))
             (load-rmq-plan tpn plan-id begin)))))))

-(defn network-reset []
-  (let [plan-id (:rmq-plan-id @state)]
-    (when plan-id
+(defn network-reset [json-str]
+  (let [parsed (json/read-str json-str :key-fn #(keyword %))
+        netid (keyword (:network-id parsed))
+        ;A plan exists for the tpn network being reset
+        existing-plan-id (find-plan netid)]
+    (when existing-plan-id
+      (swap! state assoc :rmq-plan-id existing-plan-id)
       (broadcast-clients nil {:rmethod :network-reset
-                              :args    [plan-id]}))))
+                              :args    [existing-plan-id]}))))

 (defn tpn-object-update [json-str]
   (let [m (read-json-str json-str)
@@ -1044,7 +1048,7 @@
     (log/trace (str \newline (with-out-str (clojure.pprint/pprint json-str))))
     (condp = routing-key                                    ;; case does not work with a symbol below
       "network.new" (new-rmq-tpn json-str)
-      "network.reset" (network-reset)                       ;;(tpn-object-update json-str)
+      "network.reset" (network-reset json-str)                       ;;(tpn-object-update json-str)
       "tpn.object.update" (tpn-object-update json-str)
       "tpn.activity.active" (tpn-object-update json-str)
       "tpn.activity.finished" (tpn-object-update json-str)


Updated modal card for readability

Updated modal card for readability

--- src/guide/untangled/ui/element_cards.cljs
+++ src/guide/untangled/ui/element_cards.cljs
@@ -248,11 +248,10 @@
   Use `ui-modal` to render a modal dialog with title, body and action items (typically buttons).

   Sample shown below:"
-  (dom/div nil
-    (dom/div #js {}
-      (e/ui-modal {:active :true}
-        (e/ui-modal-title {} "Informative")
-        (e/ui-modal-body {} "You have been notified.")
-        (e/ui-modal-actions {}
-          (e/ui-flat-button {:color :primary} "Cancel")
-          (e/ui-flat-button {:color :primary} "Ok"))))))
+  (dom/div #js {:style #js {:height "200px" :position "relative"}}
+    (e/ui-modal {:active :true}
+      (e/ui-modal-title {} "Informative")
+      (e/ui-modal-body {} "You have been notified.")
+      (e/ui-modal-actions {}
+        (e/ui-flat-button {:color :primary} "Cancel")
+        (e/ui-flat-button {:color :primary} "Ok")))))


Update subs.cljc

Update subs.cljc

--- src/re_frame/subs.cljc
+++ src/re_frame/subs.cljc
@@ -203,7 +203,7 @@
   During program execution, a call to `subscribe`, such as `(subscribe [:sub-id 3 "blue"])`,
   will create a new `:sub-id` node in the Signal Graph. And, at that time, re-frame
   needs to know how to create the node.   By calling `reg-sub`, you are registering
-  "the template" or "the mechanism" by which nodes in the Signal Graph can be created.
+  'the template' or 'the mechanism' by which nodes in the Signal Graph can be created.

   Repeating: calling `reg-sub` does not create a node. It only creates the template
   from which nodes can be created later.


Minor subs cleanup

Minor subs cleanup

--- src/re_frame/subs.cljc
+++ src/re_frame/subs.cljc
@@ -36,7 +36,7 @@
   (let [cache-key [query-v dynv]]
     ;; when this reaction is nolonger being used, remove it from the cache
     (add-on-dispose! r #(do (swap! query->reaction dissoc cache-key)
-                            #_(console :log "Removing subscription: " cache-key)))    ;; XXX remove console debug
+                            #_(console :log "Removing subscription: " cache-key)))
     ;; cache this reaction, so it can be used to deduplicate other, later "=" subscriptions
     (swap! query->reaction assoc cache-key r)
     r))  ;; return the actual reaction
@@ -82,9 +82,6 @@
            (cache-and-return v dynv (make-reaction (fn [] @@sub)))))))))

 ;; -- Helper code for register-pure -------------------
-
-;; add `metric`  which   (metric :using-cached-subscription  {:text
-;; XXX no need for maps

 (defn- map-vals
   "Returns a new version of 'm' in which 'f' has been applied to each value.


Insignificant typo correction in console output (#177)

--- src/re_frame/subs.cljs
+++ src/re_frame/subs.cljs
@@ -67,7 +67,7 @@
          cached)
      (let [query-id   (first-in-vector query-v)
            handler-fn (get @qid->fn query-id)]
-       (console :warn "Subscription crerated: " query-v)
+       (console :warn "Subscription created: " query-v)
        (if-not handler-fn
          (console :error "re-frame: no subscription handler registered for: \"" query-id "\". Returning a nil subscription."))
        (cache-and-return query-v [] (handler-fn app-db query-v)))))


Remove require for spec

Remove require for spec

--- src/rp/util/number.clj
+++ src/rp/util/number.clj
@@ -1,5 +1,4 @@
-(ns rp.util.number
-  (:require [clojure.spec :as s]))
+(ns rp.util.number)

 (defn nat-num?
   [x]


Added O'Reilly links

Added O'Reilly links

Noted "Stay tuned for our next ClojureBridgeMN workshop
  (tentatively scheduled for June 25-26)"
Updated Clojure.MN links
Updated the event calendar

--- src/main/cljs/clojurebridgemn/client.cljs
+++ src/main/cljs/clojurebridgemn/client.cljs
@@ -589,7 +589,7 @@
      ;; [:i [:a {:href "https://www.eventbrite.com/e/clojurebridge-mn-fallwinter-2015-tickets-19159690149"} "Sign up now"]]
      ;;  " for our Fall/Winter workshop November 13-14!"
      ;; "Save the date! Our next ClojureBridgeMN workshop is scheduled for 11/13-14"
-     "Stay tuned for our next ClojureBridgeMN workshop (TBD)"
+     "Stay tuned for our next ClojureBridgeMN workshop (tentatively scheduled for June 25-26)"
      ]
     }
    :logos
@@ -740,8 +740,9 @@
               :src "images/clojurebridge.png"}]
        [:img {:alt "Clockwork"
               :src "images/sponsors/cw_logo.png"}]
-       [:img {:alt "O'Reilly"
-              :src "images/sponsors/ORM.jpg"}]]
+       [:a {:href "http://www.oreilly.com/pub/cpc/9557"}
+        [:img {:alt "O'Reilly"
+               :src "http://www.oreilly.com/partner_file/ORM_logo_box75_hex.jpg"}]]]
       [:li "March 6-7 2015: UMSEC, Trivent, Adobe, O'Reilly"  [:br]
        [:img {:alt "UMSEC"
               :src "images/sponsors/umseclogo.jpg"}]
@@ -749,8 +750,9 @@
               :src "images/sponsors/Thrivent.png"}]
        [:img {:alt "Adobe"
               :src "images/sponsors/Adobe.png"}]
-       [:img {:alt "O'Reilly"
-              :src "images/sponsors/ORM.jpg"}]]
+       [:a {:href "http://www.oreilly.com/pub/cpc/9557"}
+        [:img {:alt "O'Reilly"
+               :src "http://www.oreilly.com/partner_file/ORM_logo_box75_hex.jpg"}]]]
       [:li
        "May 16-17 2014: DevJam Studios, Code 42, Brick Alloy, Lispcast" [:br]
        [:img {:alt "DevJam Studios"
@@ -803,7 +805,7 @@
      ;; "Stay tuned for more information about our upcoming workshop at "
      ;; [:a {:href "http://vidku.com"} "Vidku"]
      ;; " on September 11-12!"
-     "Stay tuned for our next ClojureBridgeMN workshop (TBD)"
+     "Stay tuned for our next ClojureBridgeMN workshop (tentatively scheduled for June 25-26)"
      [:br]
      [:br]
      "Want to connect with the local Clojure community?"
@@ -811,7 +813,7 @@
      [:br]
      "Join us for our next "
      [:a {:href "http://www.meetup.com/clojuremn/"} "clojure.mn"]
-     " meeting on February 10th!"
+     " meeting on April 13th!"
      [:br]
      [:br]
      ]
@@ -837,7 +839,7 @@
      [:ul
       [:li "Global " [:a {:href "http://clojurebridge.org"} "ClojureBridge"] " organization"]
       [:li "Contact us at info@ClojureBridgeMN.org"]
-      [:li "Local " [:a {:href "http://clojure.mn"} "clojure.mn"] " user group (meets every 2nd Wednesday)"]
+      [:li "Local " [:a {:href "http://www.meetup.com/clojuremn/"} "clojure.mn"] " user group (meets every 2nd Wednesday)"]
       [:li "ClojureBridge "
        [:a {:href "http://bit.ly/cb-mn"} "installfest"] " and "
        [:a {:href "https://github.com/ClojureBridge/getting-started/blob/master/nightcode.md"} "Nightcode"]


simplify metamodel based operators

simplify metamodel based operators

--- src/main/clojure/org/dada/demo/whales.clj
+++ src/main/clojure/org/dada/demo/whales.clj
@@ -221,29 +221,29 @@
 (import org.dada.core.View)
 (import org.dada.core.Update)

+(defn meta-view [f]
+  (proxy [View] []
+	 (update [insertions alterations deletions]
+		 (doall (map (fn [#^Update insertion] (apply f (.getNewValue insertion))) insertions)))))
+
 (defn split [[#^Model src-metamodel #^Metadata src-metadata #^Collection extra-keys] split-key
 	     & [split-key-fn]]
   (let [tgt-metamodel (model (str (.getName src-metamodel) ".split(" split-key")") nil (.getMetadata src-metamodel))]
     (insert *metamodel* tgt-metamodel)
     (connect
      src-metamodel
-     (proxy [View] []
-	    (update [insertions alterations deletions]
-		    (doall
-		     (map
-		      (fn [#^Update insertion]
-			  (let [[model & extra-values] (.getNewValue insertion)]
-			    (do-split
-			     model
-			     split-key
-			     (or split-key-fn list)
-			     identity
-			     (fn [#^Model model extra-value]
-				 (let [model-entry (list* model (concat extra-values [extra-value]))]
-				   (insert tgt-metamodel model-entry)
-				   (insert *metamodel* model)
-				   )))))
-		      insertions)))))
+     (meta-view
+      (fn [model & extra-values]
+	  (do-split
+	   model
+	   split-key
+	   (or split-key-fn list)
+	   identity
+	   (fn [#^Model model extra-value]
+	       (let [model-entry (list* model (concat extra-values [extra-value]))]
+		 (insert tgt-metamodel model-entry)
+		 (insert *metamodel* model)
+		 ))))))
     [tgt-metamodel src-metadata (concat extra-keys [split-key])]))

 ;; extra keys are inserted into attribute list
@@ -262,7 +262,7 @@
 		    (doall
 		     (map
 		      (fn [#^Update insertion]
-			  (let [[src-model & extra-values] (.getNewValue insertion)
+			  (let [[#^Model src-model & extra-values] (.getNewValue insertion)
 				count-model (do-reduce-count
 					     (.getName src-model)
 					     (.getMetadata src-model)


add PigPen to Cascading appliction frameworks

--- pigpen-cascading/src/main/clojure/pigpen/cascading/core.clj
+++ pigpen-cascading/src/main/clojure/pigpen/cascading/core.clj
@@ -24,6 +24,7 @@
            (cascading.pipe.assembly Unique Rename AggregateBy)
            (cascading.pipe.joiner BufferJoin MixedJoin)
            (cascading.scheme.hadoop TextLine)
+           (cascading.property AppProps)
            (cascading.tap Tap)
            (cascading.tap.hadoop Hfs)
            (cascading.tuple Fields)
@@ -37,6 +38,9 @@
             [pigpen.extensions.core :refer [zip]]))

 (set! *warn-on-reflection* true)
+
+(AppProps/addApplicationFramework nil
+  (str "PigPen:0.3.1" ))

 (defn cfields
   ^Fields [fields]


new_stress_test.clj prints frequencies of all :error messages on intstack after each run


rearrange function order

rearrange function order

--- src/atom_finder/questions/superfluous_parens.clj
+++ src/atom_finder/questions/superfluous_parens.clj
@@ -27,6 +27,13 @@

     (tree=by (juxt class expr-operator) parenless-mom reparsed-parenless-mom)
   ))
+
+(defn multi-op-expr?
+  "Return all nodes (recursively) that represent an expression which uses more
+  than one operator"
+  [root]
+  (and (expr-operator root)
+       (exists? expr-operator (children root))))

 (defn macro-def-node?
   "Was this AST node parsed from inside the defintion of a macro?"
@@ -111,13 +118,6 @@
    )
   )

-(defn multi-op-expr?
-  "Return all nodes (recursively) that represent an expression which uses more
-  than one operator"
-  [root]
-  (and (expr-operator root)
-       (exists? expr-operator (children root))))
-
 (defn --test-parse-file-for-superfluous-parens []
   "Just a place for sandbox code to live"
   (->> "sql/item_geofunc.cc"


Make sure correct namespace is called in command-log*

--- systems/logging/src/containium/systems/logging.clj
+++ systems/logging/src/containium/systems/logging.clj
@@ -122,7 +122,7 @@
   is not recommended to call this directly."
   [app-logger level fn & vals]
   (let [ns (str *ns*)
-        fn (symbol (str "log-" fn))]
+        fn (symbol "containium.systems.logging" (str "log-" fn))]
     `(~fn ~app-logger ~level ~ns (apply str (interpose " " [~@vals])))))


rename dep handler which creates synth group

--- src/overtone/sc/node.clj
+++ src/overtone/sc/node.clj
@@ -282,7 +282,7 @@
        (with-meta (parse-node-tree tree)
          {:type ::node-tree})))))

-(on-deps :connected ::create-root-group #(dosync (ref-set synth-group* (group :head ROOT-GROUP))))
+(on-deps :connected ::create-synth-group #(dosync (ref-set synth-group* (group :head ROOT-GROUP))))

 (on-sync-event :reset :reset-base
   (fn []


we need to fix systems-for

we need to fix systems-for

--- test/celestial/integration/persistency/systems.clj
+++ test/celestial/integration/persistency/systems.clj
@@ -11,16 +11,16 @@
 (with-conf
   (with-state-changes [(before :facts (set-user {:username "admin"} (populate-all)))]
    (fact "systems for user" :integration :redis :systems
-     (set-user {:username "ronen"}
+     #_(set-user {:username "ronen"}
        (mapv #(-> (Integer/valueOf %) s/get-system :env) (s/systems-for "ronen"))
           => (has every? (partial = :dev)))
-      (set-user {:username "admin"}
+     (set-user {:username "admin"}
        (mapv #(-> (Integer/valueOf %) s/get-system :env) (s/systems-for "ronen"))
           => (has every? (partial = :dev)))
-      (set-user {:username "ronen"}
+     (set-user {:username "ronen"}
         (mapv #(-> (Integer/valueOf %) s/get-system :env) (s/systems-for "admin"))
           => (throws ExceptionInfo (is-type? :celestial.persistency.systems/persmission-violation)))
-      (set-user {:username "admin"}
+     (set-user {:username "admin"}
         (mapv #(-> (Integer/valueOf %) s/get-system :env) (s/systems-for "admin"))
           => (has every? #{:dev :qa :prod}))
      )))


CMR-2335: Finishing addressing code review comments.

--- metadata-db-app/src/cmr/metadata_db/system.clj
+++ metadata-db-app/src/cmr/metadata_db/system.clj
@@ -21,10 +21,9 @@

 ;; Design based on http://stuartsierra.com/2013/09/15/lifecycle-composition and related posts

-(def
-  ^{:doc "Defines the order to start the components."
-    :private true}
-  component-order [:db :log :queue-broker :scheduler :web :nrepl])
+(def ^:private component-order
+  "Defines the order to start the components."
+  [:db :log :queue-broker :scheduler :web :nrepl])

 (def system-holder
   "Required for jobs"


Don't choke resolving localhost (and other names..

from /etc/hosts).

--- src/shale/sessions.clj
+++ src/shale/sessions.clj
@@ -38,12 +38,16 @@
 (defn resolve-host [host]
   (if (is-ip? host)
     host
-    (let [resolved (first ((dns-lookup host Type/A) :answers))]
-      (if resolved
+    (if-let [resolved (first ((dns-lookup host Type/A) :answers))]
         (string/replace (str (.getAddress resolved)) "/" "")
-        (throw
-          (ex-info (format "Unable to resolve host %s." host)
-                   {:user-visible true :status 500}))))))
+        (if-let [resolved
+                 (try
+                   (java.net.InetAddress/getByName host)
+                   (catch java.net.UnknownHostException e nil))]
+          (.getHostAddress resolved)
+          (throw
+            (ex-info (format "Unable to resolve host %s." host)
+                     {:user-visible true :status 500}))))))

 (defn host-resolved-url [url]
   (let [u (if (string? url) (uri/uri url) url)]


When you create transaction, you assign category

--- src/swanson/models/db.clj
+++ src/swanson/models/db.clj
@@ -3,7 +3,8 @@
             [java-jdbc.ddl :as ddl]
             [java-jdbc.sql :as sql]
             [swanson.utils :refer [date-converter]]
-            [clj-time.core :as time-core])
+            [clj-time.core :as time-core]
+            [swanson.models.matcher :as matcher])
   (:import [java.security MessageDigest]
            [javax.xml.bind DatatypeConverter]))

@@ -93,15 +94,25 @@
   (jdbc/query db-spec
               (sql/select * :transactions (sql/where {:id id}))))

-(def ^:dynamic *default-category-id* 1)
+(defn get-category-id
+  "Get id corresponding to category match or return 'unknown'"
+  [category-name]
+  (let [fetch-category
+        (fn [name] (get (first (jdbc/query db-spec
+                               (sql/select * :categories
+                               (sql/where {:name name})))) :id))
+        category-id (fetch-category category-name)]
+    (or category-id (fetch-category "unknown"))))

 (defn create-transaction
   [{:keys [amount date description]}]
-  (let [converted-date (date-converter date)]
+  (let [converted-date (date-converter date)
+        matching-category (matcher/match-description description)
+        category-id (get-category-id matching-category)]
     (jdbc/insert! db-spec
       :transactions
       [:amount :date :category_id :description]
-      [amount converted-date *default-category-id* description])))
+      [amount converted-date category-id description])))

 (defn- sha256-digest [bs]
   (doto (MessageDigest/getInstance "SHA-256") (.update bs)))


First fast version of canonical-base

First fast version of canonical-base

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

--- src/conexp/contrib/algorithms/canonical_base.clj
+++ src/conexp/contrib/algorithms/canonical_base.clj
@@ -17,67 +17,40 @@
 ;;; Computing Implicational Closures

 (defn- add-immediate-elements
-  [implications initial-set subset-test]
-  (loop [conclusions  (transient initial-set),
+  [implications, ^BitSet initial-set, subset-test]
+  (loop [^BitSet conclusions  initial-set,
          impls        implications,
          unused-impls (transient [])]
     (if-let [^Implication impl (first impls)]
       (if (subset-test (.premise impl) initial-set)
-        (recur (reduce conj! conclusions (.conclusion impl))
+        (recur (do (dobits [x (.conclusion impl)]
+                     (.set conclusions x))
+                   conclusions)
                (rest impls)
                unused-impls)
         (recur conclusions
                (rest impls)
                (conj! unused-impls impl)))
-      [(persistent! conclusions)
-       (persistent! unused-impls)])))
+      [conclusions, (persistent! unused-impls)])))

 (defn close-under-implications
-  "Computes smallest superset of set being closed under given implications."
-  [implications set]
-  (assert (set? set))
+  [implications, ^BitSet set]
   (loop [set   set,
          impls implications]
-    (let [[new impls] (add-immediate-elements impls set subset?)]
+    (let [[new impls] (add-immediate-elements impls (.clone set)
+                                              (fn [^BitSet A, ^BitSet B]
+                                                (forall-in-bitset [x A]
+                                                  (.get B x))))]
       (if (= new set)
         new
         (recur new impls)))))

 (defn clop-by-implications
-  "Returns closure operator given by implications."
   [implications]
   (partial close-under-implications implications))

 ;;; Canonical Base
-
-(defn canonical-base-from-clop
-  ([clop base]
-     (canonical-base-from-clop clop base #{}))
-  ([clop base background-knowledge]
-     (assert (fn? clop)
-             "Given closure operator must be a function")
-     (assert (coll? base)
-             "Base must be a collection")
-     (assert (and (set? background-knowledge)
-                  (cm/forall [x background-knowledge]
-                    (implication? x)))
-             "Background knowledge must be a set of implications")
-     (let [next-closure (fn [implications last]
-                          (cm/next-closed-set base
-                                              (clop-by-implications implications)
-                                              last)),
-           runner       (fn runner [implications candidate]
-                          (when candidate
-                            (let [conclusions (clop candidate)]
-                              (if (not= candidate conclusions)
-                                (let [impl  (cm/make-implication candidate conclusions),
-                                      impls (conj implications impl)]
-                                  (cons impl
-                                        (lazy-seq (runner impls (next-closure impls candidate)))))
-                                (recur implications (next-closure implications candidate))))))]
-       (lazy-seq (runner background-knowledge
-                         (close-under-implications background-knowledge #{}))))))

 (defn canonical-base
   ([ctx]
@@ -85,9 +58,33 @@
   ([ctx background-knowledge]
      (assert (context? ctx)
              "First argument must be a formal context")
-     (canonical-base-from-clop #(cm/context-attribute-closure ctx %)
-                               (attributes ctx)
-                               background-knowledge)))
+     (with-binary-context ctx
+       (let [next-closure (fn [implications last]
+                            (next-closed-set object-count
+                                             attribute-count
+                                             (clop-by-implications implications)
+                                             last)),
+             runner       (fn runner [implications, ^BitSet candidate]
+                            (when candidate
+                              (let [conclusions (bitwise-context-attribute-closure
+                                                 object-count
+                                                 attribute-count
+                                                 incidence-matrix
+                                                 candidate)]
+                                (if (not= candidate conclusions)
+                                  (let [impl  (Implication. candidate
+                                                            (filter-bitset #(not (.get candidate %))
+                                                                           conclusions)),
+                                        impls (conj implications impl)]
+                                    (cons impl
+                                          (lazy-seq (runner impls (next-closure impls candidate)))))
+                                  (recur implications (next-closure implications candidate))))))]
+         (map (fn [bit-impl]
+                (cm/make-implication (to-hashset attribute-vector (premise bit-impl))
+                                     (to-hashset attribute-vector (conclusion bit-impl))))
+              (lazy-seq (runner (vec background-knowledge)
+                                (close-under-implications background-knowledge
+                                                          (to-bitset attribute-vector #{})))))))))

 ;;;


documenting edits

documenting edits

--- src/text_stream/edits.clj
+++ src/text_stream/edits.clj
@@ -1,35 +1,47 @@
-(ns text-stream.edits-model)
+(ns text-stream.edits
+  (:gen-class))

-(defn perform)
+(defn perform
+  "Performs the `edits` (in the manner defined by the `consolidate` function)
+  on the provided `source-map`."
+  [edits source-map]
+  ((consolidate edits) source-map))

 (defn consolidate
-  "Takes a seq of edits and composes them into a single function.
-   Applies from front to back of edits seq."
+  "Takes a seq of edits and composes them into a single function. Applies from
+  last to first of edits seq. This makes composing a list of edits very easy
+  with `cons`."
   [edits]
   (apply comp edits))

-(defn move-cursor
-  "Edit moves the cursor to a particular position.
-"
+(defn cursor
+  "Produces an edit function which moves the cursor to index `position-index`
+  in the text."
   [position-index]
   (fn [source-map]
     (assoc-in source-map [:pos] position-index)))

-(defn insert-text
+(defn insert
+  "Produces an edit function which inserts `text-insertion` into the text at
+  the current cursor position."
   [text-insertion]
   (fn [source-map]
+    (println "insert into:" source-map)
     (let [old-text (:text source-map)
           cursor (:pos source-map)
           new-text (str
                     (subs old-text 0 cursor)
                     text-insertion
                     (subs old-text cursor))
-          new-position (+ cursor (count new-text))]
+          new-position (+ cursor (count text-insertion))]
       {:pos new-position :text new-text})))

-(defn delete-text
+(defn delete
+  "Produces an edit function which deletes `deletion-count` characters from
+  the text from the current cursor position (backwards)."
   [deletion-count]
   (fn [source-map]
+    (println "delete from" source-map)
     (let [old-text (:text source-map)
           cursor (:pos source-map)
           new-position (- cursor deletion-count)
@@ -38,6 +50,14 @@
                     (subs old-text cursor))]
       {:pos new-position :text new-text})))

+(defn forward-delete
+  "Produces an edit function which deletes `deletion-count` characters from
+  the text forwards from the current cursor position."
+  [deletion-count]
+  #((delete deletion-count)
+    ((cursor (+ deletion-count (:pos %)))
+     %)))
+
 (defn initial-text
   [text]
   ((insert-text text)


Try to fix the "first time you visit the Adjust containers and click pay" issue.

--- frontend/components/org_settings.cljs
+++ frontend/components/org_settings.cljs
@@ -494,10 +494,14 @@
                        {:data-success-text "Paid!",
                         :data-loading-text "Paying...",
                         :data-failed-text "Failed!",
-                        :on-click #(raise! owner [:new-plan-clicked {:containers selected-paid-containers
-                                                                     :paid {:template (:id pm/default-template-properties)}
-                                                                     :price new-total
-                                                                     :description (str "$" new-total "/month, includes " (pluralize selected-containers "container"))}])}
+                        :type "submit"
+                        :on-click #(do (raise! owner [:new-plan-clicked
+                                                      {:containers selected-paid-containers
+                                                       :paid {:template (:id pm/default-template-properties)}
+                                                       :price new-total
+                                                       :description (str "$" new-total "/month, includes "
+                                                                         (pluralize selected-containers "container"))}])
+                                       false)}
                        "Pay Now"])))
                  (if (or (pm/paid? plan) (and (pm/freemium? plan) (not (pm/in-trial? plan))))
                    (list


tweet text fix

tweet text fix

--- src/tweetiment/web.clj
+++ src/tweetiment/web.clj
@@ -88,7 +88,10 @@
       (link-to
         {:class "twitter-share-button" :data-lang "en"}
         (str "https://twitter.com/share?text="
-          (url-encode (str "I got " num " as my Tweet Happiness Quotient! See yours at http://tweetiment.herokuapp.com")))
+          (url-encode
+            (str
+              "I got " num
+              " as my Tweet Happiness Quotient! See yours at http://tweetiment.herokuapp.com")))
         "Tweet")])

 (defpartial error-page []


Adapt benchmark to book two flights. Now it corresponds more closely to the paper.

--- src/vacation2/main.clj
+++ src/vacation2/main.clj
@@ -195,24 +195,27 @@
   [reservation
    {:keys [cars flights rooms]}
    {:keys [n-queries password-work-factor]}]
-  "Process a reservation: find a car, flight, and room for the reservation,
-  generate a PNR, and update the data structures.
+  "Process a reservation: find two flights, a room, and a car for the
+  reservation, generate a PNR, and update the data structures.

   This version is similar to the original vacation benchmark."
   (dosync
     (log "start tx for reservation" (:id @reservation))
-    (let [n-people     (:n-people @reservation)
-          found-car    (look-for-seats (random-subset n-queries cars) n-people)
-          found-flight (look-for-seats (random-subset n-queries flights) n-people)
-          found-room   (look-for-seats (random-subset n-queries rooms) n-people)
-          pnr          (generate-pnr reservation password-work-factor)]
+    (let [n-people      (:n-people @reservation)
+          found-flight1 (look-for-seats (random-subset n-queries flights) n-people)
+          found-flight2 (look-for-seats (random-subset n-queries flights) n-people)
+          found-room    (look-for-seats (random-subset n-queries rooms) n-people)
+          found-car     (look-for-seats (random-subset n-queries cars) n-people)
+          pnr           (generate-pnr reservation password-work-factor)]
       (log "reserving:"
-        (if found-car    (str "car "    (:id @found-car))    "no car")    "-"
-        (if found-flight (str "flight " (:id @found-flight)) "no flight") "-"
-        (if found-room   (str "room "   (:id @found-room))   "no room"))
-      (when found-car    (reserve-relation reservation found-car n-people))
-      (when found-flight (reserve-relation reservation found-flight n-people))
-      (when found-room   (reserve-relation reservation found-room n-people))
+        (if found-flight1 (str "flight1 " (:id @found-flight1)) "no flight") "-"
+        (if found-flight2 (str "flight2 " (:id @found-flight2)) "no flight") "-"
+        (if found-room    (str "room "   (:id @found-room))   "no room")     "-"
+        (if found-car     (str "car "    (:id @found-car))    "no car"))
+      (when found-flight1 (reserve-relation reservation found-flight1 n-people))
+      (when found-flight2 (reserve-relation reservation found-flight2 n-people))
+      (when found-room    (reserve-relation reservation found-room n-people))
+      (when found-car     (reserve-relation reservation found-car n-people))
       (alter reservation assoc
         :status :processed
         :pnr    pnr)))
@@ -223,15 +226,16 @@
    {:keys [cars flights rooms]}
    {:keys [n-queries password-work-factor]}
    secondary-workers]
-  "Process a reservation: find a car, flight, and room for the reservation,
-  generate a PNR, and update the data structures.
-
-  This version books the car, flight, and room in a separate actor."
+  "Process a reservation: find two flights, a room, and a car for the
+  reservation, generate a PNR, and update the data structures.
+
+  This version books the items in a separate actor."
   (dosync
     (log "start tx for reservation" (:id @reservation))
-    (send (rand-nth secondary-workers) :car    cars    reservation n-queries)
+    (send (rand-nth secondary-workers) :flight flights reservation n-queries)
     (send (rand-nth secondary-workers) :flight flights reservation n-queries)
     (send (rand-nth secondary-workers) :room   rooms   reservation n-queries)
+    (send (rand-nth secondary-workers) :car    cars    reservation n-queries)
     (let [pnr (generate-pnr reservation password-work-factor)]
       (alter reservation assoc
         :status :in-process
@@ -305,7 +309,7 @@
                         (range n-workers)))
           expected-n-done-messages
             (case version
-              :txact (* n-reservations 4)
+              :txact (* n-reservations 5) ; 1 from reservation, 4 from relations
                      n-reservations)
           start-time
             (System/nanoTime)]


Add docstring on filter-nil-vals

Add docstring on filter-nil-vals

--- src/yetibot/core/util.clj
+++ src/yetibot/core/util.clj
@@ -7,7 +7,9 @@
     [clojure.stacktrace :as st]
     [clojure.data.json :as json]))

-(defn filter-nil-vals [m]
+(defn filter-nil-vals
+  "Takes a map and returns all of its non-nil values"
+  [m]
   (into {} (remove (comp nil? second) m)))

 (defn map-to-strs [m]


Fix framebuffer size off by one error and make character dimensions available in (groups)

--- src/zaffre/glterminal.clj
+++ src/zaffre/glterminal.clj
@@ -607,7 +607,14 @@
   (args [_]
     term-args)
   (groups [_]
-     (into {} (map (fn [[id ref]] [id @ref]) group-map)))
+     (into {} (map (fn [[id ref]]
+                     (let [group @ref
+                           gg @(get group->font-texture id)]
+                       [id (merge group (select-keys gg [:font-texture-width
+                                                         :font-texture-height
+                                                         :character-width
+                                                         :character-height]))]))
+                   group-map)))
   (alter-group-pos! [_ group-id pos-fn]
     (alter (get group-map group-id) (fn [group] (update group :pos (fn [pos] (mapv int (pos-fn pos)))))))
   (alter-group-font! [_ group-id font-fn]
@@ -1016,6 +1023,7 @@
         group->font-texture (into {}
                               (mapv (fn [[k v]]
                                       [k (ref (let [font ((get @v :font) (zlwjgl/platform))
+                                                    _    (log/info "Creating glyph-graphics for" font (zlwjgl/platform))
                                                     gg   (if (zfont/glyph-graphics? font)
                                                              font
                                                              (zfont/glyph-graphics font))
@@ -1213,8 +1221,8 @@
         framebuffer-size-callback
                               (proxy [GLFWFramebufferSizeCallback] []
                                 (invoke [window framebuffer-width framebuffer-height]
-                                  (let [fbo-texture-width  (inc framebuffer-width) #_(int (zutil/next-pow-2 framebuffer-width))
-                                        fbo-texture-height (inc framebuffer-height) #_(int (zutil/next-pow-2 framebuffer-height))
+                                  (let [fbo-texture-width  framebuffer-width #_(int (zutil/next-pow-2 framebuffer-width))
+                                        fbo-texture-height framebuffer-height #_(int (zutil/next-pow-2 framebuffer-height))
                                         ^ByteBuffer bbnil  nil]
                                     (with-gl-context gl-lock window capabilities
                                       (log/info "Changing size of fbo" fbo-texture)


Added list-empty?

Added list-empty?

--- standard-library/list.clj
+++ standard-library/list.clj
@@ -57,6 +57,13 @@
             Empty
                 Empty))

+(def list-empty? (list)
+     (match list
+            (Cons _ __)
+                False
+            Empty
+                True))
+
 (def list-indexed-iterator-get (collection _)
       (match collection
              (Cons x _)  (Some x)


Strain tests runnable with lein-exec

Strain tests runnable with lein-exec

--- strain/strain_test.clj
+++ strain/strain_test.clj
@@ -39,3 +39,5 @@
                 filterv (fn [& _] (throw (Exception. "Implement without filterv!")))]
     (dorun (keep even? (range 10)))
     (dorun (discard even? (range 10)))))
+
+(run-tests)


make sure split pane is redrawn on restoration

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@10549 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- plugins/SlideExplorer2/src/slide_explorer/user_controls.clj
+++ plugins/SlideExplorer2/src/slide_explorer/user_controls.clj
@@ -314,8 +314,7 @@
                #(swap! screen-state-atom
                        assoc :x 0 :y 0 :z 0 :zoom 1)))

-;(defn handle-open [window]
-;  (bind-window-keys window ["S"] create-dir-dialog))
+;; toggling split pane

 (defn redraw-frame [frame]
   (doto (.getContentPane frame)
@@ -335,11 +334,12 @@
 (defn hide-1x-view [{:keys [frame content-pane split-pane left-panel right-panel]}]
   (doto split-pane
     remember-divider-location!
-    (.remove (.getLeftComponent split-pane))
-    (.remove (.getRightComponent split-pane)))
+    (.remove left-panel)
+    (.remove right-panel))
   (doto content-pane
     (.remove split-pane)
     (.add left-panel))
+  (.setBounds right-panel 0 0 0 0) ; ensures redraw on restoration
   (redraw-frame frame))

 (defn show-1x-view [{:keys [frame content-pane split-pane left-panel right-panel]}]
@@ -350,7 +350,7 @@
     (.setLeftComponent left-panel)
     (.setRightComponent right-panel)
     restore-divider-location!)
-  (redraw-frame frame))
+  (redraw-frame frame))

 (defn toggle-1x-view [{:keys [split-pane] :as widgets}]
   (if (.getParent split-pane)
@@ -359,6 +359,8 @@

 (defn handle-toggle-split [widgets]
   (bind-window-keys (:frame widgets) ["1"] #(toggle-1x-view widgets)))
+
+;; main function enabling controls

 (defn make-view-controllable [widgets screen-state-atom]
   (let [panel (:left-panel widgets)]


[#2032] Ensure edn files are reloaded with dev/go

dev/refresh only ensures that those files that were changed are
reloaded, but there are cases that we change edn configuration but we
don't change dev.commons namespace so edn changes aren't effective
with dev/go

--- backend/dev/src/dev.clj
+++ backend/dev/src/dev.clj
@@ -38,6 +38,7 @@
   (check-specs!))

 (defn go []
+  (commons/config)
   (ir/go))

 (defn halt! []


Fixed wrong type for whisky

Fixed wrong type for whisky


Switch rules to use defrecord

Switch rules to use defrecord

--- src/chapter3/leibniz.cljs
+++ src/chapter3/leibniz.cljs
@@ -1,20 +1,22 @@
 (ns chapter3.leibniz
   (:refer chapter3.match :only [match match-state atom?])
   (:refer clojure.test :only [with-test is run-tests]))
+
+(defrecord rule [pattern action name])
 (defn nested-diff-sum? [d v]
   (and (not (atom? v))
        (when-let [d2 (match-state '(+ (? e1) (? e2)) v)]
          (merge d d2))))
 (def diff-sum-rule
-  ['(d (nested-diff-sum? e3) (? v1))
+  (->rule '(d (nested-diff-sum? e3) (? v1))
    #(list '+ (list 'd (% 'e1) (% 'v1)) (list 'd (% 'e2) (% 'v1)))
-   "diff-sum-rule"])
+   "diff-sum-rule"))
 (defn nested-diff-x1? [d v] d)
 (defn nested-diff-x2? [d v] (and (= v (d 'e1)) d))
 (def diff-x-rule
-  ['(d (nested-diff-x1? e1) (nested-diff-x2? e2))
+  (->rule '(d (nested-diff-x1? e1) (nested-diff-x2? e2))
    (fn [d] 1)
-   "diff-x-rule"])
+   "diff-x-rule"))
 (with-test
   (defn exists-tree? [f v1]
     (if (atom? f)
@@ -32,19 +34,19 @@
   (is (exists-tree? '((2 3) (4 (5) 3) 2 1) 1)))
 (defn diff-const-e2-rule [d x] (and (not (exists-tree? (d 'e1) x)) d))
 (def diff-const-rule
-  ['(d (? e1) (diff-const-e2-rule e2))
+  (->rule '(d (? e1) (diff-const-e2-rule e2))
    (fn [d] 0)
-   "diff-const-rule"])
+   "diff-const-rule"))
 (defn diff-product-e3-rule [d x]
   (and (not (atom? x))
        (when-let [d2 (match-state '(* (? e1) (? e2)) x)]
          (merge d d2))))
 (def diff-product-rule
-  ['(d (diff-product-e3-rule e3) (? v1))
+  (->rule '(d (diff-product-e3-rule e3) (? v1))
    (fn [d] (list '+
                  (list '* (d 'e2) (list 'd (d 'e1) (d 'v1)))
                  (list '* (d 'e1) (list 'd (d 'e2) (d 'v1)))))
-   "diff-product-rule"])
+   "diff-product-rule"))
 (defn number-state? [d x]
   (when (number? x) d))
 (defn diff-power-e3-rule [d x]
@@ -52,28 +54,23 @@
        (when-let [d2 (match-state '(exp (? e1) (number-state? e2)) x)]
          (merge d d2))))
 (def diff-power-rule
-  ['(d (diff-power-e3-rule e3) (? v1))
+  (->rule '(d (diff-power-e3-rule e3) (? v1))
    (fn [d] (list '* (d 'e2)
                  (list '* (list 'exp (d 'e1) (list 'dec (d 'e2)))
                        (list 'd (d 'e1) (d 'v1)))))
-   "diff-power-rule"])
-(def ladd-zero-rule ['(+ (? x) 0) #(% 'x) "ladd-zero-rule"])
-(def radd-zero-rule ['(+ 0 (? x)) #(% 'x) "radd-zero-rule"])
-(def add-const-rule ['(+ (number-state? x) (number-state? y)) #(+ (% 'x) (% 'y)) "add-const-rule"])
-(def lprod-zero-rule ['(* (? x) 0) (fn [d] 0) "lprod-zero-rule"])
-(def rprod-zero-rule ['(* 0 (? x)) (fn [d] 0) "rprod-zero-rule"])
-(def lprod-id-rule ['(* (? x) 1) #(% 'x) "lprod-id-rule"])
-(def rprod-id-rule ['(* 1 (? x)) #(% 'x) "rprod-id-rule"])
-(def prod-const-rule ['(* (number-state? x) (number-state? y)) #(* (% 'x) (% 'y)) "prod-const-rule"])
-(def exp-zero-rule ['(exp (? x) 0) (fn [d] 1) "exp-zero-rule"])
-(def exp-id-rule ['(exp (? x) 1) #(% 'x) "exp-id-rule"])
-(def dec-rule ['(dec (number-state? x)) #(dec (% 'x)) "dec-rule"])
-; other rules go here ...
-
-; TODO: Clojure HAS to have a class/record facility to do this...
-(def rule-pattern first)
-(def rule-action second)
-(defn rule-name [rule] (nth rule 2))
+   "diff-power-rule"))
+(def ladd-zero-rule2 (->rule '(+ (? x) 0) #(% 'x) "ladd-zero-rule"))
+(def ladd-zero-rule (->rule '(+ (? x) 0) #(% 'x) "ladd-zero-rule"))
+(def radd-zero-rule (->rule '(+ 0 (? x)) #(% 'x) "radd-zero-rule"))
+(def add-const-rule (->rule '(+ (number-state? x) (number-state? y)) #(+ (% 'x) (% 'y)) "add-const-rule"))
+(def lprod-zero-rule (->rule '(* (? x) 0) (fn [d] 0) "lprod-zero-rule"))
+(def rprod-zero-rule (->rule '(* 0 (? x)) (fn [d] 0) "rprod-zero-rule"))
+(def lprod-id-rule (->rule '(* (? x) 1) #(% 'x) "lprod-id-rule"))
+(def rprod-id-rule (->rule '(* 1 (? x)) #(% 'x) "rprod-id-rule"))
+(def prod-const-rule (->rule '(* (number-state? x) (number-state? y)) #(* (% 'x) (% 'y)) "prod-const-rule"))
+(def exp-zero-rule (->rule '(exp (? x) 0) (fn [d] 1) "exp-zero-rule"))
+(def exp-id-rule (->rule '(exp (? x) 1) #(% 'x) "exp-id-rule"))
+(def dec-rule (->rule '(dec (number-state? x)) #(dec (% 'x)) "dec-rule"))

 (def rules
   [[diff-sum-rule diff-x-rule diff-const-rule diff-product-rule diff-power-rule]
@@ -91,12 +88,12 @@
       (when-let [temp (try-rule-on-list rule (rest expressions))]
         (cons (first expressions) temp)))))
 (defn fire [rule d]
-  ;(println (rule-name rule) "fires.")
-  ((rule-action rule) d))
+  ;(println (:name rule) "fires.")
+  ((:action rule) d))
 (defn try-rule [rule expression]
   (if (atom? expression)
     nil
-    (if-let [d (match-state (rule-pattern rule) expression)]
+    (if-let [d (match-state (:pattern rule) expression)]
       (fire rule d)
       (try-rule-on-list rule expression))))
 (with-test


More work with Top nav bar

More work with Top nav bar

--- src/cljs/metime/core.cljs
+++ src/cljs/metime/core.cljs
@@ -42,11 +42,20 @@
   (
    let [token (.getToken history)
         set-active (fn [nav]
-                     (assoc-in [:top-nav-bar] (if (= (:path nav) token) ({:active true}) ({:active false}))))]
+                     ((if (= (:path item) token) (assoc item :active true) (assoc item :active false))))
+        set-menu-items (fn [_] (update-in @app-state [:top-nav-bar] #(map set-active %)))]

    (swap! app-state #(map set-active %))))

 ;; (refresh-navigation)
+
+;; (defn set-active [item]
+;;   (let [token "#calendar"]
+;;    (if (= (:path item) token) (assoc item :active true) (assoc item :active false))))
+
+;; (update-in @app-state [:top-nav-bar] #(map set-active %))
+
+

 (def history (History.))


Moar.

Moar.

--- src/clojurecraft/core.clj
+++ src/clojurecraft/core.clj
@@ -45,6 +45,7 @@
   0x28 :entitymetadata
   0x32 :prechunk
   0x33 :mapchunk
+  0x34 :multiblockchange
 })
 (def packet-ids (apply assoc {} (mapcat reverse packet-types)))

@@ -69,10 +70,18 @@
   (doto (:out @conn)
     (.writeByte (int i))))

+(defn -write-bytearray [conn ba]
+  ; TODO: Implement this.
+  nil)
+
 (defn -write-short [conn i]
   (println (str "-> SHORT: " i))
   (doto (:out @conn)
     (.writeShort (int i))))
+
+(defn -write-shortarray [conn sa]
+  ; TODO: Implement this.
+  nil)

 (defn -write-int [conn i]
   (println (str "-> INT: " i))
@@ -268,6 +277,16 @@

   (-write-int conn eid)
   (-write-metadata conn metadata))
+
+(defn write-packet-multiblockchange [conn {chunkx :chunkx chunkz :chunkz arraysize :arraysize coordinatearray :coordinatearray typearray :typearray metadataarray :metadataarray}]
+  (-write-byte conn (:multiblockchange packet-ids))
+
+  (-write-int conn chunkx)
+  (-write-int conn chunkz)
+  (-write-short conn arraysize)
+  (-write-shortarray conn coordinatearray)
+  (-write-bytearray conn typearray)
+  (-write-bytearray conn metadataarray))

 ; Writing Wrappers -----------------------------------------------------------------
@@ -297,6 +316,7 @@
     (= packet-type :entityvelocity)       (write-packet-entityvelocity conn payload)
     (= packet-type :attachentity)         (write-packet-attachentity conn payload)
     (= packet-type :entitymetadata)       (write-packet-entitymetadata conn payload)
+    (= packet-type :multiblockchange)     (write-packet-multiblockchange conn payload)

     )
   (flushc conn))
@@ -322,6 +342,10 @@
 (defn -read-short [conn]
   (let [i (.readShort (:in @conn))]
     i))
+
+(defn -read-shortarray [conn size]
+  ; TODO: Implement this.
+  nil)

 (defn -read-bool [conn]
   (let [b (.readBoolean (:in @conn))]
@@ -598,6 +622,15 @@
            :compresseddata
            (-read-bytearray conn
                             (:compressedsize predata)))))
+
+(defn read-packet-multiblockchange [conn]
+  (-> {}
+    (assoc :chunkx (-read-int conn))
+    (assoc :chunkz (-read-int conn))
+    (assoc :arraysize (-read-short conn))
+    (assoc :coordinatearray (-read-shortarray conn))
+    (assoc :typearray (-read-bytearray conn))
+    (assoc :metadataarray (-read-bytearray conn))))

 ; Reading Wrappers -----------------------------------------------------------------
@@ -643,6 +676,7 @@
         (= packet-type :entitymetadata)            (read-packet-entitymetadata conn)
         (= packet-type :prechunk)                  (read-packet-prechunk conn)
         (= packet-type :mapchunk)                  (read-packet-mapchunk conn)
+        (= packet-type :multiblockarray)           (read-packet-multiblockchange conn)

         :else (str "UNKNOWN PACKET TYPE: " packet-id)
         ))


update defentity macro, add doc strings & arglist meta to generated ctor fns

--- src/imago/graph/model.clj
+++ src/imago/graph/model.clj
@@ -101,19 +101,16 @@
    {} res))

 (defmacro defentity
-  [name rdf-type props]
-  (let [name       name
-        type       rdf-type
-        ->sym      (comp symbol clojure.core/name)
-        props      (assoc props :type {:prop "rdf:type"})
+  [name type props]
+  (let [->sym      (comp symbol clojure.core/name)
+        props      (merge {:type {:prop "rdf:type"}} props)
         fields     (cons 'id (map ->sym (keys props)))
         ctor-name  (utils/->kebab-case name)
         ctor       (symbol (str 'make- ctor-name))
         dctor      (symbol (str 'describe- ctor-name))
         dctor-as   (symbol (str 'describe-as- ctor-name))
         mctor      (symbol (str 'map-> name))]
-    `(let [;;validators# (extract-key ~props :validate)
-           validators# (build-validators ~props)
+    `(let [validators# (build-validators ~props)
            defaults#   (extract-key ~props :default)
            inits#      (extract-key ~props :init)]
        ;;(prn "-------- " ~type)
@@ -126,7 +123,12 @@
          trio/PTripleSeq
          (~'triple-seq
            [_#] (filtered-triple-seq {~'id (triple-map ~props _#)})))
+
        (defn ~ctor
+         {:doc ~(str "Constructs a new `" (namespace-munge *ns*) "." `~name "` entity from given map.\n"
+                     "  Applies entity's property intializers, defaults & validation.\n"
+                     "  In case of validation errors, throws map of errors using `slingshot/throw+`.")
+          :arglists '([~'props])}
          [opts#]
          (let [[opts# err#]
                (-> opts#
@@ -136,14 +138,23 @@
                    (inject-defaults defaults#)
                    (v/validate validators#))]
            (if (nil? err#) (~mctor opts#) (throw+ err#))))
+
        (defn ~dctor
+         {:doc ~(str "Executes a :describe query for given entity ID in graph.\n"
+                     "  Returns seq of triples. ")
+          :arglists '([~'graph ~'id])}
          [g# id#]
          (q/query
           {:describe '~'?id
            :from g#
-           :query [{:where [['~'?id "rdf:type" ~type]]}]
+           :query [{:where [['~'?id (-> ~props :type :prop) ~type]]}]
            :values {'~'?id #{id#}}}))
+
        (defn ~dctor-as
+         {:doc ~(str "Constructs a new `" (namespace-munge *ns*) "." `~name "` entity based on a graph query\n"
+                     "  for given entity ID and its specified props/rels. If returned query results\n"
+                     "  conflict with entity validation, throws map of errors using `slingshot/throw+`.")
+          :arglists '([~'graph ~'id])}
          [g# id#]
          (->> ~props
               (build-describe-spec g# id#)
@@ -151,8 +162,7 @@
               (q/accumulate-result-vars)
               ;;((fn [x#] (prn x#) x#))
               (prepare-describe-results ~props)
-              (~ctor)))
-       )))
+              (~ctor))))))

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


fix loader json generator

fix loader json generator

--- src/main/shadow/build/targets/browser.clj
+++ src/main/shadow/build/targets/browser.clj
@@ -104,7 +104,7 @@

         module-uris
         (reduce
-          (fn [m {:keys [name foreign-files sources] :as module}]
+          (fn [m {:keys [module-id foreign-files sources] :as module}]
             (let [uris
                   (if release?
                     [(str asset-path "/" (:output-name module))]
@@ -117,21 +117,21 @@
                                       (data/get-source-by-id state src-id)]
                                   (str asset-path "/" cljs-runtime-path "/" output-name))))
                          (into [])))]
-              (assoc m name uris)))
+              (assoc m module-id uris)))
           {}
           modules)

         module-infos
         (reduce
-          (fn [m {:keys [name depends-on]}]
-            (assoc m name (disj depends-on (:name loader-module))))
+          (fn [m {:keys [module-id depends-on]}]
+            (assoc m module-id (disj depends-on (:module-id loader-module))))
           {}
           modules)

         loader-append-rc
         (-> loader-module :sources last)]

-    (when-not (data/get-output! state loader-append-rc)
+    (when-not (data/get-output! state {:resource-id loader-append-rc})
       (throw (ex-info "no loader append rc" {:rc loader-append-rc})))

     (update-in state [:output loader-append-rc :js]


Fixes exception pretty printing.

Fixes exception pretty printing.

--- src/onyx/static/logging_configuration.clj
+++ src/onyx/static/logging_configuration.clj
@@ -10,8 +10,8 @@
 ;; temporary workaround to prevent timbre from crashing under some circumstances
 ;; e.g. java.lang.IllegalArgumentException: Multiple methods in multimethod 'exception-dispatch' match dispatch value: class schema.core.Either
 ;; -> interface clojure.lang.IPersistentMap and interface clojure.lang.IRecord, and neither is preferred]
-; (defmethod pretty/exception-dispatch clojure.lang.IPersistentMap [m]
-;   (pr-str m))
+(defmethod pretty/exception-dispatch clojure.lang.IPersistentMap [m]
+  (prn m))

 (defrecord LoggingConfiguration [file config]
   component/Lifecycle


added notes to cluster.clj.

added notes to cluster.clj.

--- src/clj/forma/hadoop/cluster.clj
+++ src/clj/forma/hadoop/cluster.clj
@@ -1,12 +1,17 @@
+;; Very much a work in progress...
+;;
+;; TODO: Get pallet cluster configuration stuff into here, so we can
+;; use job specific cluster definitions.
+
 (ns forma.hadoop.cluster
   (:import [forma FloatsSerialization IntsSerialization]
            [cascading.tuple.hadoop BytesSerialization TupleSerialization]
            [org.apache.hadoop.io.serializer WritableSerialization JavaSerialization]))

-;; Nothing here, yet!
-;;
 ;; Returns a sequence of the classnames of all serializers used in
 ;; Forma.
+;;
+;; TODO: make sure these are in the proper order.

 (def serializers
   (let [class-seq (for [cls [FloatsSerialization IntsSerialization


implement The Turning Wheel

implement The Turning Wheel

--- src/clj/game/cards-resources.clj
+++ src/clj/game/cards-resources.clj
@@ -823,6 +823,22 @@
              :pre-advancement-cost {:effect (effect (advancement-cost-bonus 1))}
              :pre-steal-cost {:effect (effect (steal-cost-bonus [:credit 3]))}}}

+   "The Turning Wheel"
+   {:events {:run {:req (req (#{:hq :rd} target))
+                   :effect (effect (register-run-flag! card :no-agenda-stolen (constantly true)))}
+             :agenda-stolen {:req (req (#{[:hq] [:rd]} (:server run)))
+                             :effect (effect (clear-run-flag! card :no-agenda-stolen)
+                                             (register-run-flag! card :no-agenda-stolen (constantly false)))}
+             :run-ends {:req (req (and (run-flag? state side card :no-agenda-stolen)
+                                       (#{:hq :rd} target)))
+                        :effect (effect (add-prop card :counter 1))}}
+    :abilities [{:req (req (and (:run @state)
+                                (#{[:hq] [:rd]} (:server run))
+                                (> (:counter card 0) 1)))
+                 :msg "access 1 additional card for the remainder of the run"
+                 :effect (effect (add-prop card :counter -2)
+                                 (access-bonus 1))}]}
+
    "Theophilius Bagbiter"
    {:effect (req (lose state :runner :credit :all)
                  (add-watch state :theophilius-bagbiter


The proof of concept version of websocket event router is ready

--- src/clj/hellhound/http/route.clj
+++ src/clj/hellhound/http/route.clj
@@ -22,16 +22,13 @@
    :body "Expected a websocket request."})

 (def event-router
-  {:hello #(stream/put! (:stream %) "hey!")})
-
-(defn resolve-route
-  [input-stream router msg]
-  (let [handler (:hello router)]
-    (handler {:stream input-stream :msg msg})))
+  {:hello (fn [x] (str "xxx" x))})

 (defn setup-event-router
-  [router-stream router]
-  (stream/consume #(resolve-route router-stream event-router %) router-stream))
+  [output router]
+  (fn [msg]
+    (let [handler (:hello router)]
+      (stream/put! output (handler {:msg msg})))))

 (defn create-ws
   [req]
@@ -43,15 +40,16 @@
   (log/info "Accpting WS connection")
   (->
    (deferred/let-flow [socket (http/websocket-connection req)
-                       input-stream @socket
                        router-stream (stream/stream 100)
                        output-stream (stream/stream 100)]
-    (stream/consume #(println %) output-stream)
-    (setup-event-router router-stream)
-    (stream/connect input-stream router-stream)
-    (stream/connect router-stream output-stream))
+
+    (stream/connect-via socket (setup-event-router router-stream event-router) router-stream)
+    (stream/connect router-stream output-stream)
+    (stream/consume #(log/info %) output-stream))
+
    (deferred/catch
-       (fn [_]
+       (fn [err]
+         (log/error err)
          non-websocket-request))))


Removing dead code (buffer/estimate)

Removing dead code (buffer/estimate)

--- src/clj/momentum/core/buffer.clj
+++ src/clj/momentum/core/buffer.clj
@@ -20,43 +20,31 @@
  write)

 (defprotocol Conversion
-  (^{:private true} estimate [_])
   (^{:private true} to-buffer [_]))

 (extend-protocol Conversion
   (class (byte-array 0))
-  (estimate  [bytes] (count bytes))
   (to-buffer [bytes] (Buffer/wrap bytes))

   Buffer
-  (estimate  [buf] (.remaining buf))
   (to-buffer [buf] buf)

   ByteBuffer
-  (estimate  [buf] (.remaining buf))
   (to-buffer [buf] (Buffer/wrap buf))

   ChannelBuffer
-  (estimate  [buf] (.readableBytes buf))
   (to-buffer [buf] (Buffer/wrap buf))

   Collection
-  (estimate  [coll]
-    (/ (* (count coll)
-          (+ (estimate (first coll))
-             (estimate (last coll)))) 2))
   (to-buffer [coll] (Buffer/wrap coll))

   String
-  (estimate  [str] (* 2 (.length str)))
   (to-buffer [str] (Buffer/wrap str))

   Number
-  (estimate  [n] n)
   (to-buffer [n] (Buffer/allocate n))

   nil
-  (estimate  [_] 0)
   (to-buffer [_] nil))

 (defprotocol Manipulation


Add sourcery command for in-REPL defn source code

Closes #6

--- src/clj/reply/initialization.clj
+++ src/clj/reply/initialization.clj
@@ -1,4 +1,15 @@
-(ns reply.initialization)
+(ns reply.initialization
+  (:require [clojure.pprint]))
+
+(defmacro repl-defn [sym & args]
+  (let [no-meta-source (with-out-str (clojure.pprint/pprint `(defn ~sym ~@args)))
+        meta-source `(clojure.core/defn ~(with-meta sym {:source no-meta-source}) ~@args)]
+    meta-source))
+
+(defmacro sourcery [name]
+  `(if-let [s# (:source (meta (var ~name)))]
+    (do (print s#) (flush))
+    (clojure.repl/source ~name)))

 (defn help
   "Prints a list of helpful commands."
@@ -8,6 +19,7 @@
   (println "    Docs: (doc function-name-here)")
   (println "          (find-doc \"part-of-name-here\")")
   (println "  Source: (source function-name-here)")
+  (println "          (sourcery function-name-here)")
   (println " Javadoc: (javadoc java-object-or-class-here)")
   (println "Examples from clojuredocs.org:")
   (println "          (clojuredocs name-here)")
@@ -15,10 +27,10 @@

 (defn intern-with-meta [ns sym value-var]
   (intern ns
-          (with-meta sym (assoc (meta value-var) :ns (the-ns ns)))
+          (with-meta sym (meta value-var))
           @value-var))

-(def default-init-code
+(defn default-init-code []
   '(do
     (println "Welcome to REPL-y!")
     (println "Clojure" (clojure-version))
@@ -29,8 +41,12 @@
     (def exit reply.main/exit)
     (def quit reply.main/exit)
     (def help reply.initialization/help)
+
     (help)
     (reply.initialization/intern-with-meta 'user 'clojuredocs #'cd-client.core/pr-examples)
+    (binding [*err* (java.io.StringWriter.)]
+      (reply.initialization/intern-with-meta 'user 'defn #'reply.initialization/repl-defn))
+    (reply.initialization/intern-with-meta 'user 'sourcery #'reply.initialization/sourcery)
     nil))

 (defn eval-in-user-ns [code]
@@ -43,7 +59,7 @@
   [{:keys [skip-default-init
            custom-init] :as options}]
   `(do
-    ~(when-not skip-default-init default-init-code)
+    ~(when-not skip-default-init (default-init-code))
     ~(when custom-init custom-init)
     nil))


don't use doseq while blitting

don't use doseq while blitting

goya.canvasdrawing/draw-image-to-canvas is an inner loop. doseq over a
range is a big performance hit, instead use dotimes which compiles down to
a JavaScript primitive loop.

--- src/cljs/goya/canvasdrawing.cljs
+++ src/cljs/goya/canvasdrawing.cljs
@@ -15,7 +15,7 @@
     (set! (.-height canvas) screen-canvas-height)
     (set! (.-fillStyle context) "#ff0000")
     (.fillRect context 0 0 screen-canvas-width screen-canvas-height)
-    (doseq [x (range 0 pixel-count)]
+    (dotimes [x pixel-count]
       (let [pix-x (* (mod x width) pixel-size)
             pix-y (* (quot x height) pixel-size)
             color (nth pixels x)]


Remove some dead code

Remove some dead code

--- src/cljs/hyphen_keeper/core.cljs
+++ src/cljs/hyphen_keeper/core.cljs
@@ -110,8 +110,7 @@
       {:type "text"
        :placeholder label
        :value @hyphenation
-       :on-change #(reset! hyphenation (-> % .-target .-value))}]
-     #_[:p.help-block "If the hyphenation is as you would expect it then the problem lies with the liblouis tables. Please contact Christian or Mischa."]]))
+       :on-change #(reset! hyphenation (-> % .-target .-value))}]]))

 (defn- hyphenation-add-button []
   [:button.btn.btn-default


Undo schema integration temporarily

Undo schema integration temporarily

schema version needs to be upgraded, however no internet access at the moment.

--- src/cljx/ji/domain/messages.cljx
+++ src/cljx/ji/domain/messages.cljx
@@ -1,61 +1,62 @@
 (ns ^:shared ji.domain.messages
   (:require [ji.domain.game :as game]
-            [schema.core :as s]
-            #+clj [schema.macros :as sm])
-  #+cljs (:require-macros [schema.macros :as sm]))
+            ;[schema.core :as s]
+            ;#+clj [schema.macros :as sm]
+            )
+  ;#+cljs (:require-macros [schema.macros :as sm])
+  )

-#+cljs (reset! sm/*use-potemkin* false)
+;(defn valid? [& _] true) ;; TODO

-(defn valid? [& _] true) ;; TODO
-;(defprotocol IMessage
-  ;(valid? [this]))
+(defprotocol IMessage
+  (valid? [this]))

-;(defrecord ErrorMessage [message]
-  ;IMessage
-  ;(valid? [_] true))
+(defrecord ErrorMessage [message]
+  IMessage
+  (valid? [_] true))

-;(defrecord GameStateMessage [game]
-  ;IMessage
-  ;(valid? [_] true))
+(defrecord GameStateMessage [game]
+  IMessage
+  (valid? [_] true))

-;(defrecord GameFinishMessage [game]
-  ;IMessage
-  ;(valid? [_] true))
+(defrecord GameFinishMessage [game]
+  IMessage
+  (valid? [_] true))

-;(defrecord GameJoinMessage [player-id color]
-  ;IMessage
-  ;(valid? [_]
-    ;(and (string? player-id)
-         ;(re-find #"^\w{1,16}$" player-id))))
+(defrecord GameJoinMessage [player-id color]
+  IMessage
+  (valid? [_]
+    (and (string? player-id)
+         (re-find #"^\w{1,16}$" player-id))))

-;(defrecord GameLeaveMessage [player-id]
-  ;IMessage
-  ;(valid? [_] true))
+(defrecord GameLeaveMessage [player-id]
+  IMessage
+  (valid? [_] true))

-;(defrecord PlayerSetMessage [cards]
-  ;IMessage
-  ;(valid? [_] (= (count cards) 3)))
+(defrecord PlayerSetMessage [cards]
+  IMessage
+  (valid? [_] (= (count cards) 3)))

-(def +player-id+ #"^\w{1,16}$")
+;(def +player-id+ #"^\w{1,16}$")

-(sm/defrecord ErrorMessage
-  [message :- s/String])
+;(sm/defrecord ErrorMessage
+  ;[message :- s/String])

-(sm/defrecord GameStateMessage
-  [game :- s/Any #_game/Game])
+;(sm/defrecord GameStateMessage
+  ;[game :- s/Any #_game/Game])

-(sm/defrecord GameFinishMessage
-  [game :- s/Any #_game/Game])
+;(sm/defrecord GameFinishMessage
+  ;[game :- s/Any #_game/Game])

-(sm/defrecord GameJoinMessage
-  [player-id :- +player-id+
-   color :- s/Keyword])
+;(sm/defrecord GameJoinMessage
+  ;[player-id :- +player-id+
+   ;color :- s/Keyword])

-(sm/defrecord GameLeaveMessage
-  [player-id :- s/String])
+;(sm/defrecord GameLeaveMessage
+  ;[player-id :- s/String])

-(sm/defrecord PlayerSetMessage
-  [cards :- (s/pred #(= 3 (count %)) #(every? map? %)) #_[(s/one {}) (s/one {}) (s/one {})]])
+;(sm/defrecord PlayerSetMessage
+  ;[cards :- (s/pred #(= 3 (count %)) #(every? map? %)) #_[(s/one {}) (s/one {}) (s/one {})]])

 (defn join-game [& {:as fields}]
   (map->GameJoinMessage fields))


Make dependencies on functions in clj-time.* namespaces explicit to avoid clashes between `clj-time.local/to-local-date-time` and `clj-time.coerce/to-local-date-time` in clj-time 0.9.0.

--- src/clojure/contrib/humanize.clj
+++ src/clojure/contrib/humanize.clj
@@ -5,8 +5,8 @@
             [clj-time.core :refer [date-time interval in-seconds
                                    in-minutes in-hours in-days
                                    in-weeks in-months in-years]]
-            [clj-time.local :refer :all]
-            [clj-time.coerce :refer :all]))
+            [clj-time.local :refer [local-now]]
+            [clj-time.coerce :refer [to-date-time to-string]]))

 (defn intcomma
   "Converts an integer to a string containing commas. every three digits.


Imported brocas area and initialize it in main

--- src/clojure/life/daemon/main.clj
+++ src/clojure/life/daemon/main.clj
@@ -4,8 +4,10 @@
               [neko.notify :refer [toast]]
               [neko.resource :as res]
               [neko.find-view :refer [find-view]]
-              [neko.threading :refer [on-ui]])
-    (:import android.widget.EditText))
+              [neko.threading :refer [on-ui]]
+              [life.daemon.brocas-area :as brocas-area])
+    (:import android.widget.EditText
+             [android.speech.tts TextToSpeech$OnInitListener]))

 ;; We execute this function to import all subclasses of R class. This gives us
 ;; access to all application resources.
@@ -22,6 +24,12 @@
              (res/get-string R$string/your_input_fmt input))
            :long)))

+(def tts-ready
+  (reify TextToSpeech$OnInitListener
+    (onInit [this status]
+      (if (= status 0)
+        (toast "TTS ready")))))
+
 ;; This is how an Activity is defined. We create one and specify its onCreate
 ;; method. Inside we create a user interface that consists of an edit and a
 ;; button. We also give set callback to the button.
@@ -31,6 +39,7 @@
   (onCreate [this bundle]
     (.superOnCreate this bundle)
     (neko.debug/keep-screen-on this)
+    (brocas-area/init this tts-ready)
     (on-ui
       (set-content-view! (*a)
         [:linear-layout {:orientation :vertical


Fix occasional insertion of additional whitespace

Due to lack of normalization an additional newline would sometimes be
inserted after the ns form after rename-file-or-dir had done it's
thing.

--- src/refactor_nrepl/rename_file_or_dir.clj
+++ src/refactor_nrepl/rename_file_or_dir.clj
@@ -85,6 +85,7 @@
     (-> file
         slurp
         file-content-sans-ns
+        str/trim
         (str/replace old-prefix new-prefix)
         (str/replace old-ns-ref new-ns-ref))))


put in the logic for tweaking the revision description to indicate when a reversion was the reason for the change.

--- src/metabase/models/revision.clj
+++ src/metabase/models/revision.clj
@@ -60,12 +60,18 @@
          (integer? id)]}
   (sel :many Revision :model (:name entity), :model_id id, (order :id :DESC)))

-(defn- revisions-add-diff-strs [entity revisions]
-  (loop [acc [], [r1 r2 & more] revisions]
+(defn- revisions-add-diff-strs
+  "Add string descriptions of the change to each revision.  It's assumed revisions are in reverse chronological order."
+  [entity revisions]
+  (let [revision-desc (fn [rev1 rev2]
+                        (let [reverted (when (:is_reversion rev2) "reverted to an earlier revision and ")]
+                          (->> (describe-diff entity (:object rev1) (:object rev2))
+                               (str reverted))))]
+    (loop [acc [], [r1 r2 & more] revisions]
     (if-not r2
       (conj acc (assoc r1 :description "First revision."))
-      (recur (conj acc (assoc r1 :description (describe-diff entity (:object r2) (:object r1))))
-             (conj more r2)))))
+      (recur (conj acc (assoc r1 :description (revision-desc r2 r1)))
+             (conj more r2))))))

 (defn- add-details
   "Hydrate `user` and add `:description` to a sequence of REVISIONS."


Added order by clause for stations query

--- src/org/gensym/viddy/storage.clj
+++ src/org/gensym/viddy/storage.clj
@@ -63,7 +63,7 @@
 (defn current-stations [db-spec]
   (->>
    (sql/query db-spec
-              ["SELECT id, station_id, station_name, bikes, docks, longitude, latitude, status, execution_time FROM current_stations"])
+              ["SELECT id, station_id, station_name, bikes, docks, longitude, latitude, status, execution_time FROM current_stations ORDER BY station_id"])
    (map
     #(replace-keys {:station_id :station-id
                    :station_name :station-name


Actually fix the test

Actually fix the test

--- src/test/clojure/pigpen/tutorial_test.clj
+++ src/test/clojure/pigpen/tutorial_test.clj
@@ -14,7 +14,7 @@

 (defn my-data []
   (->>
-    (pig/load-tsv "input.tsv")
+    (pig/load-tsv "build/tutorial-test/input.tsv")
     (pig/map (fn [[a b c]]
                {:sum (+ (Integer/valueOf a) (Integer/valueOf b))
                 :name c}))))
@@ -23,7 +23,7 @@

 (defn my-data []
   (->>
-    (pig/load-tsv "input.tsv")
+    (pig/load-tsv "build/tutorial-test/input.tsv")
     (pig/map (fn [[a b c]]
                {:sum (+ (Integer/valueOf a) (Integer/valueOf b))
                 :name c}))
@@ -56,7 +56,7 @@
     (is (= (pig/dump (my-func data))
            [{:sum 3, :name "foo"}]))))

-(pig/write-script "build/tutorial-test/my-script.pig" (my-query "input.tsv" "output.clj"))
+(pig/write-script "build/tutorial-test/my-script.pig" (my-query "build/tutorial-test/input.tsv" "build/tutorial-test/output.clj"))

 (deftest test-join
   (let [left  (pig/return [{:a 1 :b 2} {:a 1 :b 3} {:a 2 :b 4}])


wrap up js core + tools imagery

wrap up js core + tools imagery

--- src/solar_system_of_js/core.cljs
+++ src/solar_system_of_js/core.cljs
@@ -36,6 +36,18 @@
                  :es7 {:alpha 0}
                  :es8 {:alpha 0}}
    :highlight-layer nil
+   :transpiler {:x 900
+                :y 0
+                :alpha 0
+                :font-alpha 0}
+   :linter {:x 900
+            :y 70
+            :alpha 0
+            :font-alpha 0}
+   :modulesys {:x 900
+               :y 140
+               :alpha 0
+               :font-alpha 0}
    })

 ;; Current state of the application.
@@ -198,7 +210,6 @@
       (stroke-style! "#1EA")
       (stroke!))))

-
 (defn draw-es-captions!
   [{:keys [es3 es5 es6 es7 es8]}]
   (save!)
@@ -241,9 +252,49 @@
         )
       (restore!)
       ))
-  (restore!)
-  )
-
+  (restore!))
+
+(defn draw-sign!
+  [{:keys [x y alpha font-alpha highlight]} caption offset]
+  (when-not (zero? alpha)
+    (save!)
+    (translate! x y)
+    (let [a 10
+          w 100
+          h 30]
+      (translate! (- (* 2 a (* 1.2 offset))) 0)
+
+      (save!)
+      (global-alpha! alpha)
+      (begin-path!)
+      (move-to! (- a w) (- h))
+      (line-to! (+ a w) (- h))
+      (line-to! (- w a) (+ h))
+      (line-to! (- (+ w a)) (+ h))
+      (fill-style! (if highlight "#1EA" "#EEE"))
+      (fill!)
+      (restore!)
+
+      (global-alpha! font-alpha)
+      (text-baseline! "middle")
+      (text-align! "center")
+      (font! "100 24px Roboto")
+      (fill-style! "#222")
+      (fill-style! (if highlight "#222" "#222"))
+      (fill-text! caption 0 0))
+    (restore!)))
+
+(defn draw-transpiler!
+  [opts]
+  (draw-sign! opts "TRANSPILER" 0))
+
+(defn draw-linter!
+  [opts]
+  (draw-sign! opts "LINTER" 1))
+
+(defn draw-modulesys!
+  [opts]
+  (draw-sign! opts "MODULE SYS" 2))

 ;;--------------------------------------------------------------------------------
 ;; Drawing
@@ -267,9 +318,14 @@

   (draw-title! (:title @state))
   (draw-js-core! (:js-core @state))
-  (draw-js-face! (:js-face @state))
   (draw-es-captions! (:es-captions @state))
   (draw-highlight-layer! (:highlight-layer @state))
+
+  (draw-transpiler! (:transpiler @state))
+  (draw-linter! (:linter @state))
+  (draw-modulesys! (:modulesys @state))
+
+  (draw-js-face! (:js-face @state))

   (restore!))

@@ -397,11 +453,14 @@
                  {:a :_ :b 1 :duration t} [:es-captions :es8 :alpha])))
         ])
      #(go
+        (swap! state assoc-in [:transpiler :highlight] true)
         (let [chans [(multi-animate!
                        {:a :_ :b 0 :duration 0.01} [:es-captions :es8 :alpha]
                        {:a :_ :b 200 :duration 1} [:cam :x]
                        {:a :_ :b 1.3 :duration 1} [:cam :zoom]
-                       {:a :_ :b 1 :duration 1} [:transpiler :x]
+                       {:a :_ :b 450 :duration 1} [:transpiler :x]
+                       {:a :_ :b 1 :duration 1} [:transpiler :alpha]
+                       {:a :_ :b 1 :duration 1} [:transpiler :font-alpha]
                        )
                      (go
                        (<! (timeout 50))
@@ -410,6 +469,38 @@
                          (<! (timeout 70))))]]
           (doseq [c chans]
             (<! c))))
+     #(go
+        (swap! state assoc-in [:transpiler :highlight] false)
+        (swap! state assoc-in [:linter :highlight] true)
+        (<! (multi-animate!
+              {:a :_ :b 1 :duration 1} [:linter :alpha]
+              {:a :_ :b 1 :duration 1} [:linter :font-alpha]
+              {:a :_ :b 450 :duration 1} [:linter :x])))
+     #(go
+        (swap! state assoc-in [:linter :highlight] false)
+        (swap! state assoc-in [:modulesys :highlight] true)
+        (<! (multi-animate!
+              {:a :_ :b 1 :duration 1} [:modulesys :alpha]
+              {:a :_ :b 1 :duration 1} [:modulesys :font-alpha]
+              {:a :_ :b 450 :duration 1} [:modulesys :x])))
+     #(go
+        (swap! state assoc-in [:modulesys :highlight] false)
+        (let [t 2]
+          (<! (multi-animate!
+                {:a :_ :b 0 :duration t} [:transpiler :font-alpha]
+                {:a :_ :b 0 :duration t} [:linter :font-alpha]
+                {:a :_ :b 0 :duration t} [:modulesys :font-alpha]
+                {:a :_ :b 220 :duration t} [:transpiler :x]
+                {:a :_ :b 220 :duration t} [:linter :x]
+                {:a :_ :b 220 :duration t} [:modulesys :x]
+                {:a :_ :b 0 :duration t} [:js-face :y]
+                {:a :_ :b 0 :duration t} [:js-face :x]
+                {:a :_ :b 0 :duration t} [:js-face :angle]
+                {:a 1 :b 1 :duration t} [:js-face :alpha]
+                {:a :_ :b 1 :duration t} [:cam :zoom]
+                {:a :_ :b 0 :duration t} [:cam :x]
+                {:a :_ :b 0 :duration t} [:cam :y]
+                ))))
      ])))

 (def num-slides


Add provider id to the debug message for bulk indexing

--- metadata-db-app/src/cmr/metadata_db/data/oracle/concepts.clj
+++ metadata-db-app/src/cmr/metadata_db/data/oracle/concepts.clj
@@ -357,7 +357,7 @@
                        table (tables/get-table-name provider-id concept-type)
                        conditions [`(>= :id ~start-index)
                                    `(< :id ~(+ start-index batch-size))]
-                       _ (debug "Finding batch from id >=" start-index " and id <" (+ start-index batch-size))
+                       _ (debug "Finding batch for provider" provider-id "from id >=" start-index " and id <" (+ start-index batch-size))
                        conditions (if (empty? params)
                                     conditions
                                     (cons (find-params->sql-clause params) conditions))


Story ID: develop Summary: Fixed double print if =throws=> assertion has actual as an error and it has a throwable

--- src/untangled_spec/reporters/terminal.clj
+++ src/untangled_spec/reporters/terminal.clj
@@ -113,8 +113,7 @@
                      :failed "Failed"}]
     (->> (str (status->str s) " in " w)
          (color-str :where)
-         print-fn)
-    (print-fn (color-str :where ))))
+         print-fn)))

 (defn print-test-result [{:keys [message where status actual
                                  expected extra throwable diff]}
@@ -124,7 +123,9 @@
   (when (and (= status :error)
              (instance? Throwable actual))
     (print-throwable actual))
-  (some-> throwable print-throwable)
+  (when (and throwable
+             (not (instance? Throwable actual)))
+    (print-throwable throwable))
   (some-> message (print-message print-fn))
   (when (or (not diff) (not (env :diff?))
             (and (not (env :diff-hl?)) (not (env :diff-list?))))


Make a generic realtime query function

Make a generic realtime query function

Make a generic realtime query function

--- src/webapp/framework/server/systemfns.clj
+++ src/webapp/framework/server/systemfns.clj
@@ -505,26 +505,7 @@

            (if (get @cached-queries  query-key)
                nil
-               (let [
-                     record-count       (get-count   db-table  where   params)
-
-
-
-                     results            (get-results    :db-table db-table
-                                                        :where    where
-                                                        :order    order
-                                                        :start    start
-                                                        :end      end
-                                                        :params   params
-                                                        )
-
-                     result-id-vector   (into [] (map :id results))
-                    ]
-                      (swap! cached-queries assoc  query-key {
-                                                               :records      result-id-vector
-                                                               :count        record-count
-                                                                  })
-              )
+               (update-query-in-cache  query-key)

            )

@@ -680,7 +661,7 @@
                      (println (str "    " "Before"))
                      (println (str "    " (get @cached-queries query)))

-                     (update-query-in-cache query)
+                     (update-query-in-cache  query)

                      (println (str "    "))
                      (println (str "    " "After"))