refactor using a threading macro (->>)

refactor using a threading macro (->>)

--- src/babel/italiano/morphology.cljc
+++ src/babel/italiano/morphology.cljc
@@ -1405,346 +1405,346 @@
           (let [lexemes (get lexicon k)
                 lexeme-kv [k lexemes]]
             (if lexemes
-              (let [result (mapcat (fn [path-and-merge-fn]
-                                     (let [path (:path path-and-merge-fn)
-                                           surface-form-fn (if (:surface-form path-and-merge-fn)
-                                                             (:surface-form path-and-merge-fn)
-                                                             (fn [lexeme]
-                                                               (get-in lexeme path :none)))
-                                           merge-fn (:merge-fn path-and-merge-fn)]
-                                       ;; a lexeme-kv is a pair of a key and value. The key is a string (the word's surface form)
-                                       ;; and the value is a list of lexemes for that string.
-                                       (log/trace (str "lexeme key:" k))
-                                       (log/trace (str (first lexeme-kv) " generating exception for path: " path))
-                                       (mapcat (fn [lexeme]
-                                                 ;; this is where a unify/dissoc that supported
-                                                 ;; non-maps like :top and :fail, would be useful:
-                                                 ;; would not need the (if (not (fail? lexeme)..)) check
-                                                 ;; to avoid a difficult-to-understand "java.lang.ClassCastException:
-                                                 ;; clojure.lang.Keyword cannot be cast to clojure.lang.IPersistentMap" error.
-                                                 (let [debug (log/debug (str "lexeme: " lexeme))
-                                                       lexeme (cond (= lexeme :fail)
-                                                                    :fail
-                                                                    (= lexeme :top)
-                                                                    :top
-                                                                    true
-                                                                    lexeme)]
-                                                                    ;; not copying this time
-;;                                                                    (dissoc (copy lexeme) :serialized))]
-                                                   (if (not (= :none (get-in lexeme path :none)))
-                                                     (do (log/debug (str (first lexeme-kv) " generating lexeme exceptional surface form: " (surface-form-fn lexeme)))
-                                                         (list {(surface-form-fn lexeme)
-                                                                [(reduce
-                                                                  (fn [a b]
-                                                                    (cond
-                                                                      (= a :fail)
-                                                                      (do
-                                                                        (log/warn (str ":fail in exception rule:"
-                                                                                (:label path-and-merge-fn)
-                                                                                "; lexeme's italiano:"
-                                                                                (strip-refs (get-in lexeme [:italiano]))))
-                                                                        :fail)
-                                                                      (= b :fail)
-                                                                      (do
-                                                                        (log/warn (str ":fail in exception rule:"
-                                                                                (:label path-and-merge-fn)
-                                                                                "; lexeme:"
-                                                                                (or (strip-refs (get-in lexeme [:italiano :italiano]))
-                                                                                (strip-refs (get-in lexeme [:italiano])))))
-                                                                        :fail)
-                                                                      true
-                                                                      (unify a b)))
-                                                                  [(dissoc-paths lexeme [[:italiano :italiano]])
-                                                                   (merge-fn lexeme)
-                                                                   {:italiano {:infinitive k
-                                                                               :exception true}}])]})))))
-                                               lexemes)))
-                                   [
-                                    ;; 1. past-tense exceptions
-                                    {:path [:italiano :passato]
-                                     :label "past-tense exception"
-                                     :merge-fn
-                                     (fn [val]
-                                       {:italiano {:infl :past
-                                                   :italiano (get-in val [:italiano :passato] :nothing)}})}
-
-                                    ;; 1.5 imperfect
-                                    {:path [:italiano :imperfect :1sing]
-                                     :label "imperfect 1sing"
-                                     :merge-fn
-                                     (fn [val]
-                                       {:italiano {:infl :imperfect
-                                                   :italiano (get-in val [:italiano :imperfect :1sing] :nothing)
-                                                   :agr {:number :sing
-                                                         :person :1st}}})}
-                                    {:path [:italiano :imperfect :2sing]
-                                     :label "imperfect 2sing"
-                                     :merge-fn
-                                     (fn [val]
-                                       {:italiano {:infl :imperfect
-                                                   :italiano (get-in val [:italiano :imperfect :2sing] :nothing)
-                                                   :agr {:number :sing
-                                                         :person :2nd}}})}
-
-                                    {:path [:italiano :imperfect :3sing]
-                                     :label "imperfect 3sing"
-                                     :merge-fn
-                                     (fn [val]
-                                       {:italiano {:infl :imperfect
-                                                   :italiano (get-in val [:italiano :imperfect :3sing] :nothing)
-                                                   :agr {:number :sing
-                                                         :person :3rd}}})}
-
-                                    {:path [:italiano :imperfect :1plur]
-                                     :label "imperfect 1plur"
-                                     :merge-fn
-                                     (fn [val]
-                                       {:italiano {:infl :imperfect
-                                                   :italiano (get-in val [:italiano :imperfect :1plur] :nothing)
-                                                   :agr {:number :plur
-                                                         :person :1st}}})}
-
-                                    {:path [:italiano :imperfect :2plur]
-                                     :label "imperfect 2plur"
-                                     :merge-fn
-                                     (fn [val]
-                                       {:italiano {:infl :imperfect
-                                                   :italiano (get-in val [:italiano :imperfect :2plur] :nothing)
-                                                   :agr {:number :plur
-                                                         :person :2nd}}})}
-
-                                    {:path [:italiano :imperfect :3plur]
-                                     :label "imperfect 3plur"
-                                     :merge-fn
-                                     (fn [val]
-                                       {:italiano {:infl :imperfect
-                                                   :italiano (get-in val [:italiano :imperfect :3plur] :nothing)
-                                                   :agr {:number :plur
-                                                         :person :3rd}}})}
-
-                                    ;; 2. present-tense exceptions
-                                    {:path [:italiano :present :1sing]
-                                     :label "present 1sing"
-                                     :merge-fn
-                                     (fn [val]
-                                       {:italiano {:infl :present
-                                                   :italiano (get-in val [:italiano :present :1sing] :nothing)
-                                                   :agr {:number :sing
-                                                         :person :1st}}})}
-                                    {:path [:italiano :present :2sing]
-                                     :label "present 2sing"
-                                     :merge-fn
-                                     (fn [val]
-                                       {:italiano {:infl :present
-                                                   :italiano (get-in val [:italiano :present :2sing] :nothing)
-                                                   :agr {:number :sing
-                                                         :person :2nd}}})}
-
-                                    {:path [:italiano :present :3sing]
-                                     :label "present 3sing"
-                                     :merge-fn
-                                     (fn [val]
-                                       {:italiano {:infl :present
-                                                   :italiano (get-in val [:italiano :present :3sing] :nothing)
-                                                   :agr {:number :sing
-                                                         :person :3rd}}})}
-
-                                    {:path [:italiano :present :1plur]
-                                     :label "present 1plur"
-                                     :merge-fn
-                                     (fn [val]
-                                       {:italiano {:infl :present
-                                                   :italiano (get-in val [:italiano :present :1plur] :nothing)
-                                                   :agr {:number :plur
-                                                         :person :1st}}})}
-
-                                    {:path [:italiano :present :2plur]
-                                     :label "present 2plur"
-                                     :merge-fn
-                                     (fn [val]
-                                       {:italiano {:infl :present
-                                                   :italiano (get-in val [:italiano :present :2plur] :nothing)
-                                                   :agr {:number :plur
-                                                         :person :2nd}}})}
-
-                                    {:path [:italiano :present :3plur]
-                                     :label "present 3plur"
-                                     :merge-fn
-                                     (fn [val]
-                                       {:italiano {:infl :present
-                                                   :italiano (get-in val [:italiano :present :3plur] :nothing)
-                                                   :agr {:number :plur
-                                                         :person :3rd}}})}
-
-                                    ;; 2.1. present tense boot-stem
-                                    (let [surface-form (fn [val] (str (get-in val [:italiano :boot-stem1]) "o"))]
-                                      {:path [:italiano :boot-stem1]
-                                       :label "present boot-stem1: o"
-                                       :surface-form surface-form
-                                       :merge-fn
-                                       (fn [val]
-                                         {:italiano {:infl :present
-                                                     :italiano (surface-form val)
-                                                     :agr {:number :sing
-                                                           :person :1st}}})})
-
-                                    (let [surface-form (fn [val] (str (get-in val [:italiano :boot-stem1]) "i"))]
-                                      {:path [:italiano :boot-stem1]
-                                       :label "present boot-stem1: i"
-                                       :surface-form surface-form
-                                       :merge-fn
-                                       (fn [val]
-                                         {:italiano {:infl :present
-                                                     :italiano (surface-form val)
-                                                     :agr {:number :sing
-                                                           :person :2nd}}})})
-
-                                    (let [surface-form (fn [val] (str (get-in val [:italiano :boot-stem1]) "e"))]
-                                      {:path [:italiano :boot-stem1]
-                                       :label "present boot-stem1: e"
-                                       :surface-form surface-form
-                                       :merge-fn
-                                       (fn [val]
-                                         {:italiano {:infl :present
-                                                     :italiano (surface-form val)
-                                                     :agr {:number :sing
-                                                           :person :3rd}}})})
-
-                                    (let [surface-form (fn [val] (str (get-in val [:italiano :boot-stem1]) "ono"))]
-                                      {:path [:italiano :boot-stem1]
-                                       :label "present boot-stem1: ono"
-                                       :surface-form surface-form
-                                       :merge-fn
-                                       (fn [val]
-                                         {:italiano {:infl :present
-                                                     :italiano (surface-form val)
-                                                     :agr {:number :plur
-                                                           :person :3rd}}})})
-
-                                    ;; 3. future-tense exceptions
-                                    {:path [:italiano :future :1sing]
-                                     :label "future 1sing"
-                                     :merge-fn
-                                     (fn [val]
-                                       {:italiano {:infl :future
-                                                   :italiano (get-in val [:italiano :future :1sing] :nothing)
-                                                   :agr {:number :sing
-                                                         :person :1st}}})}
-                                    {:path [:italiano :future :2sing]
-                                     :label "future 2sing"
-                                     :merge-fn
-                                     (fn [val]
-                                       {:italiano {:infl :future
-                                                   :italiano (get-in val [:italiano :future :2sing] :nothing)
-                                                   :agr {:number :sing
-                                                         :person :2nd}}})}
-                                    {:path [:italiano :future :3sing]
-                                     :label "future 3sing"
-                                     :merge-fn
-                                     (fn [val]
-                                       {:italiano {:infl :future
-                                                   :italiano (get-in val [:italiano :future :3sing] :nothing)
-                                                   :agr {:number :sing
-                                                         :person :3rd}}})}
-                                    {:path [:italiano :future :1plur]
-                                     :label "future 1plur"
-                                     :merge-fn
-                                     (fn [val]
-                                       {:italiano {:infl :future
-                                                   :italiano (get-in val [:italiano :future :1plur] :nothing)
-                                                   :agr {:number :plur
-                                                         :person :1st}}})}
-                                    {:path [:italiano :future :2plur]
-                                     :label "future 2plur"
-                                     :merge-fn
-                                     (fn [val]
-                                       {:italiano {:infl :future
-                                                   :italiano (get-in val [:italiano :future :2plur] :nothing)
-                                                   :agr {:number :plur
-                                                         :person :2nd}}})}
-                                    {:path [:italiano :future :3plur]
-                                     :label "future 3plur"
-                                     :merge-fn
-                                     (fn [val]
-                                       {:italiano {:infl :future
-                                                   :italiano (get-in val [:italiano :future :3plur] :nothing)
-                                                   :agr {:number :plur
-                                                         :person :3rd}}})}
-
-                                    ;; 4. conditional-tense exceptions
-                                    {:path [:italiano :conditional :1sing]
-                                     :label "conditional 1sing"
-                                     :merge-fn
-                                     (fn [val]
-                                       {:italiano {:infl :conditional
-                                                   :italiano (get-in val [:italiano :conditional :1sing] :nothing)
-                                                   :agr {:number :sing
-                                                         :person :1st}}})}
-                                    {:path [:italiano :conditional :2sing]
-                                     :label "conditional 2sing"
-                                     :merge-fn
-                                     (fn [val]
-                                       {:italiano {:infl :conditional
-                                                   :italiano (get-in val [:italiano :conditional :2sing] :nothing)
-                                                   :agr {:number :sing
-                                                         :person :2nd}}})}
-                                    {:path [:italiano :conditional :3sing]
-                                     :label "conditional 3sing"
-                                     :merge-fn
-                                     (fn [val]
-                                       {:italiano {:infl :conditional
-                                                   :italiano (get-in val [:italiano :conditional :3sing] :nothing)
-                                                   :agr {:number :sing
-                                                         :person :3rd}}})}
-                                    {:path [:italiano :conditional :1plur]
-                                     :label "conditional 1plur"
-                                     :merge-fn
-                                     (fn [val]
-                                       {:italiano {:infl :conditional
-                                                   :italiano (get-in val [:italiano :conditional :1plur] :nothing)
-                                                   :agr {:number :plur
-                                                         :person :1st}}})}
-                                    {:path [:italiano :conditional :2plur]
-                                     :label "conditional 2plur"
-                                     :merge-fn
-                                     (fn [val]
-                                       {:italiano {:infl :conditional
-                                                   :italiano (get-in val [:italiano :conditional :2plur] :nothing)
-                                                   :agr {:number :plur
-                                                         :person :2nd}}})}
-                                    {:path [:italiano :conditional :3plur]
-                                     :label "conditional 3plur"
-                                     :merge-fn
-                                     (fn [val]
-                                       {:italiano {:infl :conditional
-                                                   :italiano (get-in val [:italiano :conditional :3plur] :nothing)
-                                                   :agr {:number :plur
-                                                         :person :3rd}}})}
-                                    ;; adjectives
-                                    {:path [:italiano :masc :plur]
-                                     :merge-fn
-                                     (fn [val]
-                                       {:italiano {:agr {:gender :masc
-                                                         :number :plur}}})}
-
-                                    {:path [:italiano :fem :plur]
-                                     :merge-fn
-                                     (fn [val]
-                                       {:italiano {:agr {:gender :fem
-                                                         :number :plur}}})}
-                                    {:path [:italiano :fem :sing]
-                                     :merge-fn
-                                     (fn [val]
-                                       {:italiano {:agr {:gender :fem
-                                                         :number :sing}}})}
-                                    ;; nouns
-                                    {:path [:italiano :plur]
-                                     :merge-fn
-                                     (fn [val]
-                                       {:synsem {:cat :noun}
-                                        :italiano {:agr {:number :plur}}})}
-                                    ])]
-                result))))
+              (->> lexemes
+                   (mapcat (fn [path-and-merge-fn]
+                             (let [path (:path path-and-merge-fn)
+                                   surface-form-fn (if (:surface-form path-and-merge-fn)
+                                                     (:surface-form path-and-merge-fn)
+                                                     (fn [lexeme]
+                                                       (get-in lexeme path :none)))
+                                   merge-fn (:merge-fn path-and-merge-fn)]
+                               ;; a lexeme-kv is a pair of a key and value. The key is a string (the word's surface form)
+                               ;; and the value is a list of lexemes for that string.
+                               (log/trace (str "lexeme key:" k))
+                               (log/trace (str (first lexeme-kv) " generating exception for path: " path))
+                               (mapcat (fn [lexeme]
+                                         ;; this is where a unify/dissoc that supported
+                                         ;; non-maps like :top and :fail, would be useful:
+                                         ;; would not need the (if (not (fail? lexeme)..)) check
+                                         ;; to avoid a difficult-to-understand "java.lang.ClassCastException:
+                                         ;; clojure.lang.Keyword cannot be cast to clojure.lang.IPersistentMap" error.
+                                         (let [debug (log/debug (str "lexeme: " lexeme))
+                                               lexeme (cond (= lexeme :fail)
+                                                            :fail
+                                                            (= lexeme :top)
+                                                            :top
+                                                            true
+                                                            lexeme)]
+                                           ;; not copying this time
+                                           ;;                                                                    (dissoc (copy lexeme) :serialized))]
+                                           (if (not (= :none (get-in lexeme path :none)))
+                                             (do (log/debug (str (first lexeme-kv) " generating lexeme exceptional surface form: " (surface-form-fn lexeme)))
+                                                 (list {(surface-form-fn lexeme)
+                                                        [(reduce
+                                                          (fn [a b]
+                                                            (cond
+                                                              (= a :fail)
+                                                              (do
+                                                                (log/warn (str ":fail in exception rule:"
+                                                                               (:label path-and-merge-fn)
+                                                                               "; lexeme's italiano:"
+                                                                               (strip-refs (get-in lexeme [:italiano]))))
+                                                                :fail)
+                                                              (= b :fail)
+                                                              (do
+                                                                (log/warn (str ":fail in exception rule:"
+                                                                               (:label path-and-merge-fn)
+                                                                               "; lexeme:"
+                                                                               (or (strip-refs (get-in lexeme [:italiano :italiano]))
+                                                                                (strip-refs (get-in lexeme [:italiano])))))
+                                                                :fail)
+                                                              true
+                                                              (unify a b)))
+                                                          [(dissoc-paths lexeme [[:italiano :italiano]])
+                                                           (merge-fn lexeme)
+                                                           {:italiano {:infinitive k
+                                                                       :exception true}}])]})))))
+                                       lexemes)))
+                           [
+                            ;; 1. past-tense exceptions
+                            {:path [:italiano :passato]
+                             :label "past-tense exception"
+                             :merge-fn
+                             (fn [val]
+                               {:italiano {:infl :past
+                                           :italiano (get-in val [:italiano :passato] :nothing)}})}
+
+                            ;; 1.5 imperfect
+                            {:path [:italiano :imperfect :1sing]
+                             :label "imperfect 1sing"
+                             :merge-fn
+                             (fn [val]
+                               {:italiano {:infl :imperfect
+                                           :italiano (get-in val [:italiano :imperfect :1sing] :nothing)
+                                           :agr {:number :sing
+                                                 :person :1st}}})}
+                            {:path [:italiano :imperfect :2sing]
+                             :label "imperfect 2sing"
+                             :merge-fn
+                             (fn [val]
+                               {:italiano {:infl :imperfect
+                                           :italiano (get-in val [:italiano :imperfect :2sing] :nothing)
+                                           :agr {:number :sing
+                                                 :person :2nd}}})}
+
+                            {:path [:italiano :imperfect :3sing]
+                             :label "imperfect 3sing"
+                             :merge-fn
+                             (fn [val]
+                               {:italiano {:infl :imperfect
+                                           :italiano (get-in val [:italiano :imperfect :3sing] :nothing)
+                                           :agr {:number :sing
+                                                 :person :3rd}}})}
+
+                            {:path [:italiano :imperfect :1plur]
+                             :label "imperfect 1plur"
+                             :merge-fn
+                             (fn [val]
+                               {:italiano {:infl :imperfect
+                                           :italiano (get-in val [:italiano :imperfect :1plur] :nothing)
+                                           :agr {:number :plur
+                                                 :person :1st}}})}
+
+                            {:path [:italiano :imperfect :2plur]
+                             :label "imperfect 2plur"
+                             :merge-fn
+                             (fn [val]
+                               {:italiano {:infl :imperfect
+                                           :italiano (get-in val [:italiano :imperfect :2plur] :nothing)
+                                           :agr {:number :plur
+                                                 :person :2nd}}})}
+
+                            {:path [:italiano :imperfect :3plur]
+                             :label "imperfect 3plur"
+                             :merge-fn
+                             (fn [val]
+                               {:italiano {:infl :imperfect
+                                           :italiano (get-in val [:italiano :imperfect :3plur] :nothing)
+                                           :agr {:number :plur
+                                                 :person :3rd}}})}
+
+                            ;; 2. present-tense exceptions
+                            {:path [:italiano :present :1sing]
+                             :label "present 1sing"
+                             :merge-fn
+                             (fn [val]
+                               {:italiano {:infl :present
+                                           :italiano (get-in val [:italiano :present :1sing] :nothing)
+                                           :agr {:number :sing
+                                                 :person :1st}}})}
+                            {:path [:italiano :present :2sing]
+                             :label "present 2sing"
+                             :merge-fn
+                             (fn [val]
+                               {:italiano {:infl :present
+                                           :italiano (get-in val [:italiano :present :2sing] :nothing)
+                                           :agr {:number :sing
+                                                 :person :2nd}}})}
+
+                            {:path [:italiano :present :3sing]
+                             :label "present 3sing"
+                             :merge-fn
+                             (fn [val]
+                               {:italiano {:infl :present
+                                           :italiano (get-in val [:italiano :present :3sing] :nothing)
+                                           :agr {:number :sing
+                                                 :person :3rd}}})}
+
+                            {:path [:italiano :present :1plur]
+                             :label "present 1plur"
+                             :merge-fn
+                             (fn [val]
+                               {:italiano {:infl :present
+                                           :italiano (get-in val [:italiano :present :1plur] :nothing)
+                                           :agr {:number :plur
+                                                 :person :1st}}})}
+
+                            {:path [:italiano :present :2plur]
+                             :label "present 2plur"
+                             :merge-fn
+                             (fn [val]
+                               {:italiano {:infl :present
+                                           :italiano (get-in val [:italiano :present :2plur] :nothing)
+                                           :agr {:number :plur
+                                                 :person :2nd}}})}
+
+                            {:path [:italiano :present :3plur]
+                             :label "present 3plur"
+                             :merge-fn
+                             (fn [val]
+                               {:italiano {:infl :present
+                                           :italiano (get-in val [:italiano :present :3plur] :nothing)
+                                           :agr {:number :plur
+                                                 :person :3rd}}})}
+
+                            ;; 2.1. present tense boot-stem
+                            (let [surface-form (fn [val] (str (get-in val [:italiano :boot-stem1]) "o"))]
+                              {:path [:italiano :boot-stem1]
+                               :label "present boot-stem1: o"
+                               :surface-form surface-form
+                               :merge-fn
+                               (fn [val]
+                                 {:italiano {:infl :present
+                                             :italiano (surface-form val)
+                                             :agr {:number :sing
+                                                   :person :1st}}})})
+
+                            (let [surface-form (fn [val] (str (get-in val [:italiano :boot-stem1]) "i"))]
+                              {:path [:italiano :boot-stem1]
+                               :label "present boot-stem1: i"
+                               :surface-form surface-form
+                               :merge-fn
+                               (fn [val]
+                                 {:italiano {:infl :present
+                                             :italiano (surface-form val)
+                                             :agr {:number :sing
+                                                   :person :2nd}}})})
+
+                            (let [surface-form (fn [val] (str (get-in val [:italiano :boot-stem1]) "e"))]
+                              {:path [:italiano :boot-stem1]
+                               :label "present boot-stem1: e"
+                               :surface-form surface-form
+                               :merge-fn
+                               (fn [val]
+                                 {:italiano {:infl :present
+                                             :italiano (surface-form val)
+                                             :agr {:number :sing
+                                                   :person :3rd}}})})
+
+                            (let [surface-form (fn [val] (str (get-in val [:italiano :boot-stem1]) "ono"))]
+                              {:path [:italiano :boot-stem1]
+                               :label "present boot-stem1: ono"
+                               :surface-form surface-form
+                               :merge-fn
+                               (fn [val]
+                                 {:italiano {:infl :present
+                                             :italiano (surface-form val)
+                                             :agr {:number :plur
+                                                   :person :3rd}}})})
+
+                            ;; 3. future-tense exceptions
+                            {:path [:italiano :future :1sing]
+                             :label "future 1sing"
+                             :merge-fn
+                             (fn [val]
+                               {:italiano {:infl :future
+                                           :italiano (get-in val [:italiano :future :1sing] :nothing)
+                                           :agr {:number :sing
+                                                 :person :1st}}})}
+                            {:path [:italiano :future :2sing]
+                             :label "future 2sing"
+                             :merge-fn
+                             (fn [val]
+                               {:italiano {:infl :future
+                                           :italiano (get-in val [:italiano :future :2sing] :nothing)
+                                           :agr {:number :sing
+                                                 :person :2nd}}})}
+                            {:path [:italiano :future :3sing]
+                             :label "future 3sing"
+                             :merge-fn
+                             (fn [val]
+                               {:italiano {:infl :future
+                                           :italiano (get-in val [:italiano :future :3sing] :nothing)
+                                           :agr {:number :sing
+                                                 :person :3rd}}})}
+                            {:path [:italiano :future :1plur]
+                             :label "future 1plur"
+                             :merge-fn
+                             (fn [val]
+                               {:italiano {:infl :future
+                                           :italiano (get-in val [:italiano :future :1plur] :nothing)
+                                           :agr {:number :plur
+                                                 :person :1st}}})}
+                            {:path [:italiano :future :2plur]
+                             :label "future 2plur"
+                             :merge-fn
+                             (fn [val]
+                               {:italiano {:infl :future
+                                           :italiano (get-in val [:italiano :future :2plur] :nothing)
+                                           :agr {:number :plur
+                                                 :person :2nd}}})}
+                            {:path [:italiano :future :3plur]
+                             :label "future 3plur"
+                             :merge-fn
+                             (fn [val]
+                               {:italiano {:infl :future
+                                           :italiano (get-in val [:italiano :future :3plur] :nothing)
+                                           :agr {:number :plur
+                                                 :person :3rd}}})}
+
+                            ;; 4. conditional-tense exceptions
+                            {:path [:italiano :conditional :1sing]
+                             :label "conditional 1sing"
+                             :merge-fn
+                             (fn [val]
+                               {:italiano {:infl :conditional
+                                           :italiano (get-in val [:italiano :conditional :1sing] :nothing)
+                                           :agr {:number :sing
+                                                 :person :1st}}})}
+                            {:path [:italiano :conditional :2sing]
+                             :label "conditional 2sing"
+                             :merge-fn
+                             (fn [val]
+                               {:italiano {:infl :conditional
+                                           :italiano (get-in val [:italiano :conditional :2sing] :nothing)
+                                           :agr {:number :sing
+                                                 :person :2nd}}})}
+                            {:path [:italiano :conditional :3sing]
+                             :label "conditional 3sing"
+                             :merge-fn
+                             (fn [val]
+                               {:italiano {:infl :conditional
+                                           :italiano (get-in val [:italiano :conditional :3sing] :nothing)
+                                           :agr {:number :sing
+                                                 :person :3rd}}})}
+                            {:path [:italiano :conditional :1plur]
+                             :label "conditional 1plur"
+                             :merge-fn
+                             (fn [val]
+                               {:italiano {:infl :conditional
+                                           :italiano (get-in val [:italiano :conditional :1plur] :nothing)
+                                           :agr {:number :plur
+                                                 :person :1st}}})}
+                            {:path [:italiano :conditional :2plur]
+                             :label "conditional 2plur"
+                             :merge-fn
+                             (fn [val]
+                               {:italiano {:infl :conditional
+                                           :italiano (get-in val [:italiano :conditional :2plur] :nothing)
+                                           :agr {:number :plur
+                                                 :person :2nd}}})}
+                            {:path [:italiano :conditional :3plur]
+                             :label "conditional 3plur"
+                             :merge-fn
+                             (fn [val]
+                               {:italiano {:infl :conditional
+                                           :italiano (get-in val [:italiano :conditional :3plur] :nothing)
+                                           :agr {:number :plur
+                                                 :person :3rd}}})}
+                            ;; adjectives
+                            {:path [:italiano :masc :plur]
+                             :merge-fn
+                             (fn [val]
+                               {:italiano {:agr {:gender :masc
+                                                 :number :plur}}})}
+
+                            {:path [:italiano :fem :plur]
+                             :merge-fn
+                             (fn [val]
+                               {:italiano {:agr {:gender :fem
+                                                 :number :plur}}})}
+                            {:path [:italiano :fem :sing]
+                             :merge-fn
+                             (fn [val]
+                               {:italiano {:agr {:gender :fem
+                                                 :number :sing}}})}
+                            ;; nouns
+                            {:path [:italiano :plur]
+                             :merge-fn
+                             (fn [val]
+                               {:synsem {:cat :noun}
+                                :italiano {:agr {:number :plur}}})}
+                            ])))))
         (sort (keys lexicon)))))

 (defn phonize2 [lexicon]


refactored return statements for parsing thread tables

--- src/bonews_rest/scraper/forums.clj
+++ src/bonews_rest/scraper/forums.clj
@@ -17,8 +17,7 @@

 (defn get-thread-num-replies
   [col]
-  (let [replies (first (first (rest (first (rest (rest col))))))]
-  (Integer/parseInt replies)))
+  (Integer/parseInt (first (:content col))))

 (defn get-thread-last-update
   [col]
@@ -27,29 +26,29 @@
 (defn get-author-url
   [col]
   (let [title-node (html/select col [[:a (html/attr? :href)]])]
-  (:href (first (rest (first (rest (last title-node))))))))
+  (:href (:attrs (last title-node)))))

 (defn get-thread-author
   [col]
   (let [title-node (html/select col [[:a (html/attr? :href)]])]
-  (first (first (rest (last (last title-node)))))))
+  (first (:content (last title-node)))))

 (defn get-thread-title
   [col]
   (let [title-node (html/select col [:h4 [:a (html/attr? :href)]])]
-  (first (first (rest (first (rest (rest (first title-node)))))))))
+  (first (:content (first title-node)))))

 (defn get-thread-url
   [col]
   (let [title-node (html/select col [:h4 [:a (html/attr? :href)]])]
-  (:href (first (rest (first (rest (first title-node))))))))
+  (:href (:attrs (first title-node)))))

 (defn get-cols
   [row]
   (let [cols (rest (html/select row [:td]))]
     {:thread-url            (get-thread-url (first cols))
      :thread-title          (get-thread-title (first cols))
-     :thread-num-replies    (get-thread-num-replies (first (rest cols)))
+     :thread-num-replies    (get-thread-num-replies (fnext cols))
      :thread-last-update    (get-thread-last-update (last cols))
      :author                (get-thread-author (first cols))
      :author-url            (get-author-url (first cols))}))


