fix unique-key mgmt

fix unique-key mgmt

--- src/er_cassandra/model/unique_key.clj
+++ src/er_cassandra/model/unique_key.clj
@@ -128,7 +128,7 @@
         (if coll
           (let [old-kvs (set (k/extract-key-value-collection key old-record))
                 new-kvs (set (k/extract-key-value-collection key new-record))
-                stale-kvs (filter identity (set/difference new-kvs old-kvs))]
+                stale-kvs (filter identity (set/difference old-kvs new-kvs))]
             (for [kv stale-kvs]
               (release-unique-key session model t uber-key-value kv)))

@@ -143,7 +143,7 @@
   (combine-responses
    (mapcat
     identity
-    (for [t (:lookup-tables model)]
+    (for [t (:unique-key-tables model)]
       (let [uber-key (t/uber-key model)
             uber-key-value (t/extract-uber-key-value model record)
             key (:key t)
@@ -170,30 +170,29 @@

 (defn update-with-acquire-responses
   [table acquire-key-responses record]
-  (reduce (fn [[status key-desc _]]
+  (reduce (fn [r [status key-desc _]]
             (let [coll (:collection table)
                   key-col (last (:key key-desc))
                   key-val (last (:key-value key-desc))]
-              (condp = coll
-                :set (when-not (= :ok status)
-                       (assoc record
+              (if (= :ok status)
+                r
+                (condp = coll
+
+                  :set (assoc r
                               key-col
                               (disj (get record key-col)
-                                    key-val)))
-                :list (when-not (= :ok status)
-                        (assoc record
+                                    key-val))
+                  :list (assoc r
                                key-col
                                (filterv #(not= key-val %)
-                                        (get record key-col))))
-
-                :map (when-not (= :ok status)
-                       (assoc record
+                                        (get record key-col)))
+
+                  :map (assoc r
                               key-col
                               (dissoc (get record key-col)
-                                      key-val)))
-
-                :else (when-not (= :ok status)
-                        (assoc record key-col nil)))))
+                                      key-val))
+
+                  (assoc r key-col nil)))))
           record
           acquire-key-responses))

@@ -212,7 +211,7 @@
           new-record
           (:unique-key-tables model)))

-(defn acquire-unique-keys
+(defn update-unique-keys
   "attempts to acquire unique keys for an owner... returns
    a Deferred[Right[[:ok updated-owner-record :failed-keys]]] with an updated
    owner record containing only the keys that could be acquired"
@@ -234,6 +233,7 @@
                                     new-record)]
             (m/return
              (update-record-by-key-responses
+              model
               old-record
               new-record
               acquire-key-responses)))))


Fix url

Fix url

