support :boot-stem1 and :boot-stem2

support :boot-stem1 and :boot-stem2

--- src/babel/francais/morphology.cljc
+++ src/babel/francais/morphology.cljc
@@ -7,7 +7,7 @@
    [clojure.string :refer (trim)]
    #?(:clj [clojure.tools.logging :as log])
    #?(:cljs [babel.logjs :as log])
-   [dag_unify.core :refer (copy dissoc-paths fail? get-in ref? strip-refs unifyc)]))
+   [dag_unify.core :refer (copy dissoc-paths fail? get-in ref? strip-refs unify unifyc)]))

 (def replace-patterns
   (concat
@@ -40,20 +40,103 @@
                                 (get lexicon lex)))))))
            replace-patterns)))

-(defn conjugate [infinitive unify-with]
+(defn conjugate [infinitive unify-with & [lexicon]]
   "Conjugate an infinitive into a surface form by taking the first
    element of replace-patterns where the element's :u unifies successfully with
-   unify-with."
-  (let [result
-        (take 1
-              (remove #(nil? %)
-                      (map
-                       (fn [replace-pattern]
-                         (let [from (nth (:g replace-pattern) 0)
-                               to (nth (:g replace-pattern) 1)
-                               unify-against (if (:u replace-pattern)
-                                               (:u replace-pattern)
-                                               :top)]
+   unify-with. If lexicon is supplied, look up infinitive in lexicon and use exceptional form of
+   first return value, if any."
+  (let [exception (let [exception (first (get lexicon infinitive))
+                        boot-stem1 (get-in exception [:français :boot-stem])
+                        boot-stem2 (get-in exception [:français :boot-stem2])
+                        present-1-sing (get-in exception [:français :present :1sing])
+                        present-2-sing (get-in exception [:français :present :2sing])
+                        present-3-sing (get-in exception [:français :present :3sing])]
+                    (if exception
+                      [(cond
+                         (and present-1-sing
+                              (not (fail?
+                                    (unify {:synsem {:infl :present
+                                                     :subcat {:1 {:agr {:person :1st
+                                                                        :number :sing}}}}}
+                                           unify-with))))
+                         present-1-sing
+
+                         (and present-2-sing
+                              (not (fail?
+                                    (unify {:synsem {:infl :present
+                                                     :subcat {:1 {:agr {:person :2nd
+                                                                        :number :sing}}}}}
+                                           unify-with))))
+                         present-2-sing
+
+                         (and present-3-sing
+                              (not (fail?
+                                    (unify {:synsem {:infl :present
+                                                     :subcat {:1 {:agr {:person :3rd
+                                                                        :number :sing}}}}}
+                                           unify-with))))
+                         present-3-sing
+
+                         (and boot-stem1
+                              (not (fail?
+                                    (unify {:synsem {:infl :present
+                                                     :subcat {:1 {:agr {:person :1st
+                                                                        :number :sing}}}}}
+                                           unify-with))))
+                         (str boot-stem1 "s")
+
+                         (and boot-stem1
+                              (not (fail?
+                                    (unify {:synsem {:infl :present
+                                                     :subcat {:1 {:agr {:person :2nd
+                                                                        :number :sing}}}}}
+                                           unify-with))))
+                         (str boot-stem1 "s")
+
+                         (and boot-stem1
+                              (not (fail?
+                                    (unify {:synsem {:infl :present
+                                                     :subcat {:1 {:agr {:person :3rd
+                                                                        :number :sing}}}}}
+                                           unify-with))))
+                         (str boot-stem1 "t")
+
+                         (and boot-stem2
+                              (not (fail?
+                                    (unify {:synsem {:infl :present
+                                                     :subcat {:1 {:agr {:person :1st
+                                                                        :number :plur}}}}}
+                                           unify-with))))
+                         (str boot-stem2 "ons")
+
+                         (and boot-stem2
+                              (not (fail?
+                                    (unify {:synsem {:infl :present
+                                                     :subcat {:1 {:agr {:person :2nd
+                                                                        :number :plur}}}}}
+                                           unify-with))))
+                         (str boot-stem2 "ez")
+
+                         (and boot-stem1
+                              (not (fail?
+                                    (unify {:synsem {:infl :present
+                                                     :subcat {:1 {:agr {:person :3rd
+                                                                        :number :plur}}}}}
+                                           unify-with))))
+                         (str boot-stem1 "ent")
+
+                         true nil)]))
+        result
+        (or exception
+            (take 1
+                  (remove #(nil? %)
+                          (map
+                           (fn [replace-pattern]
+                             (let [from (nth (:g replace-pattern) 0)
+                                   to (nth (:g replace-pattern) 1)
+                                   unify-against (if (:u replace-pattern)
+                                                   (:u replace-pattern)
+                                                   :top)]
                             (if (and from to
                                      (re-matches from infinitive)
                                      (not (fail? (unifyc unify-against
@@ -65,17 +148,16 @@
                                 (log/debug (str "input spec: " (strip-refs unify-with)))
                                 (log/debug (str "pattern spec:"  (strip-refs unify-against)))
                                 (string/replace infinitive from to)))))
-                        replace-patterns)))]
+                           replace-patterns))))]
     (if (empty? result)
       (throw (Exception. (str "nothing found to match infinitive: " infinitive " ; "
                               " unify-with: " (strip-refs unify-with) ".")))
-
       (first result))))

 ;; TODO: separate part-of-speech -related functionality (e.g. the word is a verb) from
 ;; compositional functionality (e.g. the word has an :a and :b, so combine by concatenation, etc)
 ;;
-(defn get-string [word & [b]]
+(defn get-string [word & [b lexicon]]
   (cond (and (nil? b)
              (seq? word))
         (let [result (get-string word)]
@@ -223,7 +305,7 @@
                                       ;; TODO: add checks for other -stem features, like :imperfect-stem.
                                       true
                                       (get-in word [:français]))]
-                 (log/info (str "conjugate: infinitive=" infinitive "; word=" word))
+                 (log/debug (str "conjugate: infinitive=" infinitive "; word=" (strip-refs word)))
                  (conjugate infinitive word))))

            (and
@@ -376,154 +458,218 @@
                           :infl :infinitive}}}})

 (defn exception-generator [lexicon]
-  (let [lexeme-kv (first lexicon)
-        lexemes (second lexeme-kv)]
-    (if lexeme-kv
-      (let [result (mapcat (fn [path-and-merge-fn]
-                             (let [path (:path path-and-merge-fn)
-                                   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 (first lexeme-kv) ": looking at 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 [lexeme (cond (= lexeme :fail)
-                                                            :fail
-                                                            (= lexeme :top)
-                                                            :top
-                                                            true
-                                                            (copy lexeme))]
-                                           (if (not (= :none (get-in lexeme path :none)))
-                                             (list {(get-in lexeme path :none)
-                                                    (unifyc
-                                                     (dissoc-paths lexeme [path
-                                                                           [:français :français]])
-                                                     (unifyc (apply merge-fn (list lexeme))
-                                                             {:français {:exception true}}))}))))
-                                       lexemes)))
-                           [
-                            ;; 1. past-tense exceptions
-                            {:path [:français :past-participle]
-                             :merge-fn
-                             (fn [val]
-                               {:français {:infl :past-p
-                                           :français (get-in val [:français :past-participle] :nothing)}})}
-
-                            ;; 2. present-tense exceptions
-                            {:path [:français :present :1sing]
-                             :merge-fn
-                             (fn [val]
-                               {:français {:infl :present
-                                           :français (get-in val [:français :present :1sing] :nothing)
-                                           :agr {:number :sing
-                                                 :person :1st}}})}
-                            {:path [:français :present :2sing]
-                             :merge-fn
-                             (fn [val]
-                               {:français {:infl :present
-                                           :français (get-in val [:français :present :2sing] :nothing)
-                                           :agr {:number :sing
-                                                 :person :2nd}}})}
-
-                            {:path [:français :present :3sing]
-                             :merge-fn
-                             (fn [val]
-                               {:français {:infl :present
-                                           :français (get-in val [:français :present :3sing] :nothing)
-                                           :agr {:number :sing
-                                                 :person :3rd}}})}
-
-                            {:path [:français :present :1plur]
-                             :merge-fn
-                             (fn [val]
-                               {:français {:infl :present
-                                           :français (get-in val [:français :present :1plur] :nothing)
-                                           :agr {:number :plur
-                                                 :person :1st}}})}
-
-                            {:path [:français :present :2plur]
-                             :merge-fn
-                             (fn [val]
-                               {:français {:infl :present
-                                           :français (get-in val [:français :present :2plur] :nothing)
-                                           :agr {:number :plur
-                                                 :person :2nd}}})}
-
-                            {:path [:français :present :3plur]
-                             :merge-fn
-                             (fn [val]
-                               {:français {:infl :present
-                                           :français (get-in val [:français :present :3plur] :nothing)
-                                           :agr {:number :plur
-                                                 :person :3rd}}})}
-
-                            ;; 3. imperfect-tense exceptions
-                            {:path [:français :imperfect :1sing]
-                             :merge-fn
-                             (fn [val]
-                               {:français {:infl :imperfect
-                                           :français (get-in val [:français :imperfect :1sing] :nothing)
-                                           :agr {:number :sing
-                                                 :person :1st}}})}
-                            {:path [:français :imperfect :2sing]
-                             :merge-fn
-                             (fn [val]
-                               {:français {:infl :imperfect
-                                           :français (get-in val [:français :imperfect :2sing] :nothing)
-                                           :agr {:number :sing
-                                                 :person :2nd}}})}
-
-                            {:path [:français :imperfect :3sing]
-                             :merge-fn
-                             (fn [val]
-                               {:français {:infl :imperfect
-                                           :français (get-in val [:français :imperfect :3sing] :nothing)
-                                           :agr {:number :sing
-                                                 :person :3rd}}})}
-
-                            {:path [:français :imperfect :1plur]
-                             :merge-fn
-                             (fn [val]
-                               {:français {:infl :imperfect
-                                           :français (get-in val [:français :imperfect :1plur] :nothing)
-                                           :agr {:number :plur
-                                                 :person :1st}}})}
-
-                            {:path [:français :imperfect :2plur]
-                             :merge-fn
-                             (fn [val]
-                               {:français {:infl :imperfect
-                                           :français (get-in val [:français :imperfect :2plur] :nothing)
-                                           :agr {:number :plur
-                                                 :person :2nd}}})}
-
-                            {:path [:français :imperfect :3plur]
-                             :merge-fn
-                             (fn [val]
-                               {:français {:infl :imperfect
-                                           :français (get-in val [:français :imperfect :3plur] :nothing)
-                                           :agr {:number :plur
-                                                 :person :3rd}}})}
-
-                            ;; 4. adjectives
-                            {:path [:français :masc :plur]
-                             :merge-fn
-                             (fn [val]
-                               {:français {:agr {:gender :masc
-                                                 :number :plur}}})}
-
-                            {:path [:français :fem :plur]
-                             :merge-fn
-                             (fn [val]
-                               {:français {:agr {:gender :fem
-                                                 :number :plur}}})}
-                            ])]
-        (if (not (empty? result))
-          (concat result (exception-generator (rest lexicon)))
-          (exception-generator (rest lexicon)))))))
+  (mapcat
+   (fn [lexeme-kv]
+          (let [lexemes (second lexeme-kv)
+                result (mapcat (fn [path-and-merge-fn]
+                                 (let [path (:path path-and-merge-fn)
+                                       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 (first lexeme-kv) ": looking at 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.
+                                             (log/debug "lexeme: " (get-in lexeme [:français :français]))
+                                             (log/debug " path: " path)
+                                             (if-let [value (get-in lexeme path)]
+                                               (log/debug " value@" path ": " value))
+                                             (if (not (= ::none (get-in lexeme path ::none)))
+                                               (let [exceptional-lexeme
+                                                     (apply merge-fn (list lexeme))]
+                                                 (log/debug " exceptional-lexeme: " exceptional-lexeme)
+                                                 (cond (or (seq? exceptional-lexeme)
+                                                           (vector? exceptional-lexeme))
+                                                       (map (fn [exceptional-lexeme]
+                                                              (log/debug " RESULT(in-list): " exceptional-lexeme)
+                                                              (log/debug "   conjugated:"
+                                                                         (get-in exceptional-lexeme
+                                                                                [:français :français]))
+                                                              (let [exceptional-lexeme
+                                                                    (unify
+                                                                     exceptional-lexeme
+                                                                     (dissoc-paths lexeme [path
+                                                                                [:français :français]])
+                                                                     {:français {:exception true}})]
+                                                                (log/debug " RESULT(in-list)1: "
+                                                                           (dissoc
+                                                                            exceptional-lexeme
+                                                                            :dag_unify.core/serialized))
+                                                                {(get-in exceptional-lexeme [:français :français])
+                                                                 exceptional-lexeme}))
+                                                            exceptional-lexeme)
+
+                                                       true
+                                                       (let [exceptional-lexeme
+                                                             (unify
+                                                              exceptional-lexeme
+                                                              (dissoc-paths lexeme [path
+                                                                                [:français :français]])
+                                                              {:français {:exception true}})]
+                                                         (log/debug " RESULT1: "
+                                                                    (unify
+                                                                     exceptional-lexeme
+                                                                     (dissoc-paths lexeme [path
+                                                                                [:français :français]])))
+                                                         (log/debug " RESULT2: "
+                                                                    (dissoc
+                                                                     exceptional-lexeme
+                                                                     :dag_unify.core/serialized))
+                                                         (list {(get-in exceptional-lexeme [:français :français])
+                                                                exceptional-lexeme}))))))
+                                           lexemes)))
+                               [;; 1. past-tense exceptions
+                                {:path [:français :past-participle]
+                                 :merge-fn
+                                 (fn [val]
+                                   {:français {:infl :past-p
+                                               :français (get-in val [:français :past-participle] :nothing)}})}
+                                ;; 2. present-tense exceptions
+                                {:path [:français :present :1sing]
+                                 :merge-fn
+                                 (fn [val]
+                                   {:français {:infl :present
+                                               :français (get-in val [:français :present :1sing] :nothing)
+                                               :agr {:number :sing
+                                                     :person :1st}}})}
+                                {:path [:français :present :2sing]
+                                 :merge-fn
+                                 (fn [val]
+                                   {:français {:infl :present
+                                               :français (get-in val [:français :present :2sing] :nothing)
+                                               :agr {:number :sing
+                                                     :person :2nd}}})}
+                                {:path [:français :present :3sing]
+                                 :merge-fn
+                                 (fn [val]
+                                   {:français {:infl :present
+                                               :français (get-in val [:français :present :3sing] :nothing)
+                                               :agr {:number :sing
+                                                     :person :3rd}}})}
+                                {:path [:français :present :1plur]
+                                 :merge-fn
+                                 (fn [val]
+                                   {:français {:infl :present
+                                               :français (get-in val [:français :present :1plur] :nothing)
+                                               :agr {:number :plur
+                                                     :person :1st}}})}
+                                {:path [:français :present :2plur]
+                                 :merge-fn
+                                 (fn [val]
+                                   {:français {:infl :present
+                                               :français (get-in val [:français :present :2plur] :nothing)
+                                               :agr {:number :plur
+                                                     :person :2nd}}})}
+                                {:path [:français :present :3plur]
+                                 :merge-fn
+                                 (fn [val]
+                                   {:français {:infl :present
+                                               :français (get-in val [:français :present :3plur] :nothing)
+                                               :agr {:number :plur
+                                                     :person :3rd}}})}
+                                ;; 3. imperfect-tense exceptions
+                                {:path [:français :imperfect :1sing]
+                                 :merge-fn
+                                 (fn [val]
+                                   {:français {:infl :imperfect
+                                               :français (get-in val [:français :imperfect :1sing] :nothing)
+                                               :agr {:number :sing
+                                                     :person :1st}}})}
+                                {:path [:français :imperfect :2sing]
+                                 :merge-fn
+                                 (fn [val]
+                                   {:français {:infl :imperfect
+                                               :français (get-in val [:français :imperfect :2sing] :nothing)
+                                               :agr {:number :sing
+                                                     :person :2nd}}})}
+                                {:path [:français :imperfect :3sing]
+                                 :merge-fn
+                                 (fn [val]
+                                   {:français {:infl :imperfect
+                                               :français (get-in val [:français :imperfect :3sing] :nothing)
+                                               :agr {:number :sing
+                                                     :person :3rd}}})}
+                                {:path [:français :imperfect :1plur]
+                                 :merge-fn
+                                 (fn [val]
+                                   {:français {:infl :imperfect
+                                               :français (get-in val [:français :imperfect :1plur] :nothing)
+                                               :agr {:number :plur
+                                                     :person :1st}}})}
+                                {:path [:français :imperfect :2plur]
+                                 :merge-fn
+                                 (fn [val]
+                                   {:français {:infl :imperfect
+                                               :français (get-in val [:français :imperfect :2plur] :nothing)
+                                               :agr {:number :plur
+                                                     :person :2nd}}})}
+                                {:path [:français :imperfect :3plur]
+                                 :merge-fn
+                                 (fn [val]
+                                   {:français {:infl :imperfect
+                                               :français (get-in val [:français :imperfect :3plur] :nothing)
+                                               :agr {:number :plur
+                                                     :person :3rd}}})}
+                                ;; 3. present-tense boot-stem exception: :boot-stem1.
+                                {:path [:français :boot-stem1]
+                                 :merge-fn
+                                 (fn [val]
+                                   [{:français {:infl :present
+                                                :français (str (get-in val [:français :boot-stem1])
+                                                               "s")
+                                                :agr {:number :sing
+                                                      :person :1st}}}
+                                    {:français {:infl :present
+                                                :français (str (get-in val [:français :boot-stem1])
+                                                               "s")
+                                                :agr {:number :sing
+                                                      :person :2nd}}}
+                                    {:français {:infl :present
+                                                :français (str (get-in val [:français :boot-stem1])
+                                                               "t")
+                                                :agr {:number :sing
+                                                      :person :3rd}}}
+                                    {:français {:infl :present
+                                                :français (str (get-in val [:français :boot-stem1])
+                                                               "vent")
+                                                :agr {:number :plur
+                                                      :person :3rd}}}])}
+
+                                {:path [:français :boot-stem2]
+                                 :merge-fn
+                                 (fn [val]
+                                   [{:français {:infl :present
+                                                :français (str (get-in val [:français :boot-stem2])
+                                                               "ons")
+                                                :agr {:number :plur
+                                                      :person :1st}}}
+                                    {:français {:infl :present
+                                                :français (str (get-in val [:français :boot-stem2])
+                                                               "ez")
+                                                :agr {:number :plur
+                                                      :person :2nd}}}])}
+
+
+                                ;; 4. adjectives
+                                {:path [:français :masc :plur]
+                                 :merge-fn
+                                 (fn [val]
+                                   {:français {:agr {:gender :masc
+                                                     :number :plur}}})}
+                                {:path [:français :fem :plur]
+                                 :merge-fn
+                                 (fn [val]
+                                   {:français {:agr {:gender :fem
+                                                     :number :plur}}})}
+                                ])]
+            result))
+   lexicon))

 (defn phonize [a-map a-string]
   (let [common {:phrasal false}]


remove non-portable code

remove non-portable code

--- src/babel/italiano/morphology.cljc
+++ src/babel/italiano/morphology.cljc
@@ -1048,10 +1048,6 @@

    (= input :fail)
    (str input)
-
-   (= (type input) clojure.lang.LazySeq)
-   (str "['" (string/join "','" (map fo input)) "']")
-

    (string? input)
    input


very good

very good

--- src/bluebell/utils/setdispatch.clj
+++ src/bluebell/utils/setdispatch.clj
@@ -136,7 +136,7 @@
      system
      (clojure.set/difference all-sets all-elements))))