Log the ssh command

Log the ssh command

--- src/circle/backend/action/bash.clj
+++ src/circle/backend/action/bash.clj
@@ -24,13 +24,14 @@
            instance-id# (-> build# (deref) :instance-ids (first))
            ip-addr# (ec2/public-ip instance-id#)
            ssh-map# (merge (-> build# (deref) :group :circle-node-spec) {:ip-addr ip-addr#})
+           cmd# (pallet.script/with-script-context (pallet.action-plan/script-template-for-server (-> build# (deref) :nodes (first)))
+                  (pallet.stevedore/with-script-language :pallet.stevedore.bash/bash
+                    (pallet.stevedore/script ("cd" (clj *pwd*))
+                                             ~@body)))
+           _# (build-log cmd#)
            result# (binding [ssh/handle-out build-log
                              ssh/handle-err build-log-error]
-                     (ssh/remote-exec ssh-map#
-                                      (pallet.script/with-script-context (pallet.action-plan/script-template-for-server (-> build# (deref) :nodes (first)))
-                                        (pallet.stevedore/with-script-language :pallet.stevedore.bash/bash
-                                          (pallet.stevedore/script ("cd" (clj *pwd*))
-                                                                   ~@body)))))]
+                     (ssh/remote-exec ssh-map# cmd#))]
        (when (and (not= 0 (-> result# :exit)) ~abort-on-nonzero)
          (action/abort! build# (str (quote ~body) "returned exit code" (-> result# :exit))))
        (action/add-action-result result#)


remove function wrap-system

remove function wrap-system

--- src/clj/om_next_leaflet/server.clj
+++ src/clj/om_next_leaflet/server.clj
@@ -29,7 +29,7 @@
 (defn api [req]
   (generate-response
    ((om/parser {:read parser/readf :mutate parser/mutatef})
-    {:state (:state req) :db (:db req)} (:remote (:transit-params req)))))
+    {:state (:state req) :db (:database system)} (:remote (:transit-params req)))))

 (defn index [req]
   (assoc (resource-response "index.html" {:root "public"})
@@ -45,22 +45,13 @@
       :api (api (assoc req :state state))
       nil)))

-(defn wrap-system
-  [handler system]
-  (fn [req]
-    (handler (assoc req
-                    :db (:database system)
-                    :system system))))
-
 (def app
-  (wrap-system
-   (-> handler
-       (wrap-resource "public")
-       wrap-reload
-       wrap-transit-response
-       wrap-transit-params
-       wrap-with-logger)
-   system))
+  (-> handler
+      (wrap-resource "public")
+      wrap-reload
+      wrap-transit-response
+      wrap-transit-params
+      wrap-with-logger))

 (defn create-database
   []


Add 30s timeout to request in fetch-json-data -function

--- src/clj/salava/badge/assertion.clj
+++ src/clj/salava/badge/assertion.clj
@@ -14,9 +14,11 @@
   (try+
     (:body
       (client/request
-        {:method      :get
-         :url         url
-         :as          :json}))
+        {:method         :get
+         :url            url
+         :as             :json
+         :socket-timeout 30000
+         :conn-timeout   30000}))
     (catch Object _
       {:error (t :badge/Errorfetchingjson)})))


