DRUNK!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

--- src/cljs/bmihw/submit.cljs
+++ src/cljs/bmihw/submit.cljs
@@ -14,9 +14,11 @@
   (let [target-username (.-value (.querySelector js/document "#username"))
         keyword (.-value (.querySelector js/document "#keyword"))
         content (.-value (.querySelector js/document "#content"))
+        drunk (.-checked (.querySelector js/document "#drunk"))
         state {:target-username target-username
                :keyword keyword
-               :content content}]
+               :content content
+               :drunk drunk}]
     (cond
       (not (or (seq target-username) (seq keyword)))
       (js/alert "YOU NEED A USERNAME OR KEYWORD.")
@@ -74,6 +76,9 @@
      [:br]
      [:input {:id "content" :type :text :name :content :placeholder "Content" :class "control big"}]
      [:br]
+     [:input {:id "drunk" :type :checkbox :name :drunk :class "control"}]
+     [:label {:for :drunk :style {:margin-left "5px"}} "I am drunk"]
+     [:br]
      [:button {:id "submit" :class "control"
                :on-click submit-to-fb!}
       "SCHEDULE IT!"]


some fixes

some fixes

--- src/cljs/redditv/core.cljs
+++ src/cljs/redditv/core.cljs
@@ -16,7 +16,7 @@
 (defonce app-state
   (atom {:subreddit "videos"
          :playlist []
-         :playlist-selected (atom nil)
+         :playlist-selected nil
          }))

 (defn player-component [entry owner]
@@ -50,7 +50,7 @@
     om/IWillReceiveProps
     (will-receive-props [this entry]
       (p/dispose (om/get-state owner :player))
-      (when (entry :url)
+      (when-not (nil? entry)
         (let [event-channel (om/get-state owner :event-channel)
               new-player
               (yt/create-youtubeplayer
@@ -71,7 +71,7 @@
     om/IRenderState
     (render-state [_ {:keys [selected
                              selection-channel]}]
-      (let [classes (if (= selected @entry)
+      (let [classes (if (= (:title selected) (:title (and entry @entry)))
                       "redditv-playlist-entry selected"
                       "redditv-playlist-entry")]
         (dom/div #js {:className classes
@@ -96,7 +96,8 @@
         [success-channel error-channel]
         (reddit/get-subreddit-videos subreddit)]
     (go (let [new-playlist (<! success-channel)]
-          (om/update! app :playlist-selected (first new-playlist))
+          (when-not (-> app :playlist-selected)
+            (om/update! app :playlist-selected (first new-playlist)))
           (om/update! app :playlist new-playlist)
           ))
     error-channel
@@ -139,11 +140,7 @@
               (let [{:keys [event-type] :as event} (<! player-channel)]
                 (case event-type
                   :video-ended
-                  (let [playlist (om/get-props owner :playlist)
-                        current-selection (om/get-props owner :playlist-selected)
-                        next-selection (utils/next-element playlist current-selection)]
-                    (om/update! app :playlist-selected next-selection)
-                    )
+                  (next-video! app)
                   :video-not-started
                   (next-video! app)
                   nil))


minor fix

minor fix

--- src/cljs/worktv/views.cljs
+++ src/cljs/worktv/views.cljs
@@ -138,7 +138,7 @@
                 :placeholder "Optional title" :wrapper-class "col-sm-10" :label-class "col-sm-2"}]
       [c/input {:type "text" :label "URL" :model [form :url] :placeholder "Image URL or search text"
                 :wrapper-class "col-sm-10" :label-class "col-sm-2"}]
-      [c/input {:type "radio" :label "Display" :model [form :display] :id "display"
+      [c/input {:type "radio" :label "Display" :model [form :display] :name "display"
                 :wrapper-class "col-sm-10" :label-class "col-sm-2"
                 :items {"fit-full" "Fill" "clipped" "Clip"}}]]
      [:div {:on-double-click #(if-let [url (-> % .-target (.getAttribute "data-url"))]


fucking macros man

fucking macros man

--- src/clojure/flambo/api.clj
+++ src/clojure/flambo/api.clj
@@ -67,10 +67,8 @@

 (defmacro iterator-fn
   [& body]
-  (let [[args & rest] body
-        rest (cons 'flambo.api/iterator rest)
-        it-body (cons args (list rest))]
-    `(fn ~@it-body)))
+  (let [[args & impl] body]
+    `(fn ~args (~'flambo.api/iterator ~@impl))))

 (defn spark-context
   "Creates a spark context that loads settings from given configuration object


adsense code

adsense code

--- src/clojure/nossal/web.clj
+++ src/clojure/nossal/web.clj
@@ -33,6 +33,8 @@
            [48 96 144 192])
       [:link {:rel "canonical" :href (core/cannonical-url req)}]
       [:link {:rel "manifest" :href (s/join ["/" (options :manifest) ".json"])}]
+      [:script {:async true :scr "//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"}]
+      [:script "(adsbygoogle = window.adsbygoogle || []).push({google_ad_client: \"ca-pub-9207695243671092\",enable_page_level_ads: true});"]
       [:script {:async true :src "https://cdn.ampproject.org/v0.js"}]
       (if-not (contains? #{"localhost" "127.0.0.1"} (:server-name req))
         [:script {:async true :custom-element "amp-analytics" :src "https://cdn.ampproject.org/v0/amp-analytics-0.1.js"}])


Put a class on the editor.

Put a class on the editor.

--- src/klangmeister/views.cljs
+++ src/klangmeister/views.cljs
@@ -18,7 +18,7 @@
     [:div
      [:div {:class "graph"} [graph/render handle! state-atom]]
      [:div {:class "controls"} button]
-     [:div {:class (if error "error" "")} [editor/render handle! state]]
+     [:div {:class (str "editor " (if error "error" ""))} [editor/render handle! state]]
      [:div
       [:table {:class "cheatsheet"}
        [:tbody


Fixed apply-at call in looper example. Also made arg handling of apply-at calls consistent.

--- examples/basic.clj
+++ examples/basic.clj
@@ -50,7 +50,7 @@
         (if (zero? (mod beat 6))
           (overpad (+ 12 (choose notes)) 0.5 0.15 0.1)
           (overpad (choose notes) 0.5 0.15 0.1)))
-  (apply-at (metro (inc beat)) #'player (inc beat) [(next notes)])))
+  (apply-at (metro (inc beat)) #'player (inc beat) (next notes) [])))

 (player (metro) [])

@@ -99,7 +99,7 @@
   (at t (kick))
   (at (+ t 350) (doseq [note (chord-notes)] (overpad (first notes) 0.3 0.1)))
   (at t (overpad (- (first notes) 36) 0.3 (/ dur 1000)))
-  (apply-at (+ t dur) #'looper (+ t dur) dur (next notes)))
+  (apply-at (+ t dur) #'looper (+ t dur) dur (next notes) []))

 ;(looper (now) 500 (cycle [60 67 65 72 75 70]))


runnign but still-buggy bottom-up version.

--- src/exp/sahucs_inverted.clj
+++ src/exp/sahucs_inverted.clj
@@ -24,6 +24,7 @@
       (do (assert (pred (get m k) v)) m)
     (assoc m k v)))

+(defn spos [s]  (try  (map #(env/get-var s %) '[[atx] [aty]]) (catch Exception e)))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Data Structures ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -48,11 +49,23 @@
     (.add hs init-parent-entry)
     (SANode context a (atom init-result-map) (atom [[init-parent-entry ip-reward]]) hs)))

+
+(defn gq-parent-key [parent-info]
+  (if (= parent-info :fresh) :fresh (first (first parent-info))))
+
 (deftype GQEntry [effects reward-to-state sanode remaining-parents-atom] :as this
     Object
-    (equals [y] (and (= effects (:effects y)) (identical? sanode (:sanode y))))
-    (hashCode [] (unchecked-add (int (hash effects))
-                                (unchecked-multiply (int 13) (System/identityHashCode sanode)))))
+    (equals [y]
+      (and (= effects (:effects y))
+           (identical? sanode (:sanode y))
+           (identical? (gq-parent-key @remaining-parents-atom)
+                       (gq-parent-key @(:remaining-parents-atom y)))))
+    (hashCode []
+      (unchecked-add (int (hash effects))
+        (unchecked-multiply (int 13)
+          (unchecked-add (System/identityHashCode sanode)
+            (unchecked-multiply (int 17)
+              (System/identityHashCode (gq-parent-key @remaining-parents-atom))))))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -63,50 +76,55 @@

 (defn get-sa-node [#^HashMap cache a parent-entry pre-reward]
   "Create a new sa-node, or returned the cached copy if it exists."
-  (println "get-sa" (env/action-name a))
   (let [s       (:state parent-entry)
         context (env/precondition-context a s)
         cache-key [(env/action-name a) (env/extract-context s context)]
         cache-val (.get cache cache-key)]
+;    (println "get-sa" (env/action-name a) (when cache-val "t") (when (and cache-val (.contains (:parent-set cache-val) parent-entry)) "t") pre-reward (:reward-to-state parent-entry))
     (when cache-val (assert (<= pre-reward (second (last @(:parent-vec-atom cache-val))))))
     (cond (and cache-val (.contains (:parent-set cache-val) parent-entry))
-            []
+          []
           cache-val
-            (do (swap! (:parent-vec-atom cache-val) conj [parent-entry pre-reward])
-                (.add  (:parent-set cache-val) parent-entry)
-                (for [[e sr] @(:result-map-atom cache-val)]
-                  [(GQEntry e (+ (:reward-to-state parent-entry) sr) cache-val (atom [[parent-entry]]))
-                   (- 0 pre-reward sr)]))
+          (do (swap! (:parent-vec-atom cache-val) conj [parent-entry pre-reward])
+              (.add  (:parent-set cache-val) parent-entry)
+;              (println "REHIT" (env/action-name (:action cache-val)) (count @(:result-map-atom cache-val)))
+              (for [[e sr] @(:result-map-atom cache-val)]
+                [(GQEntry e sr cache-val (atom [[parent-entry pre-reward]]))
+                 (- 0 pre-reward sr)]))
           :else
-            (let [s      (env/get-logger s)]
-              (if (env/primitive? a)
-                  (if (env/applicable? a s)
-                      (let [[ss sr] (env/successor a (env/get-logger s ))
-                            e       (env/extract-effects ss context)
-                            nd      (make-sa-node context a {e sr} parent-entry pre-reward)]
-                        (.put cache cache-key nd)
-                        [[(GQEntry e (+ (:reward-to-state parent-entry) sr) nd (atom :fresh))
-                           (- 0 pre-reward sr)]])
-                    (do (.put cache cache-key (make-sa-node context a {} parent-entry pre-reward))
-                        nil))
-                (let [nd (make-sa-node context a {} parent-entry pre-reward)]
+          (let [s      (env/get-logger s)]
+            (if (env/primitive? a)
+              (if (env/applicable? a s)
+                (let [[ss sr] (env/successor a (env/get-logger s ))
+                      e       (env/extract-effects ss context)
+                      nd      (make-sa-node context a {e sr} parent-entry pre-reward)]
+;                  (println "app")
                   (.put cache cache-key nd)
-                  (doall
-                   (mapcat
-                    (fn [ref]
-                      (if (empty? ref)
-                        [[(GQEntry (env/extract-effects s context) 0 nd (atom :fresh)) (- pre-reward)]]
-                        (get-sa-node cache (first ref) (ParentEntry s 0 (next ref) nd) pre-reward)))
-                    (hierarchy/immediate-refinements a s)))))))))
+                  [[(GQEntry e sr nd (atom :fresh))
+                    (- 0 pre-reward sr)]])
+                (do ;(println "NA")
+                    (.put cache cache-key (make-sa-node context a {} parent-entry pre-reward))
+                    nil))
+              (let [nd (make-sa-node context a {} parent-entry pre-reward)]
+                (.put cache cache-key nd)
+                (doall
+                 (mapcat
+                  (fn [ref]
+                    (if (empty? ref)
+                      [[(GQEntry (env/extract-effects s context) 0 nd (atom :fresh)) (- pre-reward)]]
+                      (get-sa-node cache (first ref) (ParentEntry s 0 (next ref) nd) pre-reward)))
+                  (hierarchy/immediate-refinements a s)))))))))

 (defn update-parent [cache parent-entry parent-pre-reward new-effects new-reward child-sanode]
-  (let [actions      (:remaining-actions parent-entry)]
+  (let [final-state  (env/apply-effects (:state parent-entry) new-effects)
+        actions      (:remaining-actions parent-entry)]
     (if (empty? actions)
-       [[(GQEntry new-effects (+ (:reward-to-state parent-entry) new-reward)
+       [[(GQEntry (env/extract-effects final-state (:context (:sanode parent-entry)))
+                  (+ (:reward-to-state parent-entry) new-reward)
                   (:sanode parent-entry) (atom :fresh))
          (- 0 parent-pre-reward new-reward)]]
       (get-sa-node cache (first actions)
-                   (ParentEntry (env/apply-effects (:state parent-entry) new-effects)
+                   (ParentEntry final-state
                                 (+ (:reward-to-state parent-entry) new-reward)
                                 (next actions) (:sanode parent-entry))
                    (+ parent-pre-reward new-reward)))))
@@ -115,6 +133,9 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;    Top-level    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

+(defn pp [q xs]
+  ;(println "adding" (count xs))
+  (queues/pq-add-all! q xs))

 (defn sahucs-inverted [henv]
   (let [e     (hierarchy/env henv)
@@ -126,7 +147,8 @@
     (loop []
       (if (queues/pq-empty? queue) nil
           (let [[best neg-rew] (queues/pq-remove-min-with-cost! queue)]
-            (println neg-rew (queues/pq-size queue) (env/action-name (:action (:sanode best))))
+;            (assert (<= neg-rew 10))
+;            (println neg-rew (queues/pq-size queue) (env/action-name (:action (:sanode best))) (:effects best) (spos (:state (first (:parent-set (:sanode best))))))
             (if (nil? (:sanode (first (:parent-set (:sanode best)))))
                 (- neg-rew)
               (let [cpa-val     @(:remaining-parents-atom best)
@@ -137,13 +159,14 @@
                                   cpa-val)
                     best-rew    (- 0 neg-rew (:reward-to-state best))
                     [good-parents bad-parents] (split-with #(= (second %) best-rew) cur-parents)]
-                (util/assert-is (seq good-parents) "%s" [neg-rew (:reward-to-state best) best-rew (map second cur-parents) (env/action-name (:action (:sanode best)))])
+;                (println (map second bad-parentsc))
+                (util/assert-is (seq good-parents)  "%s" [(keyword? cpa-val) neg-rew (:reward-to-state best) best-rew (map second cur-parents) (env/action-name (:action (:sanode best)))])
                 (reset! (:remaining-parents-atom best) bad-parents)
                 (when (seq bad-parents)
                   (queues/pq-replace! queue best
                                       (- 0 (:reward-to-state best) (second (first bad-parents)))))
                 (doseq [[parent parent-reward] good-parents]
-                  (queues/pq-add-all! queue
+                  (pp #_ queues/pq-add-all! queue
                     (update-parent cache parent parent-reward
                                    (:effects best) (:reward-to-state best) (:sanode best))))
                 (recur))))))))


add refresh button,remove redirect after save in mutations-add-form;remove rack-number if only send date is selected in mutations-update-form

--- src_cljs/rrm/corecljs.cljs
+++ src_cljs/rrm/corecljs.cljs
@@ -538,6 +538,10 @@
           [form-input-element :remarks "Remarks" "text" data-set focus]
           ])])))

+(defn reset-mut-combo-boxes []
+  (set! (.-value (dom/getElement "districtid")) 0)
+  (set-key-value :subdivisions [])
+  (set-key-value :villages []))

 (defn add-mutation-template [doc-name data-set focus save-function]
@@ -568,10 +572,12 @@
        [add-check-input-element :senddate "Send Date" data-set focus]
        ]
       [:div.box-footer
-       [:div.col-sm-8.col-md-offset-5
+       [:div.col-sm-12.col-md-offset-5
         [button-tool-bar
          [button {:bs-style "default" :on-click form-cancel } "Cancel"]
-         [button {:bs-style "info" :on-click save-function} "Save"]]]
+         [button {:bs-style "info" :on-click save-function} "Save"]
+         (when (nil? (:id @data-set)) [button {:bs-style "info" :on-click #((reset! data-set {:isactive true})
+                                                                            (reset-mut-combo-boxes))} "Refresh"])]]
        ;;[:span (str @data-set)]
        ]]]]])

@@ -608,6 +614,7 @@
           [form-input-element :remarks "Remarks" "text" data-set focus]])])))

+
 (defn update-mutation-template [doc-name data-set focus save-function]
   [:div.container
    [:div.col-md-12
@@ -639,7 +646,7 @@
        [:div.col-sm-8.col-md-offset-5
         [button-tool-bar
          [button {:bs-style "default" :on-click form-cancel } "Cancel"]
-         [button {:bs-style "info" :on-click save-function} "Save"]]]
+         [button {:bs-style "info" :on-click save-function } "Save"]]]
        ;;[:span (str @data-set)]
        ]]]]])

@@ -662,7 +669,7 @@
 (defn add-form-onclick [data-set focus]
   (if (= nil (form-validator @data-set))
     (let [onres (fn[json]
-                  (secretary/dispatch! "/"))]
+                  (reset! data-set {:isactive true}))]
       (http-post (str serverhost "mutations")
                  onres  (.serialize (Serializer.) (clj->js (map-mutation-data @data-set)))))
     (reset! focus "on")))
@@ -671,6 +678,8 @@
   (if (= nil (form-validator @data-set))
     (let [onres (fn[data]
                   (secretary/dispatch! "/"))]
+      (when (and (not (nil? (:senddate @data-set)))
+                 (nil? (:receiveddate @data-set))) (swap! data-set assoc :racknumber ""))
       (http-put (str serverhost "mutations/" (:id @data-set))
                 onres (.serialize (Serializer.) (clj->js (map-mutation-data @data-set))))))
   (reset! focus "on"))
@@ -684,8 +693,8 @@

 (defn mutation-update-template [id dmt]
   (do
-     (if (and (not= nil (.-senddate dmt)) (not= nil (.-receiveddate dmt)))
-        (let [update-data (r/atom {:id (int id)
+    (if (and (not= nil (.-senddate dmt)) (not= nil (.-receiveddate dmt)))
+      (let [update-data (r/atom {:id (int id)
                                  :mutationnumber (.-mutationnumber (.-numbers dmt))
                                  :nameofthefirstparty (.-nameofthefirstparty dmt)
                                  :nameofthesecondparty (.-nameofthesecondparty dmt)
@@ -707,72 +716,72 @@
                                  :subdivisionid (.-id (.-subdivision dmt))
                                  :districtid (.-id (.-district dmt))
                                  :isactive true})
-              focus (r/atom nil)]
+            focus (r/atom nil)]
         (fn []
           [add-mutation-template
            "Mutation Update Form"
            update-data
            focus
            #(update-form-onclick update-data focus)]))
-        (if (= nil (.-senddate dmt))
-          (let [update-data (r/atom {:id (int id)
-                                     :mutationnumber (.-mutationnumber (.-numbers dmt))
-                                     :nameofthefirstparty (.-nameofthefirstparty dmt)
-                                     :nameofthesecondparty (.-nameofthesecondparty dmt)
-                                     :dateofinstitution (.-dateofinstitution dmt)
-                                     :nameofpo (.-nameofpo dmt)
-                                     :dateofdecision (.-dateofdecision dmt)
-                                     :title (.-title dmt)
-                                     :khasranumber (.-khasranumber (.-numbers dmt))
-                                     :khatakhatuninumber (.-khasranumber (.-numbers dmt))
-                                     :area (.-area dmt)
-                                     :o2number (.-o2number (.-numbers dmt))
-                                     :o4number (.-o4number (.-numbers dmt))
-                                     :o6number (.-o6number (.-numbers dmt))
-                                     :racknumber (.-racknumber (.-numbers dmt))
-                                     :senddate (.-senddate dmt)
-                                     :receiveddate (.-receiveddate dmt)
-                                     :remarks (.-remarks dmt)
-                                     :villageid (.-id (.-village dmt))
-                                     :subdivisionid (.-id (.-subdivision dmt))
-                                     :districtid (.-id (.-district dmt))
-                                     :isactive true})
-                focus (r/atom nil)]
-            (fn []
-              [add-mutation-template
-               "Mutation Update Form"
-               update-data
-               focus
-               #(update-form-onclick update-data focus)]))
-          (let [update-data (r/atom {:id (int id)
-                                     :mutationnumber (.-mutationnumber (.-numbers dmt))
-                                     :nameofthefirstparty (.-nameofthefirstparty dmt)
-                                     :nameofthesecondparty (.-nameofthesecondparty dmt)
-                                     :dateofinstitution (.-dateofinstitution dmt)
-                                     :nameofpo (.-nameofpo dmt)
-                                     :dateofdecision (.-dateofdecision dmt)
-                                     :title (.-title dmt)
-                                     :khasranumber (.-khasranumber (.-numbers dmt))
-                                     :khatakhatuninumber (.-khasranumber (.-numbers dmt))
-                                     :area (.-area dmt)
-                                     :o2number (.-o2number (.-numbers dmt))
-                                     :o4number (.-o4number (.-numbers dmt))
-                                     :o6number (.-o6number (.-numbers dmt))
-                                     :racknumber (.-racknumber (.-numbers dmt))
-                                     :senddate (.-senddate dmt)
-                                     :receiveddate (.-receiveddate dmt)
-                                     :remarks (.-remarks dmt)
-                                     :villageid (.-id (.-village dmt))
-                                     :subdivisionid (.-id (.-subdivision dmt))
-                                     :districtid (.-id (.-district dmt))
-                                     :isactive true})
-                focus (r/atom nil)]
-            (fn []
-              [update-mutation-template
-               "Mutation Update Form"
-               update-data
-               focus
-               #(update-form-onclick update-data focus)]))))))
+      (if (= nil (.-senddate dmt))
+        (let [update-data (r/atom {:id (int id)
+                                   :mutationnumber (.-mutationnumber (.-numbers dmt))
+                                   :nameofthefirstparty (.-nameofthefirstparty dmt)
+                                   :nameofthesecondparty (.-nameofthesecondparty dmt)
+                                   :dateofinstitution (.-dateofinstitution dmt)
+                                   :nameofpo (.-nameofpo dmt)
+                                   :dateofdecision (.-dateofdecision dmt)
+                                   :title (.-title dmt)
+                                   :khasranumber (.-khasranumber (.-numbers dmt))
+                                   :khatakhatuninumber (.-khasranumber (.-numbers dmt))
+                                   :area (.-area dmt)
+                                   :o2number (.-o2number (.-numbers dmt))
+                                   :o4number (.-o4number (.-numbers dmt))
+                                   :o6number (.-o6number (.-numbers dmt))
+                                   :racknumber (.-racknumber (.-numbers dmt))
+                                   :senddate (.-senddate dmt)
+                                   :receiveddate (.-receiveddate dmt)
+                                   :remarks (.-remarks dmt)
+                                   :villageid (.-id (.-village dmt))
+                                   :subdivisionid (.-id (.-subdivision dmt))
+                                   :districtid (.-id (.-district dmt))
+                                   :isactive true})
+              focus (r/atom nil)]
+          (fn []
+            [add-mutation-template
+             "Mutation Update Form"
+             update-data
+             focus
+             #(update-form-onclick update-data focus)]))
+        (let [update-data (r/atom {:id (int id)
+                                   :mutationnumber (.-mutationnumber (.-numbers dmt))
+                                   :nameofthefirstparty (.-nameofthefirstparty dmt)
+                                   :nameofthesecondparty (.-nameofthesecondparty dmt)
+                                   :dateofinstitution (.-dateofinstitution dmt)
+                                   :nameofpo (.-nameofpo dmt)
+                                   :dateofdecision (.-dateofdecision dmt)
+                                   :title (.-title dmt)
+                                   :khasranumber (.-khasranumber (.-numbers dmt))
+                                   :khatakhatuninumber (.-khasranumber (.-numbers dmt))
+                                   :area (.-area dmt)
+                                   :o2number (.-o2number (.-numbers dmt))
+                                   :o4number (.-o4number (.-numbers dmt))
+                                   :o6number (.-o6number (.-numbers dmt))
+                                   :racknumber (.-racknumber (.-numbers dmt))
+                                   :senddate (.-senddate dmt)
+                                   :receiveddate (.-receiveddate dmt)
+                                   :remarks (.-remarks dmt)
+                                   :villageid (.-id (.-village dmt))
+                                   :subdivisionid (.-id (.-subdivision dmt))
+                                   :districtid (.-id (.-district dmt))
+                                   :isactive true})
+              focus (r/atom nil)]
+          (fn []
+            [update-mutation-template
+             "Mutation Update Form"
+             update-data
+             focus
+             #(update-form-onclick update-data focus)]))))))

 (defn click-update[id]
   (secretary/dispatch! (str "/mutations/update/" id)))


Detail screen - Simple (single line) transactions - correctly handle when only one of the two parts has a note

--- src/accounting/calc.cljs
+++ src/accounting/calc.cljs
@@ -39,7 +39,7 @@
 (defn single-row-tx? [[part1 part2 :as parts]]
   (and (= 2 (count parts))
        (= (- (:amount part1)) (:amount part2))
-       (= (:note part1) (:note part2))))
+       (or (not (:note part1)) (not (:note part2)) (= (:note part1) (:note part2)))))

 (defn cmp-sign-abs [n1 n2]
   (if (= (compare n1 0) (compare n2 0))
@@ -53,7 +53,7 @@
         [{:to-account (:account to-part)
           :from-account (:account from-part)
           :amount (display-amount (:amount to-part) (:unit to-part))
-          :note (:note to-part)}]
+          :note (or (:note to-part) (:note from-part))}]
         (vec
           (for [{:keys [account amount unit note]} parts
                 :let [pos (pos? amount)]]


lein-release plugin: bumped version from 0.1.1 to 0.1.2-SNAPSHOT for next development cycle

--- backend/project.clj
+++ backend/project.clj
@@ -1,4 +1,4 @@
-(defproject lambdaui "0.1.1"
+(defproject lambdaui "0.1.2-SNAPSHOT"
   :description "LambdaCD-Plugin that provides a modern UI for your pipeline."
   :url "https://github.com/sroidl/lambda-ui"
   :license {:name "Apache License 2.0"


work on warnings

work on warnings

--- src/nml/core.clj
+++ src/nml/core.clj
@@ -10,16 +10,30 @@

 (def debug false)

+(def msgs
+  {0 "-i/--in-place has no effect when no input file is specified."
+   1 "Input file required for get operations."
+   2 "-n/--no-prefix has no effect on set operations."
+   3 "Do not mix get and set operations."})
+
 (def parse (insta/parser (clojure.java.io/resource "grammar")))

 (def version "0.1")

-;; defns
-
-(defn fail [& msg]
-  (doseq [line msg]
+
+;; utility defns
+
+(defn fail [& lines]
+  (doseq [line lines]
     (println line))
   (System/exit 1))
+
+(defn warn [& lines]
+  (binding [*out* *err*]
+    (doseq [line lines]
+      (println (str "WARNING: " line)))))
+
+;; nml defns

 (defn nml-add [tree parent child match proxy]
   (let [missing  (fn [children] (not-any? #(= (nml-name %) match) children))
@@ -149,6 +163,7 @@
 (def cliopts
   [["-g" "--get n:k"   "Get value of key 'k' in namelist 'n'"         :assoc-fn assoc-get :parse-fn parse-get]
    ["-h" "--help"      "Show usage information"                                                              ]
+   ["-i" "--in-place"  "Edit namelist file in place"                                                         ]
    ["-n" "--no-prefix" "Report values without 'namelist:key=' prefix"                                        ]
    ["-s" "--set n:k=v" "Set value of key 'k' in namelist 'n' to 'v'"  :assoc-fn assoc-set :parse-fn parse-set]
    ["-v" "--version"   "Show version information"                                                            ]])
@@ -173,10 +188,12 @@
         sets (:set options)]
     (if (:help options) (usage summary))
     (if (:version options) (do (println version) (System/exit 0)))
-    (if (and gets sets) (fail "Do not mix get and set operations."))
+    (if (and gets sets) (fail (msgs 3)))
+    (if (and sets (:no-prefix options)) (warn (msgs 2)))
     (let [file (first arguments)
           tree (if file (nml-tree file) [:s])]
-      (if (and gets (not file)) (fail "Input file required for get operations."))
+      (if (and gets (not file)) (fail (msgs 1)))
+      (if (and (:in-place options) (not file)) (warn (msgs 0)))
       (if debug (println tree))
       (cond gets  (nml-gets tree gets (:no-prefix options))
             sets  (println (string/trim (nml-str (nml-sets tree sets))))


add file content

add file content

--- src/dasha/widgets/test.clj
+++ src/dasha/widgets/test.clj
@@ -1 +1,31 @@
-(ns dasha.widgets.test)
+(ns dasha.widgets.test
+  (:require [org.httpkit.client :as http]
+            [cheshire.core :as json]
+            [clojure.core.async :as async :refer [chan dropping-buffer sliding-buffer
+                                                  go go-loop thread
+                                                  <! >! >!! <!! take!
+                                                  alts! alts!!
+                                                  timeout
+                                                  close!]]))
+
+(defn print-weather [responce]
+  (let [main-weather (:main responce)]
+    (println "Temperature is " (:temp main-weather)
+             " atmospheric pressure is " (:pressure main-weather))))
+
+(def channel (chan))
+
+(go-loop [] (let [body (<! channel)]
+      (print-weather (json/parse-string body true))
+      (recur)))
+
+(defn callback [{:keys [status headers body error opts]}]
+  (go (>! channel body)))
+
+(def options {:query-params {:q "Saint-Petersburg"}})
+
+(go-loop [step 0]
+         (<! (timeout 2000))
+         (http/get "http://api.openweathermap.org/data/2.5/weather" options callback)
+         (if (< step 10)
+           (recur (inc step))))


Fix to robot-actions

Fix to robot-actions

--- ros/angelic_planning/src/ros/world.clj
+++ ros/angelic_planning/src/ros/world.clj
@@ -404,7 +404,7 @@
 	     :height 0.6}

     "bottle" {:xyz [16.3 26.1 0.85] :rpy [0 0 0] :def (get-odwalla)
-	     :type :movable :on "table" :goal ["table" (make-xy-region [17.7 18.0] [26.0 26.2])]
+	     :type :movable :on "table" :goal nil #_ ["table" (make-xy-region [17.7 18.0] [26.0 26.2])]
 	      :height 0.2}
     "bottle2" {:xyz [16.3 27.0 0.85] :rpy [0 0 0] :def (get-odwalla)
 	     :type :movable :on "table" :goal ["endtable"] #_["table" (make-xy-region [16.21 16.8] [26.2 26.5])] :height 0.2}
@@ -412,7 +412,7 @@
 	     :type :movable :on "endtable" :goal ["table" ] :height 0.2}

     "bottle4" {:xyz [18.8 26.5 0.85] :rpy [0 0 0] :def (get-odwalla)
-	     :type :movable :on "table" :goal ["table" (make-xy-region [16.21 17.0] [26.98 27.12])]
+	     :type :movable :on "table" :goal nil #_["table" (make-xy-region [16.21 17.0] [26.98 27.12])]
 	      :height 0.2}
     }
       d3-res d2-res d2-pad))


Organizing code a little better

Organizing code a little better

--- src/descent/pom_parser.clj
+++ src/descent/pom_parser.clj
@@ -4,7 +4,7 @@

 (defn load-pom [pom-location] (parse (java.io.File. pom-location)))

-;(def pom (load-pom "resources/pom.xml"))
+(def pom (load-pom "resources/pom.xml"))

 ;(:tag pom)
 ;(:attrs pom)
@@ -25,15 +25,63 @@
   [pom]
   (-> pom :content (nth 5) :content first))

-(defn- get-properties-from-pom
-  "Given a pom, extract the properties and see if they contain dependency version data."
-  [pom]
-  (-> pom :content (nth 7) :content))
-
 ;(get-properties-from-pom pom)

 ;(def properties (get-properties-from-pom pom))
 ;(first properties)
+
+
+
+;(contains-version? {:tag :apple.hh})
+;(contains-version? {:tag :rivulet.version})
+
+;(filter-out-properties-without-version properties)
+
+
+;;;; Access the project dependencies through the following logic:
+;;;;   1. if properties section exists, place versions in a hash-map
+;;;;   2. if dependencyManagement section exists, extract deps if it does
+;;;;      if dependencyManagement is absent, just process dependencies instead
+;;;;   3. extract version nmumbers from dependencies and if needed use the properties map
+
+;;; Functions to check if certain pom sections exist
+
+(defn- tag-equals? [m tag] (= (:tag m) tag))
+
+;(get-in pom [:content])
+
+(defn- pom-has-properties?
+  [pom]
+  (some? (filter #(tag-equals? % :properties) (:content pom))))
+
+
+(defn- pom-has-dependencyManagement?
+  [pom]
+  (some? (filter #(tag-equals? % :dependencyManagement) (:content pom))))
+
+
+(defn- pom-has-dependencies?
+  [pom]
+  (some? (filter #(tag-equals? % :dependencies) (:content pom))))
+
+
+;;; Functions to process the properties section
+
+(defn- filter-out-properties-without-version
+  "Returns only those properties that are a version number."
+  [coll]
+  (filter contains-version? coll))
+
+
+(defn- get-properties-from-pom
+  "Given a pom, extract the properties and see if they contain dependency version data."
+  [pom]
+  (-> (filter #(tag-equals? % :properties) (:content pom))
+      first
+      :content
+      filter-out-properties-without-version))
+
+;(get-properties-from-pom pom)

 (defn- contains-version?
   "Checks a given member of the pom properties to see if it contains version number."
@@ -45,36 +93,25 @@
                          (= "version"))]
     has-version?))

-;(contains-version? {:tag :apple.hh})
-;(contains-version? {:tag :rivulet.version})

-(defn- filter-out-properties-without-version
-  "Returns only those properties that are a version number."
-  [coll]
-  (filter contains-version? coll))
-
-;(filter-out-properties-without-version properties)
+(defn- parse-name
+  [name]
+  (-> (clojure.string/split (str name) #"\.")
+      first
+      (subs 1)))

 (defn- get-dep-version-map
   "Given the properties portion of a pom, return a seq of "
   [properties]
-  (let [version-props (filter-out-properties-without-version properties)
-        parse-name (fn [k](-> (clojure.string/split (str k) #"\.")
-                              first
-                              (subs 1)))]
-    (-> (fn [x] [(parse-name (:tag x)) (-> x :content first)])
-        (map version-props))))
+  (let [properties-map (transient {})]
+    (doseq [p properties]
+      (assoc! properties-map (keyword (parse-name (:tag p))) (first (:content p))))
+    (persistent! properties-map)))

-;(get-dep-version-map properties)
+(get-dep-version-map (get-properties-from-pom pom))

-(defn get-deps-and-versions
-  [pom]
-  (-> (get-properties-from-pom pom)
-      get-dep-version-map))
+;;; Functions to process dependencyManagement

-;(get-deps-and-versions pom)
-
-
-
+;;; Functions to process dependencies


First windowing test complete.

First windowing test complete.

--- test/onyx/windowing/basic_windowing_test.clj
+++ test/onyx/windowing/basic_windowing_test.clj
@@ -5,24 +5,10 @@
             [onyx.test-helper :refer [load-config]]
             [onyx.api]))

-(def id (java.util.UUID/randomUUID))
-
-(def config (load-config))
-
-(def env-config (assoc (:env-config config) :onyx/id id))
-
-(def peer-config (assoc (:peer-config config) :onyx/id id))
-
-(def env (onyx.api/start-env env-config))
-
-(def peer-group (onyx.api/start-peer-group peer-config))
-
-(def batch-size 20)
-
 (def input
   [{:id 1  :age 21 :event-time #inst "2015-09-13T03:00:00.829-00:00"}
    {:id 2  :age 12 :event-time #inst "2015-09-13T03:04:00.829-00:00"}
-   {:id 3  :age 3 :event-time #inst "2015-09-13T03:05:00.829-00:00"}
+   {:id 3  :age 3  :event-time #inst "2015-09-13T03:05:00.829-00:00"}
    {:id 4  :age 64 :event-time #inst "2015-09-13T03:06:00.829-00:00"}
    {:id 5  :age 53 :event-time #inst "2015-09-13T03:07:00.829-00:00"}
    {:id 6  :age 52 :event-time #inst "2015-09-13T03:08:00.829-00:00"}
@@ -36,48 +22,24 @@
    {:id 14 :age 60 :event-time #inst "2015-09-13T03:32:00.829-00:00"}
    {:id 15 :age 35 :event-time #inst "2015-09-13T03:16:00.829-00:00"}])

-(def workflow [[:in :identity] [:identity :out]])
-
-(def catalog
-  [{:onyx/name :in
-    :onyx/plugin :onyx.plugin.core-async/input
-    :onyx/type :input
-    :onyx/medium :core.async
-    :onyx/batch-size batch-size
-    :onyx/max-peers 1
-    :onyx/doc "Reads segments from a core.async channel"}
-
-   {:onyx/name :identity
-    :onyx/fn :clojure.core/identity
-    :onyx/type :function
-    :onyx/max-peers 1
-    :onyx/batch-size batch-size}
-
-   {:onyx/name :out
-    :onyx/plugin :onyx.plugin.core-async/output
-    :onyx/type :output
-    :onyx/medium :core.async
-    :onyx/batch-size batch-size
-    :onyx/max-peers 1
-    :onyx/doc "Writes segments to a core.async channel"}])
-
-(def windows
-  [{:window/id :collect-segments
-    :window/task :identity
-    :window/type :fixed
-    :window/aggregation :count
-    :window/window-key :event-time
-    :window/range [5 :minutes]}])
+(def expected-windows
+  [[1442113200000 1442113499999 2]
+   [1442113500000 1442113799999 3]
+   [1442113200000 1442113499999 2]
+   [1442113500000 1442113799999 5]
+   [1442114100000 1442114399999 1]
+   [1442114700000 1442114999999 1]
+   [1442115900000 1442116199999 1]
+   [1442113200000 1442113499999 3]
+   [1442113500000 1442113799999 5]
+   [1442114100000 1442114399999 2]
+   [1442114700000 1442114999999 1]
+   [1442115900000 1442116199999 1]
+   [1442116500000 1442116799999 2]
+   [1442115000000 1442115299999 1]])

 (defn trigger-pred [event window-id upper lower segment]
   (:trigger? segment))
-
-(def triggers
-  [{:trigger/window-id :collect-segments
-    :trigger/refinement :accumulating
-    :trigger/on :segment
-    :trigger/threshold [5 :elements]
-    :trigger/sync ::update-atom!}])

 (def test-state (atom []))

@@ -100,57 +62,86 @@
 (def out-calls
   {:lifecycle/before-task-start inject-out-ch})

-(def lifecycles
-  [{:lifecycle/task :in
-    :lifecycle/calls ::in-calls}
-   {:lifecycle/task :in
-    :lifecycle/calls :onyx.plugin.core-async/reader-calls}
-   {:lifecycle/task :out
-    :lifecycle/calls ::out-calls}
-   {:lifecycle/task :out
-    :lifecycle/calls :onyx.plugin.core-async/writer-calls}])
+(deftest fixed-windows-segment-trigger
+  (let [id (java.util.UUID/randomUUID)
+        config (load-config)
+        env-config (assoc (:env-config config) :onyx/id id)
+        peer-config (assoc (:peer-config config) :onyx/id id)
+        env (onyx.api/start-env env-config)
+        peer-group (onyx.api/start-peer-group peer-config)
+        batch-size 20
+        workflow
+        [[:in :identity] [:identity :out]]

-(def v-peers (onyx.api/start-peers 3 peer-group))
+        catalog
+        [{:onyx/name :in
+          :onyx/plugin :onyx.plugin.core-async/input
+          :onyx/type :input
+          :onyx/medium :core.async
+          :onyx/batch-size batch-size
+          :onyx/max-peers 1
+          :onyx/doc "Reads segments from a core.async channel"}

-(onyx.api/submit-job
- peer-config
- {:catalog catalog
-  :workflow workflow
-  :lifecycles lifecycles
-  :windows windows
-  :triggers triggers
-  :task-scheduler :onyx.task-scheduler/balanced})
+         {:onyx/name :identity
+          :onyx/fn :clojure.core/identity
+          :onyx/type :function
+          :onyx/max-peers 1
+          :onyx/batch-size batch-size}

-(doseq [i input]
-  (>!! in-chan i))
+         {:onyx/name :out
+          :onyx/plugin :onyx.plugin.core-async/output
+          :onyx/type :output
+          :onyx/medium :core.async
+          :onyx/batch-size batch-size
+          :onyx/max-peers 1
+          :onyx/doc "Writes segments to a core.async channel"}]

-(>!! in-chan :done)
-(close! in-chan)
+        windows
+        [{:window/id :collect-segments
+          :window/task :identity
+          :window/type :fixed
+          :window/aggregation :count
+          :window/window-key :event-time
+          :window/range [5 :minutes]}]

-(def results (take-segments! out-chan))
+        triggers
+        [{:trigger/window-id :collect-segments
+          :trigger/refinement :accumulating
+          :trigger/on :segment
+          :trigger/threshold [5 :elements]
+          :trigger/sync ::update-atom!}]

-(def expected-windows
-  [[1442113200000 1442113499999 2]
-   [1442113500000 1442113799999 3]
-   [1442113200000 1442113499999 2]
-   [1442113500000 1442113799999 5]
-   [1442114100000 1442114399999 1]
-   [1442114700000 1442114999999 1]
-   [1442115900000 1442116199999 1]
-   [1442113200000 1442113499999 3]
-   [1442113500000 1442113799999 5]
-   [1442114100000 1442114399999 2]
-   [1442114700000 1442114999999 1]
-   [1442115900000 1442116199999 1]
-   [1442116500000 1442116799999 2]
-   [1442115000000 1442115299999 1]])
+        lifecycles
+        [{:lifecycle/task :in
+          :lifecycle/calls ::in-calls}
+         {:lifecycle/task :in
+          :lifecycle/calls :onyx.plugin.core-async/reader-calls}
+         {:lifecycle/task :out
+          :lifecycle/calls ::out-calls}
+         {:lifecycle/task :out
+          :lifecycle/calls :onyx.plugin.core-async/writer-calls}]

-(deftest fixed-windows-segment-trigger)
+        v-peers (onyx.api/start-peers 3 peer-group)]
+    (onyx.api/submit-job
+     peer-config
+     {:catalog catalog
+      :workflow workflow
+      :lifecycles lifecycles
+      :windows windows
+      :triggers triggers
+      :task-scheduler :onyx.task-scheduler/balanced})
+    (doseq [i input]
+      (>!! in-chan i))
+    (>!! in-chan :done)

-(do
-  (doseq [v-peer v-peers]
-    (onyx.api/shutdown-peer v-peer))
+    (close! in-chan)

-  (onyx.api/shutdown-peer-group peer-group)
-
-  (onyx.api/shutdown-env env))+    (let [results (take-segments! out-chan)]
+      (is (= (into #{} input) (into #{} (butlast results))))
+      (is (= :done (last results)))
+      (is (= expected-windows @test-state)))
+
+    (doseq [v-peer v-peers]
+      (onyx.api/shutdown-peer v-peer))
+    (onyx.api/shutdown-peer-group peer-group)
+    (onyx.api/shutdown-env env)))


Add id to frame and only return first frame of stack

--- src/aurora/compiler.cljs
+++ src/aurora/compiler.cljs
@@ -159,6 +159,7 @@
      (do
        (let! stack notebook.stack)
        (let! frame {})
+       (set! frame.id id)
        (set! frame.calls [])
        (set! frame.vars {})
        (stack.push frame)
@@ -196,9 +197,9 @@
     (aset notebook "next_state" state)
     (aset notebook "stack" stack)
     (try
-      [(.value_root notebook state []) (.-next_state notebook) stack]
+      [(.value_root notebook state []) (.-next_state notebook) (aget stack 0)]
       (catch :default e
-        [e (.-next_state notebook) stack]))))
+        [e (.-next_state notebook) (aget stack 0)]))))

 (defn tick-example [index id state]
   (second (run-index index id state)))


add documentation about how to use babel.directory

--- src/babel/directory.cljc
+++ src/babel/directory.cljc
@@ -9,6 +9,20 @@
             [babel.lexiconfn :refer [write-lexicon]]
             [clojure.tools.logging :as log]
             [korma.db :refer [transaction]]))
+
+;; babel.directory provides a centralized way to discover and access language models.
+;;
+;; To sync your language model after changing lexicon sources:
+;;
+;; 1. Write .edn files to database:
+;;     (write-lexicon "it" (babel.italiano.lexicon/compile-lexicon))
+;; 2. Update in-memory models from database:
+;;    (babel.directory/refresh-models)
+;; 3. Make model easily available within your own namespace:
+;;    (def model @@(get models :it))
+;; 4. Use new model via your local variable 'model':
+;;    (first (get (get model :lexicon) "uomo"))
+
 (def models
   {:en (atom (delay (en/model)))
    :es (atom (delay (es/small)))


[WM] remove some unused requires from queue

--- resources/leiningen/new/kraken_http_api/queue.clj
+++ resources/leiningen/new/kraken_http_api/queue.clj
@@ -1,9 +1,6 @@
 (ns {{name}}.queue
   (:require [clojure.tools.logging :as log]
             [langohr.core :as rmq]
-            [langohr.channel :as lch]
-            [langohr.exchange :as le]
-            [langohr.queue :as lq]
             [kehaar.core :as k]
             [kehaar.wire-up :as wire-up]
             [kehaar.rabbitmq]


new .specs

new .specs

--- src/borderless/sound.clj
+++ src/borderless/sound.clj
@@ -2,7 +2,6 @@
   (:use overtone.live)
   (:require [clojure.spec :as s]
             [clojure.spec.gen :as gen]))
-

 ;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -41,6 +40,12 @@
 ;;;;;;;;;;;;;;;;;;;;;
 ;; spec            ;;
 ;;;;;;;;;;;;;;;;;;;;;
+
+(s/def ::vca-range (s/double-in :min 0.4 :max 1.0))
+(s/def ::reverb-range (s/int-in 0 1000))
+(s/def ::q-range (s/double-in :min 0.1 :max 1.0))
+
+(s/def ::frequency (s/and number? #((control-range 0 20000) %) ))

 ;; VCA, VCO, and FX
 (s/def ::vca (s/and number? #((control-range 0.4 1) %) ))
@@ -67,9 +72,10 @@
    ::gate 1})

 (s/fdef vowel-formant
-        :args (s/cat :freq number? :eq-freq number? :q number?)
-        :ret (s/fspec :args (s/cat :saw clojure.test/function? :freq number?)
-                      :ret number?))
+        :args (s/cat :freq ::frequency :eq-freq ::frequency :q ::q-range)
+        :ret (s/fspec :args int?
+                      :ret clojure.test/function?))
+

 ;;;;;;;;;;;;;;;;;;;;;
 ;; Audio           ;;


definst macro integrated with entire program

--- src/borderless/sound.clj
+++ src/borderless/sound.clj
@@ -14,6 +14,10 @@
   (fn [value]
     (and (>= value min) (<= value max)) ))

+(defn inst-name-getter
+  [inst]
+  (-> inst meta :name))
+
 ;;;;;;;;;;;;;;;;;;;;;
 ;; spec            ;;
 ;;;;;;;;;;;;;;;;;;;;;
@@ -45,7 +49,7 @@
           :opt [::attack ::sustain ::release ::gate]))

 (def synth-defaults
-  {::vca 8 ;; TODO: arbitrarily changed this from 1. What is the correct value?
+  {::vca 1 ;; TODO: arbitrarily changed this from 1. What is the correct value?
    ::reverb 1
    ::vco 25
    ::attack 5.0
@@ -65,13 +69,19 @@
 (s/def ::drone (s/keys :req [::pitch ::eq-freq ::hpf-rlpf ::q]
                        :opt [::amp ::verb ::mod-rate]))

-(s/fdef ctl-names
-        :args (s/cat :sound-symbol symbol? :parameter keyword?)
-        :ret keyword?)
-
-;;;;;;;;;;;;;;;;;;;;;
-;; Audio           ;;
-;;;;;;;;;;;;;;;;;;;;;
+;; (= :overtone.studio.inst/instrument (type (get @person-sound 1)))
+;; (s/fdef ctl-names
+;;         :args (s/cat :instrument ??? :parameter keyword?)
+;;         :ret keyword?)
+
+;;;;;;;;;;;;;;;;;;;;;
+;; Audio Sculpting ;;
+;;;;;;;;;;;;;;;;;;;;;
+
+(def drones {::drone-aw {::pitch 300 ::eq-freq [570 840 2410]  ::hpf-rlpf [900 600 0.6] ::q 0.1}
+             ::drone-oo {::pitch 120 ::eq-freq [300 870 2240]  ::hpf-rlpf [0 600 0.6] ::q 0.1}
+             ::drone-ae {::pitch 100 ::eq-freq [270 2290 3010] ::hpf-rlpf [600 8000 0.6] ::q 0.1}
+             ::drone-eh {::pitch 80  ::eq-freq [530 1840 2480] ::hpf-rlpf [0 750 0.9] ::q 0.1}})

 (defn synth-unit-layered
   "I create a stack of oscilators, each narrowly EQed on a given Q (frequency) to shape a saw waveform of a certain pitch.
@@ -83,7 +93,7 @@
   [freq eq-freq q mod-rate]
   (let [[freq-a freq-b freq-c] eq-freq
         mod-multipliers [2.5 0.5 1.5]
-        pitch-with-kr (map #(overtone.sc.ugen-collide/+ freq (o/sin-osc:kr (* % mod-rate))) mod-multipliers)]
+        pitch-with-kr (map #(overtone.sc.ugen-collide/+ freq (o/sin-osc:kr (overtone.sc.ugen-collide/* % mod-rate))) mod-multipliers)]

     (overtone.sc.ugen-collide/+
         (map #(o/resonz (o/saw %) %2 q) pitch-with-kr eq-freq))))
@@ -104,24 +114,29 @@
         (overtone.sc.ugen-collide/* mod-rate-ctl)
         (o/free-verb verb verb verb))))

-(def drones {::drone-aw {::pitch 300 ::eq-freq [570 840 2410]  ::hpf-rlpf [900 600 0.6] ::q 0.1}
-             ::drone-oo {::pitch 120 ::eq-freq [300 870 2240]  ::hpf-rlpf [0 600 0.6] ::q 0.1}
-             ::drone-ae {::pitch 100 ::eq-freq [270 2290 3010] ::hpf-rlpf [600 8000 0.6] ::q 0.1}
-             ::drone-eh {::pitch 80  ::eq-freq [530 1840 2480] ::hpf-rlpf [0 750 0.9] ::q 0.1}})
-
 (defn ctl-names
-  "I take a generated sound's symbol (ex: 'drone-aw11111) and a parameter (ex: :freq) and destructure the generated control values (ex: :freq > freq__20280__auto__).
+  "I take an instrument (type - :overtone.studio.inst/instrument) and a keyword parameter (ex: :freq)
+   ane destructure the generated control values (ex: :freq > freq__20280__auto__).
+
    I return the generated control value.

-   Example: (ctl-names 'drone-aw20496 :amp) => :amp__20282__auto__"
-
-  [sound-symbol parameter]
-  (let [ctl-data (o/ctl (eval sound-symbol))
-        {params :params} ctl-data
-        [freq gate amp] params
-        gensym-keymap {:freq (freq :name) :gate (gate :name) :amp (amp :name)}]
-
-    (keyword (gensym-keymap parameter))))
+   Example: (ctl-names (get @person-sound 1) :amp) => :amp__20282__auto__"
+
+  [instrument parameter]
+
+  (if-let [instrument-symbol (inst-name-getter instrument)]
+    ;; If the instrument doesn't exist, it will return nil and not execute the rest of the closure.
+
+    (let [ctl-data (o/ctl (eval instrument-symbol)) ;; Grab the control data map
+          {params :params} ctl-data                 ;; Grab the parametrs from the control data
+          [freq gate amp verb mod-rate] params      ;; Destructure the parameters
+          gensym-keymap {:freq (freq :name)
+                         :gate (gate :name)
+                         :amp (amp :name)
+                         :verb (verb :name)
+                         :mod-rate (mod-rate :name)}]
+
+      (keyword (gensym-keymap parameter)))))

 (defmacro sound-returner [drone]
   "I take a sound's name as defined using clojure.spec and call the definst macro to generate an instrument on the fly
@@ -135,12 +150,12 @@
   (let [inst-name (gensym drone)
         synth-drone (drones (keyword "borderless.sound" drone))]
     `(do
-       (o/definst ~inst-name [freq#  (~synth-drone ::pitch)
-                              gate#  (~synth-defaults ::gate)
-                              amp#   (~synth-defaults ::vca)]
-         (let [verb#       (~synth-defaults ::reverb)
-               mod-rate#   (~synth-defaults ::vco)
-               eq-freq#     (~synth-drone ::eq-freq)
+       (o/definst ~inst-name [freq#     (~synth-drone ::pitch)
+                              gate#     (~synth-defaults ::gate)
+                              amp#      (~synth-defaults ::vca)
+                              verb#     (~synth-defaults ::reverb)
+                              mod-rate# (~synth-defaults ::vco)]
+         (let [eq-freq#    (~synth-drone ::eq-freq)
                hpf-rlpf#   (~synth-drone ::hpf-rlpf)
                q#          (~synth-drone ::q)
                synth-unit# (synth-unit-layered freq# eq-freq# q# mod-rate#)]
@@ -210,20 +225,11 @@
 ;; Person/Sound Mapping ;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;

-(defn inst-ns-old
-  "This is the instrument name with full namespace qualifiers. Useful becuase the 'sound name' is really the name of the 'definst' macro created by Overtone."
-    [instrument]
-    (eval (symbol "borderless.sound" instrument)))
-
-(defn inst-ns
-    [instrument]
-    (sound-maker instrument))
-
 (def person-sound (atom {}))

 (defn get-sound [pid]
   (if (contains? @person-sound pid)
-    (inst-ns (get @person-sound pid))))
+    ((get @person-sound pid))))

 (defn add-person-sound! [pid sound]
   (reset! person-sound (assoc @person-sound pid sound))
@@ -249,9 +255,12 @@
     :else 1))

 (defn end-sound! [pid]
-  (when (contains? (deref person-sound) pid) (o/ctl (get-sound pid) :gate 0)
-  	(println "Left: " pid)
-  	(remove-person-sound! pid)))
+  (let [instrument (get @person-sound pid)
+        instrument-symbol (inst-name-getter instrument)
+        gate-name (ctl-names instrument :gate)]
+    (when (contains? (deref person-sound) pid) (o/ctl (eval instrument-symbol) gate-name 0)
+          (println "Left: " pid)
+          (remove-person-sound! pid))))

 (defn reset-atom [current-people]
   (when (seq current-people) (end-sound! (ffirst current-people)) (reset-atom (rest current-people))))
@@ -267,30 +276,30 @@
     (println pid " entered")

   (case number-of-people
-    0 (add-person-sound! pid "drone-aw")
-    1 (add-person-sound! pid "drone-ae")
-    2 (add-person-sound! pid "drone-eh")
-    3 (add-person-sound! pid "drone-oo")
+    0 (add-person-sound! pid (sound-returner "drone-aw"))
+    1 (add-person-sound! pid (sound-returner "drone-oo"))
+    2 (add-person-sound! pid (sound-returner "drone-ae"))
+    3 (add-person-sound! pid (sound-returner "drone-eh"))
     "atom full: four people are tracked")))
-
-  ;; (case number-of-people
-  ;;   0 (add-person-sound! pid "drone-aw-sus")
-  ;;   1 (add-person-sound! pid "drone-ae-sus")
-  ;;   2 (add-person-sound! pid "drone-eh-sus")
-  ;;   3 (add-person-sound! pid "drone-oo-sus")
-  ;;   "atom full: four people are tracked")))

 (defn control-sound
   "I take a val between 0 and 1000+, map the value, and send it to the instrument's controller."
   [pid val]
-  (let [verb-val  (o/scale-range val 0 1000 1 0.3)
-        kr-val    (o/scale-range val 0 1000 25 0)
-        amp-val   (amplitude-mul val)]
+  (let [instrument (get @person-sound pid)
+        instrument-symbol (inst-name-getter instrument)
+
+        amp-name (ctl-names instrument :amp)
+        verb-name (ctl-names instrument :verb)
+        mod-name (ctl-names instrument :mod-rate)
+
+        amp-val   (amplitude-mul val)
+        verb-val  (o/scale-range val 0 1000 1 0.3)
+        kr-val    (o/scale-range val 0 1000 25 4)]
     (if (contains? @person-sound pid)
-      (o/ctl (get-sound pid)
-           :amp amp-val
-           :verb verb-val
-           :mod-rate-ctl kr-val))))
+      (o/ctl (eval instrument-symbol)
+           amp-name amp-val
+           verb-name verb-val
+           mod-name kr-val))))

 ;; TODO -
@@ -321,3 +330,14 @@
 ;; Rhythm
 ;; - Basic metronome for the first person
 ;; - Second metronome in phase when they're close together, drifting as they move apart
+
+;; {:name "drone-aw23914", :params (
+;;                                  {:name "freq__23702__auto__", :default 300.0, :rate :kr, :value #atom[300.0 0x7ebe010a]}
+;;                                  {:name "gate__23703__auto__", :default 1.0, :rate :kr, :value #atom[1.0 0x2f278a21]}
+;;                                  {:name "amp__23704__auto__", :default 8.0, :rate :kr, :value #atom[8.0 0x36cfe335]}),
+;;  :args ("freq__23702__auto__" "gate__23703__auto__" "amp__23704__auto__"),
+;;  :sdef {:name "borderless.sound/drone-aw23914", :constants [0.0 0 1.0 900.0 840.0 5.0 53.0 37.5 600.0 12.5 25.0 62.5 570.0 2410.0 -4 0.4 1 0.1 2 5 0.6 -99], :params (300.0 1.0 8.0), :pnames ({:name "freq__23702__auto__", :index 0} {:name "gate__23703__auto__", :index 1} {:name "amp__23704__auto__", :index 2}), :ugens ({:args nil, :special 0, :name "Control", :rate 1, :inputs (), :rate-name :kr, :n-outputs 3, :id 1365, :outputs ({:rate 1} {:rate 1} {:rate 1}), :n-inputs 0} #<sc-ugen: sin-osc:kr [0]> #<sc-ugen: binary-op-u-gen:kr [2]> #<sc-ugen: saw:ar [3]> #<sc-ugen: resonz:ar [4]> #<sc-ugen: binary-op-u-gen:ar [5]> #<sc-ugen: env-gen:kr [1]> #<sc-ugen: binary-op-u-gen:ar [8]> #<sc-ugen: hpf:ar [9]> #<sc-ugen: rlpf:ar [10]> #<sc-ugen: binary-op-u-gen:ar [12]> #<sc-ugen: sin-osc:kr [0]> #<sc-ugen: binary-op-u-gen:kr [2]> #<sc-ugen: saw:ar [3]> #<sc-ugen: resonz:ar [4]> #<sc-ugen: binary-op-u-gen:ar [5]> #<sc-ugen: binary-op-u-gen:ar [8]> #<sc-ugen: hpf:ar [9]> #<sc-ugen: rlpf:ar [10]> #<sc-ugen: sin-osc:kr [0]> #<sc-ugen: binary-op-u-gen:kr [2]> #<sc-ugen: saw:ar [3]> #<sc-ugen: resonz:ar [4]> #<sc-ugen: binary-op-u-gen:ar [12]> #<sc-ugen: binary-op-u-gen:ar [13]> #<sc-ugen: binary-op-u-gen:ar [5]> #<sc-ugen: binary-op-u-gen:ar [8]> #<sc-ugen: hpf:ar [9]> #<sc-ugen: rlpf:ar [10]> #<sc-ugen: binary-op-u-gen:ar [12]> #<sc-ugen: binary-op-u-gen:ar [13]> #<sc-ugen: free-verb:ar [14]> #<sc-ugen: free-verb:ar [14]> #<sc-ugen: binary-op-u-gen:ar [13]> #<sc-ugen: free-verb:ar [14]> #<sc-ugen: out:ar [45]>)},
+;;  :group #<synth-group [live] : Inst drone-aw23914 Container 102>,
+;;  :instance-group #<synth-group [live] : Inst drone-aw23914 103>,
+;;  :fx-group #<synth-group [live] : Inst drone-aw23914 FX 104>, :mixer #<synth-node [live] : overtone.s547/stereo-inst-mixer 105>,
+;;  :bus #<audio-bus: No Name, 3 channels, id 53>, :fx-chain [], :volume #atom[1.0 0x6aa35da8], :pan #atom[0.0 0x641ba7a7], :n-chans 3}


"M" is now abstracted, it was really annoying to look at.

--- src/bru_3/face/wings.clj
+++ src/bru_3/face/wings.clj
@@ -11,7 +11,7 @@
    :l #{:right-bottom}
    :i #{}
    :s #{:left-bottom :right-top}
-   :m #{:bottom-left :bottom-right}})
+   :m #{:bottom-left}})

 (def clockwise-keys
   [:top-left :top-right


extend to protocols

extend to protocols

--- src/ca_recipe/recipe.clj
+++ src/ca_recipe/recipe.clj
@@ -52,3 +52,16 @@
   quantities with unit conversion if necessary."
   [{q1 :quantity u1 :unit :as i1} {q2 :quantity u2 :unit}]
   (assoc i1 :quantity (+ q1 (convert u2 u1 q2))))
+
+(defprotocol TaxedCost
+  (taxed-cost [entity store]))
+
+(extend-protocol TaxedCost
+  Object
+  (taxed-cost [entity store]
+    (if (satisfies? Cost entity)
+      (do (extend-protocol TaxedCost
+            (class entity)
+            (taxed-cost [entity store]
+              (* (cost entity store) (+ (tax-rate store))))))
+      (assert false (str "Unhandled entity: " entity)))))


Handle unknown namespaces

Handle unknown namespaces

--- src/clj/cljdocs/core.clj
+++ src/clj/cljdocs/core.clj
@@ -16,7 +16,10 @@

 (defn list-ns [namespace]
   (let [sym (symbol namespace)]
-    (keys (ns-publics sym))))
+    (try
+      (keys (ns-publics sym))
+      ;; namespace unknown? return empty vector
+      (catch Exception e []))))

 (defroutes app-routes
   ;(GET "/" [] "
Hello from compojure
")


[refactor]

[refactor]

--- src/clj_dstream/core.clj
+++ src/clj_dstream/core.clj
@@ -194,17 +194,16 @@
 (defn is-grid-group
   "are all grids transitively neighbors?"
   [position-indices]
-  (let [mapped-to-neighbors
-        (into {}
-              (map (fn [pos-idx]
-                     [pos-idx (filter
-                                (fn [ref-idx]
-                                  (and (are-neighbors pos-idx ref-idx)
-                                       (not (= pos-idx ref-idx))))
-                                position-indices)])
-                   position-indices))
-        g (lgraph/graph mapped-to-neighbors)]
-    (lalg/connected? g)))
+  (-> (into {}
+            (map (fn [pos-idx]
+                   [pos-idx (filter
+                              (fn [ref-idx]
+                                (and (not (= pos-idx ref-idx))
+                                     (are-neighbors pos-idx ref-idx)))
+                              position-indices)])
+                 position-indices))
+      (lgraph/graph)
+      (lalg/connected?)))

 (s/fdef is-grid-group
         :args (s/cat :u (s/cat :indices (s/coll-of ::position-index))))


Keep it simple

Keep it simple

--- src/clj_spotify/core.clj
+++ src/clj_spotify/core.clj
@@ -100,14 +100,10 @@
              (catch Exception e (ex-data e)))
            (response-to-map))))))

-
-; Define (api-get), (api-post), etc.
-(let [defverb #(intern *ns*
-                       (symbol (str "api-" %))
-                       (partial spotify-api-call
-                                (resolve (symbol "client" %))))]
-  (doseq [verb ["get" "post" "put" "delete"]]
-    (defverb verb)))
+(def api-get    (partial spotify-api-call client/get))
+(def api-post   (partial spotify-api-call client/post))
+(def api-put    (partial spotify-api-call client/put))
+(def api-delete (partial spotify-api-call client/delete))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


add-person

add-person

--- src/cljs/ufo/client.cljs
+++ src/cljs/ufo/client.cljs
@@ -80,6 +80,13 @@

 (def list-view (om/factory ListView))

+
+(defn add-person [widget {:keys [fname lname]}]
+  (let [hm {:kws [:fperson/by-fname (keyword fname)]}]
+    (om/transact! widget `[(fperson/by-fname
+                            ~(assoc hm :v {:fname fname :lname lname}))
+                           (list/three ~hm)])))
+
 (defui RootView
   static om/IQuery
   (query
@@ -113,14 +120,7 @@
                :on-complete
                (fn [resp]
                  ;; ~ means evaluate the sexp before passing
-                 (let [fname "Jim"
-                       lname "Jones"
-                       hm {:kws [:fperson/by-fname (keyword fname)]}]
-                   (om/transact!
-                    this `[(fperson/by-fname
-                            ~(assoc hm :v {:fname fname :lname lname}))
-                           (list/three ~hm)]))
-
+                 (add-person this {:fname "Jackie" :lname "Chan"})
                  (println ":resp"
                             {:resp (str resp) :tbeg tbeg :tend (time/now)}))
                :on-error (fn [resp] (println resp))})))}


placeholder image for album artwork

placeholder image for album artwork

--- src/frontend/renderer.cljs
+++ src/frontend/renderer.cljs
@@ -87,9 +87,14 @@
         (let [music-info (core/get-music-info-from-id (:current-track-id data))
               tags (.-tags music-info)]
           (dom/div nil
-            (dom/div nil (.-title tags))
-            (dom/div nil (.-album tags))
-            (dom/div nil (.-artist tags))))))))
+            (dom/img #js {:src grey-out-image
+                          :style #js {:float "left"
+                                      :width "35%"
+                                      :height "35%"}})
+            (dom/div nil
+              (dom/div nil (.-title tags))
+              (dom/div nil (.-album tags))
+              (dom/div nil (.-artist tags)))))))))

 (defn download-progress [data owner]
   (reify


change to execute-fields

change to execute-fields

--- src/graphql_clj/parser.clj
+++ src/graphql_clj/parser.clj
@@ -69,8 +69,9 @@
                    (println "SelectionSet: " args)
                    [:selection-set args])
    :Selection (fn selection [& args]
-                (println "Selection: " args)
-                (into [:selection] args))
+                (let [props (into {} args)]
+                  (println "Selection: " props)
+                  [:selection props]))
    :Field (fn field [& args]
             (println "Field: " args)
             [:field (into {} args)])
@@ -100,19 +101,32 @@
   [selection]
   {:post [(not (nil? %))]}
   (println "get-selection-object-name: " selection)
-  (let [name (:name (second (second selection)))]
+  (let [name (get-in (second selection) [:field :name])]
     (println "get-selection-object-name: name: " name)
     name))

 (defn get-selection-name
   [selection]
   (println "get-selection-name: " selection)
-  (let [name (:name (second (second selection)))]
+  (let [name (get-in (second selection) [:field :name])]
     (println "get-selection-name: name: " name)
     name))

 (defn get-selection-type [selection]
-  (first (second selection)))
+  (println "get-selection-type: selection: " selection)
+  (let [opts (second selection)]
+    (cond
+      (:field opts) :field
+      :default (throw (ex-info (format "Selection Type is not handled for selection: %s." selection) {:type (:field opts)
+                                                                                :opts opts})))))
+
+(defn get-field-selection-set [selection]
+  (println "*** get-field-selection-set: selection: " selection)
+  (let [opts (second selection)
+        selection-set (get-in opts [:field :selection-set])]
+    (println "field: " opts)
+    (println "get-field-selection-set: selection-set: " selection-set)
+    selection-set))

 (defn collect-selection [col selection]
   (println "collect-selection: " selection)
@@ -142,11 +156,14 @@
    :UserType {:name "User"
               :kind :OBJECT
               :fields {:id {:type :GraphQLString}
-                       :name {:type :GraphQLString}}
+                       :name {:type :GraphQLString}
+                       :profilePic {:type :GraphQLString}}
               :args {}
               :resolve-fn (fn [object]
                             (println "user resolve-fn: ")
-                            {:id "test"})}})
+                            {:id "test"
+                             :name "good"
+                             :additional "extra"})}})

 (def schema
   {:query {:name "Query"
@@ -178,9 +195,11 @@
 (defn get-field-type-from-object-type
   "FIXME"
   [object-type field-selection]
-  (println (format "get-field-type-from-object-type: object-type: %s, field-selection: %s." object-type field-selection))
+  (println (format "get-field-type-from-object-type: object-type: %s." object-type))
+  (println (format "get-field-type-from-object-type: field-selection: %s." field-selection))
   (let [object-name (get-selection-object-name field-selection)
         _ (println "object-name: " object-name)
+        _ (println "object: " (get-in object-type [:fields]))
         type (get-in object-type [:fields (keyword object-name) :type])]
     (if (map? type)
       type
@@ -198,11 +217,11 @@
 (defn merge-selection-sets
   [selections]
   (let [sets (reduce (fn [col selection]
-                       (println "merge-selection-sets: selection: " selection)
-                       (let [field (second (second selection))
-                             field-selection-set (:selection-set field)]
-                         (if field-selection-set
-                           (into col field-selection-set)
+                       (println (format "merge-selection-sets: col: %s, selection: %s." col selection))
+                       (let [field (:field (second selection))]
+                         (println "merge-selection-sets: field-selection-set: " field)
+                         (if field
+                           (into col field)
                            col)))
                      [] selections)]
     (println "merge-selection-sets: sets: " sets)
@@ -230,7 +249,7 @@

 (defn complete-value
   [field-type result sub-selection-set]
-  (println "complete-value: ")
+  (println "*** complete-value: ")
   (println "field-type: " field-type)
   (println "result: " result)
   (println "sub-selection-set: " sub-selection-set)
@@ -243,25 +262,27 @@
     (cond
       (is-scalar-field-type? field-type) result
       (is-enum-field-type? field-type) result
-      (is-object-field-type? field-type) (evaluate-selection-set field-type result sub-selection-set nil)
+      (is-object-field-type? field-type) (execute-fields field-type result sub-selection-set)
       :else (throw (ex-info (format "Not a valid field type %s." field-type) {:field-type field-type})))))

-(defn get-field-entry [object-type object fields]
-  (println "get-field-entry: " fields)
-  (let [first-field-selection (first fields)
+(defn get-field-entry [parent-type parent-object field]
+  (println "*** get-field-entry: " field)
+  (let [first-field-selection field
         response-key (get-selection-name first-field-selection)
-        field-type (get-field-type-from-object-type object-type first-field-selection)
+        field-type (get-field-type-from-object-type parent-type first-field-selection)
         field-entry first-field-selection]
     (println "field-type" field-type)
     (if (not (nil? field-type))
-      (let [resolved-object (resolve-field-on-object object-type object field-entry)]
+      (let [resolved-object (resolve-field-on-object parent-type parent-object field-entry)
+            field-selection-set (get-field-selection-set field)]
+        (println "get-field-entry: field-selection-set: " field-selection-set)
         (if (nil? resolved-object)
           [response-key nil] ; If resolvedObject is null, return
                              ; tuple(responseKey, null), indicating
                              ; that an entry exists in the result map
                              ; whose value is null.
-          (let [sub-selection-set (merge-selection-sets fields)
-                response-value (complete-value field-type resolved-object sub-selection-set)]
+          (let [;; sub-selection-set (merge-selection-sets field-selection-set)
+                response-value (complete-value field-type resolved-object field-selection-set)]
             response-value)))
       (println "WARNING: field-type is nil!"))))

@@ -272,20 +293,36 @@
         resolved-fields (get-field-entry object-type object fields)]
     resolved-fields))

+(defn execute-fields
+  [parent-type root-value fields]
+  (println "*** execute-fields")
+  (println "execute-fields: parent-type: " parent-type)
+  (println "execute-fields: root-value: " root-value)
+  (println "execute-fields: fields: " fields)
+  (into {} (map (fn [field]
+                  (let [response-key (get-selection-name field)
+                        field-type (get-field-type-from-object-type parent-type field)
+                        ;; resolved-object (resolve-field-on-object field-type root-value field)
+                        field-entry (get-field-entry parent-type root-value field)]
+                    field-entry))
+                fields)))
+
 (defn execute-query [query]
   (let [selection-set (:selection-set query)
         visitied-fragments nil
-        object-type (get-type-meta :query)]
-    (evaluate-selection-set object-type :root selection-set visitied-fragments)))
+        object-type (get-type-meta :query)
+        fields (collect-fields object-type selection-set visitied-fragments)]
+    ;; (evaluate-selection-set object-type :root selection-set visitied-fragments)
+    (execute-fields object-type :root fields)))

 (defn execute-definition
   [definition]
-  (println "execute-definition: " definition)
+  (println "*** execute-definition: " definition)
   (let [operation (:operation-definition definition)
         operation-type (:operation-type operation)]
     (case operation-type
       "query" (execute-query operation)
-      (throw (ex-info (format "Unhandled operation type: %s." operation-type))))))
+      (throw (ex-info (format "Unhandled operation root type: %s." operation-type))))))

 (defn execute
   [document]


underscore in class path

underscore in class path

--- src/hack-the-drive/web.clj
+++ src/hack-the-drive/web.clj
@@ -1,4 +1,4 @@
-(ns hack-the-drive.web
+(ns hack_the_drive.web
   (:require [compojure.core :refer [defroutes GET PUT POST DELETE ANY]]
             [compojure.handler :refer [site]]
             [compojure.route :as route]


Let logger start.

Let logger start.

--- src/onyx_benchmark/peer.clj
+++ src/onyx_benchmark/peer.clj
@@ -36,9 +36,6 @@
 (defn -main [zk-addr riemann-addr riemann-port id n-peers subscriber-count messaging & args]
   (let [local? (= zk-addr "127.0.0.1:2189")

-        m-cfg (load-monitoring-config riemann-addr (Integer/parseInt riemann-port))
-        monitoring-thread (start-riemann-sender m-cfg)
-
         env-config {:onyx.bookkeeper/server? true
                     :onyx/id id
                     :zookeeper/address zk-addr
@@ -64,5 +61,7 @@
         n-peers-parsed (Integer/parseInt n-peers)
         peer-group (onyx.api/start-peer-group peer-config)
         env (onyx.api/start-env env-config)
+        m-cfg (load-monitoring-config riemann-addr (Integer/parseInt riemann-port))
+        monitoring-thread (start-riemann-sender m-cfg)
         peers (onyx.api/start-peers n-peers-parsed peer-group m-cfg)]
     (<!! (chan))))


Fix file name

Fix file name

--- tasks/leiningen/fatdeb.clj
+++ tasks/leiningen/fatdeb.clj
@@ -81,7 +81,7 @@
     (write (file dir "DEBIAN" "control") (control project))
     (write (file dir "DEBIAN" "conffiles")
            (join "\n" ["/etc/cyanite.yaml"
-                       "/etc/init.d/cyanite.yaml"
+                       "/etc/init.d/cyanite"
                        "/etc/default/cyanite"]))

     ; Preinst


starting workflow

starting workflow

--- server/src/gratefulplace/controllers/users.clj
+++ server/src/gratefulplace/controllers/users.clj
@@ -17,6 +17,6 @@

        (do
          (q/t [(s/serialize params ss/user->txdata)])
-         {:body "success"})
+         (cemerick.friend.workflows/make-auth (select-keys params [:username :email])))
        {:body {:errors errors}
         :status 412}))))


Fix typo

Fix typo

--- src/refactor_nrepl/util.clj
+++ src/refactor_nrepl/util.clj
@@ -180,7 +180,7 @@

   A string is not treated as a sexp by this function. If LEVEL is
   provided finds the enclosing sexp up to level. LEVEL defaults to 1
-  for the immediate enclising sexp.
+  for the immediate enclosing sexp.

   Both line and column are indexed from 0."
   ([file-content line column]


do not use str name.

do not use str name.

--- clojure/bob/bob.clj
+++ clojure/bob/bob.clj
@@ -1,18 +1,18 @@
 (ns bob
   (:use [clojure.string :only [join blank?]]))

-(defn- all-caps? [str]
-  (let [ascii-chars (join "" (re-seq #"[a-zA-Z]" str))]
+(defn- all-caps? [s]
+  (let [ascii-chars (join "" (re-seq #"[a-zA-Z]" s))]
     (and
      (not (blank? ascii-chars))
      (every? #(Character/isUpperCase %) ascii-chars))))

-(defn- question? [str]
-  (re-matches #".*\?\Z" str))
+(defn- question? [s]
+  (re-matches #".*\?\Z" s))

-(defn response-for [str]
+(defn response-for [s]
   (cond
-   (blank? str) "Fine. Be that way!"
-   (all-caps? str) "Woah, chill out!"
-   (question? str) "Sure."
+   (blank? s) "Fine. Be that way!"
+   (all-caps? s) "Woah, chill out!"
+   (question? s) "Sure."
    :else "Whatever."))


add state, break things

add state, break things

--- src/mermaid_ldjam/core.cljs
+++ src/mermaid_ldjam/core.cljs
@@ -2,8 +2,7 @@
   (:require [quil.core :as q :include-macros true]
             [quil.middleware :as m]))

-(defn setup []
-  (q/frame-rate 12)
+(def initial-state
   {:entities
     {;objects
      :bucket {:x 380 :y 290 :width 50 :height 60 :path "resources/bucket.png"}
@@ -15,12 +14,17 @@
      :bottle {:x 260 :y 290 :width 30 :height 80 :path "resources/bottle.png"}
      :seagull {:x 400 :y 60 :width 150 :height 100 :path "resources/seagull.png" :hidden true}
      ;actions
-     :look {:x 10 :y (- (q/height) 50) :width 100 :height 40 :label "Look" :path "resources/action.png"}
-     :flap {:x 110 :y (- (q/height) 50) :width 100 :height 40 :label "Flap":path "resources/action.png"}}
+     :look {:x 10 :y (- 400 50) :width 100 :height 40 :label "Look" :path "resources/action.png"}
+     :flap {:x 110 :y (- 400 50) :width 100 :height 40 :label "Flap":path "resources/action.png"}}
    :current-status "Hello little mermaid."
    :last-clicked []
    :mouse-clicked false
+   :game-state :play
    })
+
+(defn setup []
+  (q/frame-rate 12)
+  initial-state)

 (defn unhide [state hidden-entity]
   (let [entities (:entities state)
@@ -34,13 +38,14 @@
         new-entity (conj entity {:hidden true})]
     (assoc-in state [:entities hidden-entity] new-entity)))

+(defn reset-game [state]
+  initial-state)
+
 (defn win-game [state]
-  (q/background 90 200 21)
-  state)
+  (assoc state :game-state :win))

 (defn lose-game [state]
-  (q/background 90 200 21)
-  state)
+  (assoc state :game-state :lose))

 (def actions-map
   {[:look :window] {:text "You look outside the window and see your home, the mighty ocean." :action []}
@@ -164,13 +169,17 @@
   (q/text-align :left)
   (q/text (:current-status state) 20 15 (- (q/width) 140) 90)
   (q/text-align :right)
-  (q/text (:last-clicked state) (- (q/width) 150) 15 120 90))
+  (q/text (:game-state state) (- (q/width) 150) 15 120 90))

 (defn draw-state [state]
-  (draw-entities state)
-  (draw-background)
-  (draw-entities state)
-  (draw-status-bar state))
+  (cond
+    (= (:game-state state) :win) (q/text "YOU WIN" 10 10)
+    (= (:game-state state) :lose) (q/text "YOU LOSE" 10 10)
+    :else (do
+            (draw-entities state)
+            (draw-background)
+            (draw-entities state)
+            (draw-status-bar state))))

 (defn handle-click [state]
   (assoc state :mouse-clicked true))


change tabs update effect

change tabs update effect

--- src/mobile_patient/app.cljs
+++ src/mobile_patient/app.cljs
@@ -80,4 +80,5 @@

      })
    (clj->js
-    {:initialRouteName "Login"})))
+    {:initialRouteName "Login"
+     :headerMode :screen})))


CM + MG - #47 http-api gets bearer token from the environment variables

--- src/objective8/http_api.clj
+++ src/objective8/http_api.clj
@@ -11,8 +11,8 @@
                :consumer-token (config/get-var "API_BEARER_TOKEN")})

 (defn get-api-credentials []
-  {"api-bearer-name" "bearer"
-   "api-bearer-token" "token"})
+  {"api-bearer-name" (consumer :consumer-name)
+   "api-bearer-token" (consumer :consumer-token)})

 (defn json-request [object]
   {:headers {"Content-Type" "application/json"}


Remove debug println

Remove debug println

--- src/onyx/peer/transform.clj
+++ src/onyx/peer/transform.clj
@@ -19,7 +19,6 @@
                    (fn [leaf]
                      (let [segments (collect-next-segments f (:message leaf))
                            leaves (map (fn [segment]
-                                         (println "Associng " leaf segment)
                                          (assoc leaf :message segment))
                                        segments)]
                        (->Result leaf leaves)))


Fix missing exhaust log.

Fix missing exhaust log.

--- src/onyx/sync/zookeeper.clj
+++ src/onyx/sync/zookeeper.clj
@@ -61,7 +61,7 @@
 (defn task-path [prefix subpath]
   (str root-path "/" prefix "/task/" subpath))

-(defn plan-path [prefix subpath]
+(defn plan-path [prefix]
   (str root-path "/" prefix "/plan"))

 (defn job-log-path [prefix]
@@ -363,6 +363,10 @@
   [sync _]
   (next-offset sync (revoke-log-path (:onyx/id (:opts sync)))))

+(defmethod extensions/next-offset [ZooKeeper :exhaust-log]
+  [sync _]
+  (next-offset sync (exhaust-log-path (:onyx/id (:opts sync)))))
+
 (defmethod extensions/next-offset [ZooKeeper :seal-log]
   [sync _]
   (next-offset sync (seal-log-path (:onyx/id (:opts sync)))))
@@ -449,6 +453,10 @@
 (defmethod extensions/log-entry-at [ZooKeeper :revoke-log]
   [sync _ n]
   (read-log-entry-at sync (revoke-log-path (:onyx/id (:opts sync))) n))
+
+(defmethod extensions/log-entry-at [ZooKeeper :exhaust-log]
+  [sync _ n]
+  (read-log-entry-at sync (exhaust-log-path (:onyx/id (:opts sync))) n))

 (defmethod extensions/log-entry-at [ZooKeeper :seal-log]
   [sync _ n]


normalize todo items by id to make it easier to modify

since we get a list and later we will want to modify the status of the
todo items it's better to normalize them by id

for this we set the initial state as a map (not as an atom) and provide
that as state to the reconciler, since it will normalize it.

and define a TodoItemUI component that defines the identity function for
a todo item, which will be [:tudu.items/by-id id]

on TodoListUI we define the query as :tudu/items and the fields that
TodoItemUI needs

finally we need to specify a custom read implementation for :tudu/items
which given the paths it has after normalization, like::

    [[:tudu.items/by-id 1] [:tudu.items/by-id 2]]

it will fetch them and return a list of todo items instead, it achieves that by
using each entry in the :tudu/items vector as a path to use in get-in, like::

    (get-in state [:tudu.items/by-id 2])

:tudu.items/by-id in state looks like this

{:tudu.items/by-id {
    1 {:id 1, :status :close, :title "Implement this Step"}
    2 {:id 2, :status :open, :title "Buy Food"}
    3 {:id 3, :status :open, :title "Implement next Step"}}}

--- src/tudu/ui.cljs
+++ src/tudu/ui.cljs
@@ -5,24 +5,31 @@

 (enable-console-print!)

-(defonce state (atom {:tudu/items
-                      [{:id 1 :status :close :title "Implement this Step"}
-                       {:id 2 :status :open :title "Buy Food"}
-                       {:id 3 :status :open :title "Implement next Step"}]}))
+(def initial-state {:tudu/items
+                    [{:id 1 :status :close :title "Implement this Step"}
+                     {:id 2 :status :open :title "Buy Food"}
+                     {:id 3 :status :open :title "Implement next Step"}]})

-(defn on-increment-click [component]
-  (om/transact! component
-                `[(tudu.counter/increment {:amount 1}) :tudu/count]))
+(defui TodoItemUI
+  static om/IQuery
+  (query [this]
+         '[:id :status :title])
+  static om/Ident
+  (ident [this {:keys [id]}]
+         [:tudu.items/by-id id])
+  Object
+  (render [this]
+          (let [{:keys [id status title]} (om/props this)
+                class-name (str "todo-list-item-title status-" (name status))]
+            (dom/div #js {:className "todo-list-item" :key (str "todo-item-" id)}
+                     (dom/span #js {:className class-name} title)))))

-(defn todo-item-ui [{:keys [id status title]}]
-  (dom/div #js {:className "todo-list-item" :key (str "todo-item-" id)}
-           (dom/span #js {:className (str "todo-list-item-title status-" (name status))}
-                     title)))
+(def todo-item-ui (om/factory TodoItemUI {:keyfn :id}))

 (defui TodoListUI
   static om/IQuery
   (query [this]
-         [:tudu/items])
+         [{:tudu/items (om/get-query TodoItemUI)}])
   Object
   (render [this]
           (let [{:keys [tudu/items]} (om/props this)]
@@ -45,13 +52,21 @@
 (defmulti read om/dispatch)
 (defmulti mutate om/dispatch)

-(defmethod read :default [env key params]
+(defmethod read :default [{:keys [state]} key params]
   (if-let [[_ value] (find @state key)]
     {:value value}
     :not-found))

+(defn get-items [state]
+  (let [st @state]
+    (into [] (map #(get-in st %)) (get st :tudu/items))))
+
+
+(defmethod read :tudu/items [{:keys [state]} key params]
+  {:value (get-items state)})
+
 (def reconciler (om/reconciler
-                  {:state state
+                  {:state initial-state
                    :parser (om/parser {:read read :mutate mutate})}))

 (om/add-root! reconciler UI (gdom/getElement "main-app-area"))


Remove duplicate add projects header with new contextual crumbs in place

--- src-cljs/frontend/components/add_projects.cljs
+++ src-cljs/frontend/components/add_projects.cljs
@@ -306,9 +306,6 @@
                                                     (get-in data state/projects-path))]
     (html
      [:div#add-projects
-      [:header.main-head
-       [:div.head-user
-        [:h1 "Add Projects"]]]
       [:div#follow-contents
        [:div.follow-wrapper
         (when (seq (user-model/missing-scopes user))


CMR-736: Refactored code and added check for ignore case to handling of SCIENCE_QUALITY for collection data type.

--- src/cmr/search/services/parameters/conversion.clj
+++ src/cmr/search/services/parameters/conversion.clj
@@ -113,14 +113,6 @@
     (format "Could not find parameter handler for [%s] with concept-type [%s]"
             param concept-type)))

-(defn- convert-to-regex
-  "Convert a parameter with wildcards to a regex"
-  [param]
-  (-> param
-      (str/replace #"\?" ".")
-      (str/replace #"\*" ".*")
-      re-pattern))
-
 (defn string-parameter->condition
   [param value options]
   (let [case-sensitive (case-sensitive-field? param options)
@@ -213,6 +205,16 @@
       (qm/or-conds
         [(qm/string-condition :granule-ur value case-sensitive pattern)
          (qm/string-condition :producer-granule-id value case-sensitive pattern)]))))
+
+(defn- collection-data-type-param->regex
+  "Convert the collection-data-type parameter with wildcards to a regex. This function
+  does not fully handle escaping special characters and is only intended for handling
+  the special case of SCIENCE_QUALITY."
+  [param]
+  (-> param
+      (str/replace #"\?" ".")
+      (str/replace #"\*" ".*")
+      re-pattern))

 (defmethod parameter->condition :collection-data-type
   [concept-type param value options]
@@ -229,7 +231,11 @@
               (and (= "SCIENCE_QUALITY" (str/upper-case value))
                    (not= "false" (get-in options [:collection-data-type :ignore-case])))
               (and pattern
-                   (re-find (convert-to-regex (str/upper-case value)) "SCIENCE_QUALITY")))
+                   (re-find
+                     (collection-data-type-param->regex (if case-sensitive
+                                                          (str/upper-case value)
+                                                          value))
+                     "SCIENCE_QUALITY")))
         ; SCIENCE_QUALITY collection-data-type should match concepts with SCIENCE_QUALITY
         ; or the ones missing collection-data-type field
         (qm/or-conds


Remove unused core_test.clj

Remove unused core_test.clj

--- test/transit/core_test.clj
+++ test/transit/core_test.clj
@@ -1,7 +0,0 @@
-(ns transit.core-test
-  (:require [clojure.test :refer :all]
-            [transit-clj.core :refer :all]))
-
-(deftest a-test
-  (testing "FIXME, I fail."
-    (is (= 0 1))))


permission check on /api/query/form_input endpoint

--- src/metabase/api/query.clj
+++ src/metabase/api/query.clj
@@ -17,7 +17,7 @@

 (defendpoint GET "/form_input" [org]
-  ;; TODO - validate user has perms on org
+  (check-403 ((:perms-for-org @*current-user*) org))
   (let [dbs (databases-for-org org)]
     {:permissions common/permissions
      :timezones common/timezones


Removed old service-test

Removed old service-test

--- test/yada/service_test.clj
+++ test/yada/service_test.clj
@@ -1,63 +0,0 @@
-(ns yada.service-test
-  (:require [clojure.test :refer :all]))
-
-#_(deftest handlers
-  (testing "Service Unavailable"
-
-    (let [response (get-op-response
-                    (get-api) (mock/request :get "/pets") :service-available? false)]
-      (is (= (-> response :status) 503)))
-
-    (let [response (get-op-response
-                    (get-api) (mock/request :get "/pets") :service-available? true)]
-      (is (not= (-> response :status) 503)))
-
-    (testing "Deferred"
-      (let [response
-            (get-op-response
-             (get-api) (mock/request :get "/pets")
-             ;; Check status of slow backend system without blocking this thread.
-             :service-available? #(future (Thread/sleep 1) false))]
-        (is (= (-> response :status) 503)))))
-
-  (testing "Not Implemented"
-    (let [response (get-op-response (get-api) (mock/request :play "/pets"))]
-      (is (= (-> response :status) 501)))
-    (let [response (get-op-response (get-api) (mock/request :play "/pets")
-                                    :known-method? (fn [x] (= x :play)))]
-      (is (not= (-> response :status) 501))))
-
-  (testing "Request URI Too Long"
-    (let [response (get-op-response (get-api) (mock/request :get "/pets")
-                                    :request-uri-too-long? 4)]
-      (is (= (-> response :status) 414))))
-
-  ;; TODO Reinstate - can't do this without knowledge of other operations
-  #_(testing "Method Not Allowed"
-      (let [response (get-op-response (get-api) (mock/request :put "/pets"))]
-        (is (= (-> response :status) 405))))
-
-  (testing "OK"
-    (let [response (get-op-response (get-api) (-> (mock/request :get "/pets")
-                                                (mock/header "Accept" "text/html")))]
-      (is (= (-> response :status) 200))
-      ;; Some default exists
-      (is (not (nil? (-> response :body))))
-      (is (string? (-> response :body)))))
-
-  (testing "Not found"
-    (let [response (get-op-response
-                    (get-api)
-                    (mock/request :get "/pets/100")
-                    :find-resource false)]
-      (is (= (-> response :status) 404)))))
-
-
-
-;; TODO: Response body coercion
-;; TODO: Auth
-;; TODO: Conneg
-;; TODO: CORS/OPTIONS
-;; TODO: CSRF
-;; TODO: Cache-headers
-;; TODO: Vary


clean up with destructuring

clean up with destructuring

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

--- plugins/SlideExplorer2/src/slide_explorer/view.clj
+++ plugins/SlideExplorer2/src/slide_explorer/view.clj
@@ -161,20 +161,17 @@
                     (screen-state :tile-dimensions) 1)]
         (paint/draw-image g image x y)))))

-(defn paint-position [^Graphics2D g screen-state x y color]
-  (let [[w h] (:tile-dimensions screen-state)
-        zoom (:zoom screen-state)
-        scale (:scale screen-state)]
+(defn paint-position [^Graphics2D g
+                      {[w h] :tile-dimensions :keys [zoom scale] :as screen-state}
+                      x y color]
     (when (and x y w h color)
-;      (.drawRect g (* zoom x) (* zoom y)
-;                        (* zoom w) (* zoom h)))))
       (canvas/draw g
                    [:rect
                     {:l (inc (* zoom x)) :t (inc (* zoom y))
                      :w (* zoom w) :h (* zoom h)
                      :alpha 1
                      :stroke {:color color
-                              :width (max 4.0 (* 16 zoom))}}]))))
+                              :width (max 4.0 (* 16 zoom))}}])))

 (defn paint-stage-position [^Graphics2D g screen-state]
   (let [[x y] (:xy-stage-position screen-state)


Missed out one old reference

Missed out one old reference

fixed

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

--- src/conexp/contrib/draw/nodes_and_connections.clj
+++ src/conexp/contrib/draw/nodes_and_connections.clj
@@ -7,9 +7,8 @@
 ;; You must not remove this notice, or any other, from this software.

 (ns conexp.contrib.draw.nodes-and-connections
-  (:use [conexp.base :only (ns-doc,defvar-, defvar, round, union, difference)]
+  (:use [conexp.base :only (ns-doc,defvar-, defvar, round, union, difference, -?>)]
         conexp.contrib.draw.scenes)
-  (:use [clojure.contrib.core :only (-?>)])
   (:import [java.awt Color]
            [no.geosoft.cc.graphics GWindow GScene GObject GSegment
                                    GStyle GInteraction ZoomInteraction


Fix shell out bug

Fix shell out bug

--- src/riak_mesos/executor.clj
+++ src/riak_mesos/executor.clj
@@ -21,7 +21,7 @@
                           (let [command-string (read-string (String. bytes "UTF-8"))]
                             (println "[frameworkMessage] Running command " command-string )
                             (future (try
-                                      (println (apply clojure.java.shell/sh  (clojure.string/split command-string #"\s+") ))
+                                      (println (apply clojure.java.shell/sh command-string))
                                       (catch Exception e
                                         (.printStackTrace e)))))
                           (catch Exception e


Setup debug callback for every tweet that arrives in the queue

--- src/stream_crawler/core.clj
+++ src/stream_crawler/core.clj
@@ -13,7 +13,7 @@
    [clj-time.core :as t]
    [clj-time.coerce :as tc]
    [environ.core :refer [env]]
-   [twitter-streaming-client.core :as client])
+   [twitter-streaming-client.core :as twitter-client])
   (:import
    (twitter.callbacks.protocols AsyncStreamingCallback)))

@@ -29,26 +29,31 @@
 (defentity tweets)

 ;; create the client with a twitter.api streaming method
-(def stream (client/create-twitter-stream twitter.api.streaming/statuses-filter
+(def stream (twitter-client/create-twitter-stream twitter.api.streaming/statuses-filter
                                           :oauth-creds twitter-creds
                                           :params {:follow "1640526475"}))

 ;;asynchronously call function with the :queues map from the TwitterStream
 ;; record, then reset the :queues map to empty

+(defn create-database-objects [queues]
+  "Takes a map of queues and creates the tweet database objects for each tweet
+  in the queue"
+  (println "-----")
+  (println "=> Would create " (count (:tweet queues)) " tweets from queues")
+  (println "-----")
+  (def debug-mutable-queues queues))

-(defn do-on-queues-changed [k, r, os, nst]
+(defn do-on-queues-changed [k, stream, os, nst]
   "k[ey], r[ef], o[ld]s[tate], n[ew]st[ate]
   do something when an object is added to queues"
-  (println "-----")
-  (println (str "=> Key: " k))
-  (println (str "=> Ref: " r))
-  (println (str "=> OldState: " os))
-  (println (str "=> NewState: " nst))
-  (println (str "=> Old queue: " (k os)))
-  (println (str "=> New queue: " (k nst))))
+  (let [buffered-tweets (:tweet (k nst))]
+    (if (> (count buffered-tweets) 0)
+      ; at least one tweet is in the queue
+      (twitter-client/empty-queues stream create-database-objects))))
+

 (defn -main []
-  ; (client/cancel-twitter-stream stream))
-  (client/start-twitter-stream stream)
+  ; (twitter-client/cancel-twitter-stream stream)
+  (twitter-client/start-twitter-stream stream)
   (add-watch stream :queues do-on-queues-changed))


Improve performance of extent deletion in memory store.

--- src/onyx/state/memory.cljc
+++ src/onyx/state/memory.cljc
@@ -15,20 +15,12 @@
 #?(:cljs (def statedb-compress identity))
 #?(:cljs (def statedb-decompress identity))

-(defn clean-groups [groups]
-  (->> groups
-       (remove (fn [[_ extents]]
-                 (empty? extents)))
-       (into {})))
-
-;; Slow, but needed for equiv implementation to db store
-(defn clean-state [state]
-  (->> state
-      (map (fn [[k groups]]
-             [k (clean-groups groups)]))
-      (remove (fn [[_ groups]]
-                (empty? groups)))
-      (into {})))
+(defn clean-state [wstate group-id]
+  (let [extents (get wstate group-id)]
+    (if (empty? extents)
+      ;; TODO, remove group-id from group map when group no longer has extents
+      (dissoc wstate group-id)
+      wstate)))

 #?(:clj
    (defn export-triggers [triggers trigger-coders state-encoder serialize-fn]
@@ -132,8 +124,10 @@
     (swap! windows
            (fn [window-state]
              (-> window-state
-                 (update window-id update group-id dissoc extent)
-                 clean-state))))
+                 (update window-id (fn [w]
+                                     (-> w
+                                         (update group-id dissoc extent)
+                                         (clean-state group-id))))))))
   (put-trigger! [this trigger-id group-id v]
     (swap! triggers assoc-in [trigger-id group-id] v))
   (get-trigger [this trigger-id group-id]


spacing

spacing

--- src/openstack/provider.clj
+++ src/openstack/provider.clj
@@ -11,7 +11,7 @@

 (ns openstack.provider
   (:require
-    [slingshot.slingshot :refer  [throw+]]
+    [slingshot.slingshot :refer [throw+]]
     [celestial.persistency.systems :as s :refer (system-val)]
     [celestial.common :refer (import-logging)]
     [openstack.networking :refer