-(defn compute-alternatives [system dispatch-state args-memberships]
+(defn compute-specific-function [system dispatch-state args-memberships]
   (let [arity (count args-memberships)
         system (add-set-canonical-elements
                 (transduce cat
@@ -153,21 +153,6 @@
         frontier (pareto/elements (reduce pareto/insert
                                           (pareto/frontier alt-dominates?)
                                           matching-alternatives))]
-    (utils/map-of arity alternatives matching-alternatives frontier)))
-
-(def memoized-compute-alternatives (memoize compute-alternatives))
-
-(defn resolve-fn-call [system dispatch-state args]
-  (let [args-memberships (map (partial evaluate-feature-set-memberships
-                                       (:feature-extractor dispatch-state))
-                              args)
-        {:keys [arity
-                frontier
-                alternatives
-                matching-alternatives]} (memoized-compute-alternatives
-                                         system
-                                         dispatch-state
-                                         args-memberships)]
     (cond
       (empty? frontier) (throw (ex-info "No matching set-fn for this arity."
                                         (match-error-map
@@ -179,10 +164,21 @@
                                (match-error-map
                                 arity
                                 matching-alternatives)))
-      :default (apply (-> frontier
-                          first
-                          :fn)
-                      args))))
+      :default (-> frontier
+                   first
+                   :fn))))
+
+(def memoized-compute-specific-function (memoize compute-specific-function))
+
+(defn resolve-fn-call [system dispatch-state args]
+  (let [args-memberships (map (partial evaluate-feature-set-memberships
+                                       (:feature-extractor dispatch-state))
+                              args)
+        f (memoized-compute-specific-function
+           system
+           dispatch-state
+           args-memberships)]
+    (apply f args)))

 (defn dispatch-root [system dispatch-state]
   (fn [& args]


Whitespace

Whitespace

--- src/circle/backend/action/bash.clj
+++ src/circle/backend/action/bash.clj
@@ -77,7 +77,7 @@
                                                       :relative-timeout relative-timeout
                                                       :absolute-timeout absolute-timeout})
                                     result (apply-map remote-bash-build build body opts)]
