add user-role authorization

add user-role authorization

--- src_cljs/rrm/corecljs.cljs
+++ src_cljs/rrm/corecljs.cljs
@@ -145,6 +145,11 @@

 (defn is-authenticated? []
   (not (nil? (get-value! :user))))
+
+(defn is-admin-or-super-admin []
+  (let [role (.-role (get-value! :user))]
+    (or (= role "admin")
+        (= role "superadmin"))))

 (defn set-page! [currnt-page]
   (if (nil? (get-value! :user)) (set-key-value :page-location [login])
@@ -713,8 +718,8 @@
      [:table {:class "table table-bordered table-striped dataTable"}
       [:thead
        [:tr
-        [:th " "]
-        [:th " "]
+        (when (is-admin-or-super-admin) [:th ""])
+        (when (is-admin-or-super-admin) [:th " "])
         [:th "Mutation Number"]
         [:th "Name of the First Party"]
         [:th "Name of The Second Party"]
@@ -730,24 +735,24 @@
         [:th "Received Date "]
         ]]
       [:tbody
-       (for [mt mutations]
-         ^{:key (.-id mt)} [:tr
-                            [:td [:a {:href "javascript:;" :on-click  #(click-update (.-id mt))  :class "btn btn-success btn-sm glyphicon glyphicon-edit"}]]
-                            [:td  [:a {:href "javascript:;" :on-click #(delete(.-id mt))  :class "btn btn-danger btn-sm glyphicon glyphicon-remove"}] ]
-                            [:td (.-mutationnumber (.-numbers mt))]
-                            [:td (.-nameofthefirstparty mt)]
-                            [:td (.-nameofthesecondparty mt)]
-                            [:td (.-dateofinstitution mt)]
-                            [:td (.-nameofpo mt)]
-                            [:td (.-name (.-district  mt))]
-                            [:td (.-name (.-subdivision mt))]
-                            [:td (.-name (.-village mt))]
-                            [:td (.-o2number (.-numbers  mt))]
-                            [:td (.-o4number (.-numbers mt))]
-                            [:td (.-o6number (.-numbers mt))]
-                            [:td (.-senddate mt)]
-                            [:td (.-receiveddate mt)]
-                            ])]]
+       (doall (for [mt mutations]
+                ^{:key (.-id mt)} [:tr
+                                   (when (is-admin-or-super-admin)[:td [:a {:href "javascript:;" :on-click  #(click-update (.-id mt))  :class "btn btn-success btn-sm glyphicon glyphicon-edit"}]])
+                                   (when (is-admin-or-super-admin)[:td  [:a {:href "javascript:;" :on-click #(delete(.-id mt))  :class "btn btn-danger btn-sm glyphicon glyphicon-remove"}] ])
+                                   [:td (.-mutationnumber (.-numbers mt))]
+                                   [:td (.-nameofthefirstparty mt)]
+                                   [:td (.-nameofthesecondparty mt)]
+                                   [:td (.-dateofinstitution mt)]
+                                   [:td (.-nameofpo mt)]
+                                   [:td (.-name (.-district  mt))]
+                                   [:td (.-name (.-subdivision mt))]
+                                   [:td (.-name (.-village mt))]
+                                   [:td (.-o2number (.-numbers  mt))]
+                                   [:td (.-o4number (.-numbers mt))]
+                                   [:td (.-o6number (.-numbers mt))]
+                                   [:td (.-senddate mt)]
+                                   [:td (.-receiveddate mt)]
+                                   ]))]]
      [:div{:class "col-xs-6 col-centered col-max"} [shared-state 0]]]]])

@@ -1012,24 +1017,23 @@
           [:th "Year"]
           [:th "Rack Number"]
           [:th "Description"]
-          [:th " "]
-          [:th " "]
-          ]]
+          (when (is-admin-or-super-admin)[:th " "])
+          (when (is-admin-or-super-admin)[:th " "])]]
         [:tbody
-         (for [mt revenues]
-           ^{:key (.-id mt)} [:tr
-                              [:td (.-serialnumber mt)]
-                              [:td (.-subdivisionname mt)]
-                              [:td (.-villagename mt)]
-                              ;; [:td (.-tehsil mt)]
-                              [:td (.-year mt)]
-                              [:td (.-racknumber mt)]
-                              [:td (.-description mt)]
-                              [:td [:a {:href "javascript:;"
-                                        :on-click  #(revenue-update(.-id mt))
-                                        :class "btn btn-success btn-sm glyphicon glyphicon-edit"}]]
-                              [:td  [:a {:href "javascript:;" :on-click #(revenue-delete(.-id mt))
-                                         :class "btn btn-danger btn-sm glyphicon glyphicon-remove"}]]])]]
+         (doall (for [mt revenues]
+                  ^{:key (.-id mt)} [:tr
+                                     [:td (.-serialnumber mt)]
+                                     [:td (.-subdivisionname mt)]
+                                     [:td (.-villagename mt)]
+                                     ;; [:td (.-tehsil mt)]
+                                     [:td (.-year mt)]
+                                     [:td (.-racknumber mt)]
+                                     [:td (.-description mt)]
+                                     (when (is-admin-or-super-admin)[:td [:a {:href "javascript:;"
+                                                                              :on-click  #(revenue-update(.-id mt))
+                                                                              :class "btn btn-success btn-sm glyphicon glyphicon-edit"}]])
+                                     (when (is-admin-or-super-admin)[:td  [:a {:href "javascript:;" :on-click #(revenue-delete(.-id mt))
+                                                                               :class "btn btn-danger btn-sm glyphicon glyphicon-remove"}]])]))]]
        [:div{:class "col-xs-6 col-centered col-max"} [shared-state 0]]]]]]])

@@ -1233,24 +1237,24 @@
           [:th "Year"]
           [:th "Rack Number"]
           [:th "Description"]
-          [:th " "]
-          [:th " "]
+          (when (is-admin-or-super-admin)[:th " "])
+          (when (is-admin-or-super-admin)[:th " "])
           ]]
         [:tbody
-         (for [mt khasragirdwanis]
-           ^{:key (.-id mt)} [:tr
-                              [:td (.-serialnumber mt)]
-                              [:td (.-villagename mt)]
-                              [:td (.-subdivisionname mt)]
-                              [:td (.-tehsil mt)]
-                              [:td (.-year mt)]
-                              [:td (.-racknumber mt)]
-                              [:td (.-description mt)]
-                              [:td [:a {:href "javascript:;"
-                                        :on-click  #(khasragirdwani-update(.-id mt))
-                                        :class "btn btn-success btn-sm glyphicon glyphicon-edit"}]]
-                              [:td  [:a {:href "javascript:;" :on-click #(khasragirdwani-delete(.-id mt))
-                                         :class "btn btn-danger btn-sm glyphicon glyphicon-remove"}]]])]]
+         (doall (for [mt khasragirdwanis]
+                  ^{:key (.-id mt)} [:tr
+                                     [:td (.-serialnumber mt)]
+                                     [:td (.-villagename mt)]
+                                     [:td (.-subdivisionname mt)]
+                                     [:td (.-tehsil mt)]
+                                     [:td (.-year mt)]
+                                     [:td (.-racknumber mt)]
+                                     [:td (.-description mt)]
+                                     (when (is-admin-or-super-admin)[:td [:a {:href "javascript:;"
+                                                                              :on-click  #(khasragirdwani-update(.-id mt))
+                                                                              :class "btn btn-success btn-sm glyphicon glyphicon-edit"}]])
+                                     (when (is-admin-or-super-admin)[:td  [:a {:href "javascript:;" :on-click #(khasragirdwani-delete(.-id mt))
+                                                                               :class "btn btn-danger btn-sm glyphicon glyphicon-remove"}]])]))]]
        [:div{:class "col-xs-6 col-centered col-max"} [shared-state 0]]]]]]])

@@ -1449,24 +1453,24 @@
           [:th "Year"]
           [:th "Rack Number"]
           [:th "Description"]
-          [:th " "]
-          [:th " "]
+          (when (is-admin-or-super-admin)[:th " "])
+          (when (is-admin-or-super-admin)[:th " "])
           ]]
         [:tbody
-         (for [mt masavis]
-           ^{:key (.-id mt)} [:tr
-                              [:td (.-serialnumber mt)]
-                              [:td (.-villagename mt)]
-                              [:td (.-subdivisionname mt)]
-                              [:td (.-tehsil mt)]
-                              [:td (.-year mt)]
-                              [:td (.-racknumber mt)]
-                              [:td (.-description mt)]
-                              [:td [:a {:href "javascript:;"
-                                        :on-click  #(masavi-update(.-id mt))
-                                        :class "btn btn-success btn-sm glyphicon glyphicon-edit"}]]
-                              [:td  [:a {:href "javascript:;" :on-click #(masavi-delete(.-id mt))
-                                         :class "btn btn-danger btn-sm glyphicon glyphicon-remove"}]]])]]
+         (doall (for [mt masavis]
+                  ^{:key (.-id mt)} [:tr
+                                     [:td (.-serialnumber mt)]
+                                     [:td (.-villagename mt)]
+                                     [:td (.-subdivisionname mt)]
+                                     [:td (.-tehsil mt)]
+                                     [:td (.-year mt)]
+                                     [:td (.-racknumber mt)]
+                                     [:td (.-description mt)]
+                                     (when (is-admin-or-super-admin)[:td [:a {:href "javascript:;"
+                                                                              :on-click  #(masavi-update(.-id mt))
+                                                                              :class "btn btn-success btn-sm glyphicon glyphicon-edit"}]])
+                                     (when (is-admin-or-super-admin)[:td  [:a {:href "javascript:;" :on-click #(masavi-delete(.-id mt))
+                                                                               :class "btn btn-danger btn-sm glyphicon glyphicon-remove"}]])]))]]
        [:div{:class "col-xs-6 col-centered col-max"} [shared-state 0]]]]]]])

@@ -1665,24 +1669,24 @@
           [:th "Year"]
           [:th "Rack Number"]
           [:th "Description"]
