Updated tests.

Updated tests.

--- test/cmr/system_int_test/search/granule_search_format_test.clj
+++ test/cmr/system_int_test/search/granule_search_format_test.clj
@@ -12,14 +12,9 @@
             [clj-http.client :as client]
             [cmr.common.concepts :as cu]
             [cmr.umm.core :as umm]
-            [cmr.umm.echo10.related-url :as ru]))
+            [cmr.umm.related-url-helper :as ru]))

 (use-fixtures :each (ingest/reset-fixture "CMR_PROV1"))
-
-(comment
-  (ingest/reset)
-  (ingest/create-provider "CMR_PROV1")
-  )

 (deftest search-granules-in-xml-metadata
   ;; TODO we can add additional formats here later such as iso
@@ -76,6 +71,7 @@

 (deftest search-granule-csv
   (let [ru1 (dc/related-url "GET DATA" "http://example.com")
+        ru2 (dc/related-url "GET RELATED VISUALIZATION" "http://example.com/browse")
         coll1 (d/ingest "CMR_PROV1" (dc/collection {}))
         coll2 (d/ingest "CMR_PROV1" (dc/collection {}))
         gran1 (d/ingest "CMR_PROV1" (dg/granule coll1 {:granule-ur "Granule1"
@@ -85,7 +81,7 @@
                                                        :day-night "DAY"
                                                        :size 100
                                                        :cloud-cover 50
-                                                       :related-urls [ru1]}))
+                                                       :related-urls [ru1 ru2]}))
         gran2 (d/ingest "CMR_PROV1" (dg/granule coll2 {:granule-ur "Granule2"
                                                        :beginning-date-time "2011-01-01T12:00:00Z"
                                                        :ending-date-time "2011-01-11T12:00:00Z"
@@ -99,13 +95,13 @@
     (let [response (search/find-grans-csv :granule {:granule-ur "Granule1"})]
       (is (= 200 (:status response)))
       (is (= (str "Granule UR,Producer Granule ID,Start Time,End Time,Online Access URLs,Browse URLs,Cloud Cover,Day/Night,Size\n"
-                  "Granule1,Granule #1,2010-01-01T12:00:00Z,2010-01-11T12:00:00Z,http://example.com,50.0,DAY,100.0\n")
+                  "Granule1,Granule #1,2010-01-01T12:00:00Z,2010-01-11T12:00:00Z,http://example.com,http://example.com/browse,50.0,DAY,100.0\n")
              (:body response))))
     (let [response (search/find-grans-csv :granule {})]
       (is (= 200 (:status response)))
       (is (= (str "Granule UR,Producer Granule ID,Start Time,End Time,Online Access URLs,Browse URLs,Cloud Cover,Day/Night,Size\n"
-                  "Granule1,Granule #1,2010-01-01T12:00:00Z,2010-01-11T12:00:00Z,http://example.com,50.0,DAY,100.0\n"
-                  "Granule2,Granule #2,2011-01-01T12:00:00Z,2011-01-11T12:00:00Z,,30.0,NIGHT,80.0\n")
+                  "Granule1,Granule #1,2010-01-01T12:00:00Z,2010-01-11T12:00:00Z,http://example.com,http://example.com/browse,50.0,DAY,100.0\n"
+                  "Granule2,Granule #2,2011-01-01T12:00:00Z,2011-01-11T12:00:00Z,,,30.0,NIGHT,80.0\n")
              (:body response))))

     (testing "as extension"
@@ -120,13 +116,23 @@
   {"GET DATA" "http://esipfed.org/ns/fedsearch/1.1/data#"
    "GET RELATED VISUALIZATION" "http://esipfed.org/ns/fedsearch/1.1/browse#"})

+(defn- add-attribs
+  "Returns the attribs with the field-value pair added if there is a value"
+  [attribs field value]
+  (if (empty? value) attribs (assoc attribs field value)))
+
 (defn- related-url->link
   "Returns the atom link of the given related url"
   [related-url]
-  (let [{:keys [type url]} related-url]
-    {:href url
-     :hreflang "en-US"
-     :rel (resource-type->link-type-uri type)}))
+  (let [{:keys [type url title mime-type size]} related-url
+        attribs (-> {}
+                    (add-attribs :size size)
+                    (add-attribs :rel (resource-type->link-type-uri type))
+                    (add-attribs :type mime-type)
+                    (add-attribs :title title)
+                    (add-attribs :hreflang "en-US")
+                    (add-attribs :href url))]
+    attribs))

 (defn- related-urls->links
   "Returns the atom links of the given related urls"


add new irregular present test

add new irregular present test

--- test/babel/test/en.clj
+++ test/babel/test/en.clj
@@ -40,6 +40,34 @@
            "is Antonia"))))

 (deftest generate-irregular-present-1
+  (let [form {:english {:a {:cat :verb,
+                            :infl :present,
+                            :present {:1sing "am",
+                                      :3plur "are",
+                                      :1plur "are",
+                                      :2plur "are",
+                                      :3sing "is",
+                                      :2sing "are"},
+                            :past {:1sing "was",
+                                   :3plur "were",
+                                   :1plur "were",
+                                   :2plur "were",
+                                   :3sing "was",
+                                   :2sing "were"},
+                            :agr {:person :3rd,
+                                  :gender :masc,
+                                  :number :sing},
+                            :english "be"},
+                        :b {:agr {:person :3rd,
+                                  :gender :masc,
+                                  :number :sing},
+                            :english "Antonio",
+                            :cat :noun,
+                            :pronoun false}}}]
+    (is (= (fo form)
+           "is Antonio"))))
+
+(deftest generate-irregular-present-2
   (let [form {:english {:past {:1sing "was",
                                :3plur "were",
                                :1plur "were",
@@ -62,7 +90,7 @@
     (is (= (fo form)
            "is"))))

-(deftest generate-irregular-present-2
+(deftest generate-irregular-present-3
   (let [form {:english {:a {:infl :present,
                             :past {:2sing "were",
                                    :1sing "was",
@@ -90,6 +118,45 @@
     (is (= (fo form)
            "is Juan"))))

+(deftest generate-irregular-present-4
+  (let [form {:a {:a {:english "your"}
+                  :b {:english "name",
+                      :pronoun false,
+                      :cat :noun,
+                      :agr {:pronoun false,
+                            :gender :masc,
+                            :number :sing,
+                            :person :3rd}}}
+              :b {:a {:agr {:pronoun false,
+                            :gender :masc,
+                            :number :sing,
+                            :person :3rd},
+                      :past {:2plur "were",
+                             :3sing "was",
+                             :2sing "were",
+                             :1sing "was",
+                             :3plur "were",
+                             :1plur "were"},
+                      :english "be",
+                      :present {:2plur "are",
+                                :3sing "is",
+                                :2sing "are",
+                                :1sing "am",
+                                :3plur "are",
+                                :1plur "are"},
+                      :infl :present,
+                      :cat :verb}
+                  :b {:cat :noun,
+                      :pronoun false,
+                      :agr {:pronoun false,
+                            :gender :masc,
+                            :number :sing,
+                            :person :3rd},
+                      :english "Juan"}}}]
+    (is (or true (= (fo form)
+                    "your name is Juan")))))

+
+


No more hello world

No more hello world

--- profiles.clj
+++ profiles.clj
@@ -10,7 +10,7 @@
                         :templates
                         :choose-list
                         :new-query
-                        :hello-world
+                        :region-search
                         :upload-list
                         :histories
                         ]


supress the effectful arguments warning for bootstrapping

--- src/Makefile.boot
+++ src/Makefile.boot
@@ -28,7 +28,7 @@
 	--use_extracted_interfaces false                                \
 	--lax --MLish --no_location_info				\
 	--odir ocaml-output $(addprefix --include , $(INCLUDE_PATHS))	\
-	--warn_error -272-241 --cache_dir $(CACHE_DIR)
+	--warn_error -272-241-319 --cache_dir $(CACHE_DIR)

 # Each "project" for the compiler is in its own namespace.  We want to
 # extract them all to OCaml.  Would be more convenient if all of them


Verified find-paths & find-leaves with attribute search paths, and with either single or multiple root nodes.

--- test/tst/tupelo/x.cljc
+++ test/tst/tupelo/x.cljc
@@ -601,6 +601,11 @@
       (is= (format-solns (find-leaves (root-hids) [:** {:tag :b}] 2))
         #{[{:tag :a, :id :a1} {:attrs {:tag :b, :color :red}, :value 2}]
           [{:tag :a, :id :a2} {:attrs {:tag :b, :color :green}, :value 2}]})
+      (is= (format-solns (find-leaves x [:** {:tag :b}] 2))
+        #{[{:tag :a, :id :a1} {:attrs {:tag :b, :color :red}, :value 2}] })
+      (is= (format-solns (find-leaves #{z y} [{:tag :a} :*] 2))
+        #{[{:tag :a, :id :a2} {:attrs {:tag :b, :color :green}, :value 2}]
+          [{:tag :a, :id :a3} {:attrs {:tag :c, :color :blue}, :value 2}] })
       (is= (format-solns (find-leaves (root-hids) [{:tag :a} :*] 2))
         #{[{:tag :a, :id :a2} {:attrs {:tag :b, :color :green}, :value 2}]
           [{:tag :a, :id :a3} {:attrs {:tag :c, :color :blue}, :value 2}]


add docstrings to lib build script

add docstrings to lib build script

--- lib/dev/build.clj
+++ lib/dev/build.clj
@@ -7,7 +7,9 @@
             [parinfer.test :refer [cases-path]]
             [parinfer.parse-md-tests :refer [parse-test-cases]]))

-(defn release []
+(defn release
+  "Create a Parinfer release for JavaScript users."
+  []
   (-> (cljs/init-state)
       (cljs/find-resources-in-classpath)
       (umd/create-module
@@ -19,7 +21,10 @@
       (umd/flush-module "npm-publish/parinfer.js"))
   :done)

-(defn extract-test [name-]
+(defn extract-test
+  "Extracts the test case data from a Markdown doc, and dumps it into JSON.
+  (allows people porting Parinfer to have easy access to test cases)"
+  [name-]
   (let [in-file (str cases-path "/" name- ".md")
         out-file (str cases-path "/" name- ".json")
         in-str (slurp in-file)
@@ -41,12 +46,10 @@
          :public-path "target/cljs-tests"})
       (cljs/find-resources-in-classpath)))

-(defn test-runner []
-  (-> (test-setup)
-      (node/make-test-runner))
-  :done)
-
-(defn run-all-tests []
+(defn run-all-tests
+  "Build and run all ClojureScript tests under Node.
+  Ensures that the exit code reflects test results."
+  []
   (-> (test-setup)
       (node/execute-all-tests-and-exit!))
   :done)


Fix pixel-generator docs by dropping .clj from forma.source.tilesets

--- src/clj/forma/hadoop/predicate.clj
+++ src/clj/forma/hadoop/predicate.clj
@@ -166,7 +166,7 @@
   Arguments:
     tmp-path - A staging directory for writing tuples to a sequence file.
     res - The spatial resolution.
-    tileseq - Map of country ISO keywords to MODIS tiles (see: forma.source.tilesets.clj)"
+    tileseq - Map of country ISO keywords to MODIS tiles (see: forma.source.tilesets)"
   [tmp-path res tileseq]
   (let [tap (:sink (hfs-seqfile tmp-path))]
     (with-open [^TupleEntryCollector collector


Get nrepl-side exceptions back to printing

--- src/clj/reply/evaluation/nrepl.clj
+++ src/clj/reply/evaluation/nrepl.clj
@@ -25,7 +25,7 @@
         response-seq (nrepl/message client {:op "eval" :code form :id command-id :session @current-session})]
     (reset! current-command-id command-id)
     (doall (for [{:keys [ns value out err] :as res}
-                   (take-while #(not (some #{"done" "interrupted" "error" "eval-error"} (:status %)))
+                   (take-while #(not (some #{"done" "interrupted" "error"} (:status %)))
                                response-seq)]
       (do
         (when value ((:value options print) value))


creator content schema

creator content schema

--- src/cljc/salava/badge/schemas.cljc
+++ src/cljc/salava/badge/schemas.cljc
@@ -146,7 +146,7 @@

 (s/defschema CreatorContent (-> IssuerContent
-                                (dissoc :revocation_list_url :tier :banner)
+                                (dissoc :revocation_list_url)
                                 (assoc  :json_url s/Str)))

 (s/defschema CriteriaContent {:id s/Str


refactor

refactor

--- src/cljs/hatti/views/dataview.cljs
+++ src/cljs/hatti/views/dataview.cljs
@@ -93,7 +93,7 @@
       (let [active-view (-> app-state :views :selected)
             view->display #(if (= active-view %) "block" "none")
             view->cls #(when (= active-view %) "clicked")
-            dataviews (->> (-> app-state :views :all)
+            dataviews (->> app-state :views :all
                            (map dataview-map) (remove nil?))
             dv->link (fn [{:keys [view label]}]
                        (if (and (= view :map) no-geodata?)


fix topiq timestamp

fix topiq timestamp

--- src/cljs/link_collective/view.cljs
+++ src/cljs/link_collective/view.cljs
@@ -179,7 +179,7 @@
    [:.topiq-author] (content (:author topiq))
    [:.topiq-ts] (content
                  (let [time-diff (- (js/Date.) (:ts topiq))]
-                   (if (> time-diff 3600000)
+                   (if (> time-diff 7200000)
                      (str (Math/round (/ time-diff 3600000)) " hours ago")
                      (if (< (Math/round (/ time-diff 60000)) 2)
                        "now"


Add auto open for linkedin add to profile

--- src/cljs/salava/core/ui/share.cljs
+++ src/cljs/salava/core/ui/share.cljs
@@ -141,7 +141,7 @@
                          (-> (js* "$('#reagent-modal .modal-dialog')")
                              (.addClass "modal-lg" )
                              (.removeClass "modal-sm"))
-                         ;(js/setTimeout #(open-linkedin-popup) 500)
+                         (js/setTimeout #(open-linkedin-popup) 700)
                          )
                        )}
         [:i {:class "fa fa-linkedin"}]


relax ID type constraints

relax ID type constraints

--- src/clojure/zensols/dataset/db.clj
+++ src/clojure/zensols/dataset/db.clj
@@ -507,7 +507,7 @@
                          (take max-instances)
                          (map (case type
                                 document #(-> % :doc)
-                                ids #(-> % :id Integer/parseInt)))
+                                ids :id))
                          (array-map class-label))))
              (into {})
              doall)))))


WIP: chart improvements

WIP: chart improvements

--- src/cljs/iwaswhere_web/ui/charts/questionnaires2.cljs
+++ src/cljs/iwaswhere_web/ui/charts/questionnaires2.cljs
@@ -98,6 +98,13 @@
 (defn barchart-row
   [days span start stats tag k y scale cls]
   [:g
+   [:text {:x           180
+           :y           (- y 12)
+           :font-size   12
+           :fill        "#777"
+           :font-weight :bold
+           :text-anchor "end"}
+    tag]
    (for [n (range (inc days))]
      (let [d (* 24 60 60 1000)
            offset (* n d)
@@ -125,7 +132,8 @@
         local (r/atom {:last-fetched 0 :n 30})
         toggle (fn [_] (swap! local assoc-in [:n] (if (= 7 (:n @local)) 30 7)))]
     (fn [put-fn]
-      (h/keep-updated :stats/custom-fields 30 local @last-update put-fn)
+      (prn :keep-updated)
+      (h/keep-updated :stats/custom-fields 31 local @last-update put-fn)
       (let [scores2 (->> @stats
                          :questionnaires
                          :panas
@@ -149,7 +157,7 @@
                 :style    {:background :white}
                 :on-click toggle}
           [:filter#blur1
-           [:feGaussianBlur {:stdDeviation 2}]]
+           [:feGaussianBlur {:stdDeviation 3}]]
           [:g
            (for [n (range (+ 2 days))]
              (let [offset (* n d)
@@ -173,6 +181,20 @@
           [chart-line neg-scores neg-mapper :red]
           [chart-line pos-scores pos-mapper :green]
           [:rect {:fill :white :x 0 :y 0 :height 600 :width 200}]
+          [:text {:x           180
+                  :y           145
+                  :font-size   12
+                  :fill        "#777"
+                  :font-weight :bold
+                  :text-anchor "end"}
+           "Positive Affect Score"]
+          [:text {:x           180
+                  :y           226
+                  :font-size   12
+                  :fill        "#777"
+                  :font-weight :bold
+                  :text-anchor "end"}
+           "Negative Affect Score"]
           (for [n (range (inc days))]
             (let [offset (* (+ n 0.5) d)
                   scaled (* 900 (/ offset span))
@@ -189,5 +211,6 @@
                       :text-anchor "middle"}
                (df ts month-day)]))
           [barchart-row days span start custom-field-stats "#sit-ups" :cnt 295 0.3 "done"]
-          [barchart-row days span start custom-field-stats "#beer" :vol 328 0.015 "failed"]
-          [barchart-row days span start custom-field-stats "#steps" :cnt 361 0.0015 "done"]]]))))
+          [barchart-row days span start custom-field-stats "#coffee" :cnt 328 0.04 "failed"]
+          [barchart-row days span start custom-field-stats "#steps" :cnt 361 0.0015 "done"]
+          [barchart-row days span start custom-field-stats "#running" :distance 394 0.6 "done"]]]))))


Wait on bucket access, as we conditionally render on it and it shifts the page (#1269)

--- src/cljs/main/broadfcui/page/workspace/summary/tab.cljs
+++ src/cljs/main/broadfcui/page/workspace/summary/tab.cljs
@@ -140,7 +140,7 @@
    :render
    (fn [{:keys [state props this refs]}]
      (let [{:keys [server-response popup-error]} @state
-           {:keys [workspace workspace-id request-refresh]} props
+           {:keys [workspace workspace-id bucket-access? request-refresh]} props
            {:keys [server-error]} server-response]
        [:div {:data-test-id "summary-tab"
               :data-test-state
@@ -150,7 +150,10 @@
                     "updating"
                     ;; sidebar takes care of checking for billing loaded, library schema, and curator
                     ;; status, as it's the part that cares about it
-                    :else "ready")}
+                    (some? bucket-access?)
+                    "ready"
+                    :else
+                    "loading")}
         (when popup-error
           (modals/render-error {:text popup-error :dismiss #(swap! state dissoc :popup-error)}))
         (when-let [error-response (:error-response @state)]


Allow "nan" as well as "NA" for missing data.

--- src/cavm/core.clj
+++ src/cavm/core.clj
@@ -13,7 +13,7 @@
   (string/split line #"\t"))

 (defn- parseFloatNA [str]
-  (if (= str "NA")
+  (if (or (= str "NA") (= str "nan"))
     Double/NaN
     (Float/parseFloat str)))


Continue loading on error.

Continue loading on error.

--- src/cavm/core.clj
+++ src/cavm/core.clj
@@ -90,7 +90,7 @@
     (catch java.lang.Throwable e
       (binding [*out* *err*]
         (println "Error loading file" file)
-        (throw e)))))  ; XXX should show traceback and continue
+        (.printStackTrace e)))))

 (defn- loadfiles [args]
   (when (not (> (count args) 0))


Comments.

Comments.

--- src/cbfg/vis.cljs
+++ src/cbfg/vis.cljs
@@ -285,7 +285,7 @@
         w [{:gen-id gen-id
             :event-ch event-ch}]
         vis (atom {:actxs {} ; {actx -> {:children {child-actx -> true},
-                             ;           :wait-chs {ch -> [:take|:put optional-ch-name])},
+                             ;           :wait-chs {ch -> [:ghost|take|:put optional-ch-name])},
                              ;           :loop-state last-loop-bindings
                              ;           :closed bool}}.
                    :chs {}   ; {ch -> {:id (gen-id),
@@ -305,7 +305,7 @@
         (when (> @event-delay 0) (<! (timeout @event-delay)))
         (when (< @event-delay 0) (<! step-ch)))
         (recur (inc num-events)))
-    (let [el-event (str el-prefix "-event")
+    (let [el-event (str el-prefix "-event") ; Process U/I related events.
           el-html (str el-prefix "-html")
           el-svg (str el-prefix "-svg")]
       (ago world w
@@ -337,7 +337,7 @@
                      (set-el-innerHTML el-svg vis-next-svg))
                    (recur vis-last vis-last-positions vis-last-html vis-next-svg next-deltas)))))
            (world-init-cb world))
-      (let [toggle-ch (listen-el (gdom/getElement el-html) "click")]
+      (let [toggle-ch (listen-el (gdom/getElement el-html) "click")] ; Process toggle U/I events.
         (go-loop []
           (let [actx-id (no-prefix (.-id (.-target (<! toggle-ch))))]
             (doseq [[actx actx-info] (:actxs @vis)]


Clojure: further work on new p-graph morphism ideas


Remove reimann.sinks

Remove reimann.sinks

--- reimann/src/reimann/sinks.clj
+++ reimann/src/reimann/sinks.clj
@@ -1,26 +0,0 @@
-(ns reimann.sinks
-  (:use [reimann.client]))
-
-; Sinks take states and send them to other, better places.
-
-; Send data to a sink
-(defmulti push :type)
-(defmethod push :stdout [sink state]
-  (prn state))
-(defmethod push :client [sink state]
-  (send-state-protobuf (sink :client) state))
-(defmethod push :list [sink state]
-  (dosync (alter (sink :value) conj state)))
-
-; A sink that dumps states to stdout
-(defn stdout-sink [] {:type :stdout})
-
-; A sink that sends values to ustate
-(defn client-sink [client]
-  {:type :client
-   :client client})
-
-; A sink that accrues values in a list ref
-(defn list-sink []
-  {:type :list
-   :value (ref '())})


Marks test-request-instance-death as explicit (#711)

--- waiter/integration/waiter/websocket_integration_test.clj
+++ waiter/integration/waiter/websocket_integration_test.clj
@@ -252,7 +252,12 @@
         (finally
           (delete-service waiter-url waiter-headers))))))

-(deftest ^:parallel ^:integration-slow test-request-instance-death
+; FAIL in (test-request-instance-death) (websocket_integration_test.clj:296)
+; test-request-instance-death
+; expected: [:qbits.jet.websocket/close 1006 "Disconnected"]
+;   actual: [:qbits.jet.websocket/error #error {
+;  :cause "Idle timeout expired: 120000/120000 ms"
+(deftest ^:parallel ^:integration-slow ^:explicit test-request-instance-death
   (testing-using-waiter-url
     (let [auth-cookie-value (auth-cookie waiter-url)
           send-success-after-timeout-atom (atom true)


Remove manga-fox site definition

Remove manga-fox site definition

--- resources/sites/manga-fox.clj
+++ resources/sites/manga-fox.clj
@@ -1,20 +0,0 @@
-{:root-url "http://mangafox.me"
- :manga-list-format "%s/manga/"
- :manga-url-format "%s/manga/"
- :manga-pattern-match-portion "(.*?)/"
-
- :comic->url-format "%s%s/"
-
- :chapter-number-match-pattern #"/c0*(\d+)/"
- :chapter-number-pattern #"/\d+\.html"
-
- :chapter-list-selector [:div#chapters :ul.chlist :li :div #{:h4 :h3} :a]
- :comic-list-selector [:div.manga_list :ul :li :a]
- :image-selector [:div#viewer :img#image]
- :page-list-selector [:div#top_center_bar :form#top_bar :select.m :option]
-
- :link-name-normalize clojure.core/first
- :link-url-normalize  clojure.core/identity
-
- :page-normalize-format "%s/%s.html"
- :page-normalize-pattern #"^\d+$"}


Update example version.

Update example version.

--- example/project.clj
+++ example/project.clj
@@ -1,6 +1,6 @@
 (defproject my-lambda-project "0.1.0-SNAPSHOT"
   :description "Example lambada project."
   :dependencies [[org.clojure/clojure "1.6.0"]
-                 [uswitch/lambada "0.1.0-SNAPSHOT"]]
+                 [uswitch/lambada "0.1.0"]]
   :profiles {:uberjar {:aot :all}}
   :uberjar-name "my-lambda-project.jar")


clojure: implemented bfs-radius in terms of bfs-shells

--- clojure/org/gavrog/clojure/common/graphs.clj
+++ clojure/org/gavrog/clojure/common/graphs.clj
@@ -22,27 +22,21 @@
   ([adj & sources]
     (traversal adj #{} (into util/empty-queue sources) conj first pop)))

-(defn bfs-radius [adj source]
-  (loop [seen #{source}, maxdist 0, q (conj util/empty-queue [source 0])]
-    (if (empty? q)
-      maxdist
-      (let [[v d] (first q)
-            ws (remove seen (adj v))]
-        (recur (into seen ws)
-               (max maxdist d)
-               (into (pop q) (map vector ws (repeat (inc d)))))))))
-
-(defn diameter [adj sources]
-  (apply max (map (partial bfs-radius adj) sources)))
-
 (defn bfs-shells [adj source]
   (let [next
         (fn [[prev this]]
           [this (set (for [u this, v (adj u)
                            :when (not (or (this v) (prev v)))] v))])]
-    (conj
-      (map second (iterate next [#{source} (set (adj source))]))
-      #{source})))
+    (take-while seq
+                (conj
+                  (map second (iterate next [#{source} (set (adj source))]))
+                  #{source}))))
+
+(defn bfs-radius [adj source]
+  (dec (count (bfs-shells adj source))))
+
+(defn diameter [adj sources]
+  (apply max (map (partial bfs-radius adj) sources)))

 (defn morphism [v w edge-target incidence-pairs]
   (loop [src2img {}


Avoid collecting pending tuples if topology.debug is off

--- storm-core/src/clj/backtype/storm/daemon/executor.clj
+++ storm-core/src/clj/backtype/storm/daemon/executor.clj
@@ -572,7 +572,8 @@
                                            (do
                                              (.put pending root-id [task-id
                                                                     message-id
-                                                                    {:stream out-stream-id :values values}
+                                                                    {:stream out-stream-id
+                                                                     :values (if (= true (storm-conf TOPOLOGY-DEBUG)) values nil)}
                                                                     (if (sampler) (System/currentTimeMillis))])
                                              (task/send-unanchored task-data
                                                                    ACKER-INIT-STREAM-ID


add handlers for producer to include the produce response decoder

--- kafka-clj/src/kafka_clj/produce.clj
+++ kafka-clj/src/kafka_clj/produce.clj
@@ -1,5 +1,6 @@
 (ns kafka-clj.produce
   (:require [kafka-clj.codec :refer [crc32-int get-compress-out compress]]
+            [kafka-clj.response :refer [produce-response-decoder]]
             [clj-tcp.client :refer [client write! read! handlers]]
             [clj-tcp.codec :refer [default-encoder]])
   (:import [java.net InetAddress]
@@ -120,7 +121,7 @@

 (defn producer [host port]
   (try
-  (let [c (client host port {:reuse-client true})]
+  (let [c (client host port {:reuse-client true :handlers [default-encoder produce-response-decoder]})]
     (->Producer c host port))
   (catch Exception e (.printStackTrace e))))


More tests of macroexpansion.

More tests of macroexpansion.

--- test/com/nomistech/clojure_the_language/macros_test.clj
+++ test/com/nomistech/clojure_the_language/macros_test.clj
@@ -1,10 +1,11 @@
 (ns com.nomistech.clojure-the-language.macros-test
   (:require [midje.sweet :refer :all]))

-(defmacro goo [x] `(list a x ~x))
+(defmacro goo [x] `(list x ~'x ~x '~x))

 (fact
-  (macroexpand-1 '(goo plop))
-  => '(clojure.core/list com.nomistech.clojure-the-language.macros-test/a
-                         com.nomistech.clojure-the-language.macros-test/x
-                         plop))
+  (macroexpand-1 '(goo x-in-call))
+  => '(clojure.core/list com.nomistech.clojure-the-language.macros-test/x
+                         x
+                         x-in-call
+                         (quote x-in-call)))


Enable far-future expires header for assets

--- src/main/clojure/cascade/asset.clj
+++ src/main/clojure/cascade/asset.clj
@@ -16,6 +16,7 @@
   #^{:doc "Asset management"}
   cascade.asset
   (:import
+    (java.net URL URLConnection)
     (javax.servlet ServletContext)
     (javax.servlet.http HttpServletRequest HttpServletResponse))
   (:require
@@ -29,6 +30,9 @@

 (assoc-in-config :asset-blacklist
   [#"\.class$", #"\.clj$"])
+
+(def ten-years-from-now
+  (+ (System/currentTimeMillis) (* 1000 60 60 24 365 10)))

 ;; Assets represents files stored either under the web context or stored within the classpath.
 ;; Identifying an asset will eventually incorporate a locale-specific search. Ultimately,
@@ -111,6 +115,20 @@
       ;; TODO: internal configuration lookup
       "application/octet-stream")))

+(defn open-output-stream-for-asset
+  "Configures the response in preperation for writing content."
+  [#^HttpServletResponse response #^URL asset-url #^String mime-type]
+  (let [#^URLConnection connection (.openConnection asset-url)
+        last-modified (.getLastModified connection)
+        content-length (.getContentLength connection)]
+    (if-not (zero? content-length)
+      (.setContentLength response content-length))
+    (doto response
+      (.setDateHeader "Last-Modified" last-modified)
+      (.setDateHeader "Expires"  ten-years-from-now)
+      (.setContentType mime-type))
+    (.getOutputStream response)))
+
 (defn asset-request-dispatcher
   "Processes a request for an asset. The domain-name is used in exceptions. url-provider is a function passed
   an asset-path string that returns a URL for the asset, or nil if not found."
@@ -123,14 +141,13 @@
         _ (fail-unless (= application-version (read-config :application-version)) "Incorrect application version.")
         asset-url (url-provider asset-path)
         _ (fail-if (nil? asset-url) "Could not locate %s asset %s." domain-name asset-path)
-        mime-type (get-mime-type asset-path)
-        output-stream (.getOutputStream (doto response (.setContentType mime-type)))]
-        ; TODO: far-future expires
-        (with-open [input-stream (.openStream asset-url)]
-          (copy input-stream output-stream)
-          (.flush output-stream)))
-          ; If we got this far, we copied the contents (or failed, throwing an exception)
-          true)
+        mime-type (get-mime-type asset-path)]
+    (with-open [output-stream (open-output-stream-for-asset response asset-url mime-type)]
+      (with-open [input-stream (.openStream asset-url)]
+        (copy input-stream output-stream)
+        (.flush output-stream))))
+  ; If we got this far, we copied the contents (or failed, throwing an exception)
+  true)

 (defn classpath-asset-dispatcher
   [env]


new take on state machines

new take on state machines

--- internal/machina/src/samsara/machina/core.clj
+++ internal/machina/src/samsara/machina/core.clj
@@ -30,52 +30,136 @@

-
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;                                                                            ;;
-;;                  ---==| W R I T E   T O   F I L E |==----                  ;;
+;;                        ---==| C O U N T E R |==----                        ;;
 ;;                                                                            ;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

+(comment
+
+  (def sm
+    {:state       :machina/start
+     :data        nil
+     :transitions
+     {:machina/start {:fn*        (fnil inc 0)
+                      :on-success :machina/start
+                      :on-failure :machina/stop}}}
+    )
+
+  ;;
+  ;; TODO: interesting approach but there is no way
+  ;; for the `fn*` to know when to stop
+  ;; or to `on-success` to decide which new
+  ;; state to go. For example if the counter
+  ;; gets to 10 I would like to exit
+  ;; Same for the `on-failure` it should be
+  ;; able to decide which state based on error
+  ;; TODO: `on-success` and `on-failure` should
+  ;; take the state in input `(on-success sm)`
+  ;; or `(on-failure sm ex)`.
+  ;;
+  (defn play [{:keys [state transitions data] :as sm}]
+    (if (= state :machina/stop)
+      sm
+      (if-let [{:keys [fn* on-success on-failure]} (get transitions state)]
+        (try
+          (let [data1 (apply fn* [data])]
+            (assoc sm :data data1 :state on-success))
+          (catch Exception x
+            (assoc sm
+                   :error {:from-state state
+                           :error x}
+                   :state on-failure)))
+        (assoc sm :error {:from-state state
+                          :error :machina/bad-state}))))
+
+
+  (comment
+    (iterate play sm)
+    ))

 (def sm
-  {:state       :machina/start
-   :data        nil
+  {:state :machina/start
+   :data   nil
    :transitions
    {:machina/start {:fn*        (fnil inc 0)
-                    :on-success :machina/start
-                    :on-failure :machina/stop}}}
-  )
+                    :on-success (fn [{:keys [data]}]
+                                  (if (= data 10)
+                                    :machina/stop
+                                    :machina/start))
+                    :on-failure (constantly :machina/stop)} }})

-;;
-;; TODO: interesting approach but there is no way
-;; for the `fn*` to know when to stop
-;; or to `on-success` to decide which new
-;; state to go. For example if the counter
-;; gets to 10 I would like to exit
-;; Same for the `on-failure` it should be
-;; able to decide which state based on error
-;; TODO: `on-success` and `on-failure` should
-;; take the state in input `(on-success sm)`
-;; or `(on-failure sm ex)`.
-;;
+
 (defn play [{:keys [state transitions data] :as sm}]
   (if (= state :machina/stop)
     sm
     (if-let [{:keys [fn* on-success on-failure]} (get transitions state)]
       (try
-        (let [data1 (apply fn* [data])]
-          (assoc sm :data data1 :state on-success))
+        (as-> sm $
+          (assoc $ :data (apply fn* [data]))
+          (assoc $ :state (on-success $)))
         (catch Exception x
-          (assoc sm
-                 :error {:from-state state
-                         :error x}
-                 :state on-failure)))
+          (as-> sm $
+            (assoc $ :error {:from-state state :error x})
+            (assoc $ :state (on-failure $)))))
       (assoc sm :error {:from-state state
                         :error :machina/bad-state}))))

 (comment
-  (iterate play sm)
+  (play sm)
+  (->> sm
+       (iterate play)
+       (take-while #(not= :machina/stop (:state %)))
+       #_(map :data)
+       last
+       )
   )
+
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;;
+;;        ---==| W R I T E   T I M E S T A M P   T O   F I L E |==----        ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(def sm
+  {:state :machina/start
+   :data   nil
+   :transitions
+   {:machina/start {:fn*        (constantly "/tmp/1/2/3/4/5/file.txt")
+                    :on-success (constantly :write-to-file)
+                    :on-failure (constantly :machina/stop)}
+
+
+    :sleep {:fn*        (fn [_] (Thread/sleep 1000))
+            :on-success (constantly :write-to-file)
+            :on-failure (constantly :sleep)}
+
+
+    :write-to-file {:fn*        (fn [f]
+                                  (spit f
+                                        (str (java.util.Date.))
+                                        :append true))
+
+                    :on-success (constantly :sleep)
+                    :on-failure (constantly :sleep)}}})
+
+
+(comment
+
+  (-> sm
+      play
+      play)
+
+  (->> sm
+       (iterate play)
+       (take-while #(not= :machine/stop (:state %)))
+       (last))
+
+
+
+  )


remove into []

remove into []

--- src/oc/storage/resources/entry.clj
+++ src/oc/storage/resources/entry.clj
@@ -223,7 +223,7 @@
   [original-entry entry user]
   (let [authors (:author original-entry)
         ts (db-common/current-timestamp)
-        updated-authors (into [] (concat authors [(assoc (lib-schema/author-for-user user) :updated-at ts)]))]
+        updated-authors (concat authors [(assoc (lib-schema/author-for-user user) :updated-at ts)])]
     (assoc entry :author updated-authors)))

 (schema/defn ^:always-validate update-entry-no-version! :- (schema/maybe common/Entry)


Add paginated-entries-by-board function to entry resource used for the new board pagination.

--- src/oc/storage/resources/entry.clj
+++ src/oc/storage/resources/entry.clj
@@ -382,7 +382,7 @@

 (schema/defn ^:always-validate list-entries-by-org
   "
-  Given the UUID of the org, an order, one of `:asc` or `:desc`, a start date as an ISO8601 timestamp,
+  Given the UUID of the org, an order, one of `:asc` or `:desc`, a start date as an ISO8601 timestamp,
   and a direction, one of `:before` or `:after`, return the published entries for the org with any interactions.
   "
   [conn org-uuid :- lib-schema/UniqueID order start :- lib-schema/ISO8601 direction allowed-boards :- [lib-schema/UniqueID] {:keys [must-see count] :or {must-see false count false}}]
@@ -402,9 +402,26 @@
       ["uuid" "headline" "body" "reaction" "author"
        "published-at" "created-at" "updated-at"] {:count count})))

+
+(schema/defn ^:always-validate paginated-entries-by-board
+  "
+  Given the UUID of the org, an order, one of `:asc` or `:desc`, a start date as an ISO8601 timestamp,
+  and a direction, one of `:before` or `:after`, return the published entries for the org with any interactions.
+  "
+  [conn board-uuid :- lib-schema/UniqueID order start :- lib-schema/ISO8601 direction {:keys [count] :or {count false}}]
+  {:pre [(db-common/conn? conn)
+          (#{:desc :asc} order)
+          (#{:before :after} direction)]}
+  (db-common/read-resources-and-relations conn table-name
+    :status-board-uuid [[:published board-uuid]]
+    "published-at" order start direction config/default-activity-limit
+    :interactions common/interaction-table-name :uuid :resource-uuid
+    ["uuid" "headline" "body" "reaction" "author"
+     "published-at" "created-at" "updated-at"] {:count count}))
+
 (schema/defn ^:always-validate list-entries-by-org-author
   "
-  Given the UUID of the org, an order, one of `:asc` or `:desc`, a start date as an ISO8601 timestamp,
+  Given the UUID of the org, an order, one of `:asc` or `:desc`, a start date as an ISO8601 timestamp,
   and a direction, one of `:before` or `:after`, and an optional status of `:draft` or `:published` (the default)
   return the entries by the author with any interactions.
   "


www/application.clj: added CitationsResource

--- src/org/altlaw/www/application.clj
+++ src/org/altlaw/www/application.clj
@@ -7,6 +7,7 @@
             org.altlaw.www.CiteFinder
             org.altlaw.www.AllCasesFinder
             org.altlaw.www.SearchResource
+            org.altlaw.www.CitationsResource
             org.altlaw.www.DocResource
             org.altlaw.www.content-pages
             [org.altlaw.util.context :as context]
@@ -41,5 +42,6 @@
       (.attach "/v1/cases" (new org.altlaw.www.AllCasesFinder context))
       (.attach "/v1/search/{query_type}" org.altlaw.www.SearchResource)
       (.attach "/v1/search" org.altlaw.www.SearchResource)
+      (.attach "/v1/cases/{docid}/citations" org.altlaw.www.CitationsResource)
       (.attach "/v1/cases/{docid}" org.altlaw.www.DocResource)
       (.attach static-finder))))


add metadata to b equalisation suite ugens

--- src/overtone/sc/ugen/beq_suite.clj
+++ src/overtone/sc/ugen/beq_suite.clj
@@ -27,11 +27,11 @@
        ;; }

        {:name "BLowPass",
-        :args [{:name "in"}
-               {:name "freq", :default 1200.0}
-               {:name "rq", :default 1.0}],
-        :rates #{:ar}
-        :doc ""}
+        :args [{:name "in" :doc "input signal to be processed"}
+               {:name "freq", :default 1200.0 :doc "cutoff frequency"}
+               {:name "rq", :default 1.0 :doc "the reciprocal of Q.  bandwidth / cutoffFreq"}],
+        :rates #{:ar}
+        :doc "12db/oct rolloff - 2nd order resonant Low Pass Filter based on the Second Order Section (SOS) biquad UGen"}

        ;; BHiPass : BEQSuite {
        ;; 	*ar { arg in, freq = 1200.0, rq = 1.0, mul = 1.0, add = 0.0;
@@ -54,11 +54,11 @@
        ;;                     }

        {:name "BHiPass",
-        :args [{:name "in"}
-               {:name "freq", :default 1200.0}
-               {:name "rq", :default 1.0}],
-        :rates #{:ar}
-        :doc ""}
+        :args [{:name "in" :doc "input signal to be processed"}
+               {:name "freq", :default 1200.0 :doc "cutoff frequency"}
+               {:name "rq", :default 1.0 :doc "the reciprocal of Q. bandwidth / cutoffFreq"}],
+        :rates #{:ar}
+        :doc "12db/oct rolloff - 2nd order resonant  Hi Pass Filter based on the Second Order Section (SOS) biquad UGen."}

        ;; BAllPass : BEQSuite {
        ;; 	*ar { arg in, freq = 1200.0, rq = 1.0, mul = 1.0, add = 0.0;
@@ -78,10 +78,11 @@
        ;; }

        {:name "BAllPass",
-        :args [{:name "in"}
-               {:name "freq", :default 1200.0}
-               {:name "rq", :default 1.0}],
-        :rates #{:ar}}
+        :args [{:name "in" :doc "input signal to be processed."}
+               {:name "freq", :default 1200.0 :doc "center frequency."}
+               {:name "rq", :default 1.0 :doc "the reciprocal of Q.  bandwidth / cutoffFreq."}],
+        :rates #{:ar}
+        :doc "All pass filter based on the Second Order Section (SOS) biquad UGen"}

        ;; BBandPass : BEQSuite {
        ;; 	*ar {arg in, freq = 1200.0, bw = 1.0, mul = 1.0, add = 0.0;
@@ -104,10 +105,12 @@
        ;; }

        {:name "BBandPass",
-        :args [{:name "in"}
-               {:name "freq", :default 1200.0}
-               {:name "bw", :default 1.0}],
-        :rates #{:ar}}
+        :args [{:name "in" :doc "input signal to be processed"}
+               {:name "freq", :default 1200.0 :doc "center frequency"}
+               {:name "bw", :default 1.0 :doc "the bandwidth in octaves between -3 dB frequencies"}],
+        :rates #{:ar}
+        :doc "Band pass filter based on the Second Order Section (SOS) biquad UGen"}
+

        ;; BBandStop : BEQSuite {
        ;; 	*ar {arg in, freq = 1200.0, bw = 1.0, mul = 1.0, add = 0.0;
@@ -129,10 +132,11 @@
        ;; }

        {:name "BBandStop",
-        :args [{:name "in"}
-               {:name "freq", :default 1200.0}
-               {:name "bw", :default 1.0}],
-        :rates #{:ar}}
+        :args [{:name "in" :doc "input signal to be processed"}
+               {:name "freq", :default 1200.0 :doc "center frequency"}
+               {:name "bw", :default 1.0 :doc "the bandwidth in octaves between -3 dB frequencies"}],
+        :rates #{:ar}
+        :doc "Band reject filter based on the Second Order Section (SOS) biquad UGen"}

        ;; BPeakEQ : BEQSuite {
        ;; 	*ar {arg in, freq = 1200.0, rq = 1.0, db = 0.0, mul = 1.0, add = 0.0;
@@ -155,11 +159,12 @@
        ;;                     }

        {:name "BPeakEQ",
-        :args [{:name "in"}
-               {:name "freq", :default 1200.0}
-               {:name "rq", :default 1.0}
-               {:name "db", :default 0.0}],
-        :rates #{:ar}}
+        :args [{:name "in" :doc "input signal to be processed"}
+               {:name "freq", :default 1200.0 :doc "center frequency"}
+               {:name "rq", :default 1.0 :doc "the reciprocal of Q.  bandwidth / cutoffFreq"}
+               {:name "db", :default 0.0 :doc "boost/cut the center frequency (in dBs)"}],
+        :rates #{:ar}
+        :doc "Parametric equalizer based on the Second Order Section (SOS) biquad UGen"}

        ;; BLowShelf : BEQSuite {
        ;; 	*ar {arg in, freq = 1200.0, rs = 1.0, db = 0.0, mul = 1.0, add = 0.0;
@@ -188,11 +193,12 @@
        ;; }

        {:name "BLowShelf",
-        :args [{:name "in"}
-               {:name "freq", :default 1200.0}
-               {:name "rs", :default 1.0}
-               {:name "db", :default 0.0}],
-        :rates #{:ar}}
+        :args [{:name "in" :doc "input signal to be processed"}
+               {:name "freq", :default 1200.0 :doc "center frequency"}
+               {:name "rs", :default 1.0 :doc "the reciprocal of S.  Shell boost/cut slope. When S = 1, the shelf slope is as steep as it can be and remain monotonically increasing or decreasing gain with frequency.  The shelf slope, in  dB/octave, remains proportional to S for all other values for a fixed freq/SampleRate.ir and db."}
+               {:name "db", :default 0.0 :doc "gain. boost/cut the center frequency in dBs"}],
+        :rates #{:ar}
+        :doc "Low shelf based on the Second Order Section (SOS) biquad UGen"}

        ;; BHiShelf : BEQSuite {
        ;; 	*ar {arg in, freq = 1200.0, rs = 1.0, db = 0.0, mul = 1.0, add = 0.0;
@@ -221,11 +227,12 @@
        ;; }

        {:name "BHiShelf",
-        :args [{:name "in"}
-               {:name "freq", :default 1200.0}
-               {:name "rs", :default 1.0}
-               {:name "db", :default 0.0}],
-        :rates #{:ar}}]))
-
-
-
+        :args [{:name "in" :doc "input signal to be processed"}
+               {:name "freq", :default 1200.0 :doc "center frequency"}
+               {:name "rs", :default 1.0 :doc "the reciprocal of S.  Shell boost/cut slope. When S = 1, the shelf slope is as steep as it can be and remain monotonically increasing or decreasing gain with frequency.  The shelf slope, in  dB/octave, remains proportional to S for all other values for a fixed freq/SampleRate.ir and db."}
+               {:name "db", :default 0.0 :doc "gain. boost/cut the center frequency in dBs"}],
+        :rates #{:ar}
+        :doc "Hi shelfbased on the Second Order Section (SOS) biquad UGen"}]))
+
+
+


arranging; removed useless binding in edn read

--- src/gecf/core.clj
+++ src/gecf/core.clj
@@ -63,9 +63,8 @@
 (defn read-all
   ([] (read-all *in*))
   ([input]
-   (binding [*read-eval* false] ;; probably useless with edn...
-     (let [eof (Object.)]
-       (take-while #(not= % eof) (repeatedly #(edn/read {:eof eof} input)))))))
+   (let [eof (Object.)]
+     (take-while #(not= % eof) (repeatedly #(edn/read {:eof eof} input))))))

 (defn read-pairs [] (read-all))
@@ -136,8 +135,7 @@
                                  "full" :full ;; full, random graph: for testing etc.
                                  "random" :random ;; full, random: takes num of vertices as argument
                                  "help" :help
-                                 "version" :version
-                                 }
+                                 "version" :version}
                         :shorts{\b "bidirectional"
                                 \d "directed"
                                 \p "pairs"
@@ -149,8 +147,7 @@
                                 \A "all"
                                 \f "full"
                                 \r "random"
-                                \h "help"
-                                }
+                                \h "help"}
                         :has-data #{:full :random}
                         } args)
         opt #(get-in ac [:opts %])
@@ -165,15 +162,13 @@

         print-cut? (opt :cut)
         print-cut? (if (opt :cut-edn) :edn print-cut?)
-        print-cut? (if (opt :cut-all) :all print-cut?)
-        ]
+        print-cut? (if (opt :cut-all) :all print-cut?)]
     (cond
      (opt :version) (println (get-version))
      (opt :help) (prn-help)
      (opt :full) (->> (read-string (opt :full)) full-graph (compute-print print-cut?))
      (opt :random) (->> (read-string (opt :random)) rand-graph (compute-print print-cut?))
-     :else (->> (graph-reader) (apply graph-builder) (compute-print print-cut?))
-     )))
+     :else (->> (graph-reader) (apply graph-builder) (compute-print print-cut?)) )))

 (defn -main [& args]
   (args-dispatch args)


Fixed search field background

Fixed search field background

--- MeinsApp/src/cljs/meins/ui/journal.cljs
+++ MeinsApp/src/cljs/meins/ui/journal.cljs
@@ -103,16 +103,16 @@
         [view {:style {:background-color header-tab-bg
                        :padding-top      pt
                        :padding-bottom   6}}
-         [search-bar {:placeholder        "search..."
-                      :lightTheme         light-theme
-                      :on-change-text     on-change-text
-                      :on-clear-text      on-clear-text
-                      :keyboard-type      "twitter"
-                      :keyboardAppearance (if light-theme "light" "dark")
-                      :inputStyle         {:backgroundColor search-field-bg}
-                      :containerStyle     {:backgroundColor   "transparent"
-                                           :borderTopWidth    0
-                                           :borderBottomWidth 0}}]]))))
+         [search-bar {:placeholder         "search..."
+                      :lightTheme          light-theme
+                      :on-change-text      on-change-text
+                      :on-clear-text       on-clear-text
+                      :keyboard-type       "twitter"
+                      :keyboardAppearance  (if light-theme "light" "dark")
+                      :inputContainerStyle {:backgroundColor search-field-bg}
+                      :containerStyle      {:backgroundColor   "transparent"
+                                            :borderTopWidth    0
+                                            :borderBottomWidth 0}}]]))))

 (defn journal [_]
   (let [theme (subscribe [:active-theme])
@@ -282,4 +282,4 @@
     (clj->js {:headerMode               "none"
               :defaultNavigationOptions {:headerStyle {:backgroundColor   "#445"
                                                        :borderBottomWidth 0}}
-              :transitionConfig (fn [] (fadeIn 200))})))
+              :transitionConfig         (fn [] (fadeIn 200))})))


do less work in the action output handler

--- frontend/controllers/ws.cljs
+++ frontend/controllers/ws.cljs
@@ -106,12 +106,13 @@
 (defmethod ws-event :build/append-action
   [pusher-imp message {:keys [data channel-name]} state]
   (with-swallow-ignored-build-channels state channel-name
-    (let [{action-index :step container-index :index output :out} (utils/js->clj-kw data)]
+    (let [container-index (aget data "index")
+          action-index (aget data "step")]
       (if (not= container-index (get-in state state/current-container-path 0))
         (do (mlog "Ignoring output for inactive container: " container-index)
             (update-in state (state/action-path container-index action-index) assoc :missing-pusher-output true :has_output true))

-        (let [{action-index :step container-index :index output :out} (utils/js->clj-kw data)]
+        (let [output (utils/js->clj-kw (aget data "out"))]
           (-> state
               (build-model/fill-containers container-index action-index)
               (update-in (state/action-output-path container-index action-index) vec)


Change url for scraping service informations

--- src/servisne_info/scrape/ns_rs.clj
+++ src/servisne_info/scrape/ns_rs.clj
@@ -7,7 +7,7 @@

 (def info-site
   {:url "http://www.021.rs"
-   :links-path "/novi-sad/servisne-informacije.html"})
+   :links-path "/Novi-Sad/Servisne-informacije"})

 ; Private


Rename trait -> attribute and add alignment

--- src/main/cljc/clojure_club/rpg_spec/mgrimm.cljc
+++ src/main/cljc/clojure_club/rpg_spec/mgrimm.cljc
@@ -27,16 +27,16 @@
 (s/def ::1d6 (s/int-in 2 7))
 (s/def ::4d6 (s/tuple ::1d6 ::1d6 ::1d6 ::1d6))

-(s/def ::trait (s/with-gen (s/int-in 8 25)
-                 #(s/gen (into #{} (r/map (partial r/fold +) (g/sample (s/gen ::4d6) 100))))))
+(s/def ::attribute (s/with-gen (s/int-in 8 25)
+                     #(s/gen (into #{} (r/map (partial r/fold +) (g/sample (s/gen ::4d6) 100))))))
+(s/def ::str ::attribute)
+(s/def ::dex ::attribute)
+(s/def ::int ::attribute)
+(s/def ::cha ::attribute)
+(s/def ::wis ::attribute)
+(s/def ::con ::attribute)
+(s/def ::attributes (s/keys :req [::str ::dex ::int ::cha ::wis ::con]))

-(s/def ::str ::trait)
-(s/def ::dex ::trait)
-(s/def ::int ::trait)
-(s/def ::cha ::trait)
-(s/def ::wis ::trait)
-(s/def ::con ::trait)
-(s/def ::traits (s/keys :req [::str ::dex ::int ::cha ::wis ::con]))
 (s/def ::name (s/with-gen string?
                 #(s/gen (into #{} (apply map (fn [p s] (str (name p) (name s))) (vals (rand-nth (seq names))))))))

@@ -44,9 +44,12 @@
 (s/def ::race #{:dwarf :elf :gnome :half-elf :half-orc :halfling :human})
 (s/def ::class (s/coll-of #{:barbarian :bard :cleric :druid :fighter :monk :paladin :ranger :rogue :sorcerer :wizard}
                           :min-count 1 :max-count 2 :distinct true :into #{}))
+(s/def ::alignment #{:lawful-good :lawful-neutral :lawful-evil
+                     :neutral-good :true-neutral :neutral-evil
+                     :chaotic-good :chaotic-neutral :chaotic-evil})
 (s/def ::level (s/with-gen (s/int-in 1 21) #(s/gen #{1})))

-(s/def ::character (s/keys :req [::name ::gender ::race ::class ::level ::traits]))
+(s/def ::character (s/keys :req [::name ::gender ::race ::class ::alignment ::level ::attributes]))

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


added enlive template/snippet for shared server templates

--- src/kioo/core.clj
+++ src/kioo/core.clj
@@ -94,6 +94,8 @@
                 root
                 (select root (eval-selector sel)))
         child-sym (gensym "ch")]
+    (assert (or (empty? trans-lst) (map? trans-lst))
+            "Transforms must be a map - Kioo only supports order independent transforms")
     `(let [~child-sym ~(compile (map-trans start trans-lst) emit-opts)]
        (if (= 1 (count ~child-sym))
          (first ~child-sym)
@@ -118,3 +120,28 @@
         cnodes (vec (map #(if (map? %) (compile-node % emit-opts) %)
                               nodes))]
     `(kioo.core/flatten-nodes ~cnodes)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Enlive style template & snippet
+;;
+;; these were created to provide the ability
+;; to share templates from between server
+;; and client using cljx
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defn snippet* [path body args emit-opts]
+  `(fn [~@args]
+     ~(component* path body emit-opts)))
+
+(defmacro snippet [path sel args trans]
+  (snippet* path (list sel trans) args react-emit-opts))
+
+(defmacro template [path args trans]
+  (snippet* path trans args react-emit-opts))
+
+(defmacro defsnippet [sym path sel args trans]
+  `(def sym ~(snippet* path (list sel trans) args react-emit-opts)))
+
+(defmacro deftemplate [sym path args trans]
+  `(def sym ~(snippet* path args react-emit-opts)))
+


♻ Reuse the read model projections in the write model

Why:
- Avoids duplication of projection code for basic data.
- If necessary, write model specific customizations are still possible.

--- src/territory_bro/congregation.clj
+++ src/territory_bro/congregation.clj
@@ -124,40 +124,8 @@

 ;;;; Write model

-(defmulti ^:private write-model (fn [_congregation event]
-                                  (:event/type event)))
-
-(defmethod write-model :default
-  [congregation _event]
-  congregation)
-
-(defmethod write-model :congregation.event/congregation-created
-  [congregation event]
-  (-> congregation
-      (assoc :congregation/id (:congregation/id event))
-      (assoc :congregation/name (:congregation/name event))))
-
-(defmethod write-model :congregation.event/congregation-renamed
-  [congregation event]
-  (-> congregation
-      (assoc :congregation/name (:congregation/name event))))
-
-(defmethod write-model :congregation.event/permission-granted
-  [congregation event]
-  (if (= :view-congregation (:permission/id event))
-    (update congregation ::users (fnil conj #{}) (:user/id event))
-    congregation))
-
-(defmethod write-model :congregation.event/permission-revoked
-  [congregation event]
-  (if (= :view-congregation (:permission/id event))
-    (update congregation ::users disj (:user/id event))
-    congregation))
-
-(defn- write-model2 [congregation event]
-  (-> congregation
-      ;; TODO: rely more on reused code, remove write-model if possible
-      (write-model event)
+(defn- write-model [congregation event]
+  (-> congregation
       (update-congregation event)))

 (defmulti ^:private command-handler (fn [command _congregation _injections]
@@ -166,11 +134,12 @@
 (defmethod command-handler :congregation.command/add-user
   [command congregation {:keys [user-exists? check-permit]}]
   (let [cong-id (:congregation/id congregation)
-        user-id (:user/id command)]
+        user-id (:user/id command)
+        user-permissions (set (get-in congregation [:congregation/user-permissions user-id]))]
     (check-permit [:configure-congregation cong-id])
     (when-not (user-exists? user-id)
       (throw (ValidationException. [[:no-such-user user-id]])))
-    (when-not (contains? (::users congregation) user-id)
+    (when-not (contains? user-permissions :view-congregation)
       [{:event/type :congregation.event/permission-granted
         :event/version 1
         :congregation/id cong-id
@@ -220,7 +189,7 @@

 (defn handle-command [command events injections]
   (let [command (commands/validate-command command)
-        congregation (reduce write-model2 nil events)
+        congregation (reduce write-model nil events)
         injections (merge {:check-permit (fn [permit]
                                            (permissions/check (:state injections)
                                                               (:command/user command)


Fixed hardcoded email folder name.

Fixed hardcoded email folder name.

Note: Config file name is still hardcoded. Should be changed in the future.

--- src/arktikos/mail.clj
+++ src/arktikos/mail.clj
@@ -18,7 +18,7 @@
 ;;;

 ; TODO: change this to something reasonable
-(defconfig my-config (io/resource "config/config_testing.edn"))
+(defconfig my-config (io/resource "config/config_tower.edn"))

 (def gmail-username (get (my-config) :gmail-username))
 (def gmail-password (get (my-config) :gmail-password))
@@ -198,7 +198,7 @@
 (defn remote-mail
   "Get mail from the remote server, return it for data processing.
   Remote complement to (ingest-mail)."
-  ([] (remote-mail "Callisto/Colony/Letters/Missives"))
+  ([] (remote-mail gmail-folder))
   ([folder-name]
   (clojure.pprint/pprint (str "Accessing remote mail: " folder-name))
   (map process-remote-message


Add tests

Add tests

--- src/aurora/btree.cljs
+++ src/aurora/btree.cljs
@@ -26,7 +26,8 @@
   (into [this result]
         (.into root result))
   (valid! [this]
-          (.valid! root max-keys))
+          (.valid! root max-keys)
+          true)
   (pretty-print [this]
                 (prn :root)
                 (loop [nodes [root]]
@@ -283,6 +284,46 @@
     (set! (.-parent-ix node) 0)
     tree))

+;; TESTS
+
+(def gen-key
+  (gen/one-of [gen/int gen/string-ascii]))
+
+(def gen-assoc
+  (gen/tuple (gen/return :assoc!) gen-key gen/any-printable))
+
+(def gen-dissoc
+  (gen/tuple (gen/return :dissoc!) gen-key))
+
+(def gen-action
+  (gen/one-of [gen-assoc gen-dissoc]))
+
+(defn apply-to-tree [tree actions]
+  (doseq [action actions]
+    (case (nth action 0)
+      :assoc! (.assoc! tree (nth action 1) (nth action 2))
+      :dissoc! (.dissoc! tree (nth action 1))))
+  tree)
+
+(defn apply-to-sorted-map [map actions]
+  (reduce
+   (fn [map action]
+     (case (nth action 0)
+       :assoc! (assoc map (nth action 1) (nth action 2))
+       :dissoc! (dissoc map (nth action 1))))
+   map actions))
+
+(defn the-prop [gen]
+  (prop/for-all [min-keys gen/s-pos-int
+                 actions (gen/vector gen)]
+                (let [tree (apply-to-tree (tree min-keys) actions)
+                      sorted-map (apply-to-sorted-map (sorted-map-by #(cond (== %1 %2) 0 (lt %1 %2) -1 (gt %1 %2) 1)) actions)]
+                  (and (= (seq (map vec tree)) (seq sorted-map))
+                       (or (empty? tree) (.valid! tree))))))
+
+;; (dc/quick-check 100 (the-prop gen-assoc))
+;; (dc/quick-check 100 (the-prop gen-action))
+
 (comment
   (let [types [(type "foo") (type 1) (type :foo) (type js/Infinity)]]
     [(every? true? (for [type-a types]


more diagnostics

more diagnostics

--- src/babel/forest.cljc
+++ src/babel/forest.cljc
@@ -235,7 +235,7 @@

               ;; else, no complements could be added to this bolt.
               (do
-                (log/warn (str " add-complement took " run-time " msec, but found no lexical complements for "
+                (log/warn (str " add-complement to " (get-in bolt [:rule]) " took " run-time " msec, but found no lexical complements for "
                                "'" (morph from-bolt) "'"
                                ". Complements tried were:" (str " " (string/join "," (map morph (take 5 complement-candidate-lexemes))) ".. and "
                                                                  (- (count complement-candidate-lexemes) 5) " more.")))))


Add function to remove tautologies in cnf.

--- src/logic/cnf.clj
+++ src/logic/cnf.clj
@@ -116,6 +116,26 @@
     formula
 ))

+(defn tautology?
+  "Returns true if the formula is alway right, else false.
+   pre-con: operator must be or"
+  [formula]
+  {:pre [(= 'or (first formula))]}
+  (let [args (rest formula)
+        atoms (filter #(literal? %) args)
+        negated-atoms (filter #(not (literal? %)) args)]
+    (some #(= (first %) (second %)) (for [a atoms, n negated-atoms] (list a (second n))))))
+
+
+(defn remove-tautologies
+  "Takes a cnf formula and produce cnf without tautologies"
+  [ast]
+  (let [op (first ast) args (rest ast)
+        args-without-tautologies (filter (complement tautology?) args)]
+    `(~op ~@args-without-tautologies)))
+
+
+
 (defn transform-cnf
   "Takes a formula in clojure code and produces the conjunctive normal form of it."
   [formula]


Updated tRNA gene type assertion rule to work with ccp ext ontology


cleaning

cleaning

--- src/bløggr/posts.clj
+++ src/bløggr/posts.clj
@@ -85,12 +85,12 @@
 (defn get-posts []
     (->> (stasis/slurp-directory "posts/" #".*\.(md|markdown)$")
          (vals)
-         (map #(-> % parse-post
-                     markdown
-                     enliveify
-                     highlight
-                     render
-                     add-post-lead
-                     add-twitter-lead
-                     rss-content
-                     apply-post-layout))))
+         (map (comp apply-post-layout
+                    rss-content
+                    add-twitter-lead
+                    add-post-lead
+                    render
+                    highlight
+                    enliveify
+                    markdown
+                    parse-post))))


Add HTTP method to vault response logging.

--- metlog-vault/src-server/metlog_vault/core.clj
+++ metlog-vault/src-server/metlog_vault/core.clj
@@ -65,7 +65,7 @@
     (log/trace 'REQ (:request-method req) (:uri req) (:params req))
     (let [begin-t (. System (nanoTime))
           resp (app req)]
-      (log/info 'RESP (:status resp) (:uri req)
+      (log/info 'RESP (:status resp) (:request-method req) (:uri req)
                 "-" (/ (- (. System (nanoTime)) begin-t) 1000000.0))
       resp)))


Use Postgres as the default database

Use Postgres as the default database

Had switched to Oracle by mistake earlier

--- srcbase/webapp_config/settings.clj
+++ srcbase/webapp_config/settings.clj
@@ -18,18 +18,18 @@
 (defonce ^:dynamic *web-server* "127.0.0.1:3449")

-;(defonce ^:dynamic *database-type* "postgres")
-;(defonce ^:dynamic *database-server* "127.0.0.1")
-;(defonce ^:dynamic *database-user* "postgres")
-;(defonce ^:dynamic *database-password* "manager")
-;(defonce ^:dynamic *database-name* "postgres")
+(defonce ^:dynamic *database-type* "postgres")
+(defonce ^:dynamic *database-server* "127.0.0.1")
+(defonce ^:dynamic *database-user* "postgres")
+(defonce ^:dynamic *database-password* "manager")
+(defonce ^:dynamic *database-name* "postgres")

-(defonce ^:dynamic *database-type* "oracle")
-(defonce ^:dynamic *database-server* "localhost")
-(defonce ^:dynamic *database-user* "coils")
-(defonce ^:dynamic *database-password* "manager")
-(defonce ^:dynamic *database-name* "ORCL")
+;(defonce ^:dynamic *database-type* "oracle")
+;(defonce ^:dynamic *database-server* "localhost")
+;(defonce ^:dynamic *database-user* "coils")
+;(defonce ^:dynamic *database-password* "manager")
+;(defonce ^:dynamic *database-name* "ORCL")


Try really hard to delete directories

Try really hard to delete directories

In the face of nfs mounts there are sometimes problems to delete a
directory. In that case we garbage collect to get rid of stale file
handles in the JVM, wait and then try again.

Hopefully fixes #44

--- src/mdr2/util.clj
+++ src/mdr2/util.clj
@@ -2,7 +2,35 @@
   "Common utilies"
   (:require [org.tobereplaced.nio.file :as nio]
             [clojure.tools.logging :as log])
-  (:import java.nio.file.FileSystemException))
+  (:import (java.nio.file FileSystemException
+                          DirectoryNotEmptyException)
+           java.lang.InterruptedException))
+
+(def ^:private delete-retry-millis 10)
+
+;; when deleting a directory that is on an nfs mount we sometimes get
+;; a DirectoryNotEmptyException. This might have to do with some file
+;; handles that haven't been garbage collected. So if we fail to
+;; delete we try again a bit harder. For some inspiration see
+;; https://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/util/FileUtils.java?view=markup.
+(defn try-hard-to-delete [directory]
+  (System/gc) ; do garbage collection
+  ;; wait
+  (try
+    (Thread/sleep delete-retry-millis)
+    (catch InterruptedException e))
+  ;; and then try to delete again
+  (try
+    (nio/delete! directory)
+    (catch DirectoryNotEmptyException e
+      (log/error e))))
+
+(defn post-visit-directory [directory]
+  ;; Deal with nfs issues.
+  (try
+    (nio/delete! directory)
+    (catch DirectoryNotEmptyException e
+      (try-hard-to-delete directory))))

 (defn delete-directory!
   "Delete `directory` recursively. See
@@ -12,7 +40,7 @@
     (nio/walk-file-tree
      directory
      (nio/naive-visitor
-      :post-visit-directory nio/delete!
+      :post-visit-directory post-visit-directory
       :visit-file nio/delete!))
     (catch FileSystemException e
       (log/error e))))


Fills in get-classifier using other patrec functions.

--- src/cadence/model.clj
+++ src/cadence/model.clj
@@ -151,8 +151,11 @@
 (defn get-classifier
   "Gets the classifier needed for the specified user/phrase."
   [user-id phrase-id]
-  (if-let [result (mc/find-one-as-map "classifiers" {:user_id user-id :phrase_id phrase-id})]
+  (if-let [result (mc/find-one-as-map "classifiers"
+                                      {:user_id user-id :phrase_id phrase-id})]
     result
-    (let [classifier (patrec/gen-phrase-classifier)] ; TODO Correct call to make-classifier
+    ; TODO Correct call to make-classifier
+    (let [dataset (apply patrec/create-dataset (get-training-data user-id phrase-id))
+          classifier (patrec/gen-phrase-classifier dataset)]
       (store-classifier user-id phrase-id classifier)
       classifier)))


adjusting api to persistecy changes

adjusting api to persistecy changes

--- src/celestial/api.clj
+++ src/celestial/api.clj
@@ -103,20 +103,20 @@
         (success {:job-status (jobs/status queue uuid)})))

 (defroutes- users {:path "/user" :description "User managment"}
-  (GET- "/user/:id" [^:string id] {:nickname "getUser" :summary "Get User"}
-        (success (p/get-user id)))
+  (GET- "/user/:name" [^:string name] {:nickname "getUser" :summary "Get User"}
+        (success (p/get-user name)))

   (POST- "/user/" [& ^:user user] {:nickname "addUser" :summary "adds a new user"}
-         (let [id (p/add-user (update-in user [:roles] (fn [v] (sec/roles v))))]
-           (success {:user-id id})))
+         (p/add-user (update-in user [:roles] (fn [v] (sec/roles v))))
+         (success {:msg "added user"}))

-  (PUT- "/user/:id" [^:string id & ^:user user] {:nickname "updateUser" :summary "updates an existing user"}
-        (p/update-user (assoc user :id id))
-        (success {:msg "user updated" :id id}))
+  (PUT- "/user/" [& ^:user user] {:nickname "updateUser" :summary "updates an existing user"}
+        (p/update-user (update-in user [:roles] (fn [v] (sec/roles v))))
+        (success {:msg "user updated"}))

-  (DELETE- "/user/:id" [^:string id] {:nickname "deleteUser" :summary "deleted a user"}
-           (p/delete-user id)
-           (success {:msg "user deleted" :id id})))
+  (DELETE- "/user/:name" [^:string name] {:nickname "deleteUser" :summary "deleted a user"}
+           (p/delete-user name)
+           (success {:msg "user deleted" :name name})))

 (defroutes- hosts {:path "/host" :description "Operations on hosts"}


Fixed 1- and 2-argument forms of parse-string-strict.

When called with only 1 or 2 arguments, parse-string-strict deferred its
work to the 4-argument form of parse-string instead of
parse-string-strict (thus still decoding top-level arrays as lazy seqs
instead of vectors).

Finishes fixing #46 and #48.

--- src/cheshire/core.clj
+++ src/cheshire/core.clj
@@ -104,8 +104,8 @@
   and returning the collection to be used for array values.

   Does not lazily parse top-level arrays."
-  ([string] (parse-string string nil nil))
-  ([string key-fn] (parse-string string key-fn nil))
+  ([string] (parse-string-strict string nil nil))
+  ([string key-fn] (parse-string-strict string key-fn nil))
   ([^String string key-fn array-coerce-fn]
      (when string
        (parse/parse-strict


CLJS-1169: cannot use REPL load-file on files that declare single segment namespaces

cljs.util/to-target-file:
    * don't add parents to path if there aren't any, this covers single segment
      namespaces

--- src/clj/cljs/util.clj
+++ src/clj/cljs/util.clj
@@ -71,8 +71,9 @@
     (let [relative-path (string/split (munge-path (str (:ns ns-info))) #"\.")
           parents (cond-> (butlast relative-path)
                     target-dir (conj target-dir))]
-      (io/file (io/file (to-path parents))
-        (str (last relative-path) (str "." ext))))))
+      (cond->> (io/file (str (last relative-path) (str "." ext)))
+        (seq parents)
+        (io/file (to-path parents))))))

 (defn mkdirs
   "Create all parent directories for the passed file."


tweak for recurring credits refresh on cards hosted after installation

--- src/clj/game/core.clj
+++ src/clj/game/core.clj
@@ -1435,7 +1435,7 @@
                            :zone '(:onhost) ;; hosted cards should not be in :discard or :hand etc
                            :previous-zone (:zone target))]
        (update! state side (update-in card [:hosted] #(conj % c)))
-       (when installed
+       (when (and installed (:recurring (card-def c)))
          (card-init state side c false))
        c))))


fix issue with error handling

fix issue with error handling

--- src/clj/game/main.clj
+++ src/clj/game/main.clj
@@ -61,9 +61,8 @@
           (.send socket (generate-string "ok")))
         (catch Exception e
           (println "Error " action command (get-in args [:card :title]) e)
-          (if (and (= action "do") state)
-            (.send socket (generate-string state))
-            (.send socket (generate-string "error"))))))))
+          (when (and state (= action "do"))
+            (.send socket (generate-string state))))))))

 (defn dev []
   (println "[Dev] Listening on port 1043 for incoming commands...")


Test for anything that's an HttpEntityEnclosingRequest.

--- src/clj_http/core.clj
+++ src/clj_http/core.clj
@@ -201,7 +201,7 @@
       (if multipart
         (.setEntity #^HttpEntityEnclosingRequest http-req
                     (create-multipart-entity multipart))
-        (when (and body (not (instance? HttpHead http-req)))
+        (when (and body (instance? HttpEntityEnclosingRequest http-req))
           (if (instance? HttpEntity body)
             (.setEntity #^HttpEntityEnclosingRequest http-req body)
             (.setEntity #^HttpEntityEnclosingRequest http-req


CMR-4206: Added docstring.

CMR-4206: Added docstring.

--- search-app/src/cmr/search/services/parameters/parameter_validation.clj
+++ search-app/src/cmr/search/services/parameters/parameter_validation.clj
@@ -325,6 +325,8 @@
       [(msg/science-keyword-invalid-format-msg)])))

 (defn variables-validation
+  "Validates the variables-h search parameters are in the format of e.g.
+   variables-h[0][measurement]=vaule."
   [concept-type params]
   (when-let [variables (get params :variables-h)]
     (if (map? variables)


Use dorun instead of doall

Use dorun instead of doall

--- src/ambig_index_finder/core.clj
+++ src/ambig_index_finder/core.clj
@@ -28,14 +28,14 @@

 (defn save-results-to-file [results]
   (let [save-results-per-repetition
-        (fn [res] (doall (map #(do
+        (fn [res] (dorun (map #(do
                                  (save-json-to-file %)
                                  (progress/tick))
                               res)))
         save-results-per-sample
-        (fn [res] (doall (map save-results-per-repetition res)))
+        (fn [res] (dorun (map save-results-per-repetition res)))
         save-results-per-query
-        (fn [res] (doall (map save-results-per-sample res)))]
+        (fn [res] (dorun (map save-results-per-sample res)))]
     (save-results-per-query results)))

 (defn execute-evaluation [opts]


added ir

added ir

--- src/babel/espanol/lexicon.clj
+++ src/babel/espanol/lexicon.clj
@@ -279,6 +279,32 @@
              {:synsem {:cat :verb
                        :sem {:pred :talk
                              :subj {:human true}}}}]
+
+    "ir" {:espanol {:future-stem "ir"
+                       :present {:1sing "voy"
+                                 :2sing "vas"
+                                 :3sing "va"
+                                 :1plur "vamos"
+                                 :2plur "vais"
+                                 :3plur "van"}
+                      :preterito {:1sing "fui"
+                                 :2sing "fuiste"
+                                 :3sing "fue"
+                                 :1plur "fuimos"
+                                 :2plur "fuisteis"
+                                 :3plur "fueron"}
+                      :imperfecto {:1sing "iba"
+                                 :2sing "ibas"
+                                 :3sing "iba"
+                                 :1plur "ibamos"
+                                 :2plur "ibais"
+                                 :3plur "iban"}
+
+
+            :synsem {:cat :verb
+
+                     :sem {:subj {:animate true}
+                           :pred :go}}}

     "Juan y yo"
       [{:synsem {:cat :noun


whitespace

whitespace

--- src/babel/espanol/lexicon.clj
+++ src/babel/espanol/lexicon.clj
@@ -114,22 +114,20 @@
    "echar" {:synsem {:cat :verb
                      :sem {:pred :throw-out}}}

-    "quedarse" (let [subject-semantics (ref {:animate true})
-                   subject-agr (ref :top)]
-               {:synsem {:cat :verb
-                         :sem {:pred :remain
-                               :reflexive true
-                               :subj subject-semantics
-                               :obj subject-semantics}
-                         :subcat {:1 {:agr subject-agr
-                                      :sem subject-semantics}
-                                  :2 {:agr subject-agr
-                                      :pronoun true
-                                      :reflexive true
-                                      :sem subject-semantics}}}})
-
-
-   "el"
+   "quedarse" (let [subject-semantics (ref {:animate true})
+                    subject-agr (ref :top)]
+                {:synsem {:cat :verb
+                          :sem {:pred :remain
+                                :reflexive true
+                                :subj subject-semantics
+                                :obj subject-semantics}
+                          :subcat {:1 {:agr subject-agr
+                                       :sem subject-semantics}
+                                   :2 {:agr subject-agr
+                                       :pronoun true
+                                       :reflexive true
+                                       :sem subject-semantics}}}})
+    "el"
    (unify determiner
           {:synsem {:cat :det
                     :def :def


replace boot-stem1 with boot-stem; remove boot-stem2

--- src/babel/espanol/lexicon.clj
+++ src/babel/espanol/lexicon.clj
@@ -19,16 +19,14 @@
    "aceptar" {:synsem {:cat :verb
                        :sem {:pred :accept}}}

-   "acertar" {:espanol {:boot-stem1 "aciert"
-                        :boot-stem2 "acert"}
+   "acertar" {:espanol {:boot-stem "aciert"}
              :synsem {:cat :verb
                       :sem {:pred :guess}}}

    "acompañar" {:synsem {:cat :verb
                          :sem {:pred :accompany}}}

-   "advertir" {:espanol {:boot-stem1 "adviert"
-                        :boot-stem2 "advert"}
+   "advertir" {:espanol {:boot-stem "adviert"}
              :synsem {:cat :verb
                       :sem {:pred :warn}}}

@@ -72,8 +70,7 @@
    "comentar" {:synsem {:cat :verb
                         :sem {:pred :comment}}}

-   "comenzar" {:espanol {:boot-stem1 "comienz"
-                        :boot-stem2 "comenz"}
+   "comenzar" {:espanol {:boot-stem "comienz"}
              :synsem {:cat :verb
                       :sem {:pred :begin}}}

@@ -95,8 +92,7 @@
    "comprender" {:synsem {:cat :verb
                           :sem {:pred :understand-deeply}}}

-   "confesar" {:espanol {:boot-stem1 "confies"
-                        :boot-stem2 "confes"}
+   "confesar" {:espanol {:boot-stem "confies"}
              :synsem {:cat :verb
                       :sem {:pred :confess}}}

@@ -251,8 +247,7 @@
               :synsem {:cat :verb
                        :sem {:pred :begin}}}

-   "encender" {:espanol {:boot-stem1 "enciend"
-                        :boot-stem2 "encend"}
+   "encender" {:espanol {:boot-stem "enciend"}
              :synsem {:cat :verb
                       :sem {:pred :light}}}

@@ -298,8 +293,7 @@
    "formar" {:synsem {:cat :verb
                       :sem {:pred :form}}}

-   "fregar" {:espanol {:boot-stem1 "frieg"
-                        :boot-stem2 "freg"}
+   "fregar" {:espanol {:boot-stem "frieg"}
              :synsem {:cat :verb
                       :sem {:pred :scrub}}}

@@ -327,8 +321,7 @@
                        :sem {:pred :talk
                              :subj {:human true}}}}]

-   "hervir" {:espanol {:boot-stem1 "hierv"
-                        :boot-stem2 "herv"}
+   "hervir" {:espanol {:boot-stem "hierv"}
              :synsem {:cat :verb
                       :sem {:pred :boil}}}

@@ -379,15 +372,9 @@
                         :number :sing}
                   :sem {:pred :I}
                   :subcat '()}}
-   "mentir" {:espanol {:boot-stem1 "mient"
-                        :boot-stem2 "ment"}
+   "mentir" {:espanol {:boot-stem "mient"}
              :synsem {:cat :verb
                       :sem {:pred :lie}}}
-
-
-
-
-
    "mujer"
    (unify agreement-noun
           common-noun


add basics to cljs.compiler/api

add basics to cljs.compiler/api

--- src/clj/cljs/compiler/api.clj
+++ src/clj/cljs/compiler/api.clj
@@ -16,3 +16,63 @@
             [cljs.env :as env]
             [cljs.analyzer :as ana]
             [cljs.compiler :as comp]))
+
+;; =============================================================================
+;; Main API
+
+(defn emit
+  "Given an AST node generated by the analyzer emit JavaScript as a string."
+  [ast]
+  (with-out-str
+    (comp/emit ast)))
+
+(defn with-core-cljs
+  "Ensure that core.cljs has been loaded."
+  ([] (comp/with-core-cljs nil))
+  ([opts] (comp/with-core-cljs opts (fn [])))
+  ([opts body] (comp/with-core-cljs opts body)))
+
+(defn requires-compilation?
+  "Return true if the src file requires compilation."
+  ([src dest]
+   (comp/requires-compilation? src dest nil))
+  ([src dest opts]
+   (comp/requires-compilation? src dest opts)))
+
+(defn compile-file
+  "Compiles src to a file of the same name, but with a .js extension,
+   in the src file's directory.
+
+   With dest argument, write file to provided location. If the dest
+   argument is a file outside the source tree, missing parent
+   directories will be created. The src file will only be compiled if
+   the dest file has an older modification time.
+
+   Both src and dest may be either a String or a File.
+
+   Returns a map containing {:ns .. :provides .. :requires .. :file ..}.
+   If the file was not compiled returns only {:file ...}"
+  ([src]
+   (comp/compile-file src))
+  ([src dest]
+   (comp/compile-file src dest))
+  ([src dest opts]
+   (comp/compile-file src dest opts)))
+
+(defn cljs-files-in
+  "Return a sequence of all .cljs and .cljc files in the given directory."
+  [dir]
+  (comp/cljs-files-in dir))
+
+(defn compile-root
+  "Looks recursively in src-dir for .cljs files and compiles them to
+   .js files. If target-dir is provided, output will go into this
+   directory mirroring the source directory structure. Returns a list
+   of maps containing information about each file which was compiled
+   in dependency order."
+  ([src-dir]
+   (comp/compile-root src-dir "out"))
+  ([src-dir target-dir]
+   (comp/compile-root src-dir target-dir nil))
+  ([src-dir target-dir opts]
+   (comp/compile-root src-dir target-dir opts)))


Replace map+vec with mapv

Replace map+vec with mapv

--- src/clj/mokkameister/mqtt.clj
+++ src/clj/mokkameister/mqtt.clj
@@ -11,15 +11,13 @@
 (defn- started-percolating? [history]
   (->> history
        (take-last 3)
-       (map #(<= THRESHOLD_WATT %))
-       (vec)
+       (mapv #(<= THRESHOLD_WATT %))
        (= [false false true])))

 (defn- brew-finished? [history]
   (->> history
        (take-last 6)
-       (map #(<= THRESHOLD_WATT %))
-       (vec)
+       (mapv #(<= THRESHOLD_WATT %))
        (= [true true false false false false])))

 (defn- connect! []


use an agent on clj to create only once

use an agent on clj to create only once

--- src/deferst/core.cljc
+++ src/deferst/core.cljc
@@ -13,38 +13,89 @@
   (stop! [_])
   (system-map [_]))

-(defrecord Sys [builder sys-atom default-conf label]
+(defn return-pr
+  [v]
+  #?(:clj (d/success-deferred v)
+     :cljs (p/promise v)))
+
+;; cross-platform promise creation in the promesa style
+#?(:clj (defn create-pr
+          [resolve-reject-fn]
+          (let [d (d/deferred)]
+            (resolve-reject-fn
+             #(d/success! d %)
+             #(d/error! d %))
+            d))
+   :cljs (def create-pr p/promise))
+
+;; cross-platform branch
+#?(:clj (defn branch
+          [p success-fn error-fn]
+          (-> p
+              (d/chain success-fn)
+              (d/catch error-fn)))
+   :cljs (def branch p/branch))
+
+(defn start!*
+  [builder sys-val conf label resolve-fn reject-fn]
+  (#?(:clj send :cljs swap!)
+   sys-val
+   (fn [sys-pr]
+     (let [sys-pr (if sys-pr
+                    sys-pr
+                    (do
+                      (when label (println "starting: " label))
+                      (s/start-system! builder conf)))]
+       (-> sys-pr
+           s/system-map
+           (branch resolve-fn reject-fn))
+       sys-pr))))
+
+(defn stop!*
+  [builder sys-val label resolve-fn reject-fn]
+  (#?(:clj send :cljs swap!)
+   sys-val
+   (fn [sys-pr]
+     (let [stop-pr (if sys-pr
+                     (do
+                       (when label (println "stopping: " label))
+                       (s/system-map
+                        (s/stop-system! sys-pr)))
+                     (return-pr nil))]
+       ;; returns nil on success or an error to the caller
+       (branch stop-pr resolve-fn reject-fn)
+       nil))))
+
+(defn system-map*
+  [sys-val resolve-fn reject-fn]
+  (#?(:clj send :cljs swap!)
+   sys-val
+   (fn [sys-pr]
+     (let [sm-pr (if sys-pr
+                   (s/system-map sys-pr)
+                   (return-pr nil))]
+       (branch sm-pr resolve-fn reject-fn))
+     sys-pr)))
+
+(defrecord Sys [builder sys-val default-conf label]
   ISys
   (start! [this]
     (start! this default-conf))

   (start! [_ conf]
-    (swap!
-     sys-atom
-     (fn [sys]
-       (if sys
-         sys
-         (do
-           (when label (println "starting: " label))
-           (s/start-system! builder conf)))))
-    (s/system-map @sys-atom))
+    (create-pr
+     (fn [resolve-fn reject-fn]
+       (start!* builder sys-val conf label resolve-fn reject-fn))))

   (stop! [_]
-    (let [r (atom nil)]
-      (swap!
-       sys-atom
-       (fn [sys]
-         (when sys
-           (when label (println "stopping: " label))
-           (reset! r (s/stop-system! sys))
-           nil)))
-      (if @r
-        (s/system-map @r)
-        #?(:clj (d/success-deferred nil)
-           :cljs (p/promise nil)))))
+    (create-pr
+     (fn [resolve-fn reject-fn]
+       (stop!* builder sys-val label resolve-fn reject-fn))))

   (system-map [_]
-    (s/system-map @sys-atom)))
+    (create-pr
+     (fn [resolve-fn reject-fn]
+       (system-map* sys-val resolve-fn reject-fn)))))

 (defn create-system
   ([builder]
@@ -53,7 +104,8 @@
    (create-system builder default-conf nil))
   ([builder default-conf label]
    (map->Sys {:builder builder
-              :sys-atom (atom nil)
+              :sys-val #?(:clj (agent nil)
+                          :cljs (atom nil))
               :default-conf default-conf
               :label label})))
 #?(:clj


remove unused fns

remove unused fns

--- src/clj_kafka/consumer/zk.clj
+++ src/clj_kafka/consumer/zk.clj
@@ -27,21 +27,9 @@
   [consumer]
   (.shutdown consumer))

-(defn- topic-map
-  [topics]
-  (apply hash-map (interleave topics
-                              (repeat (Integer/valueOf 1)))))
-
 (defn messages
   "Creates a sequence of messages from the given topics."
   [consumer topic]
   (let [[topic streams] (first (.createMessageStreams consumer {topic (Integer/valueOf 1)}))]
     (iterator-seq (.iterator (first streams)))))

-(defn topics
-  "Connects to Zookeeper to read the list of topics. Use the same config
-   as with consumer, uses the zk.connect value to connect to the client"
-  [config]
-  (with-resource [z (zk/connect (get config "zk.connect"))]
-    zk/close
-    (sort (zk/children z "/brokers/topics"))))


refactor consumer.zk/messages a little

refactor consumer.zk/messages a little

--- src/clj_kafka/consumer/zk.clj
+++ src/clj_kafka/consumer/zk.clj
@@ -36,13 +36,10 @@
 (defn messages
   "Creates a sequence of messages from the given topics."
   [consumer & topics]
-  (let [streams-in (.createMessageStreams consumer (topic-map topics))
-        streams (map (fn [topic]
-                       (first (get streams-in topic)))
-                     topics)
+  (let [topic-and-streams (.createMessageStreams consumer (topic-map topics))
         [queue-seq queue-put] (pipe)]
-    (doseq [stream streams]
-      (future (doseq [msg (iterator-seq (.iterator stream))]
+    (doseq [[_ streams] topic-and-streams]
+      (future (doseq [msg (iterator-seq (.iterator (first streams)))]
                 (queue-put (to-clojure msg)))))
     queue-seq))


Fix xp calculation in player info popover

--- src/cljc/robinson/player.cljc
+++ src/cljc/robinson/player.cljc
@@ -339,7 +339,7 @@
 (defn player-level
   [state]
   (let [player-xp (player-xp state)]
-    (count (filter #(<= % player-xp) xp))))
+    (count (filter #(>= player-xp %) xp))))

 (defn xp-for-next-level
   [state]
@@ -347,7 +347,7 @@

 (defn xp-acc-for-next-level
   [state]
-  (- (player-xp state) (get xp (- (player-level state) 2) 0)))
+  (- (player-xp state) (get xp (dec (player-level state)) 0)))

 (defn player-update-hp
   [state f]


Update active-color logic when color is removed

--- src/cljs/koeeoadi/parser.cljs
+++ src/cljs/koeeoadi/parser.cljs
@@ -177,12 +177,11 @@
    (fn []
      (swap! state merge props))})

-(defn next-active-color [colors color-id-removing]
-  (let [[left-colors right-colors] (split-with #(< (last %) color-id-removing) colors)]
-    (println "here")
-    (println right-colors)
-    (println left-colors)
-    (or (second right-colors) (last left-colors))))
+(defn next-active-color [{:keys [:palette-widget/active-color :faces/list]} color-id-removing]
+  (if (= color-id-removing (:color/id active-color))
+    (let [[left-colors right-colors] (split-with #(< (last %) color-id-removing) list)]
+      (or (second right-colors) (last left-colors)))
+    active-color))

 (defmethod mutate 'color/remove
   [{:keys [state ref]} _ _]
@@ -190,8 +189,7 @@
    (fn []
      (let [st                @state
            color-id-removing (last ref)
-           active-color      (next-active-color (st :colors/list) color-id-removing)]
-       (println "removing")
+           active-color      (next-active-color st color-id-removing)]
        (reset! state (-> st
                        (update :colors/by-id dissoc (last ref))
                        (update :colors/list #(filterv (partial not= ref) %))


by default generate data using superjob.ru instead of consultant.ru

--- src/cljs_workcalendar/app.clj
+++ src/cljs_workcalendar/app.clj
@@ -1,8 +1,8 @@
 (ns cljs-workcalendar.app
   (:require [cljs-workcalendar.datasource.workcalendarsource :as source])

-  (:require [cljs-workcalendar.datasource.consultantru])
-  (:import  [cljs_workcalendar.datasource.consultantru ConsultantRuWorkCalendarSource])
+  (:require [cljs-workcalendar.datasource.superjobru])
+  (:import  [cljs_workcalendar.datasource.superjobru SuperjobRuWorkCalendarSource])

   (:require [cljs-workcalendar.format.formatinterface :as fmt])
   (:require [cljs-workcalendar.format.plaintextformatter])
@@ -25,7 +25,7 @@
                                     (:month item)
                                     (:day item)))
                           (source/get-work-calendar
-                           (ConsultantRuWorkCalendarSource.)))]
+                           (SuperjobRuWorkCalendarSource.)))]
     (do
       (serialize-calendar calendar
                           (PlainTextWorkCalendarFormatter.)


add 'layout' button

add 'layout' button

--- src/clojure/defgraph/core.clj
+++ src/clojure/defgraph/core.clj
@@ -4,7 +4,10 @@
            [com.mxgraph.swing mxGraphComponent]
            [com.mxgraph.util mxPoint]
            [com.mxgraph.view mxGraph]
-           [javax.swing JFrame]))
+           [java.awt BorderLayout]
+           [java.awt.event MouseAdapter]
+           [javax.swing JButton JFrame JPanel]
+           [javax.swing.border EmptyBorder]))

 (def defs     (filter #(.isFile %) (.listFiles (java.io.File. "defs/runs"))))
 (def vertices (map #(.getName %) defs))
@@ -19,7 +22,7 @@
     {:v (into #{} (concat (keys complete-edges) (vals complete-edges)))
      :e complete-edges}))

-(defn layout-graph [mx model root]
+(defn mx-layout [mx model root]
   (.beginUpdate model)
   (let [layout (mxOrganicLayout. mx)]
     (doto layout
@@ -28,47 +31,69 @@
       (.setEdgeLengthCostFactor 0.001)
       (.setEdgeDistanceCostFactor 6000)
       (.setEdgeCrossingCostFactor 6000)
-      (.setMaxIterations 1000)
+      (.setMaxIterations 2000)
       (.execute root)))
   (.endUpdate model))

+(defn mx-mkgc [g height width]
+  (let [mx (mxGraph.)
+        model (.getModel mx)
+        root (.getDefaultParent mx)]
+    (doto mx
+      (.setCellsDisconnectable false)
+      (.setCellsEditable false)
+      (.setCellsResizable false))
+    (.beginUpdate model)
+    (let [vs (:v g)
+          fmkv #(.insertVertex mx root nil % (rand-int width) (rand-int height) 0 0)
+          vmap (apply hash-map (interleave vs (map fmkv vs)))]
+      (doseq [[label cell] vmap]
+        (.setConnectable cell false)
+        (.cellLabelChanged mx cell label true))
+      (doseq [e (:e g)]
+        (.insertEdge mx root nil "" (vmap (key e)) (vmap (val e)))))
+    (.endUpdate model)
+    (mx-layout mx model root)
+    (let [gc (mxGraphComponent. mx)
+          bounds (.getGraphBounds mx)
+          view (.getView mx)]
+      (let [offset-x (+ 20 (- (.getX bounds)))
+            offset-y (+ 20 (- (.getY bounds)))]
+        (.setTranslate view (mxPoint. offset-x offset-y)))
+      (let [actual-height (.getHeight bounds)
+            actual-width (.getWidth bounds)
+            scale-factor (* 0.9 (min (/ width actual-width) (/ height actual-height)))]
+        (.setScale view scale-factor))
+      gc)))
+
+(defn mx-update [panel g height width button-panel]
+  (doto panel
+    (.removeAll)
+    (.add button-panel BorderLayout/SOUTH)
+    (.add (mx-mkgc g height width) BorderLayout/CENTER)))
+
 (defn -main [& args]
   (if (> (count args) 1)
     (println "Supply at most a single filtering prefix.")
     (let [prefix (first args)
+          button (JButton. "layout")
+          button-panel (JPanel.)
           g (graph (re-pattern (str prefix ".*")))
-          mx (mxGraph.)
-          model (.getModel mx)
-          root (.getDefaultParent mx)
+          panel (JPanel. (BorderLayout.))
+          width 1200
           height 1000
-          width 1200]
-      (doto mx
-        (.setCellsDisconnectable false)
-        (.setCellsEditable false)
-        (.setCellsResizable false))
-      (.beginUpdate model)
-      (let [vs (:v g)
-            fmkv #(.insertVertex mx root nil % (rand-int width) (rand-int height) 0 0)
-            vmap (apply hash-map (interleave vs (map fmkv vs)))]
-        (doseq [[label cell] vmap]
-          (.setConnectable cell false)
-          (.cellLabelChanged mx cell label true))
-        (doseq [e (:e g)]
-          (.insertEdge mx root nil "" (vmap (key e)) (vmap (val e)))))
-      (.endUpdate model)
-      (layout-graph mx model root)
-      (let [gc (mxGraphComponent. mx)
-            bounds (.getGraphBounds mx)
-            view (.getView mx)]
-        (let [offset-x (+ 20 (- (.getX bounds)))
-              offset-y (+ 20 (- (.getY bounds)))]
-          (.setTranslate view (mxPoint. offset-x offset-y)))
-        (let [actual-height (.getHeight bounds)
-              actual-width (.getWidth bounds)
-              scale-factor (* 0.9 (min (/ width actual-width) (/ height actual-height)))]
-          (.setScale view scale-factor))
-        (doto (JFrame. (str "defgraph" (if prefix (str " (" prefix ")") "")))
-          (.add gc)
-          (.setDefaultCloseOperation JFrame/EXIT_ON_CLOSE)
-          (.setSize width height)
-          (.setVisible true))))))
+          frame (JFrame. (str "defgraph" (if prefix (str " (" prefix ")") "")))]
+      (.add button-panel button)
+      (mx-update panel g height width button-panel)
+      (let [f #(do
+                      (.setVisible frame false)
+                      (doto panel
+                        (.removeAll)
+                        (mx-update g height width button-panel))
+                      (.setVisible frame true))]
+        (.addMouseListener button (proxy [MouseAdapter] [] (mousePressed [e] (f)))))
+      (doto frame
+        (.add panel)
+        (.setDefaultCloseOperation JFrame/EXIT_ON_CLOSE)
+        (.setSize width height)
+        (.setVisible true)))))


increase layout size

increase layout size

--- src/clojure/defgraph/core.clj
+++ src/clojure/defgraph/core.clj
@@ -27,8 +27,8 @@
           mx (mxGraph.)
           model (.getModel mx)
           root (.getDefaultParent mx)
-          height 700
-          width 700]
+          height 1000
+          width 1200]
       (doto mx
         (.setCellsDisconnectable false)
         (.setCellsEditable false)


Allow directly specifying resource IDs in resource-resolving functions

--- src/clojure/neko/resource.clj
+++ src/clojure/neko/resource.clj
@@ -18,14 +18,16 @@

 (defn- resource-symbol
   "Returns a symbol that represents a resource field specified by type
-  and name keywords."
+  and name keywords. If `name` is not a keyword, just returns it back."
   [type name]
-  (let [package (or (namespace name) package-name)
-        type    (clojure.core/name type)
-        name    (-> (clojure.core/name name)
-                    (string/replace \- \_)
-                    (string/replace \. \_))]
-    (symbol (str package ".R$" type "/" name))))
+  (if (not (keyword? name))
+    name
+    (let [package (or (namespace name) package-name)
+          type    (clojure.core/name type)
+          name    (-> (clojure.core/name name)
+                      (string/replace \- \_)
+                      (string/replace \. \_))]
+      (symbol (str package ".R$" type "/" name)))))

 (defmacro resolve-resource
   "Resolves the resource ID of a given type with the given name.  For example,
@@ -51,16 +53,14 @@
   If the name argument is an integer, it is assumed to be a valid resource ID
   and will be returned as is without any processing."
   [type name]
-  {:pre  [(keyword? type)
-          (keyword? name)]}
+  {:pre  [(keyword? type)]}
   (resource-symbol type name))

 (defmacro get-id
   "Finds the ID for the XML item with the given name.  This is simply a
   convenient way of calling (resolve-resource :id name)."
-  ([name]
-   {:pre [(keyword? name)]}
-   (resource-symbol :id name)))
+  [name]
+  (resource-symbol :id name))

 (defmacro get-string
   "Gets the localized string with the given ID or name from the context.
@@ -69,15 +69,12 @@
   If additional arguments are supplied, the string will be interpreted as a
   format and the arguments will be applied to the format."
   ([name]
-   {:pre [(keyword? name)]}
-   `(.getString context ~(resource-symbol :string name)))
+     `(.getString context ~(resource-symbol :string name)))
   ([name & args]
-  {:pre [(keyword? name)]}
-  `(.getString context ~(resource-symbol :string name) (to-array ~args))))
+     `(.getString context ~(resource-symbol :string name) (to-array ~args))))

 (defmacro get-layout
   "Finds the resource ID for the layout with the given name.  This is simply a
   convenient way of calling (resolve-resource context :layout name)."
   [name]
-  {:pre  [(keyword? name)]}
   (resource-symbol :layout name))