fixed attributes conversion

fixed attributes conversion

--- src/cljs/om_converter/convert.cljs
+++ src/cljs/om_converter/convert.cljs
@@ -21,7 +21,7 @@
     attr))

 (defn translate-attributes [attrs]
-  (apply merge (for [[k v] attrs] {(translate-attribute k) v})))
+  (apply merge {} (for [[k v] attrs] {(translate-attribute k) v})))

 (defn- translate [item level]
   (if (string? item)
@@ -31,8 +31,8 @@
       (apply str
              "("
              dom-id
-             " "
-             (translate-attributes (or attributes {}))
+             " #js "
+             (pr-str (translate-attributes (or attributes {})))
              (translate-children children (+ 1 level))
              ")"))))


Fix typo.

Fix typo.

--- src/coming_soon/models/contact.clj
+++ src/coming_soon/models/contact.clj
@@ -5,11 +5,11 @@
           java.util.Calendar))

 ;; Redis "schema"
-;; <prefix>:coming-soon-id - increment counter
+;; <prefix>:coming-soon-id - a simple incrementing counter
 (def coming-soon-id (str prefix ":coming-soon-id"))
-;; <prefix>:coming-soon-contacts - contact hash by counter id key
+;; <prefix>:coming-soon-contacts - hash of all contacts by id
 (def coming-soon-contacts (str prefix ":coming-soon-contacts"))