-                                 (when (and (not= 0 (-> result :exit)) abort-on-nonzero)
+                                (when (and (not= 0 (-> result :exit)) abort-on-nonzero)
                                    (action/abort! build (str body " returned exit code " (-> result :exit))))
                                  ;; only add exit code, :out and :err are handled by hooking ssh/handle-out and ssh/handle-err in action.clj
                                  (action/add-action-result (select-keys result [:exit])))


fixed accidental suppressing of errors in unit tests

--- src/clj/backtype/storm/testing.clj
+++ src/clj/backtype/storm/testing.clj
@@ -196,6 +196,7 @@
        ~@body
      (catch Throwable t#
        (log-error t# "Error in cluster")
+       (throw t#)
        )
      (finally
        (kill-local-storm-cluster ~cluster-sym)))


get-arena-area returns properly

get-arena-area returns properly

Needs testing

--- src/clj/battlebots/utils/arena.clj
+++ src/clj/battlebots/utils/arena.clj
@@ -102,7 +102,7 @@
   [arena [posx posy] radius]
   (let [[xdim ydim] (get-arena-dimensions arena)
         [xmax ymax] (map dec [xdim ydim])
-        maxradius (int (/ xdim 2))
+        maxradius (int (/ (dec xdim) 2))
         nradius (if (> (inc (* 2 radius)) xdim)
                   maxradius
                   radius)
@@ -112,13 +112,24 @@
         ;; swapping as needed
         columns (if (> x2 x1)
                   (subvec arena x1 (inc x2))
-                  (conj (subvec arena x1) (subvec arena 0 (inc x2))))
-        area (map (fn [cols]
+                  (vec (concat (subvec arena (inc x1) xdim) (subvec arena 0 (inc x2)))))
+        area (map (fn [col]
                     (if (> y2 y1)
-                      (subvec cols y1 (inc y2))
-                      (conj (subvec cols y1) (subvec cols 0 (inc y2))))) columns)
-        ]
-    arena))
+                      (subvec col y1 (inc y2))
+                      (vec (concat (subvec col (inc y1) ydim) (subvec col 0 (inc y2))))
+                      )) columns)]
+    (comment (println "xdim " xdim)
+             (println "ydim " ydim)
+             (println "xmax " xmax)
+             (println "ymax " ymax)
+             (println "maxradius " maxradius)
+             (println "nradius " nradius)
+             (println "x1 " x1)
+             (println "y1 " y1)
+             (println "x2 " x2)
+             (println "y2 " y2)
+             (println "columns ")) (pretty-print-arena columns)
+    area))

 (defn get-wrapped-area-in-range
   "given an arena, a position, and fov radius return an arena subset within range"
@@ -156,3 +167,11 @@
                (+ posy (mod (+ posy radius)) y-bound)
                (+ posy radius))]
       (map #(subvec % y1 y2) (subvec arena x1 x2)))))
+
+(defn test-arena
+  [dimx dimy]
+  (vec (map-indexed
+        (fn [colidx col]
+          (vec (map-indexed
+                (fn [cellidx cell] {:display (str colidx cellidx)}) col)))
+        (empty-arena dimx dimy))))


Fix get-criteria-markdown

Fix get-criteria-markdown

--- src/clj/salava/badge/assertion.clj
+++ src/clj/salava/badge/assertion.clj
@@ -44,16 +44,17 @@
       {:error (t :badge/Failedfetchsigned)})))

 (defn get-criteria-markdown [criteria-url]
-  "Get criteria markdown."
-  (try+
-    (let [html (html/html-resource (java.net.URL. criteria-url))
+  "Get criteria markdown, if available."
+  (try
+    (let [html  (html/html-resource (io/input-stream (.getBytes (http-get criteria-url))))
           links (filter #(and (= (get-in % [:attrs :rel]) "alternate")
                               (= (get-in % [:attrs :type]) "text/x-markdown")) (html/select html [:head :link]))
           href (first (map #(get-in % [:attrs :href]) links))]
       (if href
-        (slurp href)))
-    (catch Object _
-      ; TODO: log error
+        (http-get href)))
+    (catch Exception ex
+      (log/error "get-criteria-markdown: failed to fetch content")
+      (log/error (.getMessage ex))
       "")))

 (defn new-badge-assertion [badge-assertion-url]


coerce entity-id to integer

coerce entity-id to integer

--- src/clj_money/web/money_shared.clj
+++ src/clj_money/web/money_shared.clj
@@ -33,7 +33,7 @@
   ([entity-id]
    (grouped-options-for-accounts entity-id {}))
   ([entity-id options]
-   (let [optgroups (->> (accounts/select-nested-by-entity-id (env :db) entity-id)
+   (let [optgroups (->> (accounts/select-nested-by-entity-id (env :db) (Integer. entity-id))
                         (filter #(or (nil? (:types options))
                                      ((:types options) (:type %))))
                         (map #(opt-group-for-account-type % (:selected-id options))))]


Add hashtags to db.

Add hashtags to db.

--- src/cljs/link_collective/core.cljs
+++ src/cljs/link_collective/core.cljs
@@ -58,10 +58,13 @@

 (def url-regexp #"(https?|ftp)://[a-z0-9-]+(\.[a-z0-9-]+)+(/[\w-]+)*(/[\w-\.]+)*")

+(re-seq #"#[\w\d-_]+" "#hello")
+
 (defn add-post [stage e]
   (let [post-id (uuid)
         ts (js/Date.)
         text (dom/value (dom/by-id "general-input-form"))
+        hash-tags (re-seq #"#[\w\d-_]+" text)
         urls (->> text
                   (re-seq url-regexp)
                   (map first))
@@ -71,12 +74,16 @@
                         ["eve@polyc0l0r.net"
                          #uuid "b09d8708-352b-4a71-a845-5f838af04116"
                          "master"]
-                        [{:db/id post-id
-                          :title (apply str (take 10 text))
-                          :detail-url (first urls)
-                          :detail-text text
-                          :user user
-                          :ts ts}]
+                        (concat [{:db/id post-id
+                                  :title (str (apply str (take 40 text)) "...")
+                                  :detail-url (first urls)
+                                  :detail-text  text
+                                  :user user
+                                  :ts ts}]
+                                (map (fn [t] {:db/id (uuid)
+                                             :post post-id
+                                             :tag (keyword t)
+                                             :ts ts}) hash-tags))
                         '(fn [old params]
                            (:db-after (d/transact old params)))))
         (<! (s/commit! stage
@@ -185,6 +192,15 @@
                             #uuid "b09d8708-352b-4a71-a845-5f838af04116"
                             "master"])))

+  (d/q '[:find ?h ?tag
+         :in $
+         :where
+         [?h :tag ?tag]]
+       (get-in @stage [:volatile :val
+                       "eve@polyc0l0r.net"
+                       #uuid "b09d8708-352b-4a71-a845-5f838af04116"
+                       "master"]))
+
   (d/q '[:find ?p (max 10 ?t)
          :in $ ?amount
          :where [?h :post ?p]
@@ -205,26 +221,25 @@
       (om/transact app)

       (recur (<! val-ch))))
-[{:db/id post-id
-                          :title "How to get a Designer"
-                          :detail-url "https://medium.com/coding-design/how-to-get-a-designer-b3afdf5a853d"
-                          :detail-text "Just some thoughts ..."
-                          :user "jane"
-                          :ts ts}
-                         {:db/id (uuid)
-                          :post post-id
-                          :content "awesome :D"
-                          :user "adam"
-                          :date "today"}
-                         {:db/id (uuid)
-                          :post post-id
-                          :tag :#coding}
-                         {:db/id (uuid)
-                          :post post-id
-                          :tag :#design}
-                         {:db/id (uuid)
-                          :post post-id
-                          :user "adam"
-                          :text "awesome :D"
-                          :date "today"}]
-  )
+  [{:db/id post-id
+    :title "How to get a Designer"
+    :detail-url "https://medium.com/coding-design/how-to-get-a-designer-b3afdf5a853d"
+    :detail-text "Just some thoughts ..."
+    :user "jane"
+    :ts ts}
+   {:db/id (uuid)
+    :post post-id
+    :content "awesome :D"
+    :user "adam"
+    :date "today"}
+   {:db/id (uuid)
+    :post post-id
+    :tag :#coding}
+   {:db/id (uuid)
+    :post post-id
+    :tag :#design}
+   {:db/id (uuid)
+    :post post-id
+    :user "adam"
+    :text "awesome :D"
+    :date "today"}])


formating

formating

--- src/cljs/tictactoe/logic/turn.cljs
+++ src/cljs/tictactoe/logic/turn.cljs
@@ -9,9 +9,7 @@
 ;; --------------------------------------------------------

 (defn- next-player [current]
-  (if (= :owner/cross current)
-    :owner/circle
-    :owner/cross))
+  (if (= :owner/cross current) :owner/circle :owner/cross))

 (defn- same-owner?
   "Indicates whether all positions are owned by the same player"


testing check

testing check

--- src/cljs/triboard/logic/board.cljs
+++ src/cljs/triboard/logic/board.cljs
@@ -49,7 +49,7 @@

 (s/fdef empty-cells
   :args (s/cat :board ::board)
-  :ret (s/coll-of ::coord))
+  :ret (s/coll-of ::coord)) ;; TODO - Fails with empty collection, also fails with a s/or!

 (defn board?
   "A board is a vector of vector of cells"
@@ -96,3 +96,6 @@

 ;; You can test this function by using
 ;; (empty-cells (first (gen/sample (s/gen ::board) 1)))
+;; (stest/check `empty-cells)
+;; (s/explain `empty-cells empty-cells)
+;; (stest/instrument `empty-cells)


CMR-5351: Allow top-level config to override default config file.

--- src/cmr/exchange/common/config.clj
+++ src/cmr/exchange/common/config.clj
@@ -70,7 +70,9 @@
        ((fn [x] (log/trace "env-data:" x) x))))

 (defn data
-  []
-  (util/deep-merge (base-data)
-                   (props-data)
-                   (env-data)))
+  ([]
+    (data config-file))
+  ([filename]
+    (util/deep-merge (base-data filename)
+                     (props-data)
+                     (env-data))))


CMR-694: Updating metadata db routes so that native ids with slashes and other kinds of characters will be correctly handled.

--- src/cmr/metadata_db/api/routes.clj
+++ src/cmr/metadata_db/api/routes.clj
@@ -182,7 +182,7 @@
         (get-concept request-context params concept-id)))

     ;; get the concept id for a given concept-type, provider-id, and native-id
-    (GET "/concept-id/:concept-type/:provider-id/:native-id"
+    (GET ["/concept-id/:concept-type/:provider-id/:native-id" :native-id #".*$"]
       {{:keys [concept-type provider-id native-id] :as params} :params request-context :request-context}
       (get-concept-id request-context params concept-type provider-id native-id))


Replace (unused) printlns with timbre

Replace (unused) printlns with timbre

--- src/braid/bots/server/routes.clj
+++ src/braid/bots/server/routes.clj
@@ -167,8 +167,7 @@

 (defn bad-transit-resp-fn
   [ex req handler]
-  (println "transit error: " ex)
-  (println "req" req)
+  (timbre/warnf "transit error: %s\nrequest: %s" ex req)
   {:status 400
    :headers {"Content-Type" "text/plain"}
    :body "Malformed transit body"})


Fix small gap in line 5

Fix small gap in line 5

--- src/braid/ui/styles/imports.cljs
+++ src/braid/ui/styles/imports.cljs
@@ -2,5 +2,5 @@
   (:require [garden.stylesheet :refer [at-import]]))

 (def imports
-  [(at-import      "https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css")
-  (at-import "https://fonts.googleapis.com/css?family=Open+Sans:400,300,400italic,700")])
+  [(at-import "https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css")
+   (at-import "https://fonts.googleapis.com/css?family=Open+Sans:400,300,400italic,700")])


Hook in email functionality

Hook in email functionality

--- src/clj/freestuffly/notifier.clj
+++ src/clj/freestuffly/notifier.clj
@@ -32,10 +32,6 @@
   [results]
   (string/join "-------- \n" results))

-(defn listen
-  []
-  (presentable (content-for (parsed-html (client/get my-group-urls)))))
-
 (defn send-email
   []
   (let [credentials {:api-key (System/getenv "MAILGUN_API_KEY") :domain (System/getenv "YOUR_DOMAIN")}
@@ -43,5 +39,9 @@
                 :from "emile.swarts123@gmail.com"
                 :to "emile.swarts123@gmail.com"
                 :subject "Free stuffly"
-                :text (listen)}]
+                :text (presentable (content-for (parsed-html (client/get my-group-urls))))}]
     (mailgun/send-email credentials params)))
+
+(defn listen
+  []
+  (send-email))


lean and extensive view on different pages

--- src/clj/hsm/controllers/coll.clj
+++ src/clj/hsm/controllers/coll.clj
@@ -97,20 +97,25 @@
                   (str proj-owner " ") ] [:span " / "]
                 [:a.gray {:href (str "/p/" (str item el))}
                   proj-name ]]
-                (render-delete-action-button (:id c) item)]
+                (when detailed
+                  [:div (render-delete-action-button (:id c) item)])]
             [:div.col-lg-8
-              [:p [:b (:watchers proj)] " follows this project"]
-              [:p (:description proj)]
-              [:hr]
-              ]]))
+              (when detailed
+                [:div
+                  [:p [:b (:watchers proj)] " follows this project"]
+                  [:p (:description proj)]
+                  [:hr]])
+              ]]))]
       [:div.panel-footer
+        (when detailed
+          [:div
         [:a.green {:href "#" :onclick "$(this).parent().find('form').toggle()"} "Add New"]
         [:form {:method "POST" :action (format "/collections/%s/add" (:id c)) :style "display:none;"}
           [:div#remote
             [:input.typeahead {:type "text" :name :project :placeholder "Type to find project"}]]
             [:a.btn.btn-default {:href "#" :rel "nofollow" :onclick submit-form} "Add"]]
-        [:a.red.pull-right {:href (format "/collections/%s/rm" (:id c)) :rel "nofollow" } "Delete"]
-            ]]])
+        [:a.red.pull-right {:href (format "/collections/%s/rm" (:id c)) :rel "nofollow" } "Delete"]])
+            ]])

 (defn load-projects-of-collections
   [db project-items]


parse hosts file and split them by comma

--- src/clj/hsm/system/cassandra.clj
+++ src/clj/hsm/system/cassandra.clj
@@ -12,7 +12,8 @@

   (start [component]
     (log/info "Starting Cassandra database")
-    (let [conn (cc/connect [host])]
+    (let [hosts (vec (.split host ","))
+          conn (cc/connect hosts)]
       (db/create-or-use-keyspace conn keyspace)
       (assoc component :connection conn)))


fix npe

fix npe

--- src/clj/swarmpit/docker/http.clj
+++ src/clj/swarmpit/docker/http.clj
@@ -4,7 +4,8 @@
             [clj-http.client :as client]
             [cheshire.core :refer [parse-string generate-string]]
             [swarmpit.config :refer [config]]
-            [clojure.string :as str])
+            [clojure.string :as str]
+            [clojure.tools.logging :as log])
   (:import (org.apache.http.config RegistryBuilder)
            (swarmpit.socket UnixSocketFactory)
            (org.apache.http.impl.conn BasicHttpClientConnectionManager)
@@ -53,11 +54,7 @@
                       :body               (generate-string payload)
                       :retry-handler      (fn [& args] false)})
           response-type (-> response :headers :Content-Type)]
-      ;(if (str/includes? response-type "application/json")
-      ;  (-> response :body (parse-string true))
-      ;  (-> response :body))
-
-      (if (str/includes? response-type "text/plain")
+      (if (str/includes? (or response-type "") "text/plain")
         (-> response :body)
         (-> response :body (parse-string true))))
     (catch IOException exception


The alert class name should be "danger" in case of an error

--- src/cljs/hyphen_keeper/core.cljs
+++ src/cljs/hyphen_keeper/core.cljs
@@ -227,7 +227,7 @@
                                      ;; reload the patterns
                                      (load-hyphenation-patterns! @spelling @word))
                         on-error (fn [details]
-                                   (set-feedback! (str "Failed to add hyphenation pattern: " details) :error))]
+                                   (set-feedback! (str "Failed to add hyphenation pattern: " details) :danger))]
                     (add-hyphenation-pattern! pattern on-success on-error)))
      :disabled (when (or (string/blank? @word)
                          (not (hyphenation-valid? @hyphenation @word))


Use closures to implement pure method override.

--- src/cljs/idealist/event-bus.cljs
+++ src/cljs/idealist/event-bus.cljs
@@ -42,21 +42,35 @@
                    (got-event c e))
                  (recur))))))

+
+
+(defn- around-method!
+  "Overrides a pure method by wrapping it in f."
+  [method methods f]
+  (let [prev-method (method methods)]
+    (-> methods
+        (assoc method #(this-as this
+                                (do
+                                   (f this (fn []
+                                             (.call prev-method this)))))))))
+
+(defn- before-method!
+  "Overrides a pure method to call function f before its body."
+  [method methods f]
+  (around-method! method methods (fn [this super]
+                                   (f this)
+                                   (super))))
+
 (defn- before-will-mount!
   "Overrides componentWillMount pure method to call function f before its body."
   [methods f]
-  (let [prev-will-mount (:componentWillMount methods)]
-    (-> methods
-        (assoc :dly_prevWillMount prev-will-mount)
-        (assoc :componentWillMount #(this-as this
-                                             (do
-                                               (f this)
-                                               ((.-dly_prevWillMount this))))))))
+  (before-method! :componentWillMount methods f))

 (defn- make-descriptor
   "Creates a custom descriptor with support for an event bus."
   []
   (let [methods (before-will-mount! om/pure-methods (fn [this]
+                                                      (js/console.log "init-event-bus!")
                                                       (init-event-bus! this)))
         descriptor (om/specify-state-methods! (clj->js methods))]
     descriptor))
@@ -91,4 +105,5 @@
   "Sends an event from the component downwards to its parent components."
   [owner event]
   (let [event-send-fn (om/get-state owner ::trigger-fn)]
-    (event-send-fn event)))+    (event-send-fn event)))
+


Hide tabs when window is focused

Hide tabs when window is focused

--- src/clojure/nightcode/window.clj
+++ src/clojure/nightcode/window.clj
@@ -60,6 +60,7 @@
   (.addWindowListener window
     (proxy [WindowAdapter] []
       (windowActivated [e]
+        (shortcuts/toggle-hint! @editors/tabs false)
         (shortcuts/toggle-hints! @ui/root false)
         (ui/update-project-tree!))
       (windowClosing [e]


Remove a few blacklisted symbols

Remove a few blacklisted symbols

--- src/clojure/nightmod/sandbox.clj
+++ src/clojure/nightmod/sandbox.clj
@@ -11,7 +11,7 @@

 (def blacklist-symbols
   '#{alter-var-root resolve find-var with-redefs-fn intern
-     *read-eval* set! eval catch
+     *read-eval* eval
      addMethod forName
      load load-file load-string load-reader
      ns-resolve ns-publics ns-unmap ns-map ns-interns the-ns in-ns require


Basic idea of async gRPC call implemented

--- src/clojure_fabric/grpc_core.clj
+++ src/clojure_fabric/grpc_core.clj
@@ -31,12 +31,15 @@
   (:import [org.hyperledger.fabric.protos.peer Chaincode$ChaincodeID Chaincode$ChaincodeSpec
             Chaincode$ChaincodeInput Chaincode$ChaincodeSpec$Type Chaincode$ChaincodeInvocationSpec
             ProposalPackage$ChaincodeHeaderExtension ProposalPackage$ChaincodeProposalPayload
-            ProposalPackage$Proposal ProposalPackage$SignedProposal EndorserGrpc]
+            ProposalPackage$Proposal ProposalPackage$SignedProposal EndorserGrpc
+            EndorserGrpc$EndorserStub]
            [org.hyperledger.fabric.protos.common Common$ChannelHeader Common$HeaderType
             Common$Header Common$SignatureHeader]
            [org.hyperledger.fabric.protos.msp Identities$SerializedIdentity]
            [com.google.protobuf ByteString Timestamp]
            [java.io ByteArrayInputStream]
+           [io.grpc ManagedChannel]
+           [io.grpc.stub StreamObserver]
            [io.grpc.netty NettyChannelBuilder GrpcSslContexts]
            [io.netty.handler.ssl SslContext SslProvider]
            ))
@@ -261,9 +264,24 @@
                     (.overrideAuthority channel-builder ^String hostname-override)))))
     (.build channel-builder)))

+(defn response-waiting-observer
+  [ch]
+  (reify StreamObserver
+    (onNext [this proposal-response]
+      (async/put! ch [:ok proposal-response]))
+    (onError [this err]
+      (async/put! ch [:error err]))
+    (onCompleted [this]
+      (async/put! ch [:done]))))
+
 (defn send-chaincode-request-to-peer
   [peer proposal]
-  )
+  (let [ch (async/chan 1)]
+    (.processProposal (EndorserGrpc/newStub ^ManagedChannel (peer->channel peer))
+                     proposal
+                     (response-waiting-observer ch))
+    (async/<!! ch)))
+
 #_
 (defn send-chaincode-request
   [chaincode-key peers user-context crypto-suite]


Add base entity to env on normalize

Add base entity to env on normalize

--- src/com/wsscode/pathom/core.cljc
+++ src/com/wsscode/pathom/core.cljc
@@ -931,6 +931,7 @@
       (parser (assoc env ::plugin-actions (group-plugins-by-action plugins)
                          ::plugins plugins
                          ::request-cache (atom {})
+                         ::entity (atom {})
                          ::entity-key ::entity
                          ::parent-query tx
                          ::entity-path-cache (atom {})


CMR-3926 some spaces removed from collection update test

--- system-int-test/test/cmr/system_int_test/ingest/collection_update_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/collection_update_test.clj
@@ -871,15 +871,15 @@
          Currently it's okay if it exists under other platforms."
         ["p1-1" "i2" "GPS" "i4"]
         ["p1-2" "i1" "i2" "GPS" "i4"]
-
+
         "Adding an additional instrument is OK"
         ["p1-1" "i1" "i2" "GPS" "i4" "i5"]
         ["p1-2" "i1" "i2" "GPS" "i4" "i5"]
-
+
         "Removing an instrument not referenced by any granule in the collection is OK"
         ["p1-1" "i1" "i2" "GPS"]
         ["p1-2" "i1" "i2" "GPS"]
-
+
         "Updating an instrument  to humanized alias(case insensitively) referenced by granule on the original value is OK"
         ["p1-1" "i1" "i2" "Gps Receivers"]
         ["p1-2" "i1" "i2" "Gps Receivers"]))
@@ -899,7 +899,7 @@
         "Removing an instrument  that is referenced by a granule is invalid."
         ["p2" "i2" "GPS RECEIVERS"]
         ["Collection Child Instrument [s1] is referenced by existing granules, cannot be removed. Found 1 granules."]
-
+
         "Updating an instrument  that is referenced by a granule by humanized alias back to its original value is invalid."
         ["p2" "i2" "GPS" "s1"]
         ["Collection Child Instrument [GPS RECEIVERS] is referenced by existing granules, cannot be removed. Found 1 granules."]))))


don't require sidecar in the plugin

don't require sidecar in the plugin

fixes #260

--- plugin/project.clj
+++ plugin/project.clj
@@ -4,9 +4,7 @@
   :license {:name "Eclipse Public License - v 1.0"
             :url "http://www.eclipse.org/legal/epl-v10.html"}

-  :dependencies [[figwheel-sidecar "0.5.4-SNAPSHOT"]
-                 [figwheel "0.5.4-SNAPSHOT"]
-                 [clj-fuzzy "0.3.1"]]
+  :dependencies [[clj-fuzzy "0.3.1"]]

   :scm { :name "git"
          :url "https://github.com/bhauman/lein-figwheel"


change identifier

change identifier

--- ssclj/jar/src/com/sixsq/slipstream/ssclj/resources/configuration.clj
+++ ssclj/jar/src/com/sixsq/slipstream/ssclj/resources/configuration.clj
@@ -133,3 +133,12 @@
 (defmethod crud/query resource-name
   [request]
   (query-impl request))
+
+;;
+;; use name as the identifier
+;;
+
+(defmethod crud/new-identifier resource-name
+  [resource resource-name]
+  (if-let [new-id (:service resource)]
+    (assoc resource :id (str (u/de-camelcase resource-name) "/" new-id))))


Allow nil assets to be returned from javascripts and stylesheets.

Do not fail noisily when an asset file is missing.

--- src/incise/layouts/impl/page.clj
+++ src/incise/layouts/impl/page.clj
@@ -5,7 +5,8 @@
             (hiccup [def :refer :all]
                     [page :refer :all]
                     [element :refer :all]
-                    [core :refer :all])))
+                    [core :refer :all]))
+  (:import [java.io FileNotFoundException]))

 (defpartial header
   "A very basic header partial."
@@ -21,11 +22,18 @@
     "This website was "
     (link-to "https://github.com/RyanMcG/incise" "incise") "d."]])

+(defn- attempt-link-to-asset
+  "Return nil if the asset is not found othewise return a url for the asset."
+  [asset-name]
+  (try
+    (link-to-asset asset-name)
+    (catch FileNotFoundException _ nil)))
+
 (defn stylesheets []
-  [(link-to-asset "stylesheets/app.css.stefon")])
+  [(attempt-link-to-asset "stylesheets/app.css.stefon")])

 (defn javascripts []
-   [(link-to-asset "javascripts/app.js.stefon")])
+   [(attempt-link-to-asset "javascripts/app.js.stefon")])

 (deflayout page
   "The default page/post layout."
@@ -33,12 +41,12 @@
    [:title (str site-title (when title (str " - " title)))]
    [:meta {:name "viewport"
            :content "width=device-width, initial-scale=1.0"}]
-   (apply include-css (stylesheets))]
+   (apply include-css (remove nil? (stylesheets)))]
   [:body#page
    [:div.container
     (header)
     [:div#content content]
     (footer)]
-   (apply include-js (javascripts))])
+   (apply include-js (remove nil? (javascripts)))])

 (register [:post :page] page)


CMR-2879: Removed unused require.

CMR-2879: Removed unused require.

--- search-app/test/cmr/search/test/data/metadata_retrieval/test_metadata.clj
+++ search-app/test/cmr/search/test/data/metadata_retrieval/test_metadata.clj
@@ -1,7 +1,6 @@
 (ns cmr.search.test.data.metadata-retrieval.test-metadata
   (require
    [clojure.java.io :as io]
-   [clojure.string :as str]
    [cmr.common.mime-types :as mt]
    [cmr.search.data.metadata-retrieval.metadata-transformer :as t]))


phew...types!

phew...types!

--- src/leiningen/code_generator.clj
+++ src/leiningen/code_generator.clj
@@ -19,7 +19,11 @@
     (mapv (t/fn [col :- (t/HSequential [Keyword t/Any *])] {:colname (name (first col))}) filt-cols)))

-(ann dataset->template-map [String pt/entity-description -> t/Any])
+(ann dataset->template-map [String pt/entity-description ->
+                            (t/HMap :mandatory {:entityname String
+                                                :entityname-upper String
+                                                :ns String
+                                                :cols (t/Option (Seqable (t/HMap :mandatory {:colname String})))})])
 (defn dataset->template-map
   "Will remove every column with the name :id"
   [ns ds]
@@ -28,17 +32,18 @@
      :entityname-upper (.toUpperCase ^String (:name ds))
      :ns               (str ns "." (:name ds))
      :cols             cols}))
-;
-;(ann ^:no-check render-db-file [String pt/entity-description -> String])
-;(defn render-db-file [ns dataset]
-;  (let [templ-map (dataset->template-map ns dataset)]
-;    (stenc/render-file "templates/db.mustache" templ-map)))

-;(defn store-db-file [ns string filename proj-fp]
-;  (let [ns-path (str proj-fp "/" (s/replace ns #"\." "/"))
-;        ns-file-path (str ns-path "/" filename)]
-;    (faf/create-if-not-exists ns-path)
-;    (spit ns-file-path string)))
+(ann ^:no-check render-db-file [String pt/entity-description -> String])
+(defn render-db-file [ns dataset]
+  (let [templ-map (dataset->template-map ns dataset)]
+    (stenc/render-file "templates/db.mustache" templ-map)))
+
+
+(defn store-db-file [ns string filename proj-fp]
+  (let [ns-path (str proj-fp "/" (s/replace ns #"\." "/"))
+        ns-file-path (str ns-path "/" filename)]
+    (faf/create-if-not-exists ns-path)
+    (spit ns-file-path string)))
 ;
 ;(defn store-dataset [ns dataset proj-fp]
 ;  (let [file-content (render-db-file ns dataset)


Log messages to the view's console.

Log messages to the view's console.

--- src/fm/simrunner/gui/rendering.clj
+++ src/fm/simrunner/gui/rendering.clj
@@ -133,3 +133,11 @@
 (defn unlock! [app]
   (render-app! app :before unlock))

+(defn add-messages [app-state messages]
+  (if (seq messages)
+    (update-in app-state [:ui :model :messages] conj messages)
+    app-state))
+
+(defn log-messages! [app & messages]
+  (render-app! app :before #(add-messages % messages)))
+


Support null token (#238)

Support null token (#238)

--- scheduler/src/cook/spnego.clj
+++ scheduler/src/cook/spnego.clj
@@ -78,13 +78,16 @@
   [rh]
   (fn [req]
     (if (get-in req [:headers "authorization"])
-      (let [gss_context (gss-context-init)]
-        (if-let [token (do-gss-auth-check gss_context req)]
+      (let [gss_context (gss-context-init)
+            token (do-gss-auth-check gss_context req)]
+        ; Use isEstablished to confirm that the client authenticated correctly.
+        ; If token is non-nil, add a WWW-Authenticate header to the response.
+        (if (.isEstablished gss_context)
           (let [princ (gss-get-princ gss_context)]
-            (-> req
-                (assoc :krb5-authenticated-princ princ
-                       :authorization/user (first (str/split princ #"@" 2)))
-                (rh)
-                (header "WWW-Authenticate" token)))
+            (cond-> (-> req
+                        (assoc :krb5-authenticated-princ princ
+                               :authorization/user (first (str/split princ #"@" 2)))
+                        (rh))
+              token (header "WWW-Authenticate" token)))
           (response-401-negotiate)))
-      (response-401-negotiate))))
+        (response-401-negotiate))))


fix fen parsing for Clojurescript

fix fen parsing for Clojurescript

--- src/main/cljc/chessdojo/fen.cljc
+++ src/main/cljc/chessdojo/fen.cljc
@@ -1,5 +1,7 @@
 (ns chessdojo.fen
-  (:require [clojure.zip :as zip]
+  (:require
+    #?(:cljs [cljs.reader :refer [read-string]])
+    [clojure.zip :as zip]
             [chessdojo.rules :refer [to-sqr]]))

 ;


Fixing a problem with the collection periodic temporal test.

--- test/cmr/system_int_test/search/collection_periodic_temporal_search_test.clj
+++ test/cmr/system_int_test/search/collection_periodic_temporal_search_test.clj
@@ -90,28 +90,32 @@
 (deftest search-by-periodic-temporal
   (testing "search by both start-day and end-day."
     (let [references (search/find-collection-refs
-                       {"temporal[]" "2000-02-15T00:00:00Z, 2002-03-15T00:00:00Z, 32, 90"})]
+                       {"temporal[]" "2000-02-15T00:00:00Z, 2002-03-15T00:00:00Z, 32, 90"
+                        :page_size 100})]
       (is (= 8 (count references)))
       (is (= #{"Dataset2" "Dataset3" "Dataset6" "Dataset7"
               "Dataset10" "Dataset11" "Dataset16" "Dataset17"}
             (set (map #(:dataset-id %) references))))))
   (testing "search by end-day."
     (let [references (search/find-collection-refs
-                       {"temporal[]" "2000-02-15T00:00:00Z, 2002-03-15T00:00:00Z, , 90"})]
+                       {"temporal[]" "2000-02-15T00:00:00Z, 2002-03-15T00:00:00Z, , 90"
+                        :page_size 100})]
       (is (= 10 (count references)))
       (is (= #{"Dataset2" "Dataset3" "Dataset5" "Dataset6" "Dataset7"
               "Dataset9" "Dataset10" "Dataset11" "Dataset16" "Dataset17"}
             (set (map #(:dataset-id %) references))))))
   (testing "search by start-day."
     (let [references (search/find-collection-refs
-                       {"temporal[]" "2000-02-15T00:00:00Z, 2002-03-15T00:00:00Z, 32,"})]
+                       {"temporal[]" "2000-02-15T00:00:00Z, 2002-03-15T00:00:00Z, 32,"
+                        :page_size 100})]
       (is (= 11 (count references)))
       (is (= #{"Dataset2" "Dataset3" "Dataset4" "Dataset6" "Dataset7"
               "Dataset8" "Dataset10" "Dataset11" "Dataset16" "Dataset17" "Dataset19"}
             (set (map #(:dataset-id %) references))))))
   (testing "search by start-day without end_date."
     (let [references (search/find-collection-refs
-                       {"temporal[]" ["2000-02-15T00:00:00Z, , 32"]})]
+                       {"temporal[]" ["2000-02-15T00:00:00Z, , 32"]
+                        :page_size 100})]
       (is (= 15 (count references)))
       (is (= #{"Dataset2" "Dataset3" "Dataset4" "Dataset6" "Dataset7"
               "Dataset8" "Dataset10" "Dataset11" "Dataset12" "Dataset13"
@@ -119,7 +123,8 @@
             (set (map #(:dataset-id %) references))))))
   (testing "search by start-day/end-day with date crossing year boundary."
     (let [references (search/find-collection-refs
-                       {"temporal[]" ["2000-04-03T00:00:00Z, 2002-01-02T00:00:00Z, 93, 2"]})]
+                       {"temporal[]" ["2000-04-03T00:00:00Z, 2002-01-02T00:00:00Z, 93, 2"]
+                        :page_size 100})]
       (is (= 11 (count references)))
       (is (= #{"Dataset3" "Dataset4" "Dataset5" "Dataset6" "Dataset7" "Dataset8"
               "Dataset9" "Dataset10" "Dataset16" "Dataset17" "Dataset19"}
@@ -127,7 +132,8 @@
   (testing "search by multiple temporal."
     (let [references (search/find-collection-refs
                        {"temporal[]" ["1998-01-15T00:00:00Z, 1999-03-15T00:00:00Z, 60, 90"
-                                      "2000-02-15T00:00:00Z, 2001-03-15T00:00:00Z, 40, 50"]})]
+                                      "2000-02-15T00:00:00Z, 2001-03-15T00:00:00Z, 40, 50"]
+                        :page_size 100})]
       (is (= 5 (count references)))
       (is (= #{"Dataset2" "Dataset6" "Dataset14" "Dataset16" "Dataset17"}
             (set (map #(:dataset-id %) references)))))))


ARM: LPC32xx: Build arch dtbs

ARM: LPC32xx: Build arch dtbs

Add ea3250.dtb and phy3250.dtb to the list of dtbs to be built

Signed-off-by: Alexandre Pereira da Silva <7dd5197115085eca2e5ac8e7d69df60abf351f1d@gmail.com>
Signed-off-by: Roland Stigge <46ef883ee29e711e29b1a68d4ada6c2ebfaacc1f@antcom.de>

--- arch/arm/mach-lpc32xx/Makefile.boot
+++ arch/arm/mach-lpc32xx/Makefile.boot
@@ -2,3 +2,4 @@
 params_phys-y	:= 0x80000100
 initrd_phys-y	:= 0x82000000

+dtb-$(CONFIG_ARCH_LPC32XX) += ea3250.dtb phy3250.dtb


Fix in-fn.

Fix in-fn.

--- src/dsbdp/main.clj
+++ src/dsbdp/main.clj
@@ -102,8 +102,8 @@
                        out-fn))
           in-fn (cond
                   (nil? in-data) (fn [] (.inc in-cntr))
-                  (= scenario "pcap-direct") (fn []
-                                               (proc-fn in-data)
+                  (= scenario "pcap-direct") (fn [d]
+                                               (proc-fn d)
                                                (.inc in-cntr))
                   :default (get-in-fn pipeline))
           in-loop (ProcessingLoop.
@@ -111,7 +111,7 @@
                     (if (not (nil? in-data))
                       (fn []
                         (doseq [i (repeat 1000 0)]
-                          (in-fn)
+                          (in-fn in-data)
                           (.inc in-cntr))
                         (sleep 1))
                       (fn []


Fix get-window-handles for chrome and phantom

This command failed with an HTTP error. I've confirmed that this fix works for
the recent versions of chromedriver and phantomjs that I have installed.

--- src/etaoin/api.clj
+++ src/etaoin/api.clj
@@ -209,7 +209,7 @@
 (defmethods get-window-handles [:chrome :phantom]
   [driver]
   (with-resp driver :get
-    [:session (:session @driver) :window :window_handles]
+    [:session (:session @driver) :window_handles]
     nil resp
     (:value resp)))


Fix bug in sahucs for recursive hierarchies.

--- src/exp/sahucs.clj
+++ src/exp/sahucs.clj
@@ -98,19 +98,21 @@
                          (util/filter-map #(<= (val %) last-cutoff)  @(:result-map-atom node)))]
      (if (< (cutoff node) next-best)
          (PartialResult (stitch-effect-map new-results state reward-to-state) (cutoff node))
-       (let [[entry neg-reward] (queues/g-pq-remove-min-with-cost! (:queue node))
+       (let [[entry neg-reward] (queues/g-pq-peek-min (:queue node))
              b-s (:state entry), b-rts (:reward-to-state entry),
              b-ra (:remaining-actions entry), b-sa (:sanode entry)
              rec-next-best (- (max next-best (cutoff node)) b-rts)]
            (if (empty? b-ra)
                (let [eff (extract-effect b-s (:context node) (:opt (meta b-s)))]
                  (swap! (:result-map-atom node) assoc-safe >= eff b-rts)
+                 (queues/g-pq-remove!  (:queue node) entry)
                  (recur (assoc-safe new-results >= eff b-rts)))
              (let [rec (expand-sa-node b-sa cache rec-next-best b-s b-rts (- 0 neg-reward b-rts))]
                (doseq [[ss sr] (:result-map rec)]
                  (queues/g-pq-add! (:queue node) (get-sanode-entry cache ss sr (next b-ra)) (- sr)))
-               (when (> (:cutoff rec) Double/NEGATIVE_INFINITY)
-                 (queues/g-pq-replace! (:queue node) entry (- 0 b-rts (:cutoff rec))))
+               (if (> (:cutoff rec) Double/NEGATIVE_INFINITY)
+                   (queues/g-pq-replace! (:queue node) entry (- 0 b-rts (:cutoff rec)))
+                 (queues/g-pq-remove!  (:queue node) entry))
                (recur new-results)))))))


Some fonts and stuff

Some fonts and stuff

--- src/angelic/scripts/thesis.clj
+++ src/angelic/scripts/thesis.clj
@@ -87,7 +87,7 @@
 (def +ns-reps+ 5)

 (defn nsh [e] (ns/make-nav-switch-hierarchy e false))
-
+;asdf
 (def ns-algs
   [["dijkstra" `(textbook/uniform-cost-search ~'init true)]
    ["astar" `(textbook/a*-search ~'init ns/simple-ns-heuristic true)]
@@ -118,11 +118,9 @@
    ["dash-astar-nos" `(da/implicit-dash-a* (nsh ~'init) :abstract? false)]
    ["dash-astar-nods" `(da/implicit-dash-a* (nsh ~'init) :abstract? false :decompose? false)]])

-
-
 (defn make-ns-exps [& [test]]
   (for [[n f] ns-algs]
-    [n [(fn [sz rep]
+    [n [(fn [sz rep]
           (let [size (nth +ns-sizes+ sz)]
             (experiments/make-experiment
              (str n "-" sz "-" rep)
@@ -335,13 +333,18 @@
                                    (filter :ms s)))]
       {target-field r})))

+(defn derive-median-multi [c target-field mapper]
+  (fn [s]
+    (when-let [r (median-of c (map mapper (filter :ms s)))]
+      {target-field r})))
+
 (def chart-opts
-  {:term "dashed size 5.0,3.0"
-   :key "out right center Left box lw 0.5 reverse width -2" #_"bottom right" #_"at 2.6, 445"})
+  {:term "dashed size 5.5,3.0 font 18"
+   :key "out right center Left box lw 0.5 reverse width 0" #_"bottom right" #_"at 2.6, 445"})

 (let [fl 1 bb 2 sa 3 na 4 ah 5 ex 6 da 7]
  (def alg-styles
-   {:dijkstra            [fl 1  "UCS"]
+   {:dijkstra            [fl 3  "UCS"]
     :astar               [fl 2  "A*"]

     :go-dfbb             [bb 3  "DFBB"]
@@ -349,7 +352,7 @@
     :sahtn               [sa 4  "SAHTN"]

     :h-ucs               [na 5  "H-UCS"]
-    :dsh-ucs             [na 6  "DSH-LDFS"]
+    :dsh-ucs             [na 26  "DSH-LDFS"]
     :inv-dsh-ucs         [na 7  "DSH-UCS"]

     :optimistic-ah-astar [ah 8  "AH-A*-opt"]
@@ -362,13 +365,13 @@
     :dash-astar          [da 13 "DASH-A*"]
     :dash-astar-first    [da 14 "DASH-A*-first"]
     :dash-astar-ldfs     [da 20 "DASH-A*-ldfs"]
-    :dash-astar-hoc      [da 16 "DASH-A*-hoc"]
-    :dash-astar-nos      [da 17 "DAcH-A*"]
+    :dash-astar-hoc      [da 16 "DASH-A*-hog"]
+    :dash-astar-nos      [da 3 "DAcH-A*"]
     :dash-astar-nods     [da 18 "DAxH-A*"]

-    :dash-astar-sh       [da 21 "DASH-A*-sh"]
-    :dash-astar-sh-hoc   [da 16 "DASH-A*-sh-hoc"]
-    :dash-astar-sh-nos   [da 17 "DAcH-A*-sh"]
+    :dash-astar-sh       [da 5 "DASH-A*-sh"]
+    :dash-astar-sh-hoc   [da 16 "DASH-A*-sh-hog"]
+    :dash-astar-sh-nos   [da 3 "DAcH-A*-sh"]
     :dash-astar-sh-nods  [da 18 "DAxH-A*-sh"]

     }))
@@ -413,21 +416,26 @@

 ;; Skip: explicit-ah-astar explicit-dash-astar

-(def ns-slow-algs [:go-dfbb :sahtn :dsh-ucs :inv-dsh-ucs :h-ucs :optimistic-ah-astar :strict-ah-astar :dijkstra :astar
+#_(def ns-slow-algs [:go-dfbb :sahtn :dsh-ucs :inv-dsh-ucs :h-ucs :optimistic-ah-astar :strict-ah-astar :dijkstra :astar
                    :full-ah-astar :dash-astar ;-ldfs
                    ])

-(def ns-fast-algs [:dash-astar-nods :astar :dash-astar-first :dash-astar  :dash-astar-hoc :dash-astar-nos
-                   :full-ah-astar :dash-astar-ldfs])
+(def ns-slow-algs [:go-dfbb :sahtn :dsh-ucs :inv-dsh-ucs :h-ucs :optimistic-ah-astar :strict-ah-astar :dash-astar-nods :dijkstra :astar :dash-astar-first :dash-astar  :dash-astar-hoc :dash-astar-nos
+                   :full-ah-astar :dash-astar-ldfs
+                   ])
+
+(def ns-fast-algs [:optimistic-ah-astar :strict-ah-astar
+                   :dash-astar-nods :dijkstra :astar :dash-astar-first :dash-astar  :dash-astar-hoc :dash-astar-nos
+                   :full-ah-astar :dash-astar-ldfs ])

 (defn make-ns-charts []
   (let [opts (fn [t yr]
-               {:title (str "random nav-switch problems - " t " algorithms")
-                :xlabel "grid size (side length)" :ylabel "runtime (s)"
+               {:title (str "nav-switch - runtime - " t " algorithms")
+                :xlabel "grid side length" :ylabel "runtime (s)"
                 :xrange "[5:500]" :yrange yr})]
-    (make-chart @ns-results ns-slow-algs :secs (opts "slower" "[0:50]"))
-    (make-chart @ns-results ns-fast-algs :secs (opts "faster" "[0:12]"))))
+    (make-chart @ns-results ns-slow-algs :secs (opts "all" "[0:50]") nil "ns-slow.pdf")
+    (make-chart @ns-results ns-fast-algs :secs (opts "faster" "[0:9]") nil "ns-fast.pdf")))

@@ -452,11 +460,25 @@
                  :dash-astar-sh-nods :inv-dsh-ucs :dash-astar :dash-astar-ldfs
                  :dash-astar-sh-nos :dash-astar-sh-hoc  :dash-astar-sh ])

+(def dm-alg-ord2 [:h-ucs :dijkstra :optimistic-ah-astar
+                 :dash-astar-sh-nods :dash-astar-sh-nos :dash-astar :dash-astar-ldfs
+                   :dash-astar-sh-hoc  :dash-astar-sh
+                  :sahtn :dsh-ucs :inv-dsh-ucs
+                  ])
+
 (defn make-dm-charts []
   (make-chart
-   (:smaller @dm-results) dm-alg-ord #_ :opt-count  :secs
-   {:ylog  "t"   :xtics "1" ;:yrange "[0.3:300]" ;:xlog "t"  :yrange "[0.01:100]"
-    :title (str "discrete manipulation problems") :xlabel "\\# of objects" :ylabel "runtime (s)"}))
+   (:smaller @dm-results) dm-alg-ord :secs
+   {:ylog  "t" :xtics "1" :yrange "[0.4:1000]"
+    :title (str "discrete manipulation - runtime") :xlabel "\\# of objects" :ylabel "runtime (s)"}
+   nil "dm-runtime.pdf")
+  (make-chart
+   (:smaller @dm-results) dm-alg-ord2 :all-count
+   {:ylog  "t" :xtics "1" :yrange "[100:1000000]"
+    :title (str "discrete manipulation - description evaluations")
+    :xlabel "\\# of objects" :ylabel "\\# of evaluations"}
+   (derive-median-multi 5 :all-count #(+ (:opt-count %) (:next-count %)))
+   "dm-evals.pdf"))

 ;; note: sahtn with dijkstra, not as described.
@@ -496,35 +518,32 @@
     (let [[algs chart-opts]
           (case t
            :both [[:dijkstra :optimistic-ah-astar :inv-dsh-ucs :dash-astar]
-                  {:xrange "[5:4000]" :yrange "[0.001:100]"}]
+                  {:xrange "[5:4500]" :yrange "[0.001:100]"}]
            :num  [[:dijkstra :optimistic-ah-astar :inv-dsh-ucs :dash-astar]
                   {:xrange "[9:100]" :yrange "[0.005:10]"}]
            :size [[:dijkstra :inv-dsh-ucs :optimistic-ah-astar :dash-astar]
-                  {:xrange "[5:500]" :yrange "[0.001:1000]"}
+                  {:xrange "[5:550]" :yrange "[0.001:1000]"}
                   ])]
       (make-chart
        data (or algs (keys data)) :secs
        (assoc chart-opts
          :ylog  "t"  :xlog "t" ;:xrange "[5:500]"  :yrange "[0.01:100]"
-         :title (str "dd problems " t) :xlabel "optimal solution length" :ylabel "runtime (s)")))))
-
-(comment
-    (doseq [[t data] (group-fs @dd-results)]
-    (let [field :secs ylabel "runtime (s)"]
-      (-> (smart-results->dataset data  (derive-median :secs :ms #(/ % 1000)))
-          (add-sol-length t)
-          (datasets/ds->chart
-           [:alg] :sol-length field
-           {:term "dashed size 4.0,3.0"
-            :ylog  "t"  :xlog "t"
-                                        ;:xrange "[5:500]"
-               :yrange "[0.01:100]"
-               :title (str "dd problems" t) :key "bottom right" #_"at 2.6, 445"
-               :xlabel "size" :ylabel ylabel}
-              (constantly {:lw 3}) #_ (let [c (util/counter-from 0)] (fn [& args] (let [v ([1 2 3 6] (c))]  {:lw 3 :pt v :lt v})))
-              (comp keyword first)
-              identity #_(fn [l] (sort-by #(if (=  "UCS" (:title %)) "Q" (:title  %)) l)))
-             (charts/plot #_ (str dir "dd-" t ".pdf"))))))
+         :title (str "bit-stash - runtime - scaling "
+                     (case t :num "number of subproblems" :size "subproblem size" :both "both"))
+         :xlabel "optimal solution length" :ylabel "runtime (s)")
+       nil (str "dd-" (name t) "-log.pdf")
+       )))
+  (make-chart (:both @dd-results) [:dijkstra :optimistic-ah-astar :inv-dsh-ucs :dash-astar] :secs
+              {:xrange "[0:4500]" :yrange "[0:100]"
+               ;:xrange "[0:10000]" :yrange "[0:400]"
+               :title (str "bit-stash - runtime - scaling both") :xlabel "optimal solution length" :ylabel "runtime (s)"}
+              nil "dd-both.pdf"))
+
+(defn make-all-charts []
+  (make-ns-charts)
+  (make-dm-charts)
+  (make-dd-charts))
+

 ;; Note: right factoring is crucial! (hsould also sub-factor tla refs?)
 ;; hierarchical hurts here.


introduce new :phrasal-verb (true|false)

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -657,9 +657,10 @@
                      :sem {:pred :faint}
                      :subcat {:2 '()}}}

-    "fall" {:synsem {:cat :verb
-                     :sem {:pred :fall}}
-          :english {:past "fell"}}
+   "fall" {:transitivize false
+           :synsem {:cat :verb
+                    :sem {:pred :fall}}
+           :english {:past "fell"}}

     "fall asleep"
    (let [subject-semantics (atom :top)]
@@ -2137,7 +2138,8 @@
    "turn"
    (let [subj (atom :top)
          obj (atom :top)]
-     [{:synsem {:cat :verb
+     [{:phrasal-verb true
+       :synsem {:cat :verb
                 :sem {:pred :turn-on
                       :subj subj
                       :obj obj}
@@ -2148,7 +2150,8 @@
                              :subcat '()
                              :pronoun false
                              :sem obj}}}}
-      {:synsem {:cat :verb
+      {:phrasal-verb true
+       :synsem {:cat :verb
                 :sem {:pred :turn-off
                       :subj subj
                       :obj obj}
@@ -2642,6 +2645,10 @@
                          :aux false}}
                {:synsem {:aux false}})

+      ;; phrasal-verbs: default is false
+      (default {:synsem {:cat :verb}
+                :phrasal-verb false})
+
       ;; subject-and-reflexive-pronoun agreement
       (if-then {:synsem {:sem {:reflexive true}
                          :cat :verb


+TODO and comments

+TODO and comments

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -147,7 +147,8 @@
                  the-obj (atom {:number number
                                 :gender gender})] ;; prevents e.g. "Her name is John"
              (unify common
-                    {:sense 2 ;; used for debugging
+                    {:sense 2 ;; used for debugging suspected problems
+                     ;; with lexical compilation.
                      ;; TODO: remove (in)transtivize (false|true): should not
                      ;; need these explicit compiler directives; compilation
                      ;; should be able to manage on its own
@@ -2878,6 +2879,9 @@
                  :aux false
                  :infl :past
                  :sem {:tense :past}}})
+      ;; Not sure why or if this (default) rule is needed?
+      ;; Why set the :aspect to :perfect by default?
+      ;; TODO: remove if not needed.
       (default
        {:english {:exception true}
         :synsem {:cat :verb


differentiate apostrophe-s between singular and plural, like possessive pronouns ("his","her", etc)

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -1425,12 +1425,19 @@
           :synsem {:cat :verb
                    :sem {:pred :run}}}

-   "s" {:synsem {:cat :det
-                 :def :genitive
-                 :subcat {:1 {:cat :noun
-                              :pronoun false
-                              :subcat '()}}}}
-
+   "s" [{:synsem {:agr {:number :sing}
+                  :cat :det
+                  :def :genitive
+                  :subcat {:1 {:cat :noun
+                               :pronoun false
+                               :subcat '()}}}}
+         {:synsem {:agr {:number :plur}
+                   :cat :det
+                   :def :genitive
+                   :subcat {:1 {:cat :noun
+                                :pronoun false
+                                :subcat '()}}}}]
+
    "say" {:english {:past "said"}
           :synsem {:cat :verb
                    :sem {:pred :say}}}


added andar

added andar

--- src/babel/espanol/lexicon.cljc
+++ src/babel/espanol/lexicon.cljc
@@ -96,7 +96,11 @@
                :synsem {:cat :verb
                         :sem {:pred :have-lunch}}}

-   "andar" {}
+   "andar" {:espanol {:preterito-stem "anduv"}
+               :synsem {:cat :verb
+                        :sem {:pred :walk}}}
+
+

    "anunciar" {:synsem {:cat :verb
                         :sem {:pred :announce}}}
@@ -104,7 +108,8 @@
    "añadir" {:synsem {:cat :verb
                         :sem {:pred :add}}}

-   "apagar" {}
+   "apagar" {:synsem {:cat :verb
+                      :sem {:pred :}

    "apoyar" {:synsem {:cat :verb
                       :sem {:pred :support}}}


Add optional "channel" argument to event-source

--- src/ninjudd/eventual/client.cljs
+++ src/ninjudd/eventual/client.cljs
@@ -7,10 +7,10 @@
       (vary-meta merge {:event-id (.-lastEventId event)
                         :event-type (keyword (.-type event))})))

-(defn event-source [f url & [event-types]]
+(defn event-source [f url & [event-types channel]]
   (let [event-types (or event-types [:message])
         source (new js/EventSource url)
-        channel (async/chan)]
+        channel (or channel (async/chan))]
     (doseq [event-type event-types]
       (.addEventListener source (name event-type)
                          (fn [event]
@@ -22,11 +22,11 @@
     {:event-source source
      :channel channel}))

-(defn edn-event-source [url & [event-types]]
-  (event-source read-string url event-types))
+(defn edn-event-source [url & [event-types channel]]
+  (event-source read-string url event-types channel))

-(defn json-event-source [url & [event-types]]
-  (event-source #(.parse js/JSON %) url event-types))
+(defn json-event-source [url & [event-types channel]]
+  (event-source #(.parse js/JSON %) url event-types channel))

 (defn close-event-source! [{:keys [channel event-source]}]
   (when event-source


Add and remove author from org (Clojure API).

--- src/oc/storage/resources/org.clj
+++ src/oc/storage/resources/org.clj
@@ -1,5 +1,6 @@
 (ns oc.storage.resources.org
   (:require [clojure.walk :refer (keywordize-keys)]
+            [if-let.core :refer (when-let*)]
             [schema.core :as schema]
             [oc.lib.slugify :as slug]
             [oc.lib.schema :as lib-schema]
@@ -107,7 +108,7 @@
   Throws an exception if the merge of the prior org and the updated org property map doesn't conform
   to the common/Org schema.

-  NOTE: doesn't update admins, see: `add-admin`, `remove-admin`
+  NOTE: doesn't update authors, see: `add-author`, `remove-author`
   NOTE: doesn't handle case of slug change.
   "
   [conn slug org]
@@ -124,7 +125,7 @@
   Given the slug of the org and an org property map, create or update the org
   and return `true` on success.

-  NOTE: doesn't update admins, see: `add-admin`, `remove-admin`
+  NOTE: doesn't update authors, see: `add-author`, `remove-author`
   NOTE: doesn't handle case of slug change.
   "
   [conn slug org user :- common/User]
@@ -160,6 +161,30 @@

     false)) ; it's OK if there is no org to delete

+;; ----- Org's set operations -----
+
+(schema/defn ^:always-validate add-author :- (schema/maybe common/Org)
+  "
+  Given the slug of the org, and the user-id of the user, add the user as an author of the org if it exists.
+  Returns the updated org on success, nil on non-existence, and a RethinkDB error map on other errors.
+  "
+  [conn slug user-id :- lib-schema/UniqueID]
+  {:pre [(db-common/conn? conn)
+         (slug/valid-slug? slug)]}
+  (when-let* [org (get-org conn slug)]
+    (db-common/add-to-set conn table-name slug "authors" user-id)))
+
+(schema/defn ^:always-validate remove-author :- (schema/maybe common/Org)
+  "
+  Given the slug of the org, and the user-id of the user, remove the user as an author of the org if it exists.
+  Returns the updated org on success, nil on non-existence, and a RethinkDB error map on other errors.
+  "
+  [conn slug user-id :- lib-schema/UniqueID]
+  {:pre [(db-common/conn? conn)
+         (slug/valid-slug? slug)]}
+  (if-let [org (get-org conn slug)]
+    (db-common/remove-from-set conn table-name slug "authors" user-id)))
+
 ;; ----- Collection of orgs -----

 (defn list-orgs
@@ -187,7 +212,7 @@
   Secondary indexes:
   `uuid`
   `team-id`
-  `admins`
+  `authors`
   "
   [conn index-key v]
   {:pre [(db-common/conn? conn)


Fix reboot.

Fix reboot.

--- src/onyx/log/commands/common.clj
+++ src/onyx/log/commands/common.clj
@@ -69,7 +69,8 @@
 (defn start-new-lifecycle [old new diff state]
   (let [old-allocation (peer->allocated-job (:allocations old) (:id state))
         new-allocation (peer->allocated-job (:allocations new) (:id state))]
-    (if-not (= old-allocation new-allocation)
+    (if (and (not= old-allocation new-allocation)
+             (not (nil? new-allocation)))
       (do (when (:lifecycle state)
             (component/stop @(:lifecycle state)))
           (let [seal-ch (chan)


Remove unnecessary usage of fn->multi

Remove unnecessary usage of fn->multi

--- src/buddy/auth/accessrules.clj
+++ src/buddy/auth/accessrules.clj
@@ -16,7 +16,6 @@
   "Access Rules system for ring based applications."
   (:require [buddy.auth :refer [throw-unauthorized]]
             [buddy.auth.http :as http]
-            [buddy.auth.fnutils :refer [fn->multi]]
             [clojure.walk :refer [postwalk]]
             [clout.core :as clout]))

@@ -135,10 +134,10 @@
               (cond
                ;; In this case is a handler
                (fn? form)
-               (fn->multi [req] (form req))
+               (fn [req] (form req))

                (:or form)
-               (fn->multi [req]
+               (fn [req]
                  (let [rules (:or form)
                        evals (map (fn [x] (x req)) rules)
                        accepts (filter success? evals)]
@@ -147,7 +146,7 @@
                      (last evals))))

                (:and form)
-               (fn->multi [req]
+               (fn [req]
                  (let [rules (:and form)
                        evals (map (fn [x] (x req)) rules)
                        rejects (filter (complement success?) evals)]
@@ -225,7 +224,7 @@
         handler (compile-rule-handler (:handler accessrule))
         matcher (cond
                   (:pattern accessrule)
-                  (fn->multi [request]
+                  (fn [request]
                     (let [pattern (:pattern accessrule)
                           uri (:uri request)]
                       (when (and (matches-request-method request request-method)
@@ -234,21 +233,21 @@

                   (:uri accessrule)
                   (let [route (clout/route-compile (:uri accessrule))]
-                    (fn->multi [request]
+                    (fn [request]
                       (let [match-params (clout/route-matches route request)]
                         (when (and (matches-request-method request request-method) match-params)
                           match-params))))

                   (:uris accessrule)
                   (let [routes (mapv clout/route-compile (:uris accessrule))]
-                    (fn->multi [request]
+                    (fn [request]
                       (let [match-params (->> (map #(clout/route-matches % request) routes)
                                               (filter identity)
                                               (first))]
                         (when (and (matches-request-method request request-method) match-params)
                           match-params))))

-                  :else (fn->multi [request] {}))]
+                  :else (fn [request] {}))]
     (assoc accessrule
            :matcher matcher
            :handler handler)))


added the support for mapping lowercase to camel-case attributes

--- src/kioo/util.cljx
+++ src/kioo/util.cljx
@@ -40,6 +40,22 @@
         (apply str start (map capitalize parts))))))

+(def attribute-map
+  (assoc
+      (reduce #(assoc %1 (keyword (.toLowerCase (name %2))) %2) {}
+              [:accessKey :allowFullScreen :allowTransparency :autoComplete
+               :autoFocus :autoPlay :cellPadding :cellSpacing :charSet
+               :colSpan :contentEditable :contextMenu :dateTime :encType
+               :formNoValidate :frameBorder :htmlFor :httpEquiv :maxLength
+               :noValidate :radioGroup :readOnly :rowSpan :scrollLeft :scrollTop
+               :spellCheck :srcDoc :tabIndex])
+    :class
+    :className))
+
+(defn transform-keys [attrs]
+  (reduce (fn [m [k v]]
+            (assoc m (or (attribute-map k) k) v)) {} attrs))
+
 (defn convert-attrs [attrs]
   (let [style  (when (:style attrs)
                  (let [vals (re-seq #"\s*([^:;]*)[:][\s]*([^;]+)"
@@ -49,8 +65,8 @@
                            {} vals)))
         class-name (:class attrs)]
     (-> attrs
-        (dissoc :class)
-        (merge {:style style :className class-name}))))
+        (transform-keys)
+        (assoc :style style))))

 (defn flatten-nodes [nodes]


Some tweaks

Some tweaks

--- src/overtone_workspace/beats.clj
+++ src/overtone_workspace/beats.clj
@@ -172,8 +172,10 @@
     (swap! *beats assoc latchbell [_])
     (swap! *beats16 assoc laserbeam [_]))
   (swap! *beats assoc latchbell [a _ a _ a _ a _ a _ a _ a _ a _])
+  (swap! *beats assoc latchbell [a a  a  a [a a a]])
   (swap! *beats assoc laserbeam [d _ _ _ b _ _ d _ _ d _ b _ _ d])
   (swap! *beats assoc laserbeam [d c c c b c c d c c d c b c c d])
+  (swap! *beats assoc laserbeam (take 16 (cycle [d b c d c b [d] c c [c c c] d])))
   (swap! *beats assoc laserbeam (vec (repeat 16 c)))
   (swap! *beats assoc grumble [g _ _ _ _ _ _ _ _  _ _ _ _ _ _ _])
   (swap! *beats assoc kick [[1 _ _ [1 1]] [_ _ _ 1] [_ _ 1 _] [_ _ _ [1 1 1]]])


States are now handled via database

States are now handled via database

--- src/mdr2/state.clj
+++ src/mdr2/state.clj
@@ -1,50 +0,0 @@
-(ns mdr2.state
-  "Functionality for productions"
-  (:require [clojure.set :as set]
-            [clojure.string :as s]))
-
-(def states
-  "All possible states that a production can have"
-  [:new :structured :recorded :encoded :cataloged :archived :pending-volume-split :failed :deleted])
-
-(def states-map
-  "Map of states to state number to facilitate lookup from state kw to
-  state number"
-  (zipmap states (range)))
-
-(def states-inverse
-  "Inverse map to facilitate lookup from state number to state name"
-  (set/map-invert states-map))
-
-(def states-graph
-  {:new [:structured]
-   :structured [:recorded]
-   :archived [:structured]})
-
-(defn to-int
-  "Return the state number for the given `state`"
-  [state]
-  (get states-map state))
-
-(defn to-str
-  "Return a capitalized state name for given `state`"
-  [state]
-  (s/capitalize (name state)))
-
-(defn from-int
-  "Return a state for given state number. If there is no state for
-  given number return the `:new` state"
-  [i]
-  (get states-inverse i :new))
-
-(defn from-str
-  "Return a state for the given string. If there is no matching state
-  return the `:new` state"
-  [state]
-  (let [state (keyword (s/lower-case state))]
-    (if (contains? (set states) state) state :new)))
-
-(defn next-states
-  "For given `state` return a seq of possible next states"
-  [state]
-  (get states-graph state))


Show total time in minutes for catalog

Show total time in minutes for catalog

--- src/mdr2/views.clj
+++ src/mdr2/views.clj
@@ -126,7 +126,7 @@
      (when error
        [:p [:ul.alert.alert-danger [:li error]]])
      [:table.table.table-striped
-      [:thead [:tr [:th "Title"] [:th "Product Number"] [:th "DAM Number"] [:th "Duration"] [:th "Number of CDs"] [:th "Depth"] [:th "Narrator"] [:th "Date of Production"] [:th "Libary signature"]]]
+      [:thead [:tr [:th "Title"] [:th "Product Number"] [:th "DAM Number"] [:th "Total time"] [:th "Number of CDs"] [:th "Depth"] [:th "Narrator"] [:th "Date of Production"] [:th "Libary signature"]]]
       [:tbody
        (for [{:keys [id title product_number total_time volumes depth narrator produced_date]
               :as production} (prod/find-by-state "encoded")]
@@ -134,7 +134,7 @@
           [:td (link-to (str "/production/" id) title)]
           [:td product_number]
           [:td (prod/dam-number production)]
-          [:td total_time]
+          [:td (quot total_time (* 1000 60))] ; in minutes
           [:td volumes]
           [:td depth]
           [:td narrator]