-          [:th " "]
-          [:th " "]
+          (when (is-admin-or-super-admin)[:th " "])
+          (when (is-admin-or-super-admin)[:th " "])
           ]]
         [:tbody
-         (for [mt consolidations]
-           ^{:key (.-id mt)} [:tr
-                              [:td (.-serialnumber mt)]
-                              [:td (.-villagename mt)]
-                              [:td (.-subdivisionname mt)]
-                              [:td (.-tehsil mt)]
-                              [:td (.-year mt)]
-                              [:td (.-racknumber mt)]
-                              [:td (.-description mt)]
-                              [:td [:a {:href "javascript:;"
-                                        :on-click  #(consolidation-update(.-id mt))
-                                        :class "btn btn-success btn-sm glyphicon glyphicon-edit"}]]
-                              [:td  [:a {:href "javascript:;" :on-click #(consolidation-delete(.-id mt))
-                                         :class "btn btn-danger btn-sm glyphicon glyphicon-remove"}]]])]]
+         (doall (for [mt consolidations]
+                  ^{:key (.-id mt)} [:tr
+                                     [:td (.-serialnumber mt)]
+                                     [:td (.-villagename mt)]
+                                     [:td (.-subdivisionname mt)]
+                                     [:td (.-tehsil mt)]
+                                     [:td (.-year mt)]
+                                     [:td (.-racknumber mt)]
+                                     [:td (.-description mt)]
+                                     (when (is-admin-or-super-admin)[:td [:a {:href "javascript:;"
+                                                                              :on-click  #(consolidation-update(.-id mt))
+                                                                              :class "btn btn-success btn-sm glyphicon glyphicon-edit"}]])
+                                     (when (is-admin-or-super-admin)[:td  [:a {:href "javascript:;" :on-click #(consolidation-delete(.-id mt))
+                                                                               :class "btn btn-danger btn-sm glyphicon glyphicon-remove"}]])]))]]
        [:div{:class "col-xs-6 col-centered col-max"} [shared-state 0]]]]]]])

 (defroute consolidation-list "/consolidation" []
@@ -1880,24 +1884,24 @@
           [:th "Year"]
           [:th "Rack Number"]
           [:th "Description"]
-          [:th " "]
-          [:th " "]
+          (when (is-admin-or-super-admin) [:th " "])
+          (when (is-admin-or-super-admin) [:th " "])
           ]]
         [:tbody
-         (for [mt fieldbooks]
-           ^{:key (.-id mt)} [:tr
-                              [:td (.-serialnumber mt)]
-                              [:td (.-villagename mt)]
-                              [:td (.-subdivisionname mt)]
-                              [:td (.-tehsil mt)]
-                              [:td (.-year mt)]
-                              [:td (.-racknumber mt)]
-                              [:td (.-description mt)]
-                              [:td [:a {:href "javascript:;"
-                                        :on-click  #(fieldbook-update(.-id mt))
-                                        :class "btn btn-success btn-sm glyphicon glyphicon-edit"}]]
-                              [:td  [:a {:href "javascript:;" :on-click #(fieldbook-delete(.-id mt))
-                                         :class "btn btn-danger btn-sm glyphicon glyphicon-remove"}]]])]]
+         (doall(for [mt fieldbooks]
+                 ^{:key (.-id mt)} [:tr
+                                    [:td (.-serialnumber mt)]
+                                    [:td (.-villagename mt)]
+                                    [:td (.-subdivisionname mt)]
+                                    [:td (.-tehsil mt)]
+                                    [:td (.-year mt)]
+                                    [:td (.-racknumber mt)]
+                                    [:td (.-description mt)]
+                                    (when (is-admin-or-super-admin)[:td [:a {:href "javascript:;"
+                                                                             :on-click  #(fieldbook-update(.-id mt))
+                                                                             :class "btn btn-success btn-sm glyphicon glyphicon-edit"}]])
+                                    (when (is-admin-or-super-admin)[:td  [:a {:href "javascript:;" :on-click #(fieldbook-delete(.-id mt))
+                                                                              :class "btn btn-danger btn-sm glyphicon glyphicon-remove"}]])]))]]
        [:div{:class "col-xs-6 col-centered col-max"} [shared-state 0]]]]]]])

@@ -2057,23 +2061,23 @@
           [:th "Remarks"]
           [:th "Dispatched Date"]
           [:th "Received Date"]
-          [:th " "]
-          [:th " "]
+          (when (is-admin-or-super-admin) [:th " "])
+          (when (is-admin-or-super-admin) [:th " "])
           ]]
         [:tbody
-         (for [mt miscs]
-           ^{:key (.-id mt)} [:tr
-                              [:td (.-filenumber mt)]
-                              [:td (.-subject mt)]
-                              [:td (.-title mt)]
-                              [:td (.-remarks mt)]
-                              [:td (.-dispatcheddate mt)]
-                              [:td (.-receiveddate mt)]
-                              [:td [:a {:href "javascript:;"
-                                        :on-click  #(misc-update(.-id mt))
-                                        :class "btn btn-success btn-sm glyphicon glyphicon-edit"}]]
-                              [:td  [:a {:href "javascript:;" :on-click #(misc-delete(.-id mt))
-                                         :class "btn btn-danger btn-sm glyphicon glyphicon-remove"}]]])]]
+         (doall (for [mt miscs]
+                  ^{:key (.-id mt)} [:tr
+                                     [:td (.-filenumber mt)]
+                                     [:td (.-subject mt)]
+                                     [:td (.-title mt)]
+                                     [:td (.-remarks mt)]
+                                     [:td (.-dispatcheddate mt)]
+                                     [:td (.-receiveddate mt)]
+                                     (when (is-admin-or-super-admin)[:td [:a {:href "javascript:;"
+                                                                              :on-click  #(misc-update(.-id mt))
+                                                                              :class "btn btn-success btn-sm glyphicon glyphicon-edit"}]])
+                                     (when (is-admin-or-super-admin)[:td  [:a {:href "javascript:;" :on-click #(misc-delete(.-id mt))
+                                                                               :class "btn btn-danger btn-sm glyphicon glyphicon-remove"}]])]))]]
        [:div{:class "col-xs-6 col-centered col-max"} [shared-state 0]]]]]]])

@@ -2334,28 +2338,28 @@
           [:th "Rack NUmber"]
           [:th "Starting Year"]
           [:th "Ending Year"]
-          [:th " "]
-          [:th " "]
+          (when (is-admin-or-super-admin) [:th " "])
+          (when (is-admin-or-super-admin) [:th " "])
           ]]
         [:tbody
-         (for [mt o2registers]
-           ^{:key (.-id mt)} [:tr
-                              [:td (.-serialnumber mt)]
-                              [:td (.-subdivisionname mt)]
-                              [:td (.-dateofinstitution mt)]
-                              [:td (.-sourceofreceipt mt)]
-                              [:td (.-villagename mt)]
-                              [:td (.-nameofthefirstparty mt)]
-                              [:td (.-dateofreceiptfrompanchayat mt)]
-                              [:td (.-dateandgistoffinalorder mt)]
-                              [:td (.-racknumber mt)]
-                              [:td (.-startingyear mt)]
-                              [:td (.-endingyear mt)]
-                              [:td [:a {:href "javascript:;"
-                                        :on-click  #(o2register-update(.-id mt))
-                                        :class "btn btn-success btn-sm glyphicon glyphicon-edit"}]]
-                              [:td  [:a {:href "javascript:;" :on-click #(o2register-delete(.-id mt))
-                                         :class "btn btn-danger btn-sm glyphicon glyphicon-remove"}]]])]]
+         (doall (for [mt o2registers]
+                  ^{:key (.-id mt)} [:tr
+                                     [:td (.-serialnumber mt)]
+                                     [:td (.-subdivisionname mt)]
+                                     [:td (.-dateofinstitution mt)]
+                                     [:td (.-sourceofreceipt mt)]
+                                     [:td (.-villagename mt)]
+                                     [:td (.-nameofthefirstparty mt)]
+                                     [:td (.-dateofreceiptfrompanchayat mt)]
+                                     [:td (.-dateandgistoffinalorder mt)]
+                                     [:td (.-racknumber mt)]
+                                     [:td (.-startingyear mt)]
+                                     [:td (.-endingyear mt)]
+                                     (when (is-admin-or-super-admin)[:td [:a {:href "javascript:;"
+                                                                              :on-click  #(o2register-update(.-id mt))
+                                                                              :class "btn btn-success btn-sm glyphicon glyphicon-edit"}]])
+                                     (when (is-admin-or-super-admin)[:td  [:a {:href "javascript:;" :on-click #(o2register-delete(.-id mt))
+                                                                               :class "btn btn-danger btn-sm glyphicon glyphicon-remove"}]])]))]]
        [:div{:class "col-xs-6 col-centered col-max"} [shared-state 0]]]]]]])

 (defroute o2register-list "/o2register" []
@@ -2560,24 +2564,24 @@
           [:th "Area"]
           [:th "Revenue of Share of Plots Transfered"]
           [:th "Name and Description of the Persons Removed"]
-          [:th " "]
-          [:th " "]
+          (when (is-admin-or-super-admin) [:th " "])
+          (when (is-admin-or-super-admin) [:th " "])
           ]]
         [:tbody
-         (for [mt o4registers]
-           ^{:key (.-id mt)} [:tr
-                              [:td (.-subdivisionname mt)]
-                              [:td (.-khatakhatuninumber mt)]
-                              [:td (.-numberanddateoforder mt)]
-                              [:td (.-khasranumber mt)]
-                              [:td (.-area mt)]
-                              [:td (.-revenuerentofshareofplotstransferred mt)]
-                              [:td (.-nameanddescriptionofthepersonsremoved mt)]
-                              [:td [:a {:href "javascript:;"
-                                        :on-click  #(o4register-update(.-id mt))
-                                        :class "btn btn-success btn-sm glyphicon glyphicon-edit"}]]
-                              [:td  [:a {:href "javascript:;" :on-click #(o4register-delete(.-id mt))
-                                         :class "btn btn-danger btn-sm glyphicon glyphicon-remove"}]]])]]
+         (doall (for [mt o4registers]
+                  ^{:key (.-id mt)} [:tr
+                                     [:td (.-subdivisionname mt)]
+                                     [:td (.-khatakhatuninumber mt)]
+                                     [:td (.-numberanddateoforder mt)]
+                                     [:td (.-khasranumber mt)]
+                                     [:td (.-area mt)]
+                                     [:td (.-revenuerentofshareofplotstransferred mt)]
+                                     [:td (.-nameanddescriptionofthepersonsremoved mt)]
+                                     (when (is-admin-or-super-admin)[:td [:a {:href "javascript:;"
+                                                                              :on-click  #(o4register-update(.-id mt))
+                                                                              :class "btn btn-success btn-sm glyphicon glyphicon-edit"}]])
+                                     (when (is-admin-or-super-admin)[:td  [:a {:href "javascript:;" :on-click #(o4register-delete(.-id mt))
+                                                                               :class "btn btn-danger btn-sm glyphicon glyphicon-remove"}]])]))]]
        [:div{:class "col-xs-6 col-centered col-max"} [shared-state 0]]]]]]])

@@ -2797,23 +2801,23 @@
           [:th "Date of Orederlevy"]
           [:th "Village Name"]
           [:th "name of Person Whom Recovery is Made"]
-          [:th " "]
-          [:th " "]
+          (when (is-admin-or-super-admin) [:th " "])
+          (when (is-admin-or-super-admin) [:th " "])
           ]]
         [:tbody
-         (for [mt o6registers]
-           ^{:key (.-id mt)} [:tr
-                              [:td (.-subdivisionname mt)]
-                              [:td (.-year mt)]
-                              [:td (.-mehsilnumber mt)]
-                              [:td (.-dateoforderlevy mt)]
-                              [:td (.-villagename mt)]
-                              [:td (.-nameofpersonwhomrecoveryismade mt)]
-                              [:td [:a {:href "javascript:;"
-                                        :on-click  #(o6register-update(.-id mt))
-                                        :class "btn btn-success btn-sm glyphicon glyphicon-edit"}]]
-                              [:td  [:a {:href "javascript:;" :on-click #(o6register-delete(.-id mt))
-                                         :class "btn btn-danger btn-sm glyphicon glyphicon-remove"}]]])]]
+         (doall (for [mt o6registers]
+                  ^{:key (.-id mt)} [:tr
+                                     [:td (.-subdivisionname mt)]
+                                     [:td (.-year mt)]
+                                     [:td (.-mehsilnumber mt)]
+                                     [:td (.-dateoforderlevy mt)]
+                                     [:td (.-villagename mt)]
+                                     [:td (.-nameofpersonwhomrecoveryismade mt)]
+                                     (when (is-admin-or-super-admin)[:td [:a {:href "javascript:;"
+                                                                              :on-click  #(o6register-update(.-id mt))
+                                                                              :class "btn btn-success btn-sm glyphicon glyphicon-edit"}]])
+                                     (when (is-admin-or-super-admin)[:td  [:a {:href "javascript:;" :on-click #(o6register-delete(.-id mt))
+                                                                               :class "btn btn-danger btn-sm glyphicon glyphicon-remove"}]])]))]]
        [:div{:class "col-xs-6 col-centered col-max"} [shared-state 0]]]]]]])