-;; <prefix>:coming-soon-emails - id hashed by email key
+;; <prefix>:coming-soon-emails - hash of all ids, hashed by email (a secondary index)
 (def coming-soon-emails (str prefix ":coming-soon-emails"))

 (defn exists-by-email?
@@ -46,10 +46,20 @@
   []
   (with-car (car/hlen coming-soon-contacts)))

-;; TODO
-(defn all
-  "Return a vector of all the emails that have been collected so far."
-  [])
+(defn all-contacts
+  "Return all the contacts that have been collected so far in date of collection order."
+  []
+  (sort-by :updated-at (map read-string (with-car (car/hvals coming-soon-contacts)))))
+
+(defn all-emails
+  "Return all the emails that have been collected so far in date of collection order."
+  []
+  (map :email (all-contacts)))
+
+(defn all-referrers
+  "Return all the referral URLs and the # of referrals by that URL, in order of most referrals."
+  []
+  (sort-by last > (map identity (frequencies (map :referrer (all-contacts))))))

 ;; ISO 8601 timestamp
 (defn current-timestamp []


add persistence modules to dev profile

add persistence modules to dev profile

--- elephantdb-server/project.clj
+++ elephantdb-server/project.clj
@@ -7,7 +7,8 @@
                  [elephantdb/elephantdb-core "0.4.0-SNAPSHOT"]]
   :profiles {:dev
              {:dependencies
-              [[midje "1.5-alpha9"]]
+              [[elephantdb/elephantdb-leveldb "0.4.0-SNAPSHOT"]
+               [midje "1.5-alpha9"]]
               :plugins [[lein-midje "3.0-alpha4"]]}
              :provided
              {:dependencies


Updating version to 1.63.4-SNAPSHOT

Updating version to 1.63.4-SNAPSHOT

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -13,7 +13,7 @@
 ;; See the License for the specific language governing permissions and
 ;; limitations under the License.
 ;;
-(defproject cook "1.63.3"
+(defproject cook "1.63.4-SNAPSHOT"
   :description "This launches jobs on a Mesos cluster with fair sharing and preemption"
   :license {:name "Apache License, Version 2.0"}
   :dependencies [[org.clojure/clojure "1.10.3"]


Cleanup/refactor

Cleanup/refactor

--- env/dev/clj/gtfve/datomic.clj
+++ env/dev/clj/gtfve/datomic.clj
@@ -26,21 +26,21 @@

 (defn- drop-empty [hmap]
   (->> hmap
-       (filter (fn [[_ v]]
+       (remove (fn [[_ v]]
                  (try
-                   (not (empty? v))
+                   (empty? v)
                    (catch IllegalArgumentException e
-                     true))))
+                     false))))
        (into {})))

 (defn- assoc-temp-id [m]
   (assoc m :db/id (d/tempid :db.part/user)))

 (defn csv->maps
-  "Create a transaction from csv found in path. header-map is a map of strings
-  to keywords defining column to keyword mappings for the generated transaction
-  map. transform-vals is a map of keywords to functions defining function
-  transformations on values in the generated transaction map.
+  "Create a sequence of maps from csv found in path. header-map is a map of
+  strings to keywords defining column to keyword mappings for the generated
+  transaction map. transform-vals is a map of keywords to functions defining
+  function transformations on values in the generated transaction map.

   a,b,c  -> {:a 1 :b 2 :c 3}
   1,2,3"


transit dependencies

transit dependencies

--- Clojure-Websockets/MainApp/project.clj
+++ Clojure-Websockets/MainApp/project.clj
@@ -11,6 +11,8 @@
                  [org.clojure/tools.namespace "0.2.10"]
                  [ch.qos.logback/logback-classic "1.1.2"]
                  [com.taoensso/sente "1.4.1"]
+                 [com.cognitect/transit-clj  "0.8.259"]
+                 [com.cognitect/transit-cljs "0.8.205"]
                  [org.clojure/core.match "0.3.0-alpha4"]
                  [http-kit "2.1.19"]
                  [hiccup "1.0.5"]


Use clojure.string/replace instead of .replace

.replace invokes JavaScript's String.replace under CLJS, which
only replaces the first match, not all.

--- src/irresponsible/oolong/util.cljc
+++ src/irresponsible/oolong/util.cljc
@@ -1,5 +1,6 @@
 (ns irresponsible.oolong.util
-  (:require [com.stuartsierra.component :as cpt]))
+  (:require [com.stuartsierra.component :as cpt]
+            [clojure.string             :as string]))

 (defn fatal [message data]
   (-> (str "[FATAL] " message " " data)
@@ -19,7 +20,7 @@
       args: [sym]
       returns: atom"
      [sym]
-     (try (-> sym str (.replace "/" ".") (.replace "-" "_") js/eval atom)
+     (try (-> sym str (string/replace "/" ".") (string/replace "-" "_") js/eval atom)
         (catch js/Object e
           (fatal "Could not find var by symbol" {:got sym})))))


Correct primitive spelling

Correct primitive spelling

--- src/kixi/datastore/schemastore.clj
+++ src/kixi/datastore/schemastore.clj
@@ -27,7 +27,7 @@

 (s/def ::definition
   (s/cat :pairs (s/+ (s/cat :tag ::tag
-                            :type ::primative-schema))))
+                            :type ::primitive-schema))))

 (s/def ::list-spec
   (s/keys :req [::type ::definition]))
@@ -61,13 +61,13 @@
 (defmethod schema-type "string" [_]
   (s/keys :req [::type]))

-(s/def ::primative-schema
+(s/def ::primitive-schema
   (s/multi-spec schema-type ::type))

 (s/def ::schema
   (s/or
    :list ::list-spec
-   :primative ::primative-schema))
+   :primitive ::primitive-schema))

 (s/def ::type (set (conj (keys (methods schema-type))
                          "list")))


commeting out

commeting out

--- src/celestial/persistency.clj
+++ src/celestial/persistency.clj
@@ -34,8 +34,9 @@
     (map (partial apply hash-map) (partition 2 (wcar (car/hgetall h))) )))

-(new-type "z" {})
-(register-host "foo" "z" {:foo 1})
-(host "foo")
+(comment
+  (new-type "z" {})
+  (register-host "foo" "z" {:foo 1})
+  (host "foo"))


Undo tab animation hacks

Undo tab animation hacks

--- src/clj/gtfve/styles/core.clj
+++ src/clj/gtfve/styles/core.clj
@@ -34,10 +34,4 @@
     [:+
      [:.tab-content {:height "calc(100% - 43px)"}]]]
    [:.tab-content {:overflow :auto}
-    [:>
-     [:.tab-wrapper {:position :relative
-                     :height (percent 100)
-                     :padding (px 20)}
-      [:>
-       [:.tab-pane.fade.side {:position :absolute
-                              :display :block}]]]]]])
+    [:.tab-content-wrapper {:padding (px 20)}]]])


refactor ;)

refactor ;)

--- src/adulthood/core.clj
+++ src/adulthood/core.clj
@@ -1,12 +1,14 @@
 (ns adulthood.core
   (:gen-class)
-  (:require [clj-time.core :as t]))
+  (:require [clj-time.core :refer [in-days interval date-time]]))

-(require '[clj-time.core :as t])
+
+(defn time-til [when]
+  (in-days (interval (now) when)))

 (defn -main
   "Print how many days left until I turn 18."
   [& args]
   (println "You have"
-           (t/in-days (t/interval (t/now) (t/date-time 2015 7 27)))
-           "days remaining until adulthood."))+           (time-til (date-time 2015 7 27))
+           "days remaining until adulthood."))