--- src/export_server/sharing/twitter.clj
+++ src/export_server/sharing/twitter.clj
@@ -15,7 +15,7 @@
   (one/make-consumer
     {:access-uri     "https://api.twitter.com/oauth/access_token"
      :authorize-uri  "https://api.twitter.com/oauth/authorize"
-     :callback-uri   "http://localhost:2000/sharing/twitter_oauth1"
+     :callback-uri   "http://localhost:2000/sharing/twitter_oauth"
      ;:callback-uri   "http://export.anychart.stg/sharing/twitter_oauth"
      :key            "ffhhDbj6TYVWKtcBh6QyzUTmz"
      :request-uri    "https://api.twitter.com/oauth/request_token"


Fix dangling paren.

Fix dangling paren.

--- src/ahnentafel/server/pages/record.clj
+++ src/ahnentafel/server/pages/record.clj
@@ -74,8 +74,7 @@
   [:#child]
   (html/clone-for [child (:children record)]
                   [:#person-info] (html/set-attr :href (xref-link child))
-                  [:#person-info] (html/content (:name child)))
-  )
+                  [:#person-info] (html/content (:name child))))

 (def-layout-template record
   [:#content]


Fix user registration error

Fix user registration error

--- src/braid/server/routes/api/public.clj
+++ src/braid/server/routes/api/public.clj
@@ -64,8 +64,8 @@
       (error-response 400 "The password is too short.")

       :else
-      (let [user (db/run-txns! (user/create-user-txn {:id (db/uuid)
-                                                      :email email}))
+      (let [[user] (db/run-txns! (user/create-user-txn {:id (db/uuid)
+                                                        :email email}))
             _ (db/run-txns! (user/set-user-password-txn (user :id)
                                                         password))]
         {:status 200


Fix hard reload after badge settings save

--- src/cljs/salava/badge/ui/settings.cljs
+++ src/cljs/salava/badge/ui/settings.cljs
@@ -8,14 +8,22 @@
             [salava.core.ui.helper :refer [path-for]]
             [salava.badge.ui.helper :as bh]))

+(defn update-state [state]
+  (ajax/GET
+    (path-for "/obpv1/badge" true)
+    {:handler (fn [data]
+                (swap! state assoc :badges (filter #(= "accepted" (:status %)) data)
+                                   :pending (filter #(= "pending" (:status %)) data)
+                                   :initializing false))}))
+
 (defn set-visibility [visibility state]
   (swap! state assoc-in [:badge-settings :visibility] visibility))

-(defn delete-badge [id]
+(defn delete-badge [id state]
   (ajax/DELETE
     (path-for (str "/obpv1/badge/" id))
     {:handler (fn []
-                (.reload js/window.location))}))
+                (update-state state))}))

 (defn save-settings [state]
   (let [{:keys [id visibility tags rating evidence-url]} (:badge-settings @state)]
@@ -26,7 +34,7 @@
                  :rating       (if (pos? rating) rating nil)
                  :evidence-url evidence-url}
        :handler (fn []
-                  (.reload js/window.location))})))
+                  (update-state state))})))

 (defn settings-modal [{:keys [id name description image_file issued_on expires_on revoked issuer_content_url issuer_content_name issuer_contact issuer_image]} state]
   [:div {:id "badge-settings"}
@@ -68,7 +76,8 @@
            (t :badge/Cancel)]
           [:button {:type "button"
                     :class "btn btn-warning"
-                    :on-click #(delete-badge id)}
+                    :data-dismiss "modal"
+                    :on-click #(delete-badge id state)}
            (t :badge/Delete)]]
          [:button {:type "button"
                    :class "btn btn-warning delete-button"


Show icon for cljc files

Show icon for cljc files

--- src/clojure/nightcode/file_browser.clj
+++ src/clojure/nightcode/file_browser.clj
@@ -130,6 +130,7 @@
   (when-not (.isDirectory f)
     (case (utils/get-extension (.getName f))
       "clj" "file-clojure.png"
+      "cljc" "file-clojure.png"
       "cljs" "file-clojure.png"
       "java" "file-java.png"
       "git" "git.png"


added to utilities.cljs

added to utilities.cljs

--- resources/leiningen/new/threejs_game/src/cljs/utilities.cljs
+++ resources/leiningen/new/threejs_game/src/cljs/utilities.cljs
@@ -34,3 +34,24 @@
         (find-nearest-object target (rest object-pool) nearest-object) ;; nearest object still closer
         (find-nearest-object target (rest object-pool) next-object) ;; the next object was closer
         ))))
+
+(defn url->filename
+  "Given a url return the filename"
+  [url]
+  (let [path js/goog.string.path]
+    ($ path baseName url)))
+
+(defn clj->json
+  [clj]
+  (js/JSON.stringify (clj->js clj)))
+
+(defn json->clj
+  [json]
+  (js->clj (js/JSON.parse json) :keywordize-keys true))
+
+(defn get-input-value
+  "Get the field value of a form"
+  [field]
+  (-> field
+      ($ :target)
+      ($ :value)))


Fixing the way the printer function is called for test check failures so that it will handle multiple generated values.

--- src/cmr/common/test/test_check_ext.clj
+++ src/cmr/common/test/test_check_ext.clj
@@ -23,10 +23,10 @@
   (when printer-fn
     (when fail
       (println "-----------------------------------------------------------------------")
-      (printer-fn :first-fail (first fail)))
+      (apply printer-fn :first-fail fail))
     (when (:smallest shrunk)
       (println "-----------------------------------------------------------------------")
-      (printer-fn :shrunken (first (:smallest shrunk)))))
+      (apply printer-fn :shrunken (:smallest shrunk))))

   (if (instance? Throwable result)
     (throw result)


fix let bindings inner trace

fix let bindings inner trace

--- src/com/billpiel/sayid/deep_trace2.clj
+++ src/com/billpiel/sayid/deep_trace2.clj
@@ -419,7 +419,7 @@
                (partition 2 binds))))

 (defn xpand-let-form
-  [[_ binds & frms] template]
+  [[_ binds] [_ _ & frms] template]
   `(tr-let-ret ~'$$
                '~template
                (let ~(xpand-let-binds template
@@ -496,7 +496,8 @@
 (defn xpand-let
   [form src-map fn-meta path path-chain]
   (let [path-chain' (conj path-chain path)]
-    (xpand-let-form (xpand-all form
+    (xpand-let-form form
+                    (xpand-all form
                                src-map
                                fn-meta
                                path


Fix error, again.

Fix error, again.

--- src/oc/storage/async/email.clj
+++ src/oc/storage/async/email.clj
@@ -24,8 +24,8 @@
    :headline schema/Str
    :body (schema/maybe schema/Str)
    :must-see (schema/maybe schema/Bool)
-   :video-id (schema/maybe Schema/Str)
-   :video-image (schema/maybe Schema/Str)
+   :video-id (schema/maybe schema/Str)
+   :video-image (schema/maybe schema/Str)
    :video-duration (schema/maybe schema/Str)
    :secure-uuid lib-schema/UniqueID
    :publisher lib-schema/Author


Remove debug code.

Remove debug code.

--- src/onyx/compression/nippy.clj
+++ src/onyx/compression/nippy.clj
@@ -25,9 +25,8 @@
   (nippy/thaw x messaging-decompress-opts))

 (def zookeeper-compress-opts {})
-(def aaa (atom []))
+
 (defn zookeeper-compress [x]
-  (swap! aaa conj x)
   (nippy/freeze x zookeeper-compress-opts))

 (def zookeeper-decompress-opts {:v1-compatibility? false})


try it on fast-car again

try it on fast-car again

--- ohack/src/ohack/core.clj
+++ ohack/src/ohack/core.clj
@@ -241,10 +241,7 @@
 ;; first, filter out all lines that don't look like guitar lines
 ;; use map-index because we need to keep ordering information
 (let [
-      ;; guitar-tab fast-car-tab
-
-      ;; something seems wrong. let's try everybody-hurts
-      guitar-tab everybody-hurts
+      guitar-tab fast-car-tab

       index-line-list (filter
                        ;; a tab line must contain "-"


more work on functions in depth chapter

more work on functions in depth chapter

--- brave-true/clojure-noob/src/clojure_noob/fun-in-depth.clj
+++ brave-true/clojure-noob/src/clojure_noob/fun-in-depth.clj
@@ -3,62 +3,84 @@

 ;; Programming to Abstractions

+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; one function on different data structures
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (defn titleize
   [topic]
   (str topic " for the Brave and True"))

-(fact "test titleize"
-  (map titleize ["Hamsters" "Ragnarok"])
-  => '("Hamsters for the Brave and True" "Ragnarok for the Brave and True"))
-
-;(defn label-key-value
-;  [[key val]]
-;  (str "key: " key ", val: " val))
-
-;(map label-key-value {:name "Edward" :occupation "perenial high-schooler"})
-; => '("key: :occupation, val: perenial high-schooler" "key: :name, val: Edward")
-
-;(fact
-;  (map (fn [[key val]] [key (inc val)])
-;       {:max 30 :min 10})
-;  => '([:min 11] [:max 31]))
-
-;(fact
-;  (into {}
-;        (map (fn [[key val]] [key (inc val)])
-;             {:max 30 :min 10}))
-;  => {:min 11, :max 31})
+(facts "test titleize"
+
+  (fact "titleize a vector"
+    (map titleize ["Hamsters" "Ragnarok"])
+    => '("Hamsters for the Brave and True" "Ragnarok for the Brave and True"))
+
+  (fact "titleize a list"
+    (map titleize '("Empathy" "Decorating"))
+    => '("Empathy for the Brave and True" "Decorating for the Brave and True"))
+
+  (fact
+    (map titleize #{"Elbows" "Soap Carving"})
+    => (contains '("Soap Carving for the Brave and True" "Elbows for the Brave and True")
+                 :in-any-order)))
+
+(defn label-key-val
+  [[key val]]
+  (str "key: " key ", val: " val))
+
+(fact
+  (map label-key-val {:name "Edward"
+                      :occupation "perennial high-schooler"})
+  => (contains '("key: :name, val: Edward"
+                 "key: :occupation, val: perennial high-schooler")
+               :in-any-order))
+
+(fact "transform a map by applying a function to each of the map's values:"
+  (map (fn [[key val]] [key (inc val)])
+     {:max 30 :min 10})
+  => (contains '([:max 31] [:min 11])
+               :in-any-order))
+
+(fact "convert back 'into' a map"
+  (into {}
+      (map (fn [[key val]] [key (inc val)])
+           {:max 30 :min 10}))
+  => {:max 31, :min 11})

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; the sequence abstraction:
-
-;; The ISeq interface
-
-;(fact "returns whatever is passed to it."
-;  (identity "Stefan Salvatore from Vampire Diaries")
-;  => "Stefan Salvatore from Vampire Diaries")
-
-;; FIXME *********
-;(fact "a non sequenctial collection is conveted to a sequence"
-;  (map identity {:name "Bill Compton" :occupation "Dead mopey guy"})
-;  => ([:occupation "Dead mopey guy"] [:name "Bill Compton"]))
-
-;(fact (seq {:name "Bill Compton" :occupation "Dead mopey guy"})
-;  => ([:occupation "Dead mopey guy"] [:name "Bill Compton"]))
-
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; The ISeq interface - alows many data structurs to act as sequences
+
+(fact "'identity' returns whatever is passed to it."
+  (identity "Stefan Salvatore from Vampire Diaries")
+  => "Stefan Salvatore from Vampire Diaries")
+
+
+(fact "a non sequenctial collection is conveted to a sequence using 'map' and 'identity'"
+  (map identity {:name "Bill Compton" :occupation "Dead mopey guy"})
+  => (contains '([:name "Bill Compton"] [:occupation "Dead mopey guy"]) :in-any-order))
+
+(fact "the seq function converts a map data structure into a sequence of vectors"
+  (seq {:name "Bill Compton" :occupation "Dead mopey guy"})
+  => (contains '([:name "Bill Compton"] [:occupation "Dead mopey guy"]) :in-any-order))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; sequence function examples

-;;;;;;;;;;;;;;;;;;;;;
-;; map
-
-(fact "applies a function over a sequence"
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; map
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(fact "'map' applies a function over a sequence"
   (map inc [1 2 3])
   => '(2 3 4))

-(fact "map applied over multiple sequences"
+(fact "'map' applied over multiple sequences"
   (map str ["a" "b" "c"] ["A" "B" "C"])
   => '("aA" "bB" "cC")
   (map + [1 2 3] [1 2 3])
@@ -72,7 +94,7 @@
   {:human human
    :critter critter})

-(fact
+(fact "apply to data"
   (map unify-diet-data human-consumption critter-consumption)
   => '({:human 8.1, :critter 0.0}
        {:human 7.3, :critter 0.2}
@@ -86,12 +108,20 @@
   [numbers]
   (map #(% numbers) [sum count avg]))

-(fact (stats [3 4 10])  => '(17 3 17/3))
-(fact (stats [10 1 44 13 6])  => '(74 5 74/5))
+(fact
+
+  (stats [3 4 10])
+  => '(17 3 17/3)
+
+  (stats [80 1 44 13 6])
+  => '(144 5 144/5))
+
+

 ;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; reduce
+;;;;;;;;;;;;;;;;;;;;;;;;;

 (fact "use reduce to update a map data structure"
   (reduce (fn [new-map [key val]]
@@ -110,8 +140,10 @@
            :critter 3.9})
   => {:human 4.1})

-;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; take, drop, take-while, drop-while
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (fact (take 3 [1 2 3 4 5 6 7 8 9 10])
   => '(1 2 3))
@@ -153,6 +185,7 @@

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; filter, some
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (fact "journal entries for human less than 5 liters"
   (filter #(< (:human %) 5) food-journal)
@@ -171,30 +204,44 @@
        {:day 2, :human 5.0, :month 2, :critter 2.5}))

 (facts "'some' returns the first true value returned by a predicate"
-  (fact (some #(> (:critter %) 5) food-journal) => nil)
-  (fact (some #(> (:critter %) 3) food-journal) => true))
-
-(fact "return the actual value"
+  (fact
+    (some #(> (:critter %) 5) food-journal)
+    => nil)
+  (fact
+    (some #(> (:critter %) 3) food-journal)
+    => true))
+
+(fact "return the actual value that was true"
   (some #(and (> (:critter %) 3) %) food-journal)
-  => {:day 1, :human 4.2, :month 3, :critter 3.3})
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+  => {:month 3 :day 1 :human 4.2 :critter 3.3})
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; sort, sort-by
-
-(fact (sort [3 2 1])
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(fact "sort in ascending order"
+  (sort [3 2 1])
   => '(1 2 3))

-(fact (sort-by count ["aaa" "c" "bb"])
+(fact "sort uning a 'key-function'"
+  (sort-by count ["aaa" "c" "bb"])
   => '("c" "bb" "aaa"))

+
+;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; concat
-(fact (concat [1 2] [3 4])
+;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(fact "appends 'flattens' sequences"
+  (concat [1 2] [3 4])
   => '(1 2 3 4))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; lazy sequence
 ;; 'realizing' when needed
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (def vampire-database
   {0 {:makes-blood-puns? false, :has-pulse? true  :name "McFishwich"}
@@ -217,25 +264,29 @@
   (first (filter vampire?
                  (map vampire-related-details social-security-numbers))))

-;; (time (identify-vampire (range 0 10000)))
-;; "Elapsed time: 32007.469024 msecs"
-;; => {:makes-blood-puns? true, :has-pulse? false, :name "Damon Salvatore"}
+;; don't run when compiling or testing
+;;(fact
+;;  (time (identify-vampire (range 0 10000)))
+;; ;; "Elapsed time: 32007.469024 msecs"
+;;  => {:makes-blood-puns? true, :has-pulse? false, :name "Damon Salvatore"})

 ;; doall realizes all elements of a lazy sequence
+

 ;;;;;;;;;;;;;;;;;;;;;;
 ;; Infinite equences
+;;;;;;;;;;;;;;;;;;;;;;

 (fact "'repeat' infinite repeated sequence"
   (concat (take 8 (repeat "na")) ["Batman!"])
   => '("na" "na" "na" "na" "na" "na" "na" "na" "Batman!"))

 ;; repeates the output of a fucntion
-(take 3 (repeatedly (fn [] (rand-int 10))))
+;(take 3 (repeatedly (fn [] (rand-int 10))))
 ;; => (9 7 1)

 (defn even-numbers
-  "infinite sequence of even numbers"
+  "lazy infinite sequence of even numbers"
   ([] (even-numbers 0))
   ([n] (cons n (lazy-seq (even-numbers (+ n 2))))))

@@ -243,31 +294,47 @@
   (take 10 (even-numbers))
   => '(0 2 4 6 8 10 12 14 16 18))

-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(fact "remember that 'cons' returns a new list with an element prepended to the given list"
+  (cons 0 '(2 4 6))
+  => '(0 2 4 6))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; the collection abstraction:
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 ;; sequence is about operating on members
 ;; collection is about operating operating on the structure as a whole.
 ;;  count, empty?,every?

 (facts "about empty? operating on collections"
-  (fact (empty? [])
+  (fact
+    (empty? [])
     => true)
-  (fact (empty? ["no!"])
+  (fact
+    (empty? ["no!"])
     => false))

+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; into
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
 (facts "about into"
-  (fact (map identity {:sunlight-reation "Glitter!"})
+  (fact "'map' returns a 'seq'"
+    (map identity {:sunlight-reation "Glitter!"})
     => '([:sunlight-reation "Glitter!"]))
-  (fact (into {} (map identity {:sunlight-reation "Glitter!"}))
+  (fact "convert 'seq' 'into' a map"
+    (into {} (map identity {:sunlight-reation "Glitter!"}))
     => {:sunlight-reation "Glitter!"}))

 (facts "convert back to vector"
-  (fact (map identity [:garlic :sesame-oil :fried-eggs])
+  (fact "'map returns a 'seq'"
+    (map identity [:garlic :sesame-oil :fried-eggs])
     => '(:garlic :sesame-oil :fried-eggs))
-  (fact (into [] (map identity [:garlic :sesame-oil :fried-eggs]))
+
+  (fact  "'into' a vector"
+    (into [] (map identity [:garlic :sesame-oil :fried-eggs]))
     => [:garlic :sesame-oil :fried-eggs]))

 (fact "convert back to list"
@@ -279,27 +346,44 @@
   => #{:garlic-clove})

 (facts "the first argument of 'into' doesn't have to be empty"
-  (fact  (into {:favorite-emotion "glommy"} [[:sunlight-reaction "Glitter!"]])
+  (fact
+    (into {:favorite-emotion "glommy"} [[:sunlight-reaction "Glitter!"]])
     => {:favorite-emotion "glommy", :sunlight-reaction "Glitter!"})
-  (fact (into ["cherry"] '("pine" "spruce"))
+  (fact
+    (into ["cherry"] '("pine" "spruce"))
     => ["cherry" "pine" "spruce"]))

-;;;;;;;;;;;;;;;;;;;;;;;;;
+(fact "both arguments can be the same type:"
+  (into {:favorite-animal "kitty"} {:least-favorite-smell "dog"
+                                  :relationship-with-teenager "creepy"})
+  =>
+  {:favorite-animal "kitty"
+   :relationship-with-teenager "creepy"
+   :least-favorite-smell "dog"})
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; conj - add elements to a collection.
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (facts "about conj"
-  (fact "not so good - added whole collection"
+
+  (fact "not so good - added the entire vector [1] onto [0]"
     (conj [0] [1])
     => [0 [1]])
-  (fact "ok"
+
+  (fact "compare to:"
     (into [0] [1])
     => [0 1])
+
   (fact "Here's what we want"
     (conj [0] 1)
     => [0 1])
+
   (fact "we can supply multiple items"
     (conj [0] 1 2 3 4)
     => [0 1 2 3 4])
+
   (fact "we can add maps"
     (conj {:time "midnight"} [:place "ye olde cemetarum"])
     => {:place "ye olde cemetarum", :time "midnight"}))
@@ -310,9 +394,11 @@
   (into target additions))

 (facts "about my-conj"
-  (fact (my-conj [0] 1)
+  (fact "single value"
+    (my-conj [0] 1)
     => [0 1])
-  (fact (my-conj [0] 1 2 3)
+  (fact "multiple values"
+    (my-conj [0] 1 2 3)
     => [0 1 2 3]))

@@ -320,18 +406,21 @@
 ;; higher level fuctions
 ;; apply and partial

-;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; 'apply' - explodes a seqable collection to pass to a function that expects a 'rest' param
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (defn my-into
-  "into defined in terms of 'apply"
+  "into defined in terms of 'conj' using 'apply"
   [collection additions]
   (apply conj collection additions))

-(facts "about my-into"
-  (fact (my-into [0] [1 2 3])
+(facts "about 'my-into'"
+  (fact
+    (my-into [0] [1 2 3])
     => [0 1 2 3])
-  (fact (conj [0] 1 2 3)
+  (fact "equivalent to"
+    (conj [0] 1 2 3)
     => [0 1 2 3]))

 (facts "'max' takes a rest argument"
@@ -342,6 +431,7 @@
     (apply max [0 1 2])
     => 2))

+
 ;;;;;;;;;;;;;;;;
 ;; partial - takes a function an any number of arguements and returns a new function
 ;;   then when the new function is called it call the original function with the orignal
@@ -355,7 +445,8 @@
 (def add-missing-element
   (partial conj ["water" "earth" "air"]))

-(fact (add-missing-element "unobtainium" "adamantium")
+(fact
+  (add-missing-element "unobtainium" "adamantium")
   => ["water" "earth" "air" "unobtainium" "adamantium"])

@@ -365,12 +456,13 @@
     (apply partialized-fn (into more-args (reverse args)))))

 (def add20 (my-partial + 20))  ;; sets add20 to an anonymous function
+                               ;; returned by 'my-partial'

 (fact (add20 3)  => 23)

-;; the anonymous function as defined:
+;; the anonymous function as defined by 'my-partial':
 (fn [& more-args]
-  (apply + (into [20] more-args)))
+  (apply + (into [20] more-args)))  ; sweet!

 ;; another example:
@@ -382,11 +474,15 @@

 (def warn (partial lousy-logger :warn))

-(fact (warn "Red light ahead") => "red light ahead")
+(fact
+  (warn "Red light ahead")
+  => "red light ahead")

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; complement -
+;; Why, thank you!
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (defn identify-humans-1
   [social-security-numbers]
@@ -410,3 +506,6 @@

 (fact (my-pos? 1) => true)
 (fact (my-pos? -1) => false)
+
+
+;; see the 'FWPD' example in it's own project.


Ablity to cache for top-level script file

--- planck-cljs/src/planck/repl.cljs
+++ planck-cljs/src/planck/repl.cljs
@@ -70,6 +70,12 @@

 (defn ns-form? [form]
   (and (seq? form) (= 'ns (first form))))
+
+(defn extract-namespace
+  [source]
+  (let [first-form (repl-read-string source)]
+    (when (ns-form? first-form)
+      (second first-form))))

 (def special-doc-map
   '{.     {:forms [(.instanceMethod instance args*)
@@ -436,6 +442,15 @@
 (defn- cache-prefix-for-path [path]
   (str (:cache-path @app-env) "/" (munge path)))

+(defn- extract-cache-metadata [source]
+  (let [file-namespace (extract-namespace source)
+        relpath (if file-namespace
+                  (cljs/ns->relpath file-namespace)
+                  "cljs/user")]
+    [file-namespace relpath]))
+
+(def extract-cache-metadata-mem (memoize extract-cache-metadata))
+
 (defn caching-js-eval
   [{:keys [path name source cache]}]
   (when (and path source cache (:cache-path @app-env))
@@ -463,16 +478,20 @@
             {:lang   lang
              :source source}
             (when-not (= :js lang)
-              (let [precompiled-js (or (raw-load (add-suffix path ".js"))
+              (let [cache-prefix (if (= :calculate-cache-prefix cache-prefix)
+                                   (cache-prefix-for-path (second (extract-cache-metadata-mem source)))
+                                   cache-prefix)
+                    precompiled-js (or (raw-load (add-suffix path ".js"))
                                      (js/PLANCK_READ_FILE (str cache-prefix ".js")))
                     cache-json (or (raw-load (str path ".cache.json"))
                                  (js/PLANCK_READ_FILE (str cache-prefix ".cache.json")))]
-                (when (and precompiled-js cache-json)
+                (when precompiled-js
                   (when (:verbose @app-env)
-                    (println-verbose "Loading precompiled JS and analysis cache for" path))
-                  {:lang   :js
-                   :source precompiled-js
-                   :cache  (transit-json->cljs cache-json)})))))
+                    (println-verbose "Loading precompiled JS" (if cache-json "and analysis cache" "") "for" path))
+                  (merge {:lang   :js
+                          :source precompiled-js}
+                    (when cache-json
+                      {:cache (transit-json->cljs cache-json)})))))))
       :loaded)))

 (defn closure-index []
@@ -492,7 +511,7 @@
 ; file here is an alternate parameter denoting a filesystem path
 (defn load [{:keys [name macros path file] :as full} cb]
   (if file
-    (when-not (load-and-callback! file :clj nil cb)
+    (when-not (load-and-callback! file :clj :calculate-cache-prefix cb)
       (cb nil))
     (if (re-matches #"^goog/.*" path)
       (if-let [goog-path (get (closure-index-mem) name)]
@@ -603,6 +622,41 @@
         (-> (r/read {:read-cond :allow :features #{:cljs}} rdr)
           meta :source)))))

+(defn- run-async!
+  "Like cljs.core/run!, but for an async procedure, and with the
+  ability to break prior to processing the entire collection.
+
+  Chains successive calls to the supplied procedure for items in
+  the collection. The procedure should accept an item from the
+  collection and a callback of one argument. If the break? predicate,
+  when applied to the procedure callback value, yields a truthy
+  result, terminates early calling the supplied cb with the callback
+  value. Otherwise, when complete, calls cb with nil."
+  [proc coll break? cb]
+  (if (seq coll)
+    (proc (first coll)
+      (fn [res]
+        (if (break? res)
+          (cb res)
+          (run-async! proc (rest coll) break? cb))))
+    (cb nil)))
+
+(defn- process-deps
+  [names opts cb]
+  (run-async! (fn [name cb]
+                (cljs/require name opts cb))
+    names
+    :error
+    cb))
+
+(defn- process-macros-deps
+  [cache cb]
+  (process-deps (distinct (vals (:require-macros cache))) {:macros-ns true} cb))
+
+(defn- process-libs-deps
+  [cache cb]
+  (process-deps (distinct (concat (vals (:requires cache)) (vals (:imports cache)))) {} cb))
+
 (defn execute-source
   [[source-type source-value] {:keys [expression? print-nil-expression? in-exit-context? include-stacktrace?] :as opts}]
   (binding [ana/*cljs-ns* @current-ns
@@ -615,7 +669,15 @@
           (if source
             (case lang
               :clj (execute-source ["text" source] opts)
-              :js (js/eval source))
+              :js (process-macros-deps cache
+                    (fn [res]
+                      (if-let [error (:error res)]
+                        (handle-error (js/Error. error) false in-exit-context?)
+                        (process-libs-deps cache
+                          (fn [res]
+                            (if-let [error (:error res)]
+                              (handle-error (js/Error. error) false in-exit-context?)
+                              (js/eval source))))))))
             (handle-error (js/Error. (str "Could not load file " source-value)) false in-exit-context?))))
       (let [source-text source-value
             expression-form (and expression? (repl-read-string source-text))]
@@ -653,16 +715,21 @@
               source-text
               (if expression? "Expression" "File")
               (merge
-                {:ns           @current-ns
-                 :source-map   false
-                 :verbose      (:verbose @app-env)
-                 :cache-source (fn [x cb]
-                                 #_(when (and path (:source x))
-                                     (js/PLANCK_CACHE path (:source x) nil))
-                                 (cb {:value nil}))}
-                (when expression?
+                {:ns         @current-ns
+                 :source-map false
+                 :verbose    (:verbose @app-env)}
+                (if expression?
                   {:context       :expr
-                   :def-emits-var true}))
+                   :def-emits-var true}
+                  (when (:cache-path @app-env)
+                    {:cache-source (fn [x cb]
+                                     (when (and (= "File" (:name x)) (:source x))
+                                       (let [source (:source x)
+                                             [file-namespace relpath] (extract-cache-metadata-mem source-text)]
+                                         (js/PLANCK_CACHE (cache-prefix-for-path relpath) source
+                                           (when file-namespace
+                                             (cljs->transit-json (get-in @st [:cljs.analyzer/namespaces file-namespace]))))))
+                                     (cb {:value nil}))})))
               (fn [{:keys [ns value error] :as ret}]
                 (if expression?
                   (when-not error


Add shutdown recur back in.

Add shutdown recur back in.

--- src/onyx/peer/virtual_peer.clj
+++ src/onyx/peer/virtual_peer.clj
@@ -16,6 +16,7 @@

         (cond (nil? v) (extensions/delete sync (:node pulse))
               (= ch complete-ch) (recur nil)
+              (= ch shutdown-ch) (recur nil)
               (= ch payload-ch)
               (let [payload-node (:path v)
                     payload (extensions/read-node sync payload-node)


Make an err chan. Close peer on shutdown.

--- src/onyx/peer/virtual_peer.clj
+++ src/onyx/peer/virtual_peer.clj
@@ -7,10 +7,11 @@
             [onyx.peer.task-lifecycle :refer [task-lifecycle]]))

 (defn payload-loop [id sync queue payload-ch shutdown-ch status-ch dead-ch pulse opts]
-  (let [complete-ch (chan 1)]
+  (let [complete-ch (chan 1)
+        err-ch (chan 1)]
     (loop [pipeline nil]
-      (when-let [[v ch] (alts!! [shutdown-ch complete-ch payload-ch] :priority true)]
-        (when-not (nil? pipeline)
+      (when-let [[v ch] (alts!! [shutdown-ch err-ch complete-ch payload-ch] :priority true)]
+        (when (and (not (nil? pipeline)) (not= ch err-ch))
           (component/stop pipeline))

         (cond (nil? v) (extensions/delete sync (:node pulse))
@@ -26,8 +27,7 @@
                 (<!! status-ch)

                 (let [new-pipeline (task-lifecycle id payload sync queue payload-ch complete-ch opts)]
-                  (recur (component/start new-pipeline))))
-              :else (recur nil))))
+                  (recur (component/start new-pipeline)))))))
     (>!! dead-ch true)))

 (defrecord VirtualPeer [opts]


Switch to thread local random uuid generator

--- src/onyx/plugin/bookkeeper.clj
+++ src/onyx/plugin/bookkeeper.clj
@@ -13,6 +13,7 @@
             [onyx.monitoring.measurements :refer [measure-latency]]
             [onyx.compression.nippy :refer [compress decompress]]
             [onyx.log.commands.peer-replica-view :refer [peer-site]]
+            [onyx.static.uuid :refer [random-uuid]]
             [onyx.peer.operation :refer [kw->fn]]
             [onyx.types :refer [dec-count! inc-count!]]
             [taoensso.timbre :refer [info error debug fatal]])
@@ -102,7 +103,7 @@
     (let [segment {:entry-id (.getEntryId ^LedgerEntry ledger-entry)
                    :ledger-id ledger-id
                    :value (deserializer-fn (.getEntry ^LedgerEntry ledger-entry))}]
-      (>!! read-ch (t/input (java.util.UUID/randomUUID) segment))
+      (>!! read-ch (t/input (random-uuid) segment))
       (if (.hasMoreElements entries)
         (recur entries
                (.nextElement entries))))))
@@ -169,7 +170,7 @@
                                      (read-ledger-entries! client ledger-handle read-ch deserializer-fn last-acked max-id no-recovery? backoff-period)
                                      :finished)]
                           (if-not (= exit :shutdown)
-                            (>!! read-ch (t/input (java.util.UUID/randomUUID) :done))))
+                            (>!! read-ch (t/input (random-uuid) :done))))
                         (catch Exception e
                           (fatal e))))]
     {:bookkeeper/read-ch read-ch
@@ -237,7 +238,7 @@
   (retry-segment
     [_ event segment-id]
     (when-let [msg (get @pending-messages segment-id)]
-      (>!! read-ch (assoc msg :id (java.util.UUID/randomUUID))))
+      (>!! read-ch (assoc msg :id (random-uuid))))
     (swap! pending-messages dissoc segment-id))

   (pending?


Add test to validate middleware cannot be list

When meta-merges list with a vector, the resulting order is reversed. To avoid
this for the middleware chain, middleware cannot be lists.

--- test/cljc/reitit/ring_spec_test.cljc
+++ test/cljc/reitit/ring_spec_test.cljc
@@ -77,7 +77,15 @@
              :data {:middleware [{:spec (s/keys :opt-un [::roles])
                                   :wrap (fn [handler]
                                           (fn [request]
-                                            (handler request)))}]}})))))
+                                              (handler request)))}]}}))))
+  (testing "middleware cannot be a list"
+    (is (thrown-with-msg?
+         ExceptionInfo
+         #":reitit.ring.spec/invalid-specs"
+         (ring/router
+          ["/api" {:handler    identity
+                   :middleware '()}]
+          {:validate rrs/validate})))))

 (deftest coercion-spec-test
   (is (r/router?


unit tests import do not work in clojurescript...

--- test/cljs/tictactoe/test_runner.cljs
+++ test/cljs/tictactoe/test_runner.cljs
@@ -1,9 +1,10 @@
-(ns tictactoe.test-runner
+(ns cljs.tictactoe.test-runner
   (:require
+    ;;[tictactoe.common-test]
+    ;;[tictactoe.game-logic-test] ;; TODO - The import does not work. WHY?
     [cljs.test :as test]
-    ;;[tictactoe.game-logic-test :as logic-test]
-    ;; TODO - Import does not work... why ?
     ))

 (test/run-tests
+  'tictactoe.common-test
   'tictactoe.game-logic-test)


Fix funky spacing for cli behaviors

Fix funky spacing for cli behaviors

--- src/lt/objs/cli.cljs
+++ src/lt/objs/cli.cljs
@@ -60,33 +60,33 @@
 ;;*********************************************************

 (behavior ::open-on-args
-                  :triggers #{:post-init}
-                  :desc "App: Process commandline arguments"
-                  :reaction (fn [this]
-                              (when (args)
-                                (let [args-str (or (app/extract! (args-key (app/window-number)))
-                                                   (first (app/args)))
-                                      args (parse-args (rebuild-argv args-str))
-                                      path-line-pairs (map #(let [[_ path line] (re-find #"^(.*?):?(\d+)?$" %)]
-                                                              [(files/resolve (:dir args) path) line])
-                                                           (filter valid-path? (:_ args)))
-                                      paths (map first path-line-pairs)
-                                      open-dir? (some files/dir? paths)]
-                                  (when open-dir?
-                                    (object/merge! workspace/current-ws {:initialized? true}))
-                                  (open-paths path-line-pairs (:add args))))))
+          :triggers #{:post-init}
+          :desc "App: Process commandline arguments"
+          :reaction (fn [this]
+                      (when (args)
+                        (let [args-str (or (app/extract! (args-key (app/window-number)))
+                                           (first (app/args)))
+                              args (parse-args (rebuild-argv args-str))
+                              path-line-pairs (map #(let [[_ path line] (re-find #"^(.*?):?(\d+)?$" %)]
+                                                      [(files/resolve (:dir args) path) line])
+                                                   (filter valid-path? (:_ args)))
+                              paths (map first path-line-pairs)
+                              open-dir? (some files/dir? paths)]
+                          (when open-dir?
+                            (object/merge! workspace/current-ws {:initialized? true}))
+                          (open-paths path-line-pairs (:add args))))))

 (behavior ::open!
-                  :triggers #{:open!}
-                  :desc "App: Open a path from a file manager e.g. Finder"
-                  :reaction (fn [this path]
-                              (when (= (app/fetch :focusedWindow) (app/window-number))
-                                (let [args (parse-args (rebuild-argv path))
-                                      paths (map #(files/resolve (:dir args) %) (filter valid-path? (:_ args)))
-                                      open-dir? (some files/dir? paths)]
-                                  (if (or (:new args)
-                                          (and open-dir? (not (:add args))))
-                                    (let [winid (inc (app/fetch :window-id))]
-                                      (app/store! (args-key winid) path)
-                                      (app/open-window))
-                                    (open-paths (map vector paths) (:add args)))))))
+          :triggers #{:open!}
+          :desc "App: Open a path from a file manager e.g. Finder"
+          :reaction (fn [this path]
+                      (when (= (app/fetch :focusedWindow) (app/window-number))
+                        (let [args (parse-args (rebuild-argv path))
+                              paths (map #(files/resolve (:dir args) %) (filter valid-path? (:_ args)))
+                              open-dir? (some files/dir? paths)]
+                          (if (or (:new args)
+                                  (and open-dir? (not (:add args))))
+                            (let [winid (inc (app/fetch :window-id))]
+                              (app/store! (args-key winid) path)
+                              (app/open-window))
+                            (open-paths (map vector paths) (:add args)))))))


Update hill-climber.clj

Update hill-climber.clj

--- src/machine_learning/hill-climber.clj
+++ src/machine_learning/hill-climber.clj
@@ -1,4 +1,4 @@
-(ns machine-learning.core
+(ns hill-climber.core
   (:require [clojure.core.matrix :as mat]))

 ;;Alle Informationen auf https://clojuredocs.org/


:id.xml route should be before :id route

otherwise it will not be matched

--- src/mdr2/handler.clj
+++ src/mdr2/handler.clj
@@ -34,10 +34,10 @@
         (friend/authorize #{:admin :studio :it} (views/production-repair id)))

   ;; individual productions read-only
+  (GET "/production/:id.xml" [id]
+       (friend/authenticated (views/production-xml id)))
   (GET "/production/:id" [id :as r]
        (friend/authenticated (views/production r id)))
-  (GET "/production/:id.xml" [id]
-       (friend/authenticated (views/production-xml id)))

   ;; delete individual production
   (DELETE "/production/:id" [id]


extract/pdf.clj: read output as UTF-8

extract/pdf.clj: read output as UTF-8

--- src/org/altlaw/extract/pdf.clj
+++ src/org/altlaw/extract/pdf.clj
@@ -16,7 +16,7 @@

 (defn pdf-to-html [filename bytes]
   (try
-   (String. (.exec (get-runner) bytes))
+   (String. (.exec (get-runner) bytes) "UTF-8")
    (catch ExecuteException e
      (log/warn "altlaw_parse_pdf failed on " filename ": " e)
      nil)))


Click on instrument names in sequencer to open controller.

This reveals a couple issues. First, synth controllers don't unhook themselves
when closed. This is missing in seesaw.bind, so there's some work to do
there. Second, on OSX at least, the L&F for a toggle button doesn't show
its state when its not in the active window. So, when you show the synth
controller, the sequencer grid goes blank. We should probably just do a
custom row widget. Good times.

--- src/overtone/gui/sequencer.clj
+++ src/overtone/gui/sequencer.clj
@@ -1,7 +1,9 @@
 (ns overtone.gui.sequencer
   (:use [overtone.sc server]
         [overtone.music time]
-        [seesaw core mig border])
+        [overtone.gui.control :only [synth-controller]]
+        [seesaw core mig border]
+        [seesaw.swingx :only [hyperlink]])
   (:require [seesaw.bind :as bind]))

 (defn- make-initial-state [metro steps instruments]
@@ -35,7 +37,7 @@

 (defn- step-row
   [ins steps state-atom]
-  (let [lbl [(label (:name ins)) "gap 5px, gapright 10px"]
+  (let [ins-btn (hyperlink :text (:name ins) :tip "Click for synth controls")
         btns (repeatedly steps #(toggle :selected? false))
         btns-constrained (map (fn [b] [b "width 25:25:25"]) btns)
         clear (button :text "clear"
@@ -45,10 +47,14 @@
       (apply bind/funnel btns)
       (bind/b-swap! state-atom set-step-state ins))

+    ; inst buttons open controls
+    (listen ins-btn :action (fn [_] (synth-controller ins)))
     ; Clear button unselects the row
     (listen clear :action (fn [_] (config! btns :selected? false)))

-    (concat [lbl] btns-constrained [[clear "gapleft 10px"]])))
+    (concat [[ins-btn "growx, gap 5px, gapright 10px"]]
+            btns-constrained
+            [[clear "gapleft 10px"]])))

 (defn step-sequencer
   [metro steps & instruments]
@@ -69,7 +75,7 @@
                                         "bpm"])
           seq-pane     (mig-panel :constraints [(str "wrap " (+ 2 steps)) "" ""]
                                   :items (concat
-                                           [["step" "gap 5px, gapright 10px"]]
+                                           [[(label :text "step") "growx, gap 5px, gapright 10px"]]
                                               (for [lbl step-lbls] [lbl "width 25:25:25"])
                                               [["" ""]]
                                            (mapcat #(step-row % steps state-atom) instruments)))


Keep keyed indices for chords.

Keep keyed indices for chords.

--- src/overtunes/songs/at_all.clj
+++ src/overtunes/songs/at_all.clj
@@ -17,12 +17,12 @@
 (def note# (comp sampled-piano ground))
 (defn chord# [chord] (doseq [note (vals chord)] (note# note)))

-(def ionian (sorted-map 1 0, 2 2, 3 4, 4 5, 5 7, 6 9, 7 11, 8 12))
+(def ionian [0 2 4 5 7 9 11 12])

-(defn triad [scale root] (zipmap [5 3 1] (vals (select-keys scale [root (+ 2 root) (+ 4 root)] ))))
-(def I (triad ionian 1))
-(def II (triad ionian 2))
-(def V (triad ionian 5))
+(defn triad [scale root] (zipmap [:v :iii :i] (vals (select-keys scale [root (+ 2 root) (+ 4 root)] ))))
+(def I (triad ionian 0))
+(def II (triad ionian 1))
+(def V (triad ionian 4))

 (def progression [I {} II {} II V I V])


cleaned things up a bit

cleaned things up a bit

--- src/moomoo/core.cljs
+++ src/moomoo/core.cljs
@@ -8,18 +8,22 @@
 (def http (nodejs/require "http"))
 (def socketio (nodejs/require "socket.io"))

-(defn disconnect []
+(defn disconnect [socket]
   (.log js/console "A user has disconnected!"))

 (defn connection [socket]
   (.log js/console "A user has connected!")
-  (.on socket "disconnect" disconnect))
+  (.on socket "disconnect"
+    (fn []
+      (disconnect socket))))

 (defn -main []
   (println "Hello world!")
   (let [app (.createServer http)
         io (.listen socketio app)]
-    (.on io "connection" connection)
+    (.on io "connection"
+      (fn [socket]
+        (connection socket)))
     (.listen app port)))

 (set! *main-cli-fn* -main)


Throw exception on error from sh, fixes #174

--- planck-cljs/src/planck/shell.cljs
+++ planck-cljs/src/planck/shell.cljs
@@ -28,14 +28,17 @@
            the sub-process's stdout to a String which is returned.
   :env     override the process env with a map of String: String.
   :dir     override the process dir with a String.
-  sh returns a map of
+  if the command exits normally, sh returns a map of
     :exit => sub-process's exit code
     :out  => sub-process's stdout (as String)
-    :err  => sub-process's stderr (String via platform default encoding)"
+    :err  => sub-process's stderr (String via platform default encoding),
+  otherwise it throws an exception"
   [& args]
   (let [[cmd opts] (parse-args args)
         {:keys [in in-enc out-enc env dir]} opts]
     (let [[exit out err] (js->clj (js/PLANCK_SHELL_SH (clj->js cmd) in in-enc out-enc (clj->js (seq env)) dir))]
-      {:exit exit
-       :out  out
-       :err  err})))
+      (if (= 0 exit)
+        {:exit exit
+         :out  out
+         :err  err}
+        (throw (js/Error. (str  "sh exited with non-zero exit code: "  exit ", " err )))))))


Pull the value from the conformed dir (#331)

fixes #330

--- planck-cljs/src/planck/shell.cljs
+++ planck-cljs/src/planck/shell.cljs
@@ -35,7 +35,7 @@
     (let [{:keys [in in-enc out-enc env dir]}
           (merge {:out-enc nil :in-enc nil :dir *sh-dir* :env *sh-env*}
             (into {} (map (comp (juxt :key :val) second) opts)))
-          dir (and dir (:path (as-file dir)))
+          dir (and dir (:path (as-file (second dir))))
           [exit out err] (js->clj (js/PLANCK_SHELL_SH (clj->js cmd) in in-enc out-enc (clj->js (seq env)) dir))]
       (if (and (== -1 exit)
                (= "launch path not accessible" err))


Make sure to clear out slice before loading it

--- src/cfpb/qu/loader.clj
+++ src/cfpb/qu/loader.clj
@@ -253,8 +253,10 @@
         group-id (apply merge
                         (map #(hash-map % (str "$" (name %))) dimensions))
         aggs (map (fn [[agg-metric [agg metric]]]
-                    {agg-metric {(str "$" (name agg))
-                                 (str "$" (name metric))}}) aggregations)
+                    (if (= agg "count")
+                      {agg-metric {"$sum" 1}}
+                      {agg-metric {(str "$" (name agg))
+                                   (str "$" (name metric))}})) aggregations)
         group (apply merge {:_id group-id} aggs)
         project-dims (map (fn [dimension]
                             {dimension
@@ -357,6 +359,14 @@
     (when (and drakefile (.isFile drakefile))
       (run-drakefile drakefile))))

+(defn ez-load-definition
+  "Load the definition of a dataset.
+  Does not run Drake to process data first."
+  [dataset]
+  (let [dataset (name dataset)
+        definition (read-definition dataset)]
+    (save-dataset-definition dataset definition)))
+
 (defn ez-load-concepts
   "Load just the concepts for a dataset.
   Does not run Drake to process data first."
@@ -377,5 +387,6 @@
         definition (read-definition dataset)
         concepts (read-concepts definition)]
     (with-db (get-db dataset)
+      (coll/drop slice)
       (load-slice slice concepts definition)
       (index-slice slice definition))))


fix running pods

fix running pods

--- src/ci3/build/core.clj
+++ src/ci3/build/core.clj
@@ -38,7 +38,6 @@
                 :prefix "CI3_SECRET_"}]
      :env
      [{:name "BUILD_ID" :value (get-in res [:metadata :name])}
-      {:name "REDEPLOY_HASH" :value (System/currentTimeMillis)}
       {:name "BOTO_CONFIG" :value "/gsutil/.boto"}
       {:name "REPOSITORY" :value (get-in res [:repository])}
       {:name "DOCKER_KEY" :valueFrom {:secretKeyRef {:name "docker-registry" :key "key"}}}


Fix random test failure :wrench: [ci drivers]

--- test/metabase/models/metric_test.clj
+++ test/metabase/models/metric_test.clj
@@ -40,7 +40,7 @@
    :is_active               true
    :definition              {:clause ["a" "b"]}}
   (tu/with-temp* [Database [{database-id :id}]
-                  Table    [{:keys [id]} {:db_id database-id}]]
+                  Table    [{:keys [id]}      {:db_id database-id}]]
     (create-metric-then-select! id "I only want *these* things" nil (user->id :rasta) {:clause ["a" "b"]})))

@@ -49,12 +49,12 @@
   [true
    false]
   (tu/with-temp* [Database [{database-id :id}]
-                  Table    [{table-id :id}  {:db_id database-id}]
-                  Metric   [{metric-id :id} {:table_id   table-id
-                                             :definition {:database 45
-                                                          :query    {:filter ["yay"]}}}]]
+                  Table    [{table-id :id}    {:db_id database-id}]
+                  Metric   [{metric-id :id}   {:table_id   table-id
+                                               :definition {:database 45
+                                                            :query    {:filter ["yay"]}}}]]
     [(metric/exists? metric-id)
-     (metric/exists? 34)]))
+     (metric/exists? Integer/MAX_VALUE)])) ; a Metric that definitely doesn't exist

 ;; retrieve-metric
@@ -71,10 +71,10 @@
    :definition              {:database 45
                              :query    {:filter ["yay"]}}}
   (tu/with-temp* [Database [{database-id :id}]
-                  Table    [{table-id :id}  {:db_id database-id}]
-                  Metric   [{metric-id :id} {:table_id    table-id
-                                             :definition  {:database 45
-                                                           :query    {:filter ["yay"]}}}]]
+                  Table    [{table-id :id}    {:db_id database-id}]
+                  Metric   [{metric-id :id}   {:table_id    table-id
+                                               :definition  {:database 45
+                                                             :query    {:filter ["yay"]}}}]]
     (let [{:keys [creator] :as metric} (retrieve-metric metric-id)]
       (update (dissoc metric :id :table_id :created_at :updated_at)
               :creator (u/rpartial dissoc :date_joined :last_login)))))


change logic to snag first :breaks vector item

I probably should've spotted that, having seen `[ ]` plenty of times in the code. What's my vector, Victor...

--- src/clj/game/cards.clj
+++ src/clj/game/cards.clj
@@ -20,7 +20,7 @@
                   (update! state side (assoc card :abilities
                            (if (and (:rezzed current-ice)
                                     (or (some #(has? current-ice :subtype %) (:breaks card))
-                                        (= (:breaks card) "All"))
+                                        (= (first (:breaks card)) "All"))
                                     (> strdif 0))
                              (vec (cons {:auto-pump true :cost [:credit (* pumpcst pumpnum)]
                                          :label (str "Match strength of " (:title current-ice))} abs))


LLDS Processor. Atman fix.

LLDS Processor. Atman fix.

--- src/clj/game/cards.clj
+++ src/clj/game/cards.clj
@@ -234,7 +234,7 @@
                  :choices {:req #(and (= (:type %) "ICE")
                                       (= (last (:zone %)) :ices)
                                       (not (some (fn [c] (has? c :subtype "Caïssa")) (:hosted %))))}
-                 :msg (msg "host it on " (if (:rezzed target) (:title target) "a piece of ICE"))
+                 :msg (msg "host it on " (if (:rezzed target) (:title target) "a piece of ICE"))
                  :effect (effect (host target card))}]
     :events {:pre-ice-strength
              {:req (req (and (= (:cid target) (:cid (:host card))) (:rezzed target)))
@@ -1355,6 +1355,19 @@
     :abilities [{:cost [:credit 3] :msg "prevent a hardware from being trashed"}
                 {:effect (effect (trash card {:cause :ability-cost})) :msg "prevent a hardware from being trashed"}]}

+   "LLDS Processor"
+   {:events
+             (let [llds {:effect (req (let [cards (:llds-target card)]
+                                           (update! state side (dissoc card :llds-target))
+                                           (doseq [c cards]
+                                             (update-breaker-strength state side c))))}]
+               {:runner-turn-ends llds :corp-turn-ends llds
+                :runner-install {:req (req (has? target :subtype "Icebreaker"))
+                                 :effect (effect (update! (update-in card [:llds-target] #(conj % target)))
+                                                 (update-breaker-strength target))}
+                :pre-breaker-strength {:req (req (some #(= (:cid target) (:cid %)) (:llds-target card)))
+                                       :effect (effect (breaker-strength-bonus 1))}})}
+
    "Lockpick"
    {:recurring 1}

@@ -2692,7 +2705,7 @@

    "Atman"
    {:prompt "How many power counters?" :choices :credit :msg (msg "add " target " power counters")
-    :effect (effect (set-prop card :counter target))
+    :effect (effect (add-prop card :counter target))
     :abilities [{:cost [:credit 1] :msg "break 1 subroutine"}]
     :strength-bonus (req (or (:counter card) 0))
     :events {:counter-added {:req (req (= :cid target) (:cid card))


include meta data with pprint-and-return

--- src/clj_money/util.clj
+++ src/clj_money/util.clj
@@ -72,6 +72,8 @@
   [message value]
   (println "")
   (println message)
+  (when (meta value)
+    (pprint {:meta (meta value)}))
   (pprint value)
   value)


fixed random plushy instruction

fixed random plushy instruction

--- src/clojush/random.clj
+++ src/clojush/random.clj
@@ -1,5 +1,6 @@
 (ns clojush.random
-  (:use [clojush globals translate pushstate])
+  (:use [clojush globals translate pushstate]
+        clojush.instructions.common)
   (:require [clj-random.core :as random]))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -109,7 +110,7 @@
                       plushy-close-probability
                       (/ (apply + (filter identity ; This will look up each atom generator in the instruction table and
                                                    ; get the number of parentheses it requires
-                                          (map (comp :parentheses meta @instruction-table)
+                                          (map lookup-instruction-paren-groups
                                                atom-generators)))
                          (count atom-generators)))]
     (if (< (lrand) plushy-prob)


only move possible to move rings

only move possible to move rings

--- src/nonaga/draw.cljs
+++ src/nonaga/draw.cljs
@@ -115,10 +115,12 @@
   (let [[type & event-data] (:event state)
         coords (:rings state)]
     (map (fn [hex svg]
-           (let [click (if (or (= :marble-moved type) (= :ring-selected type))
-                         (let [[color] event-data]
-                           (ring-selected component color hex)))]
-             (ring "grey" click svg)))
+           (if (and (or (= :marble-moved type)
+                        (= :ring-selected type))
+                    (r/can-be-moved? state hex))
+             (let [[color] event-data]
+               (ring "#444" (ring-selected component color hex) svg))
+             (ring "#999" svg)))
          coords (map hex->svg coords))))

 ; Same as move-marble
@@ -137,7 +139,7 @@
       (let [[color source] event-data
             destinations (r/valid-destinations coords source)]
         (map (fn [hex svg]
-               (ring "lightgrey" (move-ring component color source hex) svg))
+               (ring "#DDD" (move-ring component color source hex) svg))
              destinations (map hex->svg destinations))))))

 (def color-name
@@ -177,7 +179,7 @@
                            (draw-rings this state)
                            (draw-potential-rings this state)
                            (if-let [last-ring (:last-ring state)]
-                             (ring "#444" (hex->svg last-ring)))
+                             (ring "#000" (hex->svg last-ring)))
                            (draw-marbles this state :red)
                            (draw-marbles this state :blue)
                            (draw-valid-marble-moves this state))))))))


Add initial (without tests) page history repository and service functions.

--- src/uxbox/services/pages.clj
+++ src/uxbox/services/pages.clj
@@ -78,7 +78,6 @@
     (some-> (sc/fetch-one conn sqlv)
             (usc/normalize-attrs))))

-
 ;; Delete Page

 (def +delete-page-schema+
@@ -116,11 +115,14 @@
     (some-> (sc/fetch-one conn sqlv)
             (usc/normalize-attrs))))

-;; (defn get-page-history
-;;   [conn {:keys [id user since] :as {since nil}}]
-;;   (let [sql (str "SELECT * FROM pages_history "
-;;                  " WHERE \"user\"=? AND id=?"
-;;                  (if since " AND created_at < ?"
+(defn get-page-history
+  [conn {:keys [id user since max] :as {since (dt/now) max 10}}]
+  (let [sql (str "SELECT * FROM pages_history "
+                 " WHERE \"user\"=? AND id=?"
+                 " AND created_at < ?")
+        sqlv [sql user id since]]
+    (->> (sc/fetch conn [sql user project])
+         (map usc/normalize-attrs))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Service (novelty)
@@ -170,12 +172,24 @@
   (->> (get-pages-for-user conn user)
        (map decode-page-data)))

-(def +page-list-by-project-schema+
+(def +query-page-history-list-schema+
+  {:user [us/required us/uuid]
+   :id [us/required us/uuid]
+   :max [us/number]
+   :since [us/datetime]})
+
+(defmethod usc/-query :page/history-list
+  [conn {:keys [id user since] :as params}]
+  {:pre [(us/validate! params +query-page-history-list-schema+)]}
+  (->> (get-page-history conn params)
+       (map decode-page-data)))
+
+(def +query-page-list-by-project-schema+
   {:user [us/required us/uuid]
    :project [us/required us/uuid]})

 (defmethod usc/-query :page/list-by-project
   [conn {:keys [user project] :as params}]
-  {:pre [(us/validate! params +page-list-by-project-schema+)]}
+  {:pre [(us/validate! params +query-page-list-by-project-schema+)]}
   (->> (get-pages-for-user-and-project conn user project)
        (map decode-page-data)))


Fix fragment-element opts

Fix fragment-element opts

--- src/reagent/impl/template.cljs
+++ src/reagent/impl/template.cljs
@@ -165,7 +165,7 @@
         (set! (.-key jsprops) key))
       (react/createElement (comp/funtional-render-fn tag) jsprops))))

-(defn fragment-element [argv]
+(defn fragment-element [argv opts]
   (let [props (nth argv 1 nil)
         hasprops (or (nil? props) (map? props))
         jsprops (or (convert-prop-value (if hasprops props))
@@ -173,7 +173,7 @@
         first-child (+ 1 (if hasprops 1 0))]
     (when-some [key (util/react-key-from-vec argv)]
       (set! (.-key jsprops) key))
-    (make-element argv react/Fragment jsprops first-child)))
+    (make-element argv react/Fragment jsprops first-child opts)))

 (defn adapt-react-class
   [c]
@@ -224,7 +224,7 @@
     (assert (valid-tag? tag) (hiccup-err v "Invalid Hiccup form"))
     (cond
       (keyword-identical? :<> tag)
-      (fragment-element v)
+      (fragment-element v opts)

       (hiccup-tag? tag)
       (let [n (name tag)


Adds more interop support.

Adds more interop support.

--- src/onyx/interop.clj
+++ src/onyx/interop.clj
@@ -73,3 +73,12 @@

 (defn coerce-lifecycles [lifecycles]
   (mapv #(cast-types :lifecycle-entry %) lifecycles))
+
+(defn coerce-flow-conditions [fcs]
+  (mapv #(cast-types :flow-conditions-entry %) fcs))
+
+(defn coerce-windows [windows]
+  (mapv #(cast-types :window-entry %) windows))
+
+(defn coerce-trigger [trigger]
+  (mapv #(cast-types :trigger-entry %) trigger))


Remove clj file

Remove clj file

--- src/othello/core.clj
+++ src/othello/core.clj
@@ -1,9 +0,0 @@
-(ns othello.core)
-
-(defn foo
-  "I don't do a whole lot."
-  [x]
-  (println x "Hello, World!"))
-
-(defn main []
-  )


Refactoring to simplify.

Refactoring to simplify.

--- src/ahnentafel/gedcom.clj
+++ src/ahnentafel/gedcom.clj
@@ -2,8 +2,8 @@

 (defn read-resource [resource-name]
   (when-let [file (clojure.java.io/resource resource-name)]
-   (with-open [rdr (clojure.java.io/reader file)]
-     (doall (line-seq rdr)))))
+    (with-open [rdr (clojure.java.io/reader file)]
+      (doall (line-seq rdr)))))

 (defn parse-line [line]
   (when (re-find #"^0\d+" line) (throw (ahnentafel.ParseError. line)))
@@ -18,33 +18,23 @@

 (defn- split-out-subordinate-records [records]
   (letfn [(subordinate-to-first [r] (> (:level r) (:level (first records))))]
-   (split-with subordinate-to-first (rest records))))
-
-(defn assoc-if [map key value]
-  (if value (assoc map key value) map))
+    (split-with subordinate-to-first (rest records))))

 (defn group-records
-  ([records] (if (not (empty? records)) (group-records (first records)
-                                   (split-out-subordinate-records records)
-                                   [])))
+  ([records] (if (not (empty? records))
+               (group-records (first records)
+                              (split-out-subordinate-records records)
+                              [])))
   ([current-record [subordinate-records unprocessed-records] processed-records]
-   (cond
-     ;; done with all processing
-     (and (empty? unprocessed-records) (empty? subordinate-records))
-     (conj processed-records current-record)
+   (letfn [(assoc-if [map key value] (if value (assoc map key value) map))
+           (conj-current-with-subordinates []
+             (conj processed-records
+                   (assoc-if current-record
+                             :subordinate-lines
+                             (group-records subordinate-records))))]

-     ;; only subordinate items left to process
-     (empty? unprocessed-records)
-     (conj processed-records
-           (assoc-if current-record
-                     :subordinate-lines (group-records subordinate-records)))
-
-     ;; add current record (with subordinates) and move to next record
-     :else
-     (group-records (first unprocessed-records)
-                    (split-out-subordinate-records unprocessed-records)
-                    (conj processed-records
-                          (assoc-if current-record
-                                    :subordinate-lines (group-records subordinate-records)))))
-   )
-)
+     (if (empty? unprocessed-records)
+       (conj-current-with-subordinates)
+       (group-records (first unprocessed-records)
+                      (split-out-subordinate-records unprocessed-records)
+                      (conj-current-with-subordinates))))))


Standardize naming

Standardize naming

--- src/physim/core.cljs
+++ src/physim/core.cljs
@@ -4,7 +4,7 @@
 (def particle-radius 20)
 (def particle-diameter (* 2 particle-radius))
 (def particle-count 10)
-(def gravity-multiplier 200)
+(def gravitational-constant 200)
 (def speed-limit 5)
 (def initial-speed 0)

@@ -111,7 +111,7 @@
            dist (distance p (:pos n))]
        (map + a
             (if (> dist 0)
-              (direction dir (/ gravity-multiplier
+              (direction dir (/ gravitational-constant
                                 (* dist dist)))
               nullv))))
    nullv


Prevent ui resizing

Prevent ui resizing

--- src/robinson/swingterminal.clj
+++ src/robinson/swingterminal.clj
@@ -165,6 +165,7 @@
                              (.setLocationByPlatform true)
                              (.setVisible true)
                              (.setFocusTraversalKeysEnabled false)
+                             (.setResizable false)
                              (.pack))]
       (reify ATerminal
         (get-size [this]


Fixed comment typos. Matched comment case.

--- src/leiningen/new/figwheel/project.clj
+++ src/leiningen/new/figwheel/project.clj
@@ -26,13 +26,13 @@
               [{:id "dev"
                 :source-paths ["src"]

-                ;; the presence of a :figwheel configuration here
+                ;; The presence of a :figwheel configuration here
                 ;; will cause figwheel to inject the figwheel client
                 ;; into your build
                 :figwheel {:on-jsload "{{name}}.core/on-js-reload"
                            ;; :open-urls will pop open your application
                            ;; in the default browser once Figwheel has
-                           ;; started and complied your application.
+                           ;; started and compiled your application.
                            ;; Comment this out once it no longer serves you.
                            :open-urls ["http://localhost:3449/index.html"]}

@@ -44,7 +44,7 @@
                            ;; To console.log CLJS data-structures make sure you enable devtools in Chrome
                            ;; https://github.com/binaryage/cljs-devtools
                            :preloads [devtools.preload]}}
-               ;; This next build is an compressed minified build for
+               ;; This next build is a compressed minified build for
                ;; production. You can build this with:
                ;; lein cljsbuild once min
                {:id "min"
@@ -94,7 +94,7 @@
              }

-  ;; setting up nREPL for Figwheel and ClojureScript dev
+  ;; Setting up nREPL for Figwheel and ClojureScript dev
   ;; Please see:
   ;; https://github.com/bhauman/lein-figwheel/wiki/Using-the-Figwheel-REPL-within-NRepl
   :profiles {:dev {:dependencies [[binaryage/devtools "0.9.0"]


minor cleanup

minor cleanup

--- src/leiningen/new/reagent_liveedit.clj
+++ src/leiningen/new/reagent_liveedit.clj
@@ -10,7 +10,6 @@
               :sanitized (name-to-path name)}]
     (->files
      data
-     ["src/env/dev/cljs/{{sanitized}}/dev.cljs" (render "dev.cljs" data)]
      ["project.clj" (render "project.clj" data)]
      ["README.md" (render "README.md")]
      ["LICENSE" (render "LICENSE")]
@@ -20,6 +19,7 @@
      ["src/cljs/{{sanitized}}/test.cljs" (render "test.cljs" data)]
      ["src/clj/{{sanitized}}/server/handler.clj" (render "handler.clj" data)]
      ["src/clj/{{sanitized}}/server/services.clj" (render "services.clj" data)]
+     ["src/env/dev/cljs/{{sanitized}}/dev.cljs" (render "dev.cljs" data)]
      ["src/env/dev/cljs/{{sanitized}}/testrunner.cljs" (render "testrunner.cljs" data)]
      ["src/env/prod/cljs/{{sanitized}}/prod.cljs" (render "prod.cljs" data)]
      ["src/styles/{{sanitized}}/styles/dev.clj" (render "dev.clj" data)]
@@ -29,4 +29,4 @@
      ["resources/public/index.html" (render "index.html" data)]

      ["resources/templates/js/function_prototype_polyfill.js" (render "function_prototype_polyfill.js")]
-)))
+     )))


Fix feed if no entries exist

Fix feed if no entries exist

Change-Id: Id62c12e42062f7693ca8bc4e47cadf684dee657a

--- src/qcast/server.clj
+++ src/qcast/server.clj
@@ -75,7 +75,8 @@
 (defn- serve-feed [media]
   (let [entries (map :data (cache/latest 50))
         items (map #(feed-item media %) entries)
-        channel (feed-channel (:publish-date (first entries)))
+        change-date (or (:publish-date (first entries)) 0)
+        channel (feed-channel change-date)
         extensions [:atom :itunes :simple-chapters]]
     (rss/feed channel items extensions)))


Use local state.

Use local state.

--- src/prod/clj/com/potetm/tire_iron.clj
+++ src/prod/clj/com/potetm/tire_iron.clj
@@ -8,12 +8,6 @@
             [cljs.env :as env]
             [cljs.repl :as repl]
             [clojure.string :as str]))
-
-(defonce refresh-tracker (track/tracker))
-(defonce disabled-unload-namespaces #{})
-(defonce disabled-load-namespaces #{'cljs.core
-                                    'clojure.browser.repl
-                                    'clojure.browser.net})

 (defprotocol IRefresh
   (-initialize [this opts])
@@ -181,11 +175,11 @@
          "  });"
          "})();")))

-(defn remove-disabled [tracker]
+(defn remove-disabled [tracker disable-unload disable-load]
   (-> tracker
-      (update-in [::track/unload] (partial remove (set/union disabled-unload-namespaces
-                                                             disabled-load-namespaces)))
-      (update-in [::track/load] (partial remove disabled-load-namespaces))))
+      (update-in [::track/unload] (partial remove (set/union disable-unload
+                                                             disable-load)))
+      (update-in [::track/load] (partial remove disable-load))))

 (defrecord HtmlAsyncRefresher []
   IRefresh
@@ -219,35 +213,38 @@
                       (set-sym-from-ti-state-script state)
                       (call-sym-script after)))))

-(defn refresh* [refresher {:keys [repl-env
-                                  analyzer-env
-                                  repl-opts
-                                  source-dirs
-                                  before
-                                  after
-                                  state
-                                  add-all?]}]
+(defn refresh* [{:keys [refresher
+                        tracker
+                        disable-unload
+                        disable-load
+                        repl-env
+                        analyzer-env
+                        repl-opts
+                        source-dirs
+                        before
+                        after
+                        state
+                        add-all?]}]
   (doseq [s (filter some? [before after state])]
     (assert (symbol? s) "value must be a symbol")
     (assert (namespace s)
             "value must be a namespace-qualified symbol"))
-  (alter-var-root #'refresh-tracker dir/scan-dirs source-dirs {:platform find/cljs
-                                                               :add-all? add-all?})
-  (alter-var-root #'refresh-tracker remove-disabled)
-  (prn :requesting-reload (::track/load refresh-tracker))
-  (-refresh refresher {:repl-env repl-env
-                       :analyzer-env analyzer-env
-                       :repl-opts repl-opts
-                       :before before
-                       :after after
-                       :state state
-                       :unload-nss (::track/unload refresh-tracker)
-                       :load-nss (::track/load refresh-tracker)})
-  (alter-var-root #'refresh-tracker (fn [tracker]
-                                      (assoc tracker
-                                        ::track/load nil
-                                        ::track/unload nil)))
-  (println :reload-requested))
+  (swap! tracker dir/scan-dirs source-dirs {:platform find/cljs
+                                            :add-all? add-all?})
+  (let [{:keys [::track/unload
+                ::track/load]}
+        (swap! tracker remove-disabled disable-unload disable-load)]
+    (prn :requesting-reload load)
+    (-refresh refresher {:repl-env repl-env
+                         :analyzer-env analyzer-env
+                         :repl-opts repl-opts
+                         :before before
+                         :after after
+                         :state state
+                         :unload-nss unload
+                         :load-nss load}))
+  (swap! tracker assoc ::track/load nil ::track/unload nil)
+  (println :ok))

 (defn recover-state [repl-env analyzer-env repl-opts state]
   (eval-form repl-env
@@ -266,19 +263,6 @@
   (if (list? symbol-or-list)
     (second symbol-or-list)
     symbol-or-list))
-
-(defn disable-unload! [ns]
-  (alter-var-root #'disabled-unload-namespaces conj (maybe-quoted->symbol ns)))
-
-(defn disable-reload! [ns]
-  (alter-var-root #'disabled-load-namespaces conj (maybe-quoted->symbol ns)))
-
-(defn clear! []
-  (alter-var-root #'refresh-tracker (constantly (track/tracker))))
-
-(defn print-disabled []
-  (prn "disabled unload" disabled-unload-namespaces)
-  (prn "disabled reload" disabled-load-namespaces))

 (defn wrap [f]
   (fn g
@@ -288,7 +272,7 @@
      (let [backup-comp @env/*compiler*]
        (try
          (apply f [repl-env analyzer-env form repl-opts])
-         (catch Exception e ;;Exception
+         (catch Exception e
            (reset! env/*compiler* backup-comp)
            (throw e)))))))

@@ -328,11 +312,19 @@
              after
              state
              add-all?
+             disable-unload
+             disable-load
              refresher]
       :as closed-settings
       :or
       {source-dirs ["src"]}}]
-  (let [refresher (atom refresher)]
+  (let [refresher (atom refresher)
+        tracker (atom (track/tracker))
+        disable-unload (atom (into #{} disable-unload))
+        disable-load (atom (into #{'cljs.core
+                                   'clojure.browser.repl
+                                   'clojure.browser.net}
+                                 disable-load))]
     {'refresh
      (wrap (fn [repl-env analyzer-env [_ & opts] repl-opts]
              (let [{:keys [source-dirs
@@ -341,14 +333,17 @@
                            state
                            add-all?] :as passed-settings} (apply hash-map opts)]
                (if-let [r @refresher]
-                 (refresh* @refresher
-                           (merge closed-settings
-                                  passed-settings
-                                  {:repl-env repl-env
+                 (refresh* (merge {:refresher r
+                                   :tracker tracker
+                                   :disable-unload @disable-unload
+                                   :disable-load @disable-load
+                                   :repl-env repl-env
                                    :analyzer-env analyzer-env
-                                   :repl-opts repl-opts}))
-                 (throw (ex-info "tire-iron not initialized"
-                                 {}))))))
+                                   :repl-opts repl-opts}
+                                  closed-settings
+                                  passed-settings))
+                 (binding [*out* *err*]
+                   (println "tire-iron not initialized"))))))

      'init
      (wrap (fn [repl-env analyzer-env _ repl-opts]
@@ -376,16 +371,17 @@

      'print-disabled
      (wrap (fn [& _]
-             (print-disabled)))
+             (prn :disabled-unload @disable-unload)
+             (prn :disabled-reload @disable-load)))

      'disable-unload!
      (wrap (fn [_ _ [_ my-ns] _]
-             (disable-unload! my-ns)))
+             (swap! disable-unload conj (maybe-quoted->symbol my-ns))))

      'disable-reload!
      (wrap (fn [_ _ [_ my-ns] _]
-             (disable-reload! my-ns)))
+             (swap! disable-load conj (maybe-quoted->symbol my-ns))))

      'clear
      (wrap (fn [_ _ _ _]
-             (clear!)))}))
+             (reset! tracker (track/tracker))))}))


Missing shared_secret fails auth, when auth is required.

Fix #49.

--- src/ruuvi_server/tracker_security.clj
+++ src/ruuvi_server/tracker_security.clj
@@ -56,7 +56,8 @@

    (not tracker) (do (debug "Tracker does not exist in system")
                      {:unknown-tracker true})
-
+   (not (tracker :shared_secret)) (do (debug "No shared secret for tracker")
+                                     {:authentication-failed true})
    :else (let [shared-secret (tracker :shared_secret)
                computed-mac (compute-hmac params shared-secret mac-field)
                request-mac (params mac-field)]


test code

test code

--- src/sandbox/command/cash_register.clj
+++ src/sandbox/command/cash_register.clj
@@ -21,3 +21,12 @@
 (defn execute-purchase [purchase]
   (swap! purchases conj purchase)
   (purchase))
+
+;;test
+(def register (make-cash-register))
+(def purchase-1 (make-purchase register 100))
+(def purchase-2 (make-purchase register 50))
+(execute-purchase purchase-1)
+(execute-purchase purchase-2)
+(reset register)
+(doseq [purchase @purchases] (purchase))


Use maps for describe/it metadata

Use maps for describe/it metadata

--- src/main/clojure/lazytest/describe.clj
+++ src/main/clojure/lazytest/describe.clj
@@ -16,15 +16,6 @@
   (if (pred (first args))
     [(first args) (next args)]
     [nil args]))
-
-(defn- get-options
-  "Extracts keyword-value pairs from head of args, until next arg is
-  not a keyword.  Returns a vector [options-map remaining-args]"
-  [args]
-  (loop [options nil args args]
-    (if (and (seq args) (keyword? (first args)))
-      (recur (assoc options (first args) (second args)) (nnext args))
-      [options args])))

 (defn- firsts [coll]
   (take-nth 2 coll))
@@ -89,14 +80,14 @@
 (defmacro describe [& decl]
   (let [[sym decl] (get-arg symbol? decl)
 	[doc decl] (get-arg string? decl)
-	[opts body] (get-options decl)
+	[opts body] (get-arg map? decl)
 	children (vec body)
 	metadata (merge (meta &form) {:doc doc} opts)]
     `(test-group ~children ~metadata)))

 (defmacro given [& decl]
   (let [[doc decl] (get-arg string? decl)
-	[opts decl] (get-options decl)
+	[opts decl] (get-arg map? decl)
 	[bindings body] (get-arg vector? decl)
 	children (vec body)
 	metadata (merge (meta &form) {:doc doc} opts)]
@@ -109,7 +100,7 @@

 (defmacro using [& decl]
   (let [[doc decl] (get-arg string? decl)
-	[opts decl] (get-options decl)
+	[opts decl] (get-arg map? decl)
 	[bindings body] (get-arg vector? decl)
 	children (vec body)
 	metadata (merge (meta &form) {:doc doc} opts)]
@@ -123,7 +114,7 @@
 (defmacro it [& decl]
   (let [[sym decl] (get-arg symbol? decl)
 	[doc decl] (get-arg string? decl)
-	[opts body] (get-options decl)
+	[opts body] (get-arg map? decl)
 	metadata (merge (meta &form) {:doc doc} opts)]
     `(test-case ~(find-locals &env)
 		(fn ~(find-local-binding-forms &env) ~@body) ~metadata)))


stub out upload to s3

stub out upload to s3

--- src/cap_and_send/core.clj
+++ src/cap_and_send/core.clj
@@ -90,6 +90,16 @@
   (fs/delete-dir dir)
   (fs/mkdir dir))

+(def s3-upload-chan (chan))
+
+(defn s3-upload [filename] ""
+  (println "uploading to s3: " filename))
+
+(go-loop []
+  (let [file (<! s3-upload-chan)]
+    (s3-upload file))
+  (recur))
+
 (defn -main
   "I don't do a whole lot ... yet."
   [cap-time-secs clip-interval-ms fps frame-dir clip-dir intermediate-dir s3-upload-dir]
@@ -109,5 +119,6 @@
           (do
             (Thread/sleep (read-string clip-interval-ms))
             (do-clip fps frame-dir clip-dir (str s3-upload-dir "/" i ".mp4"))
+            (>!! s3-upload-chan (str s3-upload-dir "/" i ".mp4"))
             )))
       ))


altering of tree in progress (note, tree related tests dont pass yet)

--- src/clj/minijava/tree.clj
+++ src/clj/minijava/tree.clj
@@ -7,17 +7,29 @@
 (defprotocol Treeable
   (tree [this frame]))

+(def *methods* (atom (hash-map)))
+
+(defn addMethod [name method frame]
+	nil;;(reset! *methods* (merge @*methods* [name {:method method :frame frame}]))
+)
+
 (defn binop
   "Quick BinaryOp for objects with e1 and e2 fields."
   [op x frame]
   (BinaryOp op (-> x .e1 (tree frame) unEx)
             (-> x .e2 (tree frame) unEx)))

+(defn apply-tree [prog]
+	(tree prog nil)
+		@*methods*
+)
+
 (defn tree-prog
   "Walks through a program, applying tree."
   [seq]
   (let [frame (new-x86 0 [] nil)]
-    (for [s seq] (tree s frame))))
+    (for [s seq] (tree s frame)))
+)

 (defmacro deftree [type [obj frame] & body]
   `(extend-class ~type
@@ -80,13 +92,19 @@

 (deftree minijava.ast.ClassDecl
   [x frame]
-  {(.name x)
+ {(.name x)
    (let [obj (new-obj (for [v ($ (.vars x))] (.name v)))]
      (into {} (for [i ($ (.methods x))]
-                (let [args  (map #(. % name) (-> i .formals $ reverse))
-                      frame (new-x86 0 (cons "obj" args) obj)
-                      name  (str (.name x) "_" (.name i))]
-                  [name (Seq (cons (Label name) (tree i frame)))]))))})
+          (let [args (map #(. % name) (-> i .formals $ reverse))
+						frame (new-x86 0 (cons "obj" args) obj)
+						name (str (.name x) "_" (.name i))
+					ir (Seq (cons (Label name) (tree i frame)))]
+(addMethod name ir frame)
+))))})
+
+
+
+

 (deftree minijava.ast.IdentifierExp
   [x frame]
@@ -115,7 +133,12 @@

 (deftree minijava.ast.MainClass
   [x frame]
-  {"main" (tree (.statement x) (new-x86 0 ["obj"] nil))})
+ (let [f (new-x86 0 ["obj"] nil)]
+(addMethod "main" (tree (.statement x) f) f ))
+
+;; {"main" (tree (.statement x) (new-x86 0 ["obj"] nil))}
+
+)

 (deftree minijava.ast.MethodDecl
   [x frame]


oops, fix wtf formatter

oops, fix wtf formatter

--- src/clj/tictag/server.clj
+++ src/clj/tictag/server.clj
@@ -21,7 +21,7 @@
             [clojure.spec.alpha :as s]))

 (taoensso.timbre/refer-timbre)
-(def wtf (f/formatter "yyyy-MM-dd HH:MM:SS"))
+(def wtf (f/formatter "yyyy-MM-dd HH:mm:SS"))

 (def UNAUTHORIZED
   {:status 401


Fix reading of keywords with namespace

Fix reading of keywords with namespace

--- src/cljs/cljs/reader.cljs
+++ src/cljs/cljs/reader.cljs
@@ -254,7 +254,7 @@
   (let [token (read-token reader (read-char reader))]
     (if (gstring/contains token "/")
       (keyword (subs token 0 (.indexOf token "/"))
-              (subs (inc (.indexOf token "/")) (.length token)))
+               (subs token (inc (.indexOf token "/")) (.length token)))
       (keyword token))))

 (defn desugar-meta


rename local var: locs, not nodes (yet)

rename local var: locs, not nodes (yet)

--- src/cljs/greffe/core.cljs
+++ src/cljs/greffe/core.cljs
@@ -32,18 +32,18 @@
                               zip/xml-zip)]
                 (om/transact! app
                   (fn [a]
-                    (let [nodes (take-while
+                    (let [locs (take-while
                                   (complement zip/end?)
                                   (iterate zip/next doc-zip))]
                      (assoc a
                        :body
                        (zip/node
                         (first
-                          (filter #(= :body (:tag (zip/node %))) nodes)))
+                          (filter #(= :body (:tag (zip/node %))) locs)))
                        :head
                        (zip/node
                         (first
-                          (filter #(= :teiHeader (:tag (zip/node %))) nodes)))))))))
+                          (filter #(= :teiHeader (:tag (zip/node %))) locs)))))))))

            ;; get our doc
            (net/get-xml


Start using Layer records

Start using Layer records

--- src/cljs/nchart/core.cljs
+++ src/cljs/nchart/core.cljs
@@ -22,8 +22,8 @@

 (defrecord Node [id layer-id characters])
-
 (defrecord Edge [nodes characters])
+(defrecord Layer [id duration nodes edges])

 (defn- add-edge [graph last-node node edge-characters]
@@ -139,10 +139,10 @@
   [graph input-layer]
   (let [layers (:layers graph)
         layer-id (count layers)
-        layer {:id layer-id
-               :duration (input-layer :duration)
-               :nodes []
-               :edges []}]
+        layer (->Layer layer-id
+                       (input-layer :duration)
+                       []
+                       [])]
     (loop [g (update-in graph [:layers] conj layer)
            input-groups (input-layer :groups)]
       (if (empty? input-groups)


Moar.

Moar.

--- src/clojurecraft/core.clj
+++ src/clojurecraft/core.clj
@@ -327,6 +327,11 @@
   (-write-int conn z)
   (-write-int conn sounddata))

+(defn write-packet-newinvalidstate [conn {reason :reason}]
+  (-write-byte conn (:newinvalidstate packet-ids))
+
+  (-write-byte conn reason))
+

 ; Writing Wrappers -----------------------------------------------------------------
 (defn flushc [conn]
@@ -359,6 +364,7 @@
     :blockchange          (write-packet-blockchange conn payload)
     :explosion            (write-packet-explosion conn payload)
     :soundeffect          (write-packet-soundeffect conn payload)
+    :newinvalidstate      (write-packet-newinvalidstate conn payload)

     )
   (flushc conn))
@@ -708,6 +714,10 @@
     :y (-read-byte conn)
     :z (-read-int conn)
     :sounddata (-read-int conn)))
+
+(defn read-packet-newinvalidstate [conn]
+  (assoc {}
+    :reason (-read-byte conn)))

 ; Reading Wrappers -----------------------------------------------------------------
@@ -758,6 +768,7 @@
         :playnoteblock             (read-packet-playnoteblock conn)
         :explosion                 (read-packet-explosion conn)
         :soundeffect               (read-packet-soundeffect conn)
+        :newinvalidstate           (read-packet-newinvalidstate conn)

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


Fixed issue #51: Add following product/release: RHEL 6.7 Resilient Storage.

--- src/clouseau/products.clj
+++ src/clouseau/products.clj
@@ -69,6 +69,11 @@
          :subprotocol "sqlite"
          :subname     "packages/rhel67_lb/primary.sqlite"
      }]
+     ["RHEL 6 Resilient Storage"
+        {:classname   "org.sqlite.JDBC"
+         :subprotocol "sqlite"
+         :subname     "packages/rhel67_rs/primary.sqlite"
+     }]
      ["RHEL 7"
         {:classname   "org.sqlite.JDBC"
          :subprotocol "sqlite"


Update copyright year on core ns.

Update copyright year on core ns.

--- src/bide/core.cljs
+++ src/bide/core.cljs
@@ -1,4 +1,4 @@
-;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
+;; Copyright (c) 2016-2017 Andrey Antukh <niwi@niwi.nz>
 ;; All rights reserved.
 ;;
 ;; Redistribution and use in source and binary forms, with or without


Removed println when closing server

Removed println when closing server

--- src/fake_http/core.clj
+++ src/fake_http/core.clj
@@ -138,7 +138,6 @@
 (defrecord NanoFakeServer [nano-server routes]
   Closeable
   (close [_]
-    (println "Closing" (.getListeningPort nano-server))
     (.stop nano-server)))

 (defn start!


Helper func vis-add-ch.

Helper func vis-add-ch.

--- src/cbfg/core.cljs
+++ src/cbfg/core.cljs
@@ -40,14 +40,20 @@

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

+(defn vis-add-ch [vis ch]
+  (swap! vis #(update-in % [:chs ch]
+                           (fn [v]
+                             (if (nil? v)
+                               {:id ((:gen-id @vis)) :msgs {}}
+                               v)))))
+
 (def vis-event-handlers
   {"ago"
    {:beg (fn [vis actx args]
            (let [[child-actx] args]
              (swap! vis #(assoc-in % [:actxs child-actx]
                                    {:children {} :wait-chs {}}))
-             (swap! vis #(assoc-in % [:actxs actx :children child-actx]
-                                   true))))
+             (swap! vis #(assoc-in % [:actxs actx :children child-actx] true))))
     :end (fn [vis actx args]
            (let [[child-actx result] args]
              (swap! vis #(dissoc-in % [:actxs child-actx]))
@@ -61,11 +67,7 @@
    {:beg (fn [vis actx args]
            (let [[ch] args]
              (swap! vis #(assoc-in % [:actxs actx :wait-chs ch] :take))
-             (swap! vis #(update-in % [:chs ch]
-                                    (fn [v]
-                                      (if (nil? v)
-                                        {:id ((:gen-id @vis)) :msgs {}}
-                                        (assoc-in v [:msgs msg] true)))))))
+             (vis-add-ch vis ch)))
     :end (fn [vis actx args]
            (let [[ch result] args]
              (swap! vis #(dissoc-in % [:actxs actx :wait-chs ch]))))}
@@ -73,11 +75,8 @@
    {:beg (fn [vis actx args]
            (let [[ch msg] args]
              (swap! vis #(assoc-in % [:actxs actx :wait-chs ch] :put))
-             (swap! vis #(update-in % [:chs ch]
-                                    (fn [v]
-                                      (if (nil? v)
-                                        {:id ((:gen-id @vis)) :msgs {msg true}}
-                                        (assoc-in v [:msgs msg] true)))))))
+             (vis-add-ch vis ch)
+             (swap! vis #(assoc-in % [:chs ch :msgs msg] true))))
     :end (fn [vis actx args]
            (let [[ch msg result] args]
              (swap! vis #(dissoc-in % [:actxs actx :wait-chs ch]))))}
@@ -130,8 +129,10 @@
         w [{:gen-id gen-id
             :event-ch event-ch}]
         root-actx (atom nil)
-        vis (atom {:actxs {} ; {actx -> {:children {}, :wait-chs {}}}.
-                   :chs {}   ; {ch -> {:id (gen-id), :msgs {}}}.
+        vis (atom {:actxs {} ; {actx -> {:children {child-actx -> true},
+                             ;           :wait-chs {ch -> (:take|:put)}}}.
+                   :chs {}   ; {ch -> {:id (gen-id),
+                             ;         :msgs {msg -> true}}}.
                    :gen-id gen-id})]
     (go-loop [num-events 0]
       (let [tdv @event-delay]


First attempt at vis-html.

First attempt at vis-html.

--- src/cbfg/core.cljs
+++ src/cbfg/core.cljs
@@ -78,13 +78,14 @@
            (let [[chs result] args] 2))}})

 (defn vis-html [vis actx]
-  (let [d (get-in vis [:actxs actx])]
-    (conj "
" (last actx)
-          "
"
-          (map #(conj "
" (vis-html vis %) "
")
-               (:children d))
-          "
"
-          "
")))
+  (if actx
+    ["
" (rest actx)
+     "
"
+     (map (fn [child-actx] ["
" (vis-html vis child-actx) "
"])
+          (sort (keys (get-in vis [:actxs actx :children]))))
+     "
"
+     "
"]
+    "no actx"))

 (defn vis-init [cmds cmd-handlers]
   (let [vis (atom {:actxs {}}) ; [actx -> {:children {}, :want-chs {}}].
@@ -92,6 +93,7 @@
         event-delay (atom 0)
         event-ch (chan)
         last-id (atom 0)
+        root-actx (atom nil)
         w [{:gen-id #(swap! last-id inc)
             :event-ch event-ch}]]
     (go-loop [num-events 0]
@@ -102,8 +104,9 @@
             [verb step & args] event
             vis-event-handler (get (get vis-event-handlers verb) step)]
         (vis-event-handler vis actx args)
-        (set-el-innerHTML "event" [num-events @vis])
-        (set-el-innerHTML "vis-html" "hello")
+        (set-el-innerHTML "vis-html"
+                          (apply str
+                                 (flatten (vis-html @vis @root-actx))))
         (set-el-innerHTML "vis"
                           (str "<circle cx='"
                                (mod num-events 500)
@@ -112,6 +115,7 @@
                                " fill='red'/>")))
       (recur (inc num-events)))
     (ago w-actx w
+         (reset! root-actx w-actx)
          (let [in (achan-buf w-actx 100)
                out (achan-buf w-actx 1)
                fdp (make-fenced-pump w-actx in out @max-inflight)


Renamed to run-control-ch.

Renamed to run-control-ch.

--- src/cbfg/core.cljs
+++ src/cbfg/core.cljs
@@ -180,10 +180,10 @@
                       "pause"    #(reset! event-delay -1)
                       "step"     #(do (reset! event-delay -1)
                                       (put! step-ch true))}]
-    (go-loop [run-control-events (merge (map #(listen (gdom/getElement %) "click")
-                                             (keys run-controls)))]
-      ((get run-controls (.-id (.-target (<! run-control-events)))))
-      (recur run-control-events))
+    (go-loop [run-control-ch (merge (map #(listen (gdom/getElement %) "click")
+                                         (keys run-controls)))]
+      ((get run-controls (.-id (.-target (<! run-control-ch)))))
+      (recur run-control-ch))
     (go-loop [num-events 0]
       (let [ed @event-delay]
         (when (> ed 0)


disable anti-forgery

disable anti-forgery

--- src/jarkeeper/core.clj
+++ src/jarkeeper/core.clj
@@ -235,7 +235,7 @@
      (wrap-json-response)
      (wrap-resource "public")
      (wrap-base-url)
-     (wrap-defaults site-defaults)))
+     (wrap-defaults (assoc-in site-defaults [:security :anti-forgery] false))))

 (defn -main [& args]
   (let [ip (get (System/getenv) "OPENSHIFT_CLOJURE_HTTP_IP" "0.0.0.0")


uses the 'exit' method of leiningen.core.main in order to report a non-zero exit code

--- src/leiningen/spec.clj
+++ src/leiningen/spec.clj
@@ -1,6 +1,7 @@
 (ns leiningen.spec
   (:use
-    [clojure.java.io :only [file]])
+    [clojure.java.io :only [file]]
+    [leiningen.core.main :only [exit]])
   (:import
     [java.io BufferedInputStream]))

@@ -46,4 +47,4 @@
   (let [speclj-args (cons "-c" args)
         classpath (compute-classpath-string project)
         jvm-args ["-cp" classpath "-Dspeclj.invocation=lein spec"]]
-    (java jvm-args "speclj.main" speclj-args (:root project))))
+    (exit (java jvm-args "speclj.main" speclj-args (:root project)))))


Flush output so the green dots show up on time

--- src/leiningen/spec.clj
+++ src/leiningen/spec.clj
@@ -7,6 +7,7 @@
     (loop [b (.read input)]
       (when-not (= -1 b)
         (.write out b)
+        (.flush out)
         (recur (.read input))))))

 (defn- java [jvm-args main-class args working-directory]


Adding convenience :bool return key for 'git function.

--- src/leiningen/voom.clj
+++ src/leiningen/voom.clj
@@ -33,7 +33,10 @@
                     (str "--work-tree=" (.getParent gitdir))])
         all-args (concat dir-args subcmd)
         ;; _ (prn :calling (doall (cons 'git all-args)))
-        {:keys [exit] :as rtn} (apply sh "git" all-args)]
+        {:keys [exit] :as rtn} (apply sh "git" all-args)
+        rtn (assoc rtn :bool (if (zero? (:exit rtn))
+                               true
+                               false))]
     (when-not (ok-statuses exit)
       (throw (ex-info "git error" (assoc rtn :git all-args))))
     (assoc rtn :lines (when (not= "\n" (:out rtn))


cleaned up ext pre/post process code a bit

--- src/duffel/ext.clj
+++ src/duffel/ext.clj
@@ -24,31 +24,30 @@
 ;
 ; Actual processessing - Where the magic happens

+(defn gen-process-structs
+    "Goes through the dir-tree and, using tree-map, calls dir-fn on all directories
+    and file-fn on all files"
+    [dir-tree dir-fn file-fn]
+    [dir-tree]
+    (dfs-util/tree-map (fn [d _ _]
+        (let [ext (ext-instance (first d))
+              processed-d (dir-fn ext d)
+              processed-root (first processed-d)]
+            (cons processed-root
+                (map #(if (seq? %) % (file-fn (ext-instance %) %)) (rest processed-d))))
+    ) dir-tree))
+
 (defn pre-process
     "Goes through the dir-tree and, using tree-map, calls preprocess-dir on all directories
     and preprocess-file on all files"
     [dir-tree]
-    (dfs-util/tree-map (fn [d _ _]
-        (let [ext (ext-instance (first d))
-              processed-d (preprocess-dir ext d)
-              processed-root (first processed-d)]
-            (cons processed-root
-                (map #(if (seq? %) % (preprocess-file (ext-instance %) %)) (rest processed-d))))
-    ) dir-tree))
+    (gen-process-structs dir-tree preprocess-dir preprocess-file))

-;I'll consolidate all these process functions once I figure out how I wanna do the detecting extension
-;and deciding on the function call based on that
 (defn post-template-process
     "Goes through the dir-tree and, using tree-map, calls postprocess-dir on all directories
     and preprocess-file on all files"
     [dir-tree]
-    (dfs-util/tree-map (fn [d _ _]
-        (let [ext (ext-instance (first d))
-              processed-d (postprocess-dir ext d)
-              processed-root (first processed-d)]
-            (cons processed-root
-                (map #(if (seq? %) % (postprocess-file (ext-instance %) %)) (rest processed-d))))
-    ) dir-tree))
+    (gen-process-structs dir-tree postprocess-dir postprocess-file))

 (defn process
     [dir-tree]


head added, but not turning on

head added, but not turning on

--- src/lights/my_show.clj
+++ src/lights/my_show.clj
@@ -59,8 +59,11 @@
                     ;;       to something descriptive and in your own style:
                     (show/show :universes [1] :description "My Show"))))

+  ;; 2DO: find what "rgb-1" means and where to look for documentation
   (show/patch-fixture! :rgb-1 (my-rgb) 1 1)
-  (show/patch-fixture! :head-1 (head280) 1 220)
+
+  ;; Code below isn't working :(
+  ;; (show/patch-fixture! :head-1 (head280) 1 220)

   ;; Return the show's symbol, rather than the actual map, which gets huge with
   ;; all the expanded, patched fixtures in it.


Now have names already in ctx, can just extract objs to get rooms.

--- src/isla/story.clj
+++ src/isla/story.clj
@@ -47,17 +47,13 @@
 (def room-defaults ["" "" [] :undefined])

 (defn init-story [story-str]
-  (let [env (interpreter/interpret
-             (parser/parse story-str)
-             (library/get-initial-env types (get-story-ctx)))
   (let [raw-env (interpreter/interpret
                  (parser/parse story-str)
                  (library/get-initial-env types (get-story-ctx)))
         env (assoc raw-env :ctx (name-into-objs (:ctx raw-env)))
         ctx (interpreter/resolve- (:ctx env) env)

-        rooms (seq-to-hash (name-into-objs
-                            (extract-by-class ctx (:type (get types "room")))) :name)
+        rooms (extract-by-class ctx (:type (get types "room")))
         player (val (first (extract-by-class ctx (:type (get types "_player")))))]
     (Story. player rooms)))