@@ -2860,7 +2864,7 @@
 (defn main
   []
   (secretary/set-config! :prefix "#")
-  (set-key-value :page-location [render-mutations])
+  (set-key-value :page-location [login])
   (r/render [page]
             (.getElementById js/document "app1"))
   (let [history (History.)]


trim fast-memoize arities to used range

trim fast-memoize arities to used range

--- src/java_time/potemkin/util.cljc
+++ src/java_time/potemkin/util.cljc
@@ -51,14 +51,8 @@
                    (memoize-form m f x y))
                   ([x y z]
                    (memoize-form m f x y z))
-                  ([x y z w]
-                   (memoize-form m f x y z w))
-                  ([x y z w u]
-                   (memoize-form m f x y z w u))
-                  ([x y z w u v]
-                   (memoize-form m f x y z w u v))
-                  ([x y z w u v & rest]
-                   (let [k (list* x y z w u v rest)]
+                  ([x y z & rest]
+                   (let [k (list* x y z rest)]
                      (let [v (.get ^ConcurrentHashMap m k)]
                        (if-not (nil? v)
                          (re-nil v)


Replace cond with if for shorter, clearer code.

--- prime.clj/src/prime/clj.clj
+++ prime.clj/src/prime/clj.clj
@@ -4,11 +4,11 @@
 (require '[clojure.math.numeric-tower :as math])

 (defn prime? [x]
-  (cond
+  (if
     (integer? (math/sqrt x)) false
-    :else (every?
-            (fn [y] (not= (mod x y) 0))
-            (range 2 (math/ceil (math/sqrt x))))))
+    (every?
+       (fn [y] (not= (mod x y) 0))
+       (range 2 (math/ceil (math/sqrt x))))))

 (defn -main


Tone down the number of gen tests for flow conditions - high number of generators.

--- test/onyx/flow_conditions/flow_conditions_gen_test.clj
+++ test/onyx/flow_conditions/flow_conditions_gen_test.clj
@@ -92,7 +92,7 @@
 (deftest conj-downstream-tasks-together
   (checking
    "It joins the :flow/to tasks together and limits selection"
-   (times 20)
+   (times 15)
    [flow-conditions
     (gen/not-empty
      (gen/vector (->> :a
@@ -110,7 +110,7 @@
 (deftest no-false-predicate-picks
   (checking
    "It doesn't pick any downstream tasks with false predicates"
-   (times 20)
+   (times 15)
    [true-fcs
     (gen/vector (->> :a
                      (flow-condition-gen)
@@ -131,7 +131,7 @@
 (deftest short-circuit
   (checking
    "It stops searching when it finds a short circuit true pred"
-   (times 20)
+   (times 15)
    [false-1
     (gen/vector (->> :a
                      (flow-condition-gen)
@@ -165,7 +165,7 @@
 (deftest retry-action
   (checking
    "Using a retry action with a true predicate flows to nil"
-   (times 20)
+   (times 15)
    [retry-false
     (gen/vector (->> :a
                      (flow-condition-gen)
@@ -210,7 +210,7 @@
 (deftest key-exclusion
   (checking
    "Matched predicates excluded keys are conj'ed together"
-   (times 20)
+   (times 15)
    [mixed
     (gen/vector
      (gen/one-of [(->> :a
@@ -232,7 +232,7 @@
 (deftest matching-all
   (checking
    "A :flow/to of :all that passes its predicate matches everything"
-   (times 20)
+   (times 15)
    [false-all
     (gen/vector (->> :a
                      (flow-condition-gen)
@@ -264,7 +264,7 @@
 (deftest matching-none
   (checking
    "A :flow/to of :none that passes its pred matches nothing"
-   (times 20)
+   (times 15)
    [false-none
     (gen/vector (->> :a
                      (flow-condition-gen)
@@ -296,7 +296,7 @@
 (deftest post-transformation
   (checking
    "A :flow/post-transform is returned for exception predicates that define it"
-   (times 20)
+   (times 15)
    [false-xform
     (gen/vector (->> :a
                      (flow-condition-gen)
@@ -328,7 +328,7 @@
 (deftest post-transformation-no-invocation
   (checking
    "Post-transformations are not invoked when they are not matched"
-   (times 20)
+   (times 15)
    [fcs
     (gen/not-empty
      (gen/vector (->> :a
@@ -347,7 +347,7 @@
 (deftest post-transformation-invocation
   (checking
    "Post-transformations are invoked when they are matched"
-   (times 20)
+   (times 15)
    [fcs
     (gen/not-empty
      (gen/vector (->> :a
@@ -367,7 +367,7 @@
 (deftest post-transformation-exclusions
   (checking
    "Key exclusions are applied during post transformation"
-   (times 20)
+   (times 15)
    [fcs
     (gen/vector (->> :a
                      (flow-condition-gen)


lng,lat was correct in the first place -- errata?

--- test/the_divine_cheese_code/visualization/svg_test.clj
+++ test/the_divine_cheese_code/visualization/svg_test.clj
@@ -6,12 +6,12 @@

 (deftest latlng->point-test
   (testing "Given a map containing lat and lng, returns those elements as a comma-delimited string"
-    (is (= "50.95,6.97" (latlng->point {:location "place1" :cheese-name "cheese1" :lat 50.95 :lng 6.97})))))
+    (is (= "6.97,50.95" (latlng->point {:location "place1" :cheese-name "cheese1" :lat 50.95 :lng 6.97})))))

 (deftest points-test
   (testing "Given a sequence of location maps, returns the latlng points as a space-delimited string"
-    (is (= "50.95,6.97" (points [{:location "place1" :cheese-name "cheese1" :lat 50.95 :lng 6.97}])))
-    (is (= "50.95,6.97 15.97,3.14" (points [{:location "place1" :cheese-name "cheese1" :lat 50.95 :lng 6.97}
+    (is (= "6.97,50.95" (points [{:location "place1" :cheese-name "cheese1" :lat 50.95 :lng 6.97}])))
+    (is (= "6.97,50.95 3.14,15.97" (points [{:location "place1" :cheese-name "cheese1" :lat 50.95 :lng 6.97}
                                             {:location "place2" :cheese-name "cheese2" :lat 15.97 :lng 3.14}])))))

 (deftest min-test


Add validations to the processing pipeline (oops!)

--- src/vip/data_processor.clj
+++ src/vip/data_processor.clj
@@ -54,6 +54,7 @@
            t/xml-csv-branch
            psql/store-public-id
            psql/store-election-id
+           add-validations
            s3/upload-to-s3
            cleanup/cleanup]))


Remove debug statement.

Remove debug statement.

--- src/onyx/plugin/kafka.clj
+++ src/onyx/plugin/kafka.clj
@@ -117,9 +117,7 @@
   (let [paused (into #{}
                      (map #(.partition %))
                      (.paused consumer))]
-    (taoensso.timbre/errorf "Partitions: %s Paused: %s" kpartitions paused)
     (= paused (set kpartitions))))
-

 (deftype KafkaReadMessages
     [log-prefix task-map topic ^:unsynchronized-mutable kpartitions batch-timeout


fix tests broken be recent change

fix tests broken be recent change

--- test/clj_money/trading_test.clj
+++ test/clj_money/trading_test.clj
@@ -334,7 +334,6 @@
 (deftest sell-a-commodity
   (let [context (serialization/realize storage-spec purchase-context)
         ira (find-account context "IRA")
-        commodity-account (find-account context "AAPL")
         ltcg (find-account context "Long-term Capital Gains")
         commodity (find-commodity context "AAPL")
         purchase (trading/buy storage-spec {:account-id (:id ira)
@@ -342,6 +341,10 @@
                                             :trade-date (t/local-date 2016 3 2)
                                             :shares 100M
                                             :value 1000M})
+        commodity-account (->> {:entity-id (-> context :entities first :id)
+                                            :commodity-id (:id commodity)}
+                               (accounts/search storage-spec)
+                               first)
         lot (-> purchase :lot)
         result (trading/sell storage-spec (sale-attributes context))
         actual-transaction (-> result
@@ -403,7 +406,8 @@
         "The shares-owned value of the original lot is updated")
     (is (:transaction result)
         "The result contains the transaction record")
-    (is (= expected-transaction actual-transaction) "The transaction contains the correct attributes")
+    (is (= expected-transaction actual-transaction)
+        "The transaction contains the correct attributes")
     (is (empty? (-> result :transaction validation/error-messages))
         "The transaction is valid")
     (testing "entity settings"
@@ -545,7 +549,7 @@

 (deftest selling-a-commodity-updates-a-lot-record
   (let [context (serialization/realize storage-spec (sell-context))
-        [ira] (:accounts context)
+        ira (find-account context "IRA")
         commodity (find-commodity context "AAPL")
         _ (trading/sell storage-spec (-> context
                                          sale-attributes


Add comments

Add comments

--- src/particlebox/core.cljs
+++ src/particlebox/core.cljs
@@ -1,3 +1,4 @@
+;; Particle box, a physics playground.
 (ns particlebox.core)

 (def particle-radius 20)
@@ -27,18 +28,23 @@
      (/ scene-height 2)))

 (defn set-position!
+  "Convenience function for changing the position of an object. This just wraps
+some of the three.js javascriptiness."
   [mesh [x y z]]
   (set! (.-x (.-position mesh)) x)
   (set! (.-y (.-position mesh)) y)
   (set! (.-z (.-position mesh)) z))

 (defn rotate-angles!
+  "Convenience function for rotating an object. This just wraps some of the
+three.js javascriptiness."
   [mesh [x y z]]
   (set! (.-x (.-rotation mesh)) (+ (.-x (.-rotation mesh)) x))
   (set! (.-y (.-rotation mesh)) (+ (.-y (.-rotation mesh)) y))
   (set! (.-z (.-rotation mesh)) (+ (.-z (.-rotation mesh)) z)))

 (defn mesh-from-particle
+  "Builds a three.js mesh from the particle."
   [p]
   (let [geometry (THREE.SphereGeometry.
                   particle-radius particle-radius particle-radius)
@@ -48,11 +54,15 @@
     mesh))

 (defn init-particles!
+  "Sets up all the necessary simulation state for the particles."
   [ps]
   (reset! particles ps)
   (reset! particle-meshes (map mesh-from-particle ps)))

 (defn make-renderer!
+  "Creates a renderer function from the meshe objects. The resulting function
+has no parameters, and completes an entire redraw of the scene when it is
+called."
   [meshes]
   (let [camera (THREE.PerspectiveCamera.
                 50 (/ scene-width
@@ -69,6 +79,7 @@
       (.render renderer scene camera))))

 (defn magnitude
+  "Calculates the magnitude (length) of a vector."
   [v]
   (Math/sqrt (apply + (map #(* % %) v))))

@@ -88,11 +99,12 @@
      (direction (map - b a) m)))

 (defn distance
+  "Calculates the distance betwen two points."
   [a b]
   (magnitude (map - a b)))

 (defn calc-accel
-  "Calculates the sum vector of the gravitational force exerted on the partical
+  "Calculates the sum vector of the gravitational force exerted on the particle
 by all the other particles."
   [p all-particles]
   (reduce
@@ -112,18 +124,28 @@
   [p v all]
   (let [a (calc-accel p all)
         v (map + v a)
+
+        ;; added a speed limit here because gavitational sigularities were
+        ;; causing particles to become superaccelerated, which is kind of cool
+        ;; but generally doesn't make for a good simulation. This is needed only
+        ;; when there's no collision detection.
         speed (magnitude v)
         v (if (> speed speed-limit)
             (direction v speed-limit)
             v)
+
         p (map + p v)]
     [p v a]))

 (defn collided?
+  "Determines whether the two particles have collided."
   [a b]
   (< (distance (:pos a) (:pos b)) particle-diameter))

 (defn handle-collisions!
+  "Scans all particles for collisions, and when any two particles collide,
+bounces them away from one another and cancels out velocity along the shared
+axis. This is not quite right, but suffices for now."
   []
   (doseq [a (range particle-count)
           b (range particle-count)]
@@ -147,6 +169,8 @@
                                (direction dir (magnitude (:vel pb)))))))))))

 (defn motion-tick!
+  "Performs all motion in the universe for one stroboscopic 'tick' of the
+clock."
   []
   (doseq [i (range particle-count)]
     (let [p (nth @particles i)
@@ -155,6 +179,8 @@
              assoc i {:pos p :vel v}))))

 (defn generate-particles
+  "Creates the given number of particles, and arranges them in the universe
+randomly."
   [n]
   (vec
    (for [i (range n)]


Subscriber chans are never blocked for heartbeats, as upstream will not send the next barrier until downstream is ready.

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -147,12 +147,9 @@
   (let [curr-time (System/nanoTime)]
     (->> (sub/status-pubs (m/subscriber (get-messenger state)))
          (filter (fn [[peer-id spub]]
-                   ;; if the publisher is blocked, then it's not its fault we're
-                   ;; not getting its heartbeats, and thus we should not time it out
-                   (and (not (status-pub/blocked? spub))
-                        (< (+ (status-pub/get-heartbeat spub)
-                              liveness-timeout-ns)
-                           curr-time))))
+                   (< (+ (status-pub/get-heartbeat spub)
+                         liveness-timeout-ns)
+                      curr-time)))
          (map key)
          (reduce evict-peer! state)
          (advance))))


Reorder default lines

Reorder default lines

--- src/onyx/static/default_vals.clj
+++ src/onyx/static/default_vals.clj
@@ -24,9 +24,9 @@
    :onyx.bookkeeper/base-dir "/tmp/bookkeeper/"
    :onyx.bookkeeper/timeout 60000
    :onyx.bookkeeper/ledger-password "INSECUREDEFAULTPASSWORD"
-   :onyx.bookkeeper/ledger-id-written-back-off 500
    :onyx.bookkeeper/ledger-ensemble-size 3
    :onyx.bookkeeper/ledger-quorum-size 3
+   :onyx.bookkeeper/ledger-id-written-back-off 500

    ;; peer defaults
    :onyx.peer/inbox-capacity 1000


Exercise 2.36, 2.37, 2.38, 2.39

Exercise 2.36, 2.37, 2.38, 2.39

--- src/sicp/chapter2/2_3.clj
+++ src/sicp/chapter2/2_3.clj
@@ -36,16 +36,43 @@
                        t)))

 ;; Exercise 2.36
-;; TODO
+(defn accumulate-n [op init seqs]
+  (if (empty? (first seqs))
+    nil
+    (cons (accumulate op init (map first seqs))
+          (accumulate-n op init (map rest seqs)))))

 ;; Exercise 2.37
-;; TODO
+(defn dot-product [v w]
+  (accumulate + 0 (map * v w)))
+
+(defn matrix-*-vector [m v]
+  (map #(dot-product % v) m))
+
+(defn transpose [mat]
+  (accumulate-n cons nil mat))
+
+(defn matrix-*-matrix [m n]
+  (let [cols (transpose n)]
+    (map #(matrix-*-vector cols %) m)))

 ;; Exercise 2.38
 ;; TODO

 ;; Exercise 2.39
-;; TODO
+(defn fold-left [op initial sequence]
+  (letfn [(iter [result rest']
+            (if (empty? rest')
+              result
+              (recur (op result (first rest'))
+                     (rest rest'))))]
+    (iter initial sequence)))
+
+(defn reverse' [sequence]
+  (fold-left (fn [x y] (cons y x)) nil sequence))
+
+(defn reverse'' [sequence]
+  (accumulate (fn [x y] (concat y (list x))) nil sequence))

 ;; Exercise 2.40
 ;; TODO


Add a fn for finding all tests

Add a fn for finding all tests

--- src/radicalzephyr/boot_junit.clj
+++ src/radicalzephyr/boot_junit.clj
@@ -16,6 +16,9 @@
    :failed  (.getFailureCount result)
    :failures (map failure->map (.getFailures result))})

+(defn find-all-tests [packages]
+  [])
+
 (core/deftask junit
   "Run the jUnit test runner."
   [p packages PACKAGE #{sym} "The set of Java packages to run tests in."]
@@ -23,7 +26,7 @@
     (if (seq packages)
       (let [result (JUnitCore/runClasses
                     (into-array Class
-                                [#_ (magic goes here to find all test classes)]))]
+                                (find-all-tests packages)))]
         (when (> (.getFailureCount result) 0)
           (throw (ex-info "There were some test failures."
                           (result->map result)))))


Display latest series data on UI.

Display latest series data on UI.

--- metlog-vault/src-client/metlog.cljs
+++ metlog-vault/src-client/metlog.cljs
@@ -7,7 +7,7 @@
             [cljs.core.async :refer [put! close! chan <!]]))

 (def dashboard-state (atom {:server-time nil
-                            :series-names []}))
+                            :series []}))

 (defn <<< [f & args]
   (let [c (chan)]
@@ -18,12 +18,10 @@
                                    (put! c x)))]))
     c))

-(defn error-handler [{:keys [status status-text]}]
-  (.log js/console (str "something bad happened: " status " " status-text)))
-
 (defn ajax-get [ url callback ]
   (GET url {:handler callback
-            :error-handler error-handler}))
+            :error-handler (fn [ resp ]
+                             (.log js/console (str "HTTP error, url: " url " resp: " resp)))}))

 (defn fetch-series-names [ cb ]
   (ajax-get "/series-names" cb))
@@ -31,22 +29,30 @@
 (defn fetch-server-time [ cb ]
   (ajax-get "/server-time" cb))

+(defn fetch-latest-series-data [ series-name cb ]
+  (ajax-get (str "/latest/" series-name) cb))
+
 (defn series-pane [ state owner ]
-  (om/component
-   (dom/div nil state)))
-
-(defn series-list [ state owner ]
   (reify
     om/IWillMount
     (will-mount [ this ]
-      (go
-        (om/update! state :series-names (<! (<<< fetch-series-names)))))
+      (js/setInterval
+       (fn []
+         (go
+           (let [ resp (<! (<<< fetch-latest-series-data (:name state)))]
+             (om/update! state :val (:val resp)))))
+       15000))
+
+    om/IRender
+    (render [ this ]
+      (dom/div nil (:name state) " - " (:val state)))))

+(defn series-list [ state owner ]
+  (reify
     om/IRender
     (render [ this ]
       (apply dom/div nil
-             (map #(om/build series-pane %)
-                  (:series-names state))))))
+             (om/build-all series-pane (:series state))))))

 (defn server-time [ state owner ]
   (reify
@@ -56,7 +62,7 @@
        (fn []
          (go
            (om/update! state :server-time (<! (<<< fetch-server-time)))))
-       1000))
+       15000))

     om/IRender
     (render [ this ]
@@ -83,3 +89,12 @@
 (om/root dashboard dashboard-state
   {:target (. js/document (getElementById "metlog"))})

+
+
+(defn load-series-names []
+  (go
+    (swap! dashboard-state assoc :series
+           (vec (map (fn [ series-name ] { :name series-name })
+                     (<! (<<< fetch-series-names)))))))
+
+(load-series-names)


finish animation events for sticky nav on homepage

--- frontend/components/landing_b.cljs
+++ frontend/components/landing_b.cljs
@@ -24,10 +24,15 @@
   (let [logo (om/get-node owner "center-logo")
         cta (om/get-node owner "cta")
         nav-bkg (om/get-node owner "nav-bkg")
+        no-cta (om/get-node owner "no-cta")
+        nav-no-bkg (om/get-node owner "nav-no-bkg")
+        vh (.-height (goog.style/getSize nav-bkg))
         scroll-callback #(do
                            (om/set-state! owner [:header-logo-visible] (neg? (.-bottom (.getBoundingClientRect logo))))
                            (om/set-state! owner [:header-cta-visible] (neg? (.-bottom (.getBoundingClientRect cta))))
-                           (om/set-state! owner [:header-bkg-visible] (< (.-bottom (.getBoundingClientRect nav-bkg)) 70)))]
+                           (om/set-state! owner [:header-bkg-visible] (< (.-bottom (.getBoundingClientRect nav-bkg)) 70))
+                           (om/set-state! owner [:header-cta-invisible] (< (.-top (.getBoundingClientRect no-cta)) vh))
+                           (om/set-state! owner [:header-bkg-invisible] (< (.-top (.getBoundingClientRect nav-no-bkg)) 70)))]
     (om/set-state! owner [:browser-resize-key]
                    (goog.events/listen
                     (sel1 (om/get-shared owner [:target]) ".app-main")
@@ -42,6 +47,8 @@
       {:header-logo-visible false
        :header-cta-visible false
        :header-bkg-visible false
+       :header-cta-invisible false
+       :header-bkg-invisible false
        :scroll-ch (chan (sliding-buffer 1))})
     om/IRenderState
     (render-state [_ state]
@@ -51,7 +58,9 @@
                [:nav.home-nav {:class (concat
                                        (when (:header-logo-visible state) ["logo-visible"])
                                        (when (:header-cta-visible state) ["cta-visible"])
-                                       (when (:header-bkg-visible state) ["bkg-visible"]))}
+                                       (when (:header-bkg-visible state) ["bkg-visible"])
+                                       (when (:header-cta-invisible state) ["cta-invisible"])
+                                       (when (:header-bkg-invisible state) ["bkg-invisible"]))}
                 [:a.promo "What is Continuous Integration?"]
                 [:a.login "Log In"]
                 (om/build drawings/logo-circleci app)
@@ -172,8 +181,9 @@
                  [:div.drawing]
                  [:div.drawing]
                  (om/build drawings/drawing-build app)]]
-               [:section.home-epilog
-                [:a.home-action {:role "button"}
+               [:section.home-epilog {:ref "nav-no-bkg"}
+                [:a.home-action {:ref "no-cta"
+                                 :role "button"}
                  "Sign Up Free"]
                 [:div.home-cover]
                 [:div.home-top-shelf]


added support for parens expression

added support for parens expression

--- src/thesis/program_semantics.clj
+++ src/thesis/program_semantics.clj
@@ -31,7 +31,7 @@

       :not-atom (let [[_not x] e-params]
                   (expr :not (tr x)))
-      :parens-predicate (let [[_paren expression _paren] e-params]
+      (:parens-predicate :parens-expression) (let [[_paren expression _paren] e-params]
                           (tr expression))

       :identifier (first e-params)


Transform feature into sentences starting with an upper case and ending with a point

--- agiledox.clj
+++ agiledox.clj
@@ -18,9 +18,12 @@

 (defn skipTestPerfixIfPresent [feature]
 	(.replaceFirst feature "- test" "-"))
+
+(defn formSentense [feature]
+	(str " - " (.toUpperCase (.substring feature 2 3)) (.substring feature 3) ".") )

 (defn as-feature [line]
-  (skipTestPerfixIfPresent (.toLowerCase (.replaceAll line "([A-Z])" " $1"))))
+  (formSentense (skipTestPerfixIfPresent (.toLowerCase (.replaceAll line "([A-Z])" " $1")))))

 (def empty-line "")


provide `unknown` instead of full path

provide `unknown` instead of full path

--- src/vignette/http/middleware.clj
+++ src/vignette/http/middleware.clj
@@ -47,7 +47,7 @@
   (fn [request]
     (let [response (handler request)
           meta (meta response)]
-      (with-meta response {:path (get meta :path (get meta :thumbnail-mode (name (get meta :request-type (:uri request)))))}))))
+      (with-meta response {:path (get meta :path (get meta :thumbnail-mode (name (get meta :request-type "unknown"))))}))))

 (defn add-headers
   [handler]


set path as context rather than as part of the message

--- src/vignette/http/middleware.clj
+++ src/vignette/http/middleware.clj
@@ -57,6 +57,6 @@
   []
   (fn [request]
     (perf/publish {:bad-request-path-count 1})
-    (log/warn (str "bad-request-path: " (:uri request)))
+    (log/warn "bad-request-path" {:path (:uri request)})
     (-> (render "Unrecognized request path!\nSee https://github.com/Wikia/vignette for documentation.\n" request)
         (status 404))))


The project table is now defined in data, and used to render rows.

--- src-cljs/kixi/hecuba/main.cljs
+++ src-cljs/kixi/hecuba/main.cljs
@@ -7,12 +7,35 @@
   (:require-macros
    [dommy.macros :refer [node sel sel1]]))

-(defn handler [response]
-  (let [tbody
-        (node [:tbody
-               (for [row (js->clj response)]
-                 [:tr [:td {:colspan 5} (str row)]])])]
-    (dommy/replace! (sel1 [:#projects :table :tbody]) tbody)))
+(def project-table
+  {:headings {:programme "Programme"
+              :name "Project"
+              :project-code "Project code"
+              :last-edit "Last edit"
+              :leaders "Leaders"
+              :properties "Properties"}})
+
+(defn make-handler [table-def]
+  (fn [response]
+    (let [table
+          (node
+           [:table.full
+            [:thead
+             [:tr
+              (for [h (vals (:headings table-def))]
+                (do
+                  (.log js/console "h is " h)
+                  [:th h]))]]
+            [:tbody
+             (for [row (js->clj response)]
+               (do
+                 (.log js/console "processing row: " row)
+                 [:tr
+                  (for [[k _] (:headings table-def)]
+                    [:td (str (get row (name k)))]
+                    )
+                  ]))]])]
+      (dommy/replace! (sel1 [:#projects :table]) table))))

 (defn table [cols]
   [:table.full
@@ -47,6 +70,6 @@
              [:a.view-all {:href "/projects"} "View all »"]
              [:a {:href "/projects/new"} "Add a new project"]]]
            ]))
-  (GET "/projects/" {:handler handler :headers {"Accept" "application/json"}}))
+  (GET "/projects/" {:handler (make-handler project-table) :headers {"Accept" "application/json"}}))

 (set! (.-onload js/window) main)


fix(re-db build): do not compile into resources directory

--- re_db/project.clj
+++ re_db/project.clj
@@ -24,14 +24,14 @@
                         :compiler     {:main                 app.core
                                        :parallel-build       true
                                        :asset-path           "/js/compiled/out"
-                                       :output-to            "resources/public/js/compiled/outliner.js"
-                                       :output-dir           "resources/public/js/compiled/out"
+                                       :output-to            "public/js/compiled/outliner.js"
+                                       :output-dir           "public/js/compiled/out"
                                        :source-map-timestamp true
                                        :cache-analysis       true}}
                        {:id           "test"
                         :source-paths ["src" "test"]
-                        :compiler     {:output-to      "resources/public/js/test.js"
-                                       :output-dir     "resources/public/js/test"
+                        :compiler     {:output-to      "public/js/test.js"
+                                       :output-dir     "public/js/test"
                                        :main           re-db.runner
                                        :optimizations  :none
-                                       :source-map-dir "resources/public/js/"}}]})
+                                       :source-map-dir "public/js/"}}]})


add music and soccer ball as notes to "play"


Solved day 11

Solved day 11

--- src/adventofcode/solutions.clj
+++ src/adventofcode/solutions.clj
@@ -279,7 +279,7 @@
   [comp-f]
   (let [input (day-input-line-seq 9)
         distances (into {} (map #(let [[[_ from to dist]] (re-seq #"^(\w+) to (\w+) = (\d+)$" %)]
-                          [#{from to} (s->int dist)]) input))
+                                  [#{from to} (s->int dist)]) input))
         places (reduce #(let [[endpoints _] %2]
                          (conj % (first endpoints) (last endpoints))) #{} distances)
         all-routes (permutations places)
@@ -303,19 +303,13 @@

 ;day 11
 ;just building blocks
-;string into number
 (defn- no-iol? [ch-seq]
   (not-any? #(#{105 108 111} %) ch-seq))

-(defn- s->big-int
-  "Simply transforms string into big integer consisting of concatenated character codes"
+(defn- s->ch-seq
+  "Turns string into sequence of char (integer) codes"
   [s]
-  (BigInteger. (clojure.string/join (map #(format "%03d" %) (map int s)))))
-
-(defn- big-int->ch-seq
-  "Simply transforms big-int into sequence of 3 digit numbers"
-  [num]
-  (map #(s->int (apply str %)) (partition 3 (str num))))
+  (vec (map int s)))

 (defn- ch-seq->str
   "Char sequence (ch here is 8bit int actually)"
@@ -325,33 +319,56 @@
 (defn- has-distinct-pairs?
   "Determines if sequence contains two distinct pairs (pairs consist of different chars)"
   [xs]
-  (let [[one two] (filter #(= 2 (count %)) (partition-by identity xs))]
+  (let [[one two] (take 2 (filter
+                            #(= 2 (count %))
+                            (partition-by identity xs)))]
     (and one two (not= (first one) (first two)))))

 (defn- has-inc-of-three?
   "Determines if provided input sequence containes increasing straight of at least three letters"
   [xs]
-  (some
-    #(>= (count %) 3)
-    (reduce #(let [prev (first %)
-                   lnum (last prev)]
-              (if (> %2 lnum)
-                (conj (rest %) (conj prev %2))
-                (conj % [%2]))) [[(first xs)]] (rest xs))))
-
-(defn- all-letters? [chs]
-  (every? #(and (>= % 97) (<= % 122)) chs))
-
+  (= 3 (count
+         (reduce #(if (= (dec %2) (last %))
+                   (let [med (conj % %2)]
+                     (if (= 3 (count med))
+                       (reduced med)
+                       med))
+                   [%2]) [(first xs)] (rest xs)))))
+
+;naive inefficient attempt
+;(defn day11 [input]
+;  (let [a0 (first (s->ch-seq input))]
+;    (for [a (range (int a0) 123)
+;          b (range 97 123)
+;          c (range 97 123)
+;          d (range 97 123)
+;          e (range 97 123)
+;          f (range 97 123)
+;          g (range 97 123)
+;          h (range 97 123)
+;          :let [cs [a b c d e f g h]]
+;          :when (and (no-iol? cs)
+;                     (has-inc-of-three? cs)
+;                     (has-distinct-pairs? cs)
+;                     (pos? (compare (ch-seq->str cs) input)))]
+;      cs)))
+
+;quite enough efficient solution
 (defn day11 [input]
-  (reduce #(let [ch-seq (big-int->ch-seq %2)]
-            (when (all-letters? ch-seq)
-              (println (ch-seq->str ch-seq))
-              (if (and
-                    (has-inc-of-three? ch-seq)
-                    (no-iol? ch-seq)
-                    (has-distinct-pairs? ch-seq))
-                (reduced (ch-seq->str ch-seq)))))
-          (iterate #(.add % BigInteger/ONE) (s->big-int input))))
-
-
-
+  (reduce #(if (and
+                 (has-inc-of-three? %2)
+                 (no-iol? %2)
+                 (has-distinct-pairs? %2))
+            (reduced (ch-seq->str %2)))
+          (iterate (fn [x]
+                     (if (= 122 (last x))
+                       (let [cnt (count (take-while #(= % 122) (reverse x)))]
+                         (vec (map-indexed #(let [pos (- 7 cnt)]
+                                             (cond
+                                               (= pos %) (inc %2)
+                                               (< % pos) %2
+                                               (> % pos) 97))
+                                           x)))
+                       (assoc x 7 (inc (last x))))) (s->ch-seq input))))
+
+


Support generic single-function channels.

--- src/afterglow/fixtures/qxf.clj
+++ src/afterglow/fixtures/qxf.clj
@@ -54,23 +54,27 @@
     (str "(chan/" (clojure.string/lower-case (:group specs)) " " offset
          (when fine-offset (str " " fine-offset)) ")")))

-(defn- define-special-channel
+(defn- define-single-function-channel
   "If the supplied channel specification map contains a single
-  function using the entire range, and it is one of the special kinds
-  of channels we recognize, emit a function which defines it at the
-  specified offsets."
+  function using the entire range, emit a function which defines it at
+  the specified offsets. If it is one of the special kinds of channels
+  we recognize, use the corresponding generator."
   [specs offset fine-offset]
   (let [caps (:capabilities specs)]
     (when (and (= 1 (count caps)) (zero? (:min (first caps))) (= 255 (:max (first caps))))
       (or (define-color-channel specs offset fine-offset)
           (define-dimmer-channel specs offset fine-offset)
-          (define-pan-tilt-channel specs offset fine-offset)))))
+          (define-pan-tilt-channel specs offset fine-offset)
+          (str "(chan/fine-channel " (keyword (sanitize-name (:name specs))) " " offset
+               (when fine-offset (str " :fine-offset " fine-offset))
+               "\n                                 :function-name \"" (:name specs)
+               "\"\n                                 :var-label \"" (:label (first caps)) "\")")))))

 (defn- define-channel
   "Generates a function call which defines the specified
   channel (given its specification map), at the specified offsets."
   [specs offset fine-offset]
-  (or (define-special-channel specs offset fine-offset)
+  (or (define-single-function-channel specs offset fine-offset)
       (str "\"Define function channel for " (:name specs) " at offset " offset "\"")))

 (defn- channel-tag


fix typo

fix typo

--- src/babel/english/grammar.cljc
+++ src/babel/english/grammar.cljc
@@ -308,7 +308,7 @@
    ;; but:
    ;;   [nbar-obj [nbar ]] is allowed.
    (unify-check c11-comp-subcat-1
-                cons-mod
+                comp-mod
                 (let [head-constraint (atom :top)]
                   {:rule "nbar"
                    :bar-level :low


"have dinner" is intransitive

"have dinner" is intransitive

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -814,7 +814,8 @@
                      :past "had"}}

    "have dinner" {:synsem {:cat :verb
-                           :sem {:pred :have-dinner}}
+                           :sem {:pred :have-dinner}
+                           :subcat {:2 '()}}
                   :english {:present {:3sing "has dinner"}
                             :past "had dinner"
                             :participle "having dinner"}}


~vocab-entry-to-lexeme: handle case of :noun1 as [:synsem :cat]: should not be there but somehow is for some vocab items

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -723,7 +723,9 @@
                             (dag_unify.core/dissoc-paths structure [[:english :plur]])
                             structure)

-                structure (if (= :unspec (dag_unify.core/get-in structure [:synsem :cat]))
+                structure (if (or
+                               (= :noun1 (u/get-in structure [:synsem :cat]))
+                               (= :unspec (u/get-in structure [:synsem :cat])))
                             (dag_unify.core/dissoc-paths structure [[:synsem :cat]])
                             structure)


Improve site-tests

Improve site-tests

- Make the site-name a dynamically bound variable instead of passing it
  everywhere
- Factor out a resource-exists? function
- Add a test for the presence of the image.html file

--- test/comic_reader/sites_test.clj
+++ test/comic_reader/sites_test.clj
@@ -1,7 +1,9 @@
 (ns comic-reader.sites-test
   (:require [clojure.test :refer :all]
             [comic-reader.sites :refer :all]
-            [clojure.java.io :as io]))
+            [comic-reader.sites.test-util :as tu]
+            [clojure.java.io :as io]
+            [net.cgrand.enlive-html :as html]))

 (deftest base-name-test
   (is (= (base-name "abc.123")
@@ -44,29 +46,48 @@
           (str "Contents of `sites/" site ".clj'"
                " cannot be empty")))))

-(defn site-test-folder [site-name]
+(def ^:dynamic site-name)
+
+(defn site-test-folder []
   (format "test/%s" site-name))

-(defn has-test-folder? [site-name]
-  (some->
-   site-name
-   site-test-folder
-   io/resource
-   io/as-file
-   .exists))
+(defn resource-exists? [path]
+  (some-> path
+          io/resource
+          io/as-file
+          .exists))

-(defn error-must-have-test-data [site-name]
+(defn has-test-folder? []
+  (some-> (site-test-folder)
+          resource-exists?))
+
+(defn error-must-have-test-data []
   (is false
       (str "There must be a site test data folder at "
            "`resources/test/" site-name "'")))

+(defn image-page-html []
+  (let [image-path (format "%s/image.html" (site-test-folder))]
+    (if (resource-exists? image-path)
+      (html/html-resource image-path)
+      nil)))
+
+(defn test-extract-image-tag []
+  (if-let [html (image-page-html)]
+    (do)
+    (is false
+        (str "There must be a sample image html page at "
+             "`resources/test/" site-name "/image.html'"))))
+
 (defn testdef-form [site-name]
   `(deftest ~(symbol (str site-name "-test"))
-     (expect-opts-are-map ~site-name)
-     (if (has-test-folder? ~site-name)
-       (do
-         )
-       (error-must-have-test-data ~site-name))))
+     (binding [~'site-name ~site-name]
+       (expect-opts-are-map ~site-name)
+       (if (has-test-folder?)
+         (do
+           (test-extract-image-tag)
+           )
+         (error-must-have-test-data)))))

 (defmacro defsite-tests []
   (try


Fix default parent style id of table style

--- src/bakyeono/litedocx/wpml.clj
+++ src/bakyeono/litedocx/wpml.clj
@@ -431,7 +431,7 @@
                      :w:styleId name ; Style ID
                      :w:customStyle "true"} ; User-Defined Style
            (node :w:name {:w:val name}) ; Primary Style Name
-           (node :w:basedOn {:w:val "a"}) ; Parent Style ID
+           (node :w:basedOn {:w:val "a1"}) ; Parent Style ID
            (when font
              (node :w:link {:w:val font-style-name})) ; Linked Style Reference
            (node :w:qFormat) ; Primary Style


fix typo, makes threads get styled when dragging over

--- src/braid/ui/views/thread.cljs
+++ src/braid/ui/views/thread.cljs
@@ -93,7 +93,7 @@
                        :focused? false})
         set-uploading! (fn [bool] (swap! state assoc :uploading? bool))
         set-focused! (fn [bool] (swap! state assoc :focused? bool))
-        set-dragging! (fn [bool] (swap! state assoc :dragging bool))
+        set-dragging! (fn [bool] (swap! state assoc :dragging? bool))

         ; TODO: this won't work if the component gets re-rendenered, 'cause thread-id changes
         open? (subscribe [:thread-open? (thread :id)])


Correct the manga-pattern for manga-reader

--- src/clj/comic_reader/sites.clj
+++ src/clj/comic_reader/sites.clj
@@ -51,7 +51,8 @@
                      :selector [:div#viewer :img#image]})})

    (let [canonical-url "http://www.mangareader.net"
-         manga-pattern (re-pattern (str canonical-url "/(.*)$"))
+         manga-pattern (re-pattern (str canonical-url
+                                        "/(.*)(\\.html)?$"))
          link->map (gen-link->map s/trim
                                   (partial str canonical-url))]
      {:id :manga-reader


using (if (.exists (clojure.java.io/as-file f)) for testing existence of ~/.clojuredocs-snapshot.txt instead of shell command - should be more portable - may even work on windoze...

--- src/clj_ns_browser/browser.clj
+++ src/clj_ns_browser/browser.clj
@@ -12,6 +12,7 @@
             [seesaw.bind :as b]
             [clojure.java.browse]
             [clojure.java.shell]
+            [clojure.java.io]
             [clojure.string :as str]
             [clj-info.doc2map :as d2m]
             [clj-ns-browser.inspector]
@@ -824,7 +825,7 @@
       (b/transform (fn [& o]
         (if (config (id :clojuredocs-offline-rb) :selected?)
           (let [f (str (System/getProperty "user.home") "/.clojuredocs-snapshot.txt")]
-            (if (= 0 (:exit (clojure.java.shell/sh "bash" "-c" (str "[ -f " f " ];" ))))
+            (if (.exists (clojure.java.io/as-file f))
               (let [s (with-out-str (cd-client.core/set-local-mode! f))]
                 (alert (str "Note: Locally cached ClojureDocs copy will be used" \newline s)))
               (do (alert "No locally cached ClojureDocs repo found - update first")


Slightly simpler board generation

Slightly simpler board generation

--- src/cljs/minesweeper/core.cljc
+++ src/cljs/minesweeper/core.cljc
@@ -9,18 +9,6 @@

 (declare propogated-coordinates)

-(def ^:private bomb? (partial = :bomb))
-
-(defn random-tuples [x y]
-  (repeatedly #(vector (rand-int x) (rand-int y))))
-
-(defn add-bombs [board c]
-  (let [w (count board)
-        h (count (first board))
-        coords (take c (distinct (random-tuples w h)))]
-    (reduce (fn [b coord]
-              (assoc-in b coord :bomb)) board coords)))
-
 (defn neighbors [board i j]
   (remove nil?
           (for [x [-1 0 1]
@@ -31,18 +19,35 @@

 (defn neighbor-bombs [board i j]
   (->> (neighbors board i j)
-       (filter bomb?)
+       (filter :bomb?)
        count))

+;; Board generation
+
+(defn random-tuples [x y]
+  (repeatedly #(vector (rand-int x) (rand-int y))))
+
+(defn add-bombs [board c]
+  (let [w (count board)
+        h (count (first board))
+        coords (take c (distinct (random-tuples w h)))]
+    (reduce (fn [b coord]
+              (assoc-in b (conj coord :bomb?) true)) board coords)))
+
 (defn annotate [board]
-  (mapv (fn [row r]
-          (mapv (fn [space c]
-                  (let [b? (bomb? space)]
-                    {:bomb? b?
-                     :revealed? false
-                     :count (when-not b? (neighbor-bombs board r c))
-                     :path [r c]}))
-                row (range))) board (range)))
+  (mapv (fn [row]
+          (mapv (fn [{:keys [bomb? path] :as space}]
+                  (assoc space
+                         :revealed? false
+                         :count (when-not bomb?
+                                  (apply neighbor-bombs board path))))
+                row))
+        board))
+
+(defn generate-base [w h]
+  (mapv (fn [x]
+          (mapv (fn [y] {:path [x y]}) (range w)))
+        (range h)))

 (defn generate-board
   ([]
@@ -51,15 +56,12 @@
    (let [settings (levels level)]
      (apply generate-board settings)))
   ([w h bombs]
-   (let [base (mapv (fn [x]
-                      (mapv (fn [y] nil) (range w)))
-                    (range h))]
-     (-> (add-bombs base bombs)
-         annotate))))
-
+   (-> (generate-base w h)
+       (add-bombs bombs)
+       annotate)))

 (defn spaces [board]
-  (apply concat board))
+  (into [] cat board))

 (defn won? [board]
   (let [s (spaces board)]
@@ -103,7 +105,7 @@
                             s)) row)) board))

 (defn print-board [board]
-  (str/join "\n" (map #(apply str (map space->str %)) board)))
+  (str/join "\n" (map #(str/join " " (map space->str %)) board)))

 (defn reveal-coords [board coords]
   (let [propogated (propogated-coordinates board coords)]
@@ -130,6 +132,6 @@

 (comment

-(println (print-board (generate-board 5 7 10)))
+(println (print-board (generate-board 7 7 10)))

 )


Add util/pp-str

Add util/pp-str

--- src/cljx/clojuredocs/util.cljx
+++ src/cljx/clojuredocs/util.cljx
@@ -2,6 +2,7 @@
   (:require [clojure.string :as str]
             [clojuredocs.md5 :as md5]
             #+clj  [cheshire.core :as json]
+            #+clj  [clojure.pprint :refer [pprint]]
             #+cljs [goog.string :as gstring])
   #+clj
   (:import [org.pegdown PegDownProcessor]
@@ -138,3 +139,9 @@
   (-> (java.util.UUID/randomUUID)
       str
       (str/replace #"-" "")))
+
+#+clj
+(defn pp-str [o]
+  (let [w (java.io.StringWriter.)]
+    (pprint o w)
+    (str/trim (.toString w))))


Put container keyword on options map instead of container type

--- src/clojure/neko/ui/traits.clj
+++ src/clojure/neko/ui/traits.clj
@@ -221,7 +221,7 @@
   Values could be either numbers of `:fill` or `:wrap`."
   {:attributes (concat margin-attributes [:layout-width :layout-height
                                           :layout-weight :layout-gravity])
-   :applies? (= (kw/keyword-by-classname container-type) :linear-layout)}
+   :applies? (= container-type :linear-layout)}
   [^View wdg, {:keys [layout-width layout-height layout-weight layout-gravity]
                :as attributes}
    {:keys [container-type]}]
@@ -271,7 +271,7 @@

 (deftrait :relative-layout-params
   {:attributes (concat all-relative-attributes margin-attributes)
-   :applies? (= (kw/keyword-by-classname container-type) :relative-layout)}
+   :applies? (= container-type :relative-layout)}
   [^View wdg, {:keys [layout-width layout-height
                       layout-align-with-parent-if-missing] :as attributes}
    {:keys [container-type]}]
@@ -310,7 +310,7 @@
   use the container type to choose the correct LayoutParams instance."
   {:applies? (constantly true)}
   [wdg _ __]
-  {:options-fn #(assoc % :container-type (type wdg))})
+  {:options-fn #(assoc % :container-type (kw/keyword-by-classname (type wdg)))})

 ;; ### Listener traits


more cleaning in signal

more cleaning in signal

--- src/clojure2d/extra/signal.clj
+++ src/clojure2d/extra/signal.clj
@@ -1,13 +1,3 @@
-;; # Namespace scope
-;;
-;; Signal processing. You can find here 3 elements
-;;
-;; * Image pixels to/from raw (signal) converter
-;; * Signal processing + effects
-;; * Signal generators
-;;
-;; See examples 16 and 18
-
 (ns clojure2d.extra.signal
   "Signal processing and generation.

@@ -125,12 +115,12 @@
 (deftype EffectsList [effect-name ^double sample effect state next]
   Object
   (toString [_] (if next
-                  (str next " -> " (name effect-name))
+                  (str next " -> " (name effect-name) ", result: " sample)
                   (name effect-name)))
   IFn
   (invoke [_] sample)
   (invoke [e n]
-    (.sample ^EffectsList (single-pass e n))))
+    (single-pass e n)))

 (defn- effect-node
   "Create `EffectsList` node from effect function and initial state"
@@ -140,20 +130,20 @@
 (defn compose-effects
   "Compose list of effects."
   [^EffectsList e & es]
-  (if (nil? es)
+  (if-not es
     e
     (EffectsList. (.effect-name e) (.sample e) (.effect e) (.state e) (apply compose-effects es))))

 (defn- reset-effects
   "Resets effects state to initial one."
   [^EffectsList e]
-  (EffectsList. (.effect-name e) 0.0 (.effect e) ((.effect e)) (when-not (nil? (.next e))
+  (EffectsList. (.effect-name e) 0.0 (.effect e) ((.effect e)) (when (.next e)
                                                                  (reset-effects (.next e)))))

 (defn- single-pass
   "Process on sample using effects, returns `EffectsList` with result and new effect states."
   [^EffectsList e ^double sample]
-  (if (nil? (.next e))
+  (if-not (.next e)
     (let [^SampleAndState r ((.effect e) sample (.state e))]
       (println (str "-> " (.effect-name e)))
       (EffectsList. (.effect-name e) (.sample r) (.effect e) (.state r) nil))


All annotation and assumptions tests are green again. Still missing functionality and tests for control flow assumptions.

--- damp.ekeko.aspectj.plugin.test/src/test/damp/ekeko/aspectj.clj
+++ damp.ekeko.aspectj.plugin.test/src/test/damp/ekeko/aspectj.clj
@@ -149,13 +149,14 @@
     (ekeko [?aspect ?advice|entry ?advice|exit ?field] (assumptions/wormhole|naive-entry-exit-field ?aspect ?advice|entry ?advice|exit ?field))
     "#{(\"cl.pleiad.ajlmp.testWormhole.WrongOrderWormholeAspect\" \"(before: (execution(* cl.pleiad.ajlmp.testWormhole.BaseClass.*2()) && persingleton(cl.pleiad.ajlmp.testWormhole.WrongOrderWormholeAspect))->void cl.pleiad.ajlmp.testWormhole.WrongOrderWormholeAspect.ajc$before$cl_pleiad_ajlmp_testWormhole_WrongOrderWormholeAspect$1$b325ee9f())\" \"(before: ((execution(* cl.pleiad.ajlmp.testWormhole.BaseClass.*1(int)) && args(BindingTypePattern(int, 0))) && persingleton(cl.pleiad.ajlmp.testWormhole.WrongOrderWormholeAspect))->void cl.pleiad.ajlmp.testWormhole.WrongOrderWormholeAspect.ajc$before$cl_pleiad_ajlmp_testWormhole_WrongOrderWormholeAspect$2$72a7b216(int))\" \"int cl.pleiad.ajlmp.testWormhole.WrongOrderWormholeAspect.store\") (\"cl.pleiad.ajlmp.testWormhole.WormholeAspect\" \"(before: ((execution(* cl.pleiad.ajlmp.testWormhole.BaseClass.*1(int)) && args(BindingTypePattern(int, 0))) && persingleton(cl.pleiad.ajlmp.testWormhole.WormholeAspect))->void cl.pleiad.ajlmp.testWormhole.WormholeAspect.ajc$before$cl_pleiad_ajlmp_testWormhole_WormholeAspect$1$9821f264(int))\" \"(before: (execution(* cl.pleiad.ajlmp.testWormhole.BaseClass.*2()) && persingleton(cl.pleiad.ajlmp.testWormhole.WormholeAspect))->void cl.pleiad.ajlmp.testWormhole.WormholeAspect.ajc$before$cl_pleiad_ajlmp_testWormhole_WormholeAspect$2$b325ee9f())\" \"int cl.pleiad.ajlmp.testWormhole.WormholeAspect.store\") (\"cl.pleiad.ajlmp.testWormhole.TSWormholeAspect\" \"(before: ((execution(* cl.pleiad.ajlmp.testWormhole.BaseClass.*1(int)) && args(BindingTypePattern(int, 0))) && percflow(cl.pleiad.ajlmp.testWormhole.TSWormholeAspect on execution(* cl.pleiad.ajlmp.testWormhole.BaseClass.run())))->void cl.pleiad.ajlmp.testWormhole.TSWormholeAspect.ajc$before$cl_pleiad_ajlmp_testWormhole_TSWormholeAspect$1$9821f264(int))\" \"(before: (execution(* cl.pleiad.ajlmp.testWormhole.BaseClass.*2()) && percflow(cl.pleiad.ajlmp.testWormhole.TSWormholeAspect on execution(* cl.pleiad.ajlmp.testWormhole.BaseClass.run())))->void cl.pleiad.ajlmp.testWormhole.TSWormholeAspect.ajc$before$cl_pleiad_ajlmp_testWormhole_TSWormholeAspect$2$b325ee9f())\" \"int cl.pleiad.ajlmp.testWormhole.TSWormholeAspect.store\")}"))

+;HERE
 (deftest test-annotation-label-types
   (test/tuples-correspond
     (damp.ekeko/ekeko [?type ?val]
       (l/all
         (world/type-packageName ?type "damp.ekeko.aspectj.annotationtests")
         (annotations/labeled|type-label|val ?type ?val)))
-    "#{(\"damp.ekeko.aspectj.annotationtests.LaFix1\" \"[Label1]\") (\"damp.ekeko.aspectj.annotationtests.LaFix2\" \"[Label2a Label2b]\")}"))
+"#{(\"damp.ekeko.aspectj.annotationtests.LaFix2\" \"[\\\"Label2a\\\" \\\"Label2b\\\"]\") (\"damp.ekeko.aspectj.annotationtests.LaFix1\" \"[\\\"Label1\\\"]\")}"))

 (deftest test-annotation-label-behavior
   (test/tuples-correspond
@@ -163,7 +164,7 @@
       (l/all
         (world/type-packageName ?type "damp.ekeko.aspectj.annotationtests")
         (annotations/labeled|behavior-label|val ?type ?val)))
-   "#{(\"void damp.ekeko.aspectj.annotationtests.LaFix2.labeledMethod()\" \"[MethLabel2]\") (\"void damp.ekeko.aspectj.annotationtests.LaFix2.ajc$before$damp_ekeko_aspectj_annotationtests_LaFix2$1$8598ac45()\" \"[AdvLabel2]\") (\"void damp.ekeko.aspectj.annotationtests.LaFix2.<init>()\" \"[ConsLabel2]\") (\"void damp.ekeko.aspectj.annotationtests.LaFix1.<init>()\" \"[ConsLabel]\") (\"void damp.ekeko.aspectj.annotationtests.LaFix2.multiLabeledMethod()\" \"[MethLabel2a MethLabel2b]\") (\"void damp.ekeko.aspectj.annotationtests.LaFix1.<init>(java.lang.String)\" \"[ConsLabel1a ConsLabel1b]\") (\"void damp.ekeko.aspectj.annotationtests.LaFix1.labeledMethod()\" \"[MethLabel]\") (\"void damp.ekeko.aspectj.annotationtests.LaFix2.ajc$before$damp_ekeko_aspectj_annotationtests_LaFix2$3$716cfb74()\" \"[AdvLabel2a AdvLabel2b]\")}"))
+   "#{(\"void damp.ekeko.aspectj.annotationtests.LaFix2.labeledMethod()\" \"[\\\"MethLabel2\\\"]\") (\"void damp.ekeko.aspectj.annotationtests.LaFix2.ajc$before$damp_ekeko_aspectj_annotationtests_LaFix2$1$8598ac45()\" \"[\\\"AdvLabel2\\\"]\") (\"void damp.ekeko.aspectj.annotationtests.LaFix2.<init>()\" \"[\\\"ConsLabel2\\\"]\") (\"void damp.ekeko.aspectj.annotationtests.LaFix1.<init>()\" \"[\\\"ConsLabel\\\"]\") (\"void damp.ekeko.aspectj.annotationtests.LaFix2.multiLabeledMethod()\" \"[\\\"MethLabel2a\\\" \\\"MethLabel2b\\\"]\") (\"void damp.ekeko.aspectj.annotationtests.LaFix1.<init>(java.lang.String)\" \"[\\\"ConsLabel1a\\\" \\\"ConsLabel1b\\\"]\") (\"void damp.ekeko.aspectj.annotationtests.LaFix1.labeledMethod()\" \"[\\\"MethLabel\\\"]\") (\"void damp.ekeko.aspectj.annotationtests.LaFix2.ajc$before$damp_ekeko_aspectj_annotationtests_LaFix2$3$716cfb74()\" \"[\\\"AdvLabel2a\\\" \\\"AdvLabel2b\\\"]\")}"))

 (deftest test-annotation-label-pointcut
   (test/tuples-correspond
@@ -171,7 +172,7 @@
       (l/all
         (world/type-packageName ?type "damp.ekeko.aspectj.annotationtests")
         (annotations/labeled|pointcut-label|val ?type ?ann)))
-    "#{(\"pointcut damp.ekeko.aspectj.annotationtests.LaFix2.barCall()\" \"[PCLabel2]\")}"))
+    "#{(\"pointcut damp.ekeko.aspectj.annotationtests.LaFix2.barCall()\" \"[\\\"PCLabel2\\\"]\")}"))

 (deftest test-annotation-requires
   (test/tuples-correspond
@@ -179,7 +180,7 @@
       (l/all
         (world/type-packageName ?type "damp.ekeko.aspectj.annotationtests")
         (annotations/requiring|type-key-val ?type ?key ?val)))
-    "#{(\"damp.ekeko.aspectj.annotationtests.REFix3\" \"type\" \"[Aspect3a Aspect3b]\") (\"damp.ekeko.aspectj.annotationtests.REFix3\" \"label\" \"[Label3a]\") (\"damp.ekeko.aspectj.annotationtests.REFix1\" \"type\" \"[Aspect1]\") (\"damp.ekeko.aspectj.annotationtests.REFix4\" \"label\" \"[Label4a]\") (\"damp.ekeko.aspectj.annotationtests.REFix4\" \"type\" \"[Aspect4a Aspect4b]\") (\"damp.ekeko.aspectj.annotationtests.REFix2\" \"label\" \"[Label2]\")}"))
+    "#{(\"damp.ekeko.aspectj.annotationtests.REFix3\" \"label\" \"[\\\"Label3a\\\"]\") (\"damp.ekeko.aspectj.annotationtests.REFix1\" \"type\" \"[\\\"Aspect1\\\"]\") (\"damp.ekeko.aspectj.annotationtests.REFix3\" \"type\" \"[\\\"Aspect3a\\\" \\\"Aspect3b\\\"]\") (\"damp.ekeko.aspectj.annotationtests.REFix2\" \"label\" \"[\\\"Label2\\\"]\") (\"damp.ekeko.aspectj.annotationtests.REFix4\" \"label\" \"[\\\"Label4a\\\"]\") (\"damp.ekeko.aspectj.annotationtests.REFix4\" \"type\" \"[\\\"Aspect4a\\\" \\\"Aspect4b\\\"]\")}"))

 (deftest test-annotation-excludes
   (test/tuples-correspond
@@ -187,7 +188,7 @@
       (l/all
         (world/type-packageName ?type "damp.ekeko.aspectj.annotationtests")
         (annotations/excluding|type-key-val ?type ?key ?val)))
-    "#{(\"damp.ekeko.aspectj.annotationtests.REFix3\" \"type\" \"[Aspect3c]\") (\"damp.ekeko.aspectj.annotationtests.REFix4\" \"label\" \"[Label4b]\") (\"damp.ekeko.aspectj.annotationtests.REFix1\" \"label\" \"[Label1]\") (\"damp.ekeko.aspectj.annotationtests.REFix4\" \"type\" \"[Aspect4c]\") (\"damp.ekeko.aspectj.annotationtests.REFix2\" \"type\" \"[Aspect2]\") (\"damp.ekeko.aspectj.annotationtests.REFix3\" \"label\" \"[Label3b Label3c]\")}"))
+    "#{(\"damp.ekeko.aspectj.annotationtests.REFix2\" \"type\" \"[\\\"Aspect2\\\"]\") (\"damp.ekeko.aspectj.annotationtests.REFix3\" \"type\" \"[\\\"Aspect3c\\\"]\") (\"damp.ekeko.aspectj.annotationtests.REFix1\" \"label\" \"[\\\"Label1\\\"]\") (\"damp.ekeko.aspectj.annotationtests.REFix3\" \"label\" \"[\\\"Label3b\\\" \\\"Label3c\\\"]\") (\"damp.ekeko.aspectj.annotationtests.REFix4\" \"label\" \"[\\\"Label4b\\\"]\") (\"damp.ekeko.aspectj.annotationtests.REFix4\" \"type\" \"[\\\"Aspect4c\\\"]\")}"))

 (deftest test-annotation-oneOf
   (test/tuples-correspond
@@ -195,18 +196,18 @@
       (l/all
         (world/type-packageName ?type "damp.ekeko.aspectj.annotationtests")
         (annotations/oneOfing|type-key-val ?type ?key ?val)))
-    "#{(\"damp.ekeko.aspectj.annotationtests.OOFix3\" \"label\" \"[Label3a Label3b]\") (\"damp.ekeko.aspectj.annotationtests.OOFix1\" \"type\" \"[Aspect1a Aspect1b]\") (\"damp.ekeko.aspectj.annotationtests.OOFix2\" \"label\" \"[Label2a Label2b]\") (\"damp.ekeko.aspectj.annotationtests.OOFix3\" \"type\" \"[Aspect3a Aspect3b]\")}"))
+    "#{(\"damp.ekeko.aspectj.annotationtests.OOFix1\" \"type\" \"[\\\"Aspect1a\\\" \\\"Aspect1b\\\"]\") (\"damp.ekeko.aspectj.annotationtests.OOFix2\" \"label\" \"[\\\"Label2a\\\" \\\"Label2b\\\"]\") (\"damp.ekeko.aspectj.annotationtests.OOFix3\" \"type\" \"[\\\"Aspect3a\\\" \\\"Aspect3b\\\"]\") (\"damp.ekeko.aspectj.annotationtests.OOFix3\" \"label\" \"[\\\"Label3a\\\" \\\"Label3b\\\"]\")}"))

 (deftest test-annotation-requiresPrevious
   (test/tuples-correspond
     (damp.ekeko/ekeko [?beh ?val] (annotations/reqPrev|behavior-val ?beh ?val))
-    "#{(\"void damp.ekeko.aspectj.annotationtests.REPFix2.methoda()\" \"[Label2Rc Label2Rd]\") (\"void damp.ekeko.aspectj.annotationtests.REPFix1.<init>()\" \"[Label1Ra]\") (\"void damp.ekeko.aspectj.annotationtests.REPFix2.ajc$before$damp_ekeko_aspectj_annotationtests_REPFix2$1$8598ac45()\" \"[Label2Re]\") (\"void damp.ekeko.aspectj.annotationtests.REPFix2.<init>()\" \"[Label2Ra Label2Rb]\") (\"void damp.ekeko.aspectj.annotationtests.REPFix1.methoda()\" \"[Label1Rb]\") (\"void damp.ekeko.aspectj.annotationtests.REPFix2.ajc$around$damp_ekeko_aspectj_annotationtests_REPFix2$3$8598ac45(org.aspectj.runtime.internal.AroundClosure)\" \"[Label2Rf Label2Rg]\")}"))
+"#{(\"void damp.ekeko.aspectj.annotationtests.REPFix2.ajc$around$damp_ekeko_aspectj_annotationtests_REPFix2$3$8598ac45(org.aspectj.runtime.internal.AroundClosure)\" \"[\\\"Label2Rf\\\" \\\"Label2Rg\\\"]\") (\"void damp.ekeko.aspectj.annasstests.PrevFix2.ajc$before$damp_ekeko_aspectj_annasstests_PrevFix2$1$36c63601()\" \"[\\\"beforecompute\\\"]\") (\"void damp.ekeko.aspectj.annasstests.PrevFix2.ajc$after$damp_ekeko_aspectj_annasstests_PrevFix2$3$36c63601()\" \"[\\\"preparing\\\"]\") (\"void damp.ekeko.aspectj.annasstests.PrevFix.ajc$before$damp_ekeko_aspectj_annasstests_PrevFix$1$36c63601()\" \"[\\\"thinking\\\"]\") (\"void damp.ekeko.aspectj.annasstests.PrevFix2.ajc$after$damp_ekeko_aspectj_annasstests_PrevFix2$2$36c63601()\" \"[\\\"beforecompute\\\"]\") (\"void damp.ekeko.aspectj.annasstests.PrevFix.ajc$around$damp_ekeko_aspectj_annasstests_PrevFix$3$592dcb64(org.aspectj.runtime.internal.AroundClosure)\" \"[\\\"executing\\\"]\") (\"void damp.ekeko.aspectj.annasstests.PrevFix2.ajc$after$damp_ekeko_aspectj_annasstests_PrevFix2$4$74faf45e()\" \"[\\\"beforecompute\\\"]\") (\"void damp.ekeko.aspectj.annotationtests.REPFix2.methoda()\" \"[\\\"Label2Rc\\\" \\\"Label2Rd\\\"]\") (\"void damp.ekeko.aspectj.annotationtests.REPFix2.ajc$before$damp_ekeko_aspectj_annotationtests_REPFix2$1$8598ac45()\" \"[\\\"Label2Re\\\"]\") (\"void damp.ekeko.aspectj.annotationtests.REPFix1.methoda()\" \"[\\\"Label1Rb\\\"]\") (\"void damp.ekeko.aspectj.annasstests.PrevFix.ajc$after$damp_ekeko_aspectj_annasstests_PrevFix$2$74faf45e()\" \"[\\\"executing\\\"]\") (\"void damp.ekeko.aspectj.annotationtests.REPFix1.<init>()\" \"[\\\"Label1Ra\\\"]\") (\"void damp.ekeko.aspectj.annotationtests.REPFix2.<init>()\" \"[\\\"Label2Ra\\\" \\\"Label2Rb\\\"]\") (\"void damp.ekeko.aspectj.annasstests.PrevFix2.unthink()\" \"[\\\"thinking\\\"]\") (\"void damp.ekeko.aspectj.annasstests.EntryPoint.execute()\" \"[\\\"computing\\\"]\")}"))
+

 (deftest test-annotation-excludesPrevious
   (test/tuples-correspond
     (damp.ekeko/ekeko [?beh ?val] (annotations/exclPrev|behavior-val ?beh ?val))
-    "#{(\"void damp.ekeko.aspectj.annotationtests.REPFix2.ajc$after$damp_ekeko_aspectj_annotationtests_REPFix2$2$8598ac45()\" \"[Label2Ee]\") (\"void damp.ekeko.aspectj.annotationtests.REPFix2.ajc$around$damp_ekeko_aspectj_annotationtests_REPFix2$3$8598ac45(org.aspectj.runtime.internal.AroundClosure)\" \"[Label2Ef Label2Eg]\") (\"void damp.ekeko.aspectj.annotationtests.REPFix2.<init>()\" \"[Label2Ea Label2Eb]\") (\"void damp.ekeko.aspectj.annotationtests.REPFix2.methodb()\" \"[Label2Ec Label2Ed]\") (\"void damp.ekeko.aspectj.annotationtests.REPFix1.methodb()\" \"[Label1Eb]\") (\"void damp.ekeko.aspectj.annotationtests.REPFix1.<init>(int)\" \"[Label1Ea]\")}"))
-
+"#{(\"void damp.ekeko.aspectj.annasstests.PrevFix.ajc$before$damp_ekeko_aspectj_annasstests_PrevFix$1$36c63601()\" \"[\\\"cleaning\\\"]\") (\"void damp.ekeko.aspectj.annotationtests.REPFix2.ajc$around$damp_ekeko_aspectj_annotationtests_REPFix2$3$8598ac45(org.aspectj.runtime.internal.AroundClosure)\" \"[\\\"Label2Ef\\\" \\\"Label2Eg\\\"]\") (\"void damp.ekeko.aspectj.annasstests.PrevFix.ajc$after$damp_ekeko_aspectj_annasstests_PrevFix$2$74faf45e()\" \"[\\\"thinking\\\"]\") (\"void damp.ekeko.aspectj.annotationtests.REPFix2.methodb()\" \"[\\\"Label2Ec\\\" \\\"Label2Ed\\\"]\") (\"void damp.ekeko.aspectj.annotationtests.REPFix2.ajc$after$damp_ekeko_aspectj_annotationtests_REPFix2$2$8598ac45()\" \"[\\\"Label2Ee\\\"]\") (\"void damp.ekeko.aspectj.annotationtests.REPFix1.methodb()\" \"[\\\"Label1Eb\\\"]\") (\"void damp.ekeko.aspectj.annotationtests.REPFix2.<init>()\" \"[\\\"Label2Ea\\\" \\\"Label2Eb\\\"]\") (\"void damp.ekeko.aspectj.annotationtests.REPFix1.<init>(int)\" \"[\\\"Label1Ea\\\"]\") (\"void damp.ekeko.aspectj.annasstests.PrevFix.ajc$around$damp_ekeko_aspectj_annasstests_PrevFix$3$592dcb64(org.aspectj.runtime.internal.AroundClosure)\" \"[\\\"simulating\\\"]\")}"))
 (deftest test-logic-requires
   (test/tuples-correspond
     (damp.ekeko/ekeko [?rqd ?rqs]
@@ -242,11 +243,14 @@

 (deftest
   test-suite
+
+
+  (comment

   ;sanity check
   (test/against-project-named "AJ-LMP-Precedence" false test-aspect)

-(comment
+

   ;precedence logic
   (test/against-project-named "AJ-LMP-Precedence" false test-explicit-decprec+)
@@ -302,8 +306,8 @@
   (test/against-project-named "AJ-LMP-Annotations" false test-logic-requires)
   (test/against-project-named "AJ-LMP-Annotations" false test-logic-excludes)
   (test/against-project-named "AJ-LMP-Annotations" false test-logic-oneOf)
-
-    )
+
+)

 (defn
   test-ns-hook