Clean up identify-mapping

Clean up identify-mapping

Take advantage of the functions available for adding and removing global
handlers, rather than directly manipulating the data structure. Also
update a TODO with a better approach for avoiding blockage now that we
are moving to core.async everywhere.

--- src/afterglow/midi.clj
+++ src/afterglow/midi.clj
@@ -159,8 +159,9 @@
           (when @running
             (try
               ;; TODO: This is not really safe because if the handler blocks it ties up all future
-              ;;       MIDI dispatch. Should do in a future with a timeout? A claypoole thread pool
-              ;;       if they support timeouts? Don't want to use a million threads for this either...
+              ;;       MIDI dispatch. Should do in a future with a timeout? Don't want to use a million
+              ;;       threads for this either, so a core.async channel approach is probably best.
+              ;;
               (handler msg)
               (catch InterruptedException e
                 (timbre/info "MIDI event handler thread interrupted, shutting down.")
@@ -570,12 +571,12 @@
                           (when (#{:note-on :note-off :control-change} (:status msg))
                             (deliver result msg)))]
      (try
-       (swap! global-handlers conj message-finder)
+       (add-global-handler! message-finder)
        (let [found (deref result timeout nil)]
          (when found
            (assoc (select-keys found [:command :channel :note :velocity])
                   :device (select-keys (:device found) [:name :description]))))
-       (finally (swap! global-handlers disj message-finder))))))
+       (finally (remove-global-handler! message-finder))))))

 ;; TODO apply to all matching input sources?
 (defn add-control-mapping


Handle routing for / and 404 otherwise

Handle routing for / and 404 otherwise

--- src/build_mon/core.clj
+++ src/build_mon/core.clj
@@ -71,7 +71,7 @@
              :body (json/parse-string true) :value)
          (catch Exception e))))

-(defn handler [account project token request]
+(defn index [account project token request]
   (let [[build previous-build] (get-last-two-builds account project token)
         commit-message (get-commit-message account token build)
         refresh (refresh-interval (:query-params request))]
@@ -87,10 +87,20 @@
        :headers {"Content-Type" "text/html; charset=utf-8"}
        :body (generate-html build previous-build commit-message refresh)})))

+(defn handlers [account project token]
+  {:index (partial index account project token)})
+
+(defn wrap-routes [handlers]
+  (fn [request]
+    (let [uri (:uri request)
+          handler (when (= uri "/") (:index handlers))]
+      (when handler (handler request)))))
+
 (defn -main [& [vso-account vso-project vso-personal-access-token port]]
   (let [port (Integer. (or port 3000))]
     (if (and vso-account vso-project vso-personal-access-token port)
-      (let [wrapped-handler (-> (partial handler vso-account vso-project vso-personal-access-token)
+      (let [wrapped-handler (-> (handlers vso-account vso-project vso-personal-access-token)
+                                wrap-routes
                                 (resource/wrap-resource "public")
                                 (params/wrap-params))]
         (ring-jetty/run-jetty wrapped-handler {:port port}))


Require clojure.string

Require clojure.string

--- src/org/spootnik/om_warp/ansi.cljs
+++ src/org/spootnik/om_warp/ansi.cljs
@@ -1,4 +1,5 @@
-(ns org.spootnik.om-warp.ansi)
+(ns org.spootnik.om-warp.ansi
+  (:require [clojure.string :as string]))

 (def colors
   ["black"
@@ -17,14 +18,14 @@

 (defn escape
   [text]
-  (clojure.string/replace
+  (string/replace
     text
-    (re-pattern (str "[" (clojure.string/join "" (keys replacements)) "]"))
+    (re-pattern (str "[" (string/join "" (keys replacements)) "]"))
     #(replacements %1)))

 (defn linkify
   [text]
-  (clojure.string/replace
+  (string/replace
     text
     #"(https?://[^\s]+)"
     "$1"))
@@ -49,19 +50,19 @@

 (defn get-classes
   [styles]
-  (clojure.string/join " " (remove nil? (vals styles))))
+  (string/join " " (remove nil? (vals styles))))

 (defn process-parts
   [styles [part & parts] done]
-  (let [lines (clojure.string/split part "\n" -1)
+  (let [lines (string/split part "\n" -1)
         [_ codes text] (re-matches #"([\d;]+?)?m(.*)" (first lines))
         text           (str (or text (first lines))
                             (if (empty? (rest lines)) "" "\n")
-                            (clojure.string/join "\n" (rest lines)))
+                            (string/join "\n" (rest lines)))
         next-styles    (if (nil? codes)
                          {}
                          (apply merge (map (comp style int)
-                                           (clojure.string/split codes ";"))))
+                                           (string/split codes ";"))))
         styles         (merge styles next-styles)
         classes        (get-classes styles)
         done           (if (empty? classes)
@@ -77,5 +78,5 @@
     (let [text (-> text
                    (escape)
                    (linkify))
-          parts (clojure.string/split text #"\033\[")]
+          parts (string/split text #"\033\[")]
       (process-parts {} parts ""))))


hiding 'fo' further down; use 'morph' instead

--- src/babel/english.cljc
+++ src/babel/english.cljc
@@ -4,7 +4,6 @@
    [dag_unify.core :refer (fail-path get-in unifyc)]
    [babel.generate :as generate]
    [babel.english.grammar :as grammar]
-   [babel.english.morphology :as morph :refer [fo]]
    [babel.over :refer [over truncate]]
    [babel.parse :as parse]
    [clojure.repl :refer [doc]]
@@ -74,9 +73,9 @@
 (defn morph [expr & {:keys [from-language show-notes]
                      :or {from-language nil
                           show-notes false}}]
-  (fo expr
-      :from-language from-language :show-notes show-notes
-      :lexicon (:lexicon (medium))))
+  (morph/fo expr
+            :from-language from-language :show-notes show-notes
+            :lexicon (:lexicon (medium))))

 (defn fo-ps [expr]
   (parse/fo-ps expr fo))


Some somewhat arbitrary changes. Still thinking about where I want to go with this.

--- src/overtone/gui/spinner_label.clj
+++ src/overtone/gui/spinner_label.clj
@@ -14,30 +14,31 @@

 (def ^{:private true} SpinnerLabelClass (class (spinner-label-proxy)))

-(defn- make-state [this]
-  { :model (atom nil)
-    :unbind (atom (fn []))
-    :update (fn [v this]
-              (.setText
-                this
-                (if (number? v)
-                  (format "%.2f" v) ; TODO make format configurable
-                  (str v))))})
+(defn- update-display [new-value this]
+  (.setText
+    this
+    (if (number? new-value)
+      (format "%.2f" new-value) ; TODO make format configurable
+      (str new-value))))
+
+(defn- make-initial-state []
+  { :model  (atom nil)
+    :unbind (atom (fn [])) })

 (defn- get-model [this] @(:model (get-meta this ::state)))
 (defn- set-model [this m]
   (let [{:keys [model unbind update]} (get-meta this ::state)]
     (@unbind)
     (reset! model m)
-    (reset! unbind (bind/bind m (bind/b-do* update this)))
-    (update (.getValue m) this)))
+    (reset! unbind (bind/bind m (bind/b-do* update-display this)))
+    (update-display (.getValue m) this)))

 (defn spinner-label
   "Same API as #'seesaw.core/spinner, but only a label is displayed and the
   current value is modified by dragging the mouse up and down over it."
   [& opts]
   (let [widget (spinner-label-proxy)
-        state  (make-state widget)]
+        state  (make-initial-state)]
     (put-meta! widget ::state state)
     (set-model widget (spinner-model 0.0))
     (when-mouse-dragged


Adds additional catch to model/connect in server.

--- src/cadence/server.clj
+++ src/cadence/server.clj
@@ -34,7 +34,10 @@
     (server/add-middleware friend/authenticate friend-settings)
     (try (model/connect config/storage)
       (catch java.io.IOException e
-        (println "ERROR: Could not connect to MongoDB.")))
+        (println "ERROR: Could not connect to MongoDB."))
+      (catch java.lang.NullPointerException e
+        (println "ERROR: Could not authenticate with Mongo. See config: \n\t"
+                 (str (assoc config/storage :password "**********")))))
     (server/start port (let [opts {:mode mode
                                    :ns 'cadence}]
                          (if (not= mode :dev)


fix distance

fix distance

--- src/ceu/live_users.clj
+++ src/ceu/live_users.clj
@@ -131,12 +131,14 @@
                 {latitude2 :lat longitude2 :lon :as pt2}]
   (debug "distance - " pt1 pt2)
   (let [R 6371 ; km
-        x (* (- longitude2 longitude1)
-             (Math/cos (/ (+ latitude1 latitude2) 2)))
-        y (- latitude2 latitude1)
-        d (* (Math/sqrt (+ (* x x) (* y y))) R)]
-    (debug "distance - " pt1 " - " pt2 " - " d)
-    d))
+        φ1  (Math/toRadians latitude1)
+        φ2  (Math/toRadians latitude2)
+        Δφ  (-> (- latitude2 latitude1) Math/toRadians)
+        Δλ  (-> (- longitude2 longitude1) Math/toRadians)
+        a   (+ (* (Math/sin (/ Δφ 2)) (Math/sin (/ Δφ 2)))
+               (* (Math/cos φ1) (Math/cos φ2) (Math/sin (/ Δλ 2)) (Math/sin (/ Δλ 2))))
+        c   (* 2 (Math/atan2 (Math/sqrt a) (Math/sqrt (- 1 a))))]
+    (* c R)))


implemented Exile's ability

implemented Exile's ability

--- src/clj/game/cards.clj
+++ src/clj/game/cards.clj
@@ -3875,7 +3875,12 @@
    {:req (req tagged)}

    "Exile: Streethawk"
-   {:effect (effect (gain :link 1))}
+   {:effect (effect (gain :link 1))
+    :events {:runner-install {:req (req (and (has? target :type "Program")
+                                              (= (:active-player @state) :runner)
+                                              ;; only trigger when played a programm from heap
+                                              (some #{:discard} (:previous-zone target))))
+                               :msg (msg "draw a card") :effect (effect (draw 1))}}}

    "Deep Red"
    {:effect (effect (gain :memory 3)) :leave-play (effect (lose :memory 3))}


Gist links in work queue go to sketch page

--- src/clj/inky/entry.clj
+++ src/clj/inky/entry.clj
@@ -188,21 +188,21 @@
 (defn compile-duration [{:keys [started succeeded]}]
   (format "%.2f" (/ (- succeeded started) 1000.0)))

-(defn $link-gist [gist-id text]
-  [:a {:href (str "https://gist.github.com/" gist-id)} text])
+(defn $link-gist [login gist-id text]
+  [:a {:href (str "/" login "/" gist-id)} text])

 (defn $jobs-section [{:keys [jobs]}]
   [:section.jobs
    [:h3 "Work Queue"]
    (if (> (count jobs) 0)
      [:ul
-      (for [{:keys [gist-id public-gist] :as job} jobs]
+      (for [{:keys [login gist-id public-gist] :as job} jobs]
         (cond
           (compiling-job? job)
           [:li.compiling
            [:i.icon-cogs]
            "Gist " (if public-gist
-                     ($link-gist gist-id gist-id)
+                     ($link-gist login gist-id gist-id)
                      "a private gist")
            ", started compiling " (util/timeago (:started job)) " ago."]

@@ -211,7 +211,7 @@
            [:i.icon-ok]
            "Compiled "
            (if public-gist
-             ($link-gist gist-id gist-id)
+             ($link-gist login gist-id gist-id)
              "a private gist")
            " " (util/timeago (:started job)) " ago."
            " Took " (compile-duration job) " s."]
@@ -221,7 +221,7 @@
            [:i.icon-remove]
            "Failed compiling "
            (if public-gist
-             ($link-gist gist-id gist-id)
+             ($link-gist login gist-id gist-id)
              "a private gist")
            " "(util/timeago (:started job)) " ago."]

@@ -230,7 +230,7 @@
            [:i.icon-time]
            "Gist "
            (if public-gist
-             ($link-gist gist-id gist-id)
+             ($link-gist login gist-id gist-id)
              "a private gist")
            ", enqueued " (util/timeago (:created job)) " ago."]))]
      [:div.null-state


correct typo in seeds

correct typo in seeds

--- src/clj_money/seed.clj
+++ src/clj_money/seed.clj
@@ -123,7 +123,7 @@
                           s
                           {:entity-id (:id entity)
                            :transaction-date %
-                           :description "Landloard"
+                           :description "Landlord"
                            :items [{:action :debit
                                     :account-id (-> accounts :rent :id)
                                     :amount 750M}


Moved state-loop higher.

Moved state-loop higher.

--- src/cbfg/world/t2.cljs
+++ src/cbfg/world/t2.cljs
@@ -6,6 +6,27 @@
                                    wait-done addr-override-xy]]
             [cbfg.world.base]
             [cbfg.world.net]))
+
+(defn state-loop [actx name initial-state & {:keys [unknown-fn]}]
+  (let [req-ch (achan actx)]
+    (act-loop state-loop actx [name name state initial-state]
+              (when-let [m (atake state-loop req-ch)]
+                (case (:op m)
+                  :get (do (aput-close state-loop (:res-ch m)
+                                       (assoc m :status :ok :value state))
+                           (recur name state))
+                  :update (do (when (:res-ch m)
+                                (aput-close state-loop (:res-ch m)
+                                            (assoc m :status :ok)))
+                              (recur name ((:update-fn m) state)))
+                  (when unknown-fn
+                    (when-let [[state2 res] (unknown-fn state-loop state m)]
+                      (when (and res (:res-ch m))
+                        (aput-close state-loop (:res-ch m) res))
+                      (recur name state2))))))
+    req-ch))
+
+; --------------------------------------------

 (defn make-initial-server-state [actx]
   {:realms {"_system" {:users {"admin" {:pswd "password"}}
@@ -96,27 +117,6 @@

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

-(defn state-loop [actx name initial-state & {:keys [unknown-fn]}]
-  (let [req-ch (achan actx)]
-    (act-loop state-loop actx [name name state initial-state]
-              (when-let [m (atake state-loop req-ch)]
-                (case (:op m)
-                  :get (do (aput-close state-loop (:res-ch m)
-                                       (assoc m :status :ok :value state))
-                           (recur name state))
-                  :update (do (when (:res-ch m)
-                                (aput-close state-loop (:res-ch m)
-                                            (assoc m :status :ok)))
-                              (recur name ((:update-fn m) state)))
-                  (when unknown-fn
-                    (when-let [[state2 res] (unknown-fn state-loop state m)]
-                      (when (and res (:res-ch m))
-                        (aput-close state-loop (:res-ch m) res))
-                      (recur name state2))))))
-    req-ch))
-
-; --------------------------------------------
-
 (defn kv-server [server-addr & ports]
   (let [world (:world (prog-base-now))
         server-state-ch (state-loop world :server-state


ENH: basic control structures 1

ENH: basic control structures 1

--- src/clj_prj03/core.clj
+++ src/clj_prj03/core.clj
@@ -8,4 +8,49 @@

 (println "Cleanliness is next to godliness")

-(defn train [] (println "Choo choo!"))
+(defn train [] (println "Choo choo!o"))
+
+(+ 1 (* 2 3) 4)
+
+
+; Control structures
+
+(println (if true
+            "abra cadabra"
+            "hocus pocus"))
+
+(if true
+  (do (println "Success!")
+      "abra cadabra")
+  (do (println "Failure:(")
+      "hocus pocus"))
+
+(when true
+   (println "Success!")
+   "abra cadabra")
+
+(def failed-protagonist-names
+    ["Larry Potter"
+     "Doreen the Explorer"
+     "The Incredible Bulk"])
+
+; Equality testing
+(println (nil? 1))
+(println (nil? nil))
+(= 1 1)
+(= nil nil)
+(= 1 2)
+
+; Numbers
+93
+1.2
+1/5
+
+; String examples
+"Lord Voldemort"
+"\"He who must not be named\""
+"\"Great cow of Moscow!\" - Hermes Conrad"
+
+; String interpolation
+(def name "Chewbacca")
+(println (str "\"Rawwwwwwwwrrrrr\" - " name))


Add sample todos

Add sample todos


127 initial

127 initial

--- stuf/src/sandbox/4clojure.clj
+++ stuf/src/sandbox/4clojure.clj
@@ -928,3 +928,7 @@

 ;;126 Through the Looking Class
 java.lang.Class
+
+
+;;
+#(Integer/toString % 2)


Support arbitrary code inside a state

Support arbitrary code inside a state

and use the new :code functionality to implement store_instruction better

--- src/computer_build.clj
+++ src/computer_build.clj
@@ -17,12 +17,6 @@
       (= (name op) "+") "010"
       (= (name op) "-") "110")
     "000"))
-
-(def static-states {
-  :fetch {:control-signals '(:rd_pc, :wr_MA), :next :store_instruction}
-  :store_instruction {:control-signals '(:rd_MD, :wr_IR, :inc_pc), :next :decode}
-  :decode {:control-signals '()}
-})

 (defn flatten-1 [things]
   (if (empty? things)
@@ -81,10 +75,17 @@
 (defn control-unit [instructions]
   "Given a set of states, make a control unit that will
   execute them"
-  (let [states (merge (make-states instructions) static-states)
+  (let [opcodes (make-opcodes instructions)
+        opcode-width (count (second (first opcodes)))
+        static-states {:fetch {:control-signals '(:rd_pc, :wr_MA), :next :store_instruction, }
+                        :store_instruction {:next :decode,
+                                            :control-signals '(:rd_MD, :wr_IR, :inc_pc),
+                                            :code
+                                            [`(if (and (event :clock) (= :clock 0))
+                                                (<= :opcode ~(- opcode-width 1) 0 :system_bus 7 ~(- 8 opcode-width)))]}
+                        :decode {:control-signals '()}}
+        states (merge (make-states instructions) static-states)
         control-signals (set (apply concat (map (fn [[_ body]] (:control-signals body)) states)))
-        opcodes (make-opcodes instructions)
-        opcode-length (count (second (first opcodes)))
         inputs {:reset std-logic :system_bus (std-logic-vector 7 0)}
         outputs (assoc
                   (zipmap control-signals (repeat (count control-signals) std-logic))
@@ -93,19 +94,16 @@
       (let [highs (:control-signals state)
             assertions (map #(list 'high %) highs)
             clears (map #(list 'low %) (difference control-signals highs))]
-        (vec (concat assertions clears `((<= :alu_operation ~(alu-op-to-opcode (:alu_op state))))))))
-    (defn tweak-instruction-fetch [entity]
-      (concat entity `((process (:clock) [
-        (if (and (event :clock) (= :clock 0) (= :state :state_store_instruction))
-        (<= :opcode ~(- opcode-length 1) 0 :system_bus 7 ~(- 8 opcode-length)))]))))
+        (vec (concat (:code state) assertions clears
+                     `((<= :alu_operation ~(alu-op-to-opcode (:alu_op state))))))))

-    (list (tweak-instruction-fetch (state-machine "control_unit"
+    (list (state-machine "control_unit"
                    ; inputs
                    inputs
                    ; outputs
                    outputs
                    ; signals
-                   { :opcode (std-logic-vector (- opcode-length 1) 0) }
+                   { :opcode (std-logic-vector (- opcode-width 1) 0) }
                    ; reset
                    (list* '(<= :alu_operation "000") '(goto :fetch) (map #(list 'low %) control-signals))
                    ; states
@@ -115,13 +113,12 @@
                      ; states
                      (map #(list (first %) (:next (second %))) (dissoc states :decode))
                      ; decode
-                     (map #(list :decode `(= :opcode ~(second %)) (keyword (str (first %) "_0"))) opcodes))
-                   )) (assoc inputs :clock std-logic) outputs)))
+                     (map #(list :decode `(= :opcode ~(second %)) (keyword (str (first %) "_0"))) opcodes)))
+          (assoc inputs :clock std-logic) outputs)))

 (defn build* [cpuname options instructions]
   (.mkdir (java.io.File. cpuname))
-  (let [states (merge static-states (make-states instructions))
-        [control-unit control-in control-out] (control-unit instructions)]
+  (let [[control-unit control-in control-out] (control-unit instructions)]
     (with-open [main-vhdl (java.io.FileWriter. (str cpuname "/main.vhdl"))
                 control-vhdl (java.io.FileWriter. (str cpuname "/control.vhdl"))]
       (binding [*out* control-vhdl]


[#9393] fix mnemonic shown during storing account on keycard

--- src/status_im/hardwallet/core.cljs
+++ src/status_im/hardwallet/core.cljs
@@ -367,6 +367,29 @@
                                                    :current             []}))}
             (listen-to-hardware-back-button)
             (navigation/navigate-to-cofx :keycard-recovery-pin nil)))
+
+(fx/defn on-generate-mnemonic-success
+  [{:keys [db] :as cofx} mnemonic]
+  (fx/merge cofx
+            {:db (-> db
+                     (assoc-in [:hardwallet :setup-step] :recovery-phrase)
+                     (assoc-in [:hardwallet :on-card-connected] nil)
+                     (assoc-in [:hardwallet :secrets :mnemonic] mnemonic))}
+            (navigation/navigate-to-cofx :keycard-onboarding-recovery-phrase nil)))
+
+(fx/defn set-mnemonic
+  [{:keys [db] :as cofx}]
+  (let [selected-id (get-in db [:intro-wizard :selected-id])
+        accounts    (get-in db [:intro-wizard :multiaccounts])
+        mnemonic    (->> accounts
+                         (filter (fn [{:keys [id]}]
+                                   (= id selected-id)))
+                         first
+                         :mnemonic)]
+    (fx/merge
+     cofx
+     {:db (assoc-in db [:hardwallet :secrets :mnemonic] mnemonic)}
+     (on-generate-mnemonic-success mnemonic))))

 (fx/defn generate-mnemonic
   [cofx]
@@ -1539,7 +1562,7 @@
               (when (= flow :import)
                 (load-recovery-pin-screen))
               (when (= flow :create)
-                (generate-mnemonic)))))
+                (set-mnemonic)))))

 (fx/defn on-pair-error
   [{:keys [db] :as cofx} {:keys [error code]}]
@@ -1556,15 +1579,6 @@
                 (navigation/navigate-to-cofx :keycard-recovery-pair nil))
               (when (not= setup-step :enter-pair-code)
                 (process-error code error)))))
-
-(fx/defn on-generate-mnemonic-success
-  [{:keys [db] :as cofx} mnemonic]
-  (fx/merge cofx
-            {:db (-> db
-                     (assoc-in [:hardwallet :setup-step] :recovery-phrase)
-                     (assoc-in [:hardwallet :on-card-connected] nil)
-                     (assoc-in [:hardwallet :secrets :mnemonic] mnemonic))}
-            (navigation/navigate-to-cofx :keycard-onboarding-recovery-phrase nil)))

 (fx/defn on-generate-mnemonic-error
   [{:keys [db] :as cofx} {:keys [error code]}]


Don't initialize mDNS since we're not using it for now

--- src/dakait/handler.clj
+++ src/dakait/handler.clj
@@ -172,10 +172,6 @@
     (load-associations)
     (run)
     (ws-downloads-pusher)
-    (let [port (System/getenv "PORT")
-          port (when (nil? port) 3000)]
-      (println "Starting mDNS server on port:" port)
-      (publish-service port))
     (catch Exception e
       (println "Program initialization failed: " (.getMessage e))
       (System/exit 1))))


preserve string keys, resolves #129

preserve string keys, resolves #129

--- src/daiquiri/util.cljc
+++ src/daiquiri/util.cljc
@@ -8,15 +8,17 @@
       (symbol? k)))

 (defn -camel-case [k]
-  (let [[first-word & words] (.split (name k) "-")]
-    (if (or (empty? words)
-            (= "aria" first-word)
-            (= "data" first-word))
-      k
-      (-> (map str/capitalize words)
-          (conj first-word)
-          str/join
-          keyword))))
+  (if (string? k)
+    k
+    (let [[first-word & words] (.split (name k) "-")]
+      (if (or (empty? words)
+              (= "aria" first-word)
+              (= "data" first-word))
+        k
+        (-> (map str/capitalize words)
+            (conj first-word)
+            str/join
+            keyword)))))

 (def attrs-cache (volatile! {}))

@@ -26,9 +28,7 @@
   [k]
   (if (valid-key? k)
     (or (get @attrs-cache k)
-        (let [kk (if-not (string? k)
-                   (-camel-case k)
-                   k)]
+        (let [kk (-camel-case k)]
           (vswap! attrs-cache assoc k kk)
           kk))
     k))


Fixed gensym in defcomp

Fixed gensym in defcomp

--- src/datascript/db.cljc
+++ src/datascript/db.cljc
@@ -420,15 +420,15 @@
           (def ~sym
             (reify
               java.util.Comparator
-              (compare [~'_ ~a1 ~a2]
+              (compare [_# ~a1 ~a2]
                 (let [~arg1 ~arg1 ~arg2 ~arg2]
                   ~@body))
               clojure.lang.IFn
-              (invoke [~'this ~a1 ~a2]
-                (.compare ~'this ~a1 ~a2))
+              (invoke [this# ~a1 ~a2]
+                (.compare this# ~a1 ~a2))
               IFn$OOL
-              (invokePrim [~'this ~a1 ~a2]
-                (.compare ~'this ~a1 ~a2))))))))
+              (invokePrim [this# ~a1 ~a2]
+                (.compare this# ~a1 ~a2))))))))

 (defcomp cmp-datoms-eavt ^long [^Datom d1, ^Datom d2]
   (combine-cmp


cosmetics

cosmetics

--- src/nml/core.clj
+++ src/nml/core.clj
@@ -53,15 +53,15 @@
               (if no-prefix val (str nml ":" key "=" val))))]
     (str (string/join "\n" (map f gets)) "\n")))

+(defn- nml-name [x]
+  (nml-str (second x)))
+
 (defn- nml-out [out s]
   (if (= out *out*)
     (println (string/trim s))
     (try (spit out s)
          (catch Exception e
            (fail (str "Could not write to '" out "'."))))))
-
-(defn- nml-name [x]
-  (nml-str (second x)))

 (defn- nml-parse [s start]
   (let [result (parse s :start start)]
@@ -71,7 +71,7 @@
               t
               (str (apply str (repeat (- c 1) " ")) "^")))
       result)))
-
+
 (defn- nml-sets [m sets]
   (loop [m m s sets]
     (if (empty? s)


add cljs.repl to generator

add cljs.repl to generator

--- src/core.clj
+++ src/core.clj
@@ -45,6 +45,8 @@
                                               "core_proxy.clj"   "src/clj/clojure"}}
    "cljs.test"              {"clojurescript" {"test.cljs"        "src/cljs/cljs"
                                               "test.clj"         "src/clj/cljs"}}
+   "cljs.repl"              {"clojurescript" {"repl.clj"         "src/clj/cljs"
+                                              "repl.cljs"        "src/cljs/cljs"}}
    "cljs.reader"            {"clojurescript" {"reader.cljs"      "src/cljs/cljs"}}
    "clojure.set"            {"clojurescript" {"set.cljs"         "src/cljs/clojure"}}
    "clojure.string"         {"clojurescript" {"string.cljs"      "src/cljs/clojure"}}
@@ -527,6 +529,10 @@
   (concat (parse-api ns- "clojurescript" "test.cljs")
           (parse-api ns- "clojurescript" "test.clj")))

+(defmethod parse-ns-api "cljs.repl" [ns-]
+  (concat (parse-api ns- "clojurescript" "repl.clj")
+          (parse-api ns- "clojurescript" "repl.cljs")))
+
 (defmethod parse-ns-api "cljs.reader" [ns-]
   (parse-api ns- "clojurescript" "reader.cljs"))

@@ -769,6 +775,10 @@
   ;; which is used by cljs.core. (the ana namespace has to exist)
   (create-ns 'ana)

+  ;; HACK: We need to create this so 'tools.reader' doesn't crash on `::env/compiler`
+  ;; which is used by cljs.repl. (the env namespace has to exist)
+  (create-ns 'env)
+
   (println "\nCloning or updating repos...")
   (clone-or-fetch-repos)


Add missing type hints

Add missing type hints

--- src/leiningen/voom.clj
+++ src/leiningen/voom.clj
@@ -17,7 +17,8 @@
   (:import [clojure.lang #_IPersistentVector Seqable]
            [java.util Date]
            [java.lang.reflect Array]
-           [java.io File FileInputStream FileOutputStream OutputStreamWriter]
+           [java.io File FileInputStream FileOutputStream OutputStreamWriter
+            Closeable]
            [java.util.logging Logger Handler Level]
            [org.sonatype.aether.transfer ArtifactNotFoundException]))

@@ -1040,7 +1041,7 @@

 (def voomdb-header "voom-db-0")

-(defn git-db-file
+(defn ^File git-db-file
   [gitdir]
   (io/file gitdir ".git" "voomdb.frs.gz"))

@@ -1066,7 +1067,8 @@
   (with-open [w (-> (git-db-file gitdir)
                     io/output-stream
                     java.util.zip.GZIPOutputStream.
-                    (fress/create-writer :handlers sha/write-handlers))]
+                    ^Closeable (fress/create-writer
+                                :handlers sha/write-handlers))]
     (fress/begin-open-list w)
     (fress/write-object w voomdb-header)
     (doseq [item (vdb/to-reldata db)]


Add tabled 'ancestoro logic.

Add tabled 'ancestoro logic.

This is slower than I'd like but tabling keeps the no-ancestor-found
case from taking eternity when run against the large test database.

--- src/leiningen/voom.clj
+++ src/leiningen/voom.clj
@@ -1092,6 +1092,14 @@
              (l/conso next-path so-far new-path)
              (file-patho next-sha new-path fname fsha tree-path))]))

+(def ancestoro
+  (l/tabled [childer parenter ancestor?]
+          (l/conde
+           [(r-commit-parent childer parenter) (l/== ancestor? true)]
+           [(l/fresh [nparent]
+                     (r-commit-parent childer nparent)
+                     (ancestoro nparent parenter ancestor?))])))
+
 (comment
   (def xdb1 (pldb/db [r-tree :a :b :c :d]))
   (pldb/with-db xdb1 (l/run* [a] (r-tree a :b :c :d)))
@@ -1120,10 +1128,14 @@
                         (file-patho tree-sha nil fname obj-sha tree-path)
                         (l/!= obj-sha p-obj-sha)))))))

-  (pldb/with-db db
-    (l/run 10 [sha]
-     (l/fresh [obj-sha]
-       (r-tree sha "project.clj" :blob obj-sha))))
+  (time
+   (let [c (str->sha "612e0705de7ff991aa65b910ed0820adabd1d921") ; for large test repo
+         p (str->sha "65691217cd9aa2b2738518dbebd3fdc7d58b162f")]
+     (doall
+      (pldb/with-db db
+        (l/run 10 [q]
+               (ancestoro c p q))))))
+
   (pldb/with-db db
     (l/run* [filename]
      (l/fresh [sha ftype]


clean up commented code / println

clean up commented code / println

--- src-cljs/frontend/controllers/controls.cljs
+++ src-cljs/frontend/controllers/controls.cljs
@@ -789,7 +789,6 @@
         uuid frontend.async/*uuid*
         api-ch (get-in current-state [:comms :api])
         org-name (get-in current-state state/org-name-path)]
-    (println "new plan clicked!")

     (utils/mlog "calling stripe/open-checkout")
     (stripe/open-checkout {:price price :description description} stripe-ch)
@@ -866,9 +865,7 @@
                              (gstring/format "/api/v1/organization/%s/%s" org-name "plan")
                              :params {:osx plan-type}))]
         (put! api-ch [:update-plan (:status api-result) (assoc api-result :context {:org-name org-name})])
-        (release-button! uuid (:status api-result))))
-    #_(let [upgrade? (> containers (get-in previous-state (conj state/org-plan-path :containers)))]
-      (analytics/track-save-containers upgrade?))))
+        (release-button! uuid (:status api-result))))))

 (defmethod post-control-event! :save-piggyback-orgs-clicked
   [target message {:keys [selected-piggyback-orgs org-name]} previous-state current-state]


Application list done

Application list done

--- src/exploud/asgard.clj
+++ src/exploud/asgard.clj
@@ -214,7 +214,7 @@
 (defn- application-list-url
   "Gives us a URL we can use to retrieve the list of applications."
   []
-  (str asgard-url "/application/list.json"))
+  (str (asgard-url-for-environment :poke) "/application/list.json"))

 (defn- auto-scaling-group-url
   "Gives us a region-based URL we can use to get information about an Auto


Removes TODO

Removes TODO

--- src/expound/alpha.cljc
+++ src/expound/alpha.cljc
@@ -549,7 +549,6 @@
    (ansi/color (printer/indent (pr-str (:expound/check-fn-call (first problems)))) :bad-value)
    (expected-str _type spec-name val path problems opts)))

-;; TODO - remove?
 (defmethod expected-str :problem/check-ret-failure [_type spec-name val path problems opts]
   (predicate-errors problems))

@@ -757,8 +756,6 @@
         :else
         (str "Unknown data:\n\n" data)))))

-;;(s/def ::foo string?)
-
 #?(:clj
    (defn ns-qualify
      "Qualify symbol s by resolving it or using the current *ns*."


add CLJS-481 test

add CLJS-481 test


Actually generate interesting inserts in table behavior test.


only update track if music is not playing

--- src/frontend/core.cljs
+++ src/frontend/core.cljs
@@ -11,7 +11,8 @@
                           :music-files {}
                           :message-received false
                           :file-downloading? false
-                          :num-of-queued-requests 0}))
+                          :num-of-queued-requests 0
+                          :current-track 0}))

 (enable-console-print!)

@@ -54,6 +55,9 @@
       (+ 1 (:num-of-queued-requests @app-state))
       :else (request-new-file))))

+(defn is-music-playing? []
+  (not (.-paused (.getElementById js/document "audio-tag"))))
+
 (.on (new js/ss socket) "file-to-client"
   (fn [stream]
     (swap! app-state assoc :file-downloading? true)
@@ -72,15 +76,16 @@
         (let [reader (new js/FileReader)
               blob   (get (:music-files @app-state) (.-id stream))]
           (.readAsDataURL reader blob)
+          (if-not (is-music-playing?)
           (set! (.-onloadend reader)
             (fn []
-              (request-new-file)
-              (swap! app-state assoc :file-downloading? false)
-              (.attr (js/$ "#current-track") "src" (.-result reader))
-              (.load (.getElementById js/document "audio-tag"))
-              (.play (.getElementById js/document "audio-tag"))
-              (println (str "Number of music files downloaded "
-                            (count (:music-files @app-state)))))))))))
+                (request-new-file)
+                (swap! app-state assoc :file-downloading? false)
+                (.attr (js/$ "#current-track") "src" (.-result reader))
+                (.load (.getElementById js/document "audio-tag"))
+                (.play (.getElementById js/document "audio-tag"))
+                (println (str "Number of music files downloaded "
+                              (count (:music-files @app-state))))))))))))

 (.change (js/$ "#file_upload_input")
   (fn [e]
@@ -107,3 +112,6 @@
       (.emit (js/ss socket) "file" stream)
       (.pipe blob-stream stream))))

+(.bind (js/$ "#audio-tag") "ended"
+  (fn []
+    (println "Track ended!")))


ideas

ideas

--- src/clj/algorithms_clj/macro_initiation.clj
+++ src/clj/algorithms_clj/macro_initiation.clj
@@ -297,6 +297,7 @@
         remaining (rest transforms)]
     (case op
       ;;TODO - Multimethod here for extensibility
+      ;;TODO - How to do mapcat (not nested loop-recur)
       :map
       `(let [h2# (~fct ~h)]
          (inline-reducer ~reducer ~remaining ~r h2#))


Cleanup

Cleanup

--- src/clojure/clojurewerkz/cassaforte/cql.clj
+++ src/clojure/clojurewerkz/cassaforte/cql.clj
@@ -265,8 +265,6 @@

    Doesn't work as a prepared query."
   [^Session session table & query-params]
-
-  (println query-params)
   (:count
    (first
     (apply select session table (dsl/count-all) query-params))))


Remove unused reference to `term`

Remove unused reference to `term`

--- src/com/puppetlabs/puppetdb/query/facts.clj
+++ src/com/puppetlabs/puppetdb/query/facts.clj
@@ -85,7 +85,7 @@
           :where (format "certnames.deactivated IS %s" (if value "NULL" "NOT NULL"))}))

 (defmethod compile-term "select-resources"
-  [[_ subquery :as term]]
+  [[_ subquery]]
   {:pre [(coll? subquery)]
    :post [(string? (:where %))]}
   (let [[subsql & params] (resource/query->sql subquery)]


Provide internalize-parser-index* to work on indexes directly

--- src/com/wsscode/pathom/connect/foreign.cljc
+++ src/com/wsscode/pathom/connect/foreign.cljc
@@ -44,26 +44,30 @@
                    ::foreign-call call})
     (cond-> (parser {} query) join-node (get join-node))))

+(defn internalize-parser-index*
+  ([indexes] (internalize-parser-index* indexes nil))
+  ([{::pc/keys [index-source-id] :as indexes} parser]
+   (let [index-source-id (or index-source-id (gensym "dynamic-parser-"))]
+     (-> indexes
+         (update ::pc/index-resolvers
+           (fn [resolvers]
+             (into {}
+                   (map (fn [[r v]] [r (assoc v ::pc/dynamic-sym index-source-id)]))
+                   resolvers)))
+         (assoc-in [::pc/index-resolvers index-source-id]
+           {::pc/sym               index-source-id
+            ::pc/cache?            false
+            ::pc/dynamic-resolver? true
+            ::pc/resolve           (fn [env _] (call-foreign-parser env parser))})
+         (dissoc ::pc/index-source-id)))))
+
 (defn internalize-parser-index
   "This function calls the the parser to return its index and them modify this index
   to be in a shape that enables it to be used as a dynamic foreign resolver. This
   function returns an index that you can just merge into your index to get the foreign
   parser integrated."
   [parser]
-  (let [{::pc/keys [index-source-id] :as indexes} (parser-indexes parser)
-        index-source-id (or index-source-id (gensym "dynamic-parser-"))]
-    (-> indexes
-        (update ::pc/index-resolvers
-          (fn [resolvers]
-            (into {}
-                  (map (fn [[r v]] [r (assoc v ::pc/dynamic-sym index-source-id)]))
-                  resolvers)))
-        (assoc-in [::pc/index-resolvers index-source-id]
-          {::pc/sym               index-source-id
-           ::pc/cache?            false
-           ::pc/dynamic-resolver? true
-           ::pc/resolve           (fn [env _] (call-foreign-parser env parser))})
-        (dissoc ::pc/index-source-id))))
+  (internalize-parser-index* (parser-indexes parser) parser))

 (defn foreign-parser-plugin [{::keys [parsers]}]
   {::p/wrap-parser2


Update core.clj

Update core.clj

--- src/iyye/bios/core.clj
+++ src/iyye/bios/core.clj
@@ -43,7 +43,7 @@

         (resource/stop-night current-night))))

-(def main-task {:name "iyye.bios.main" :function main-loop :task-future (ref 0) :parent nil :children (ref (list))})
+(def main-task {:name "iyye.bios.main" :function main-loop :task-future (ref 0) :parent nil})

 (defn- load-state [name]
   (log/info "first day load")
@@ -55,8 +55,7 @@
 (defn- init-state [name]
   (log/info "first day")
   (nouns/add-word "iyye.name" #(list name) nil)
-  (persistence/set-current-iyye name)
-  )
+  (persistence/set-current-iyye name))

 (defn usage [options-summary]
   (->> ["Usage: iyye action/option"


Some documentation notes on pepa.bus.

Some documentation notes on pepa.bus.

--- src/pepa/bus.clj
+++ src/pepa/bus.clj
@@ -2,11 +2,21 @@
   (:require [com.stuartsierra.component :as component]
             [clojure.core.async :as async :refer [>!!]]))

-(defn subscribe [bus topic]
+;;; pepa.bus is a simple application-wide notification bus. Clients
+;;; can subscribe for any topic they want and will receive a value for
+;;; any cann of `notify!' for that topic.
+
+(defn subscribe
+  "Returns a channel with that will receive a value when `notify!' is
+  called for that topic."
+  [bus topic]
   (let [chan (async/chan (async/sliding-buffer 1))]
     (async/sub (:output bus) topic chan)
     chan))

+;;; TODO: Add optional extra data. Replace `identity' in `async/pub'
+;;; below with ::topic or similar and make `notify!' put maps into the
+;;; channel.
 (defn notify! [bus topic]
   (>!! (:input bus) topic ))


derive ->  enrich

derive ->  enrich

--- src/re_frame/core.cljs
+++ src/re_frame/core.cljs
@@ -20,7 +20,7 @@
 (def debug       middleware/debug)
 (def undoable    middleware/undoable)
 (def path        middleware/path)
-(def derive      middleware/derive)
+(def enrich      middleware/enrich)
 (def trim-v      middleware/trim-v)
 (def after       middleware/after)
 ; (def log-events  middleware/log-events)
@@ -29,8 +29,8 @@

 ;; --  Convenience API -------

-;; Almost 100% of handlers will be pure, so make that easy by
-;; registering with "pure" middleware in the correct position.
+;; Almost 100% of handlers will be pure, so make it easy to
+;; register with "pure" middleware in the correct position.
 (defn register-handler
   ([id handler]
     (handlers/register-base id pure handler))