(PDB-4512) Make it possible to compile a query to a plan or sql

So that we'll be able to more easily test the drop-unused-joins
optimization, add compile-query, which is really just
compile-user-query->sql, but with an added target option that makes it
possible to request just the parameterized plan, rather than the final
sql.

--- src/puppetlabs/puppetdb/query_eng/engine.clj
+++ src/puppetlabs/puppetdb/query_eng/engine.clj
@@ -2541,11 +2541,14 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Public

-(defn compile-user-query->sql
-  "Given a user provided query and a Query instance, convert the
-   user provided query to SQL and extract the parameters, to be used
-   in a prepared statement"
-  [query-rec user-query & [{:keys [include_total] :as query-options}]]
+(defn compile-query
+  "Given a user provided query and a Query instance, converts the user
+  provided query to the requested target.  Current targets are
+  either :parameterized-plan or :sql.  For :sql, returns the SQL and
+  extracted parameters, to be used in a prepared statement.
+  For :parameterized-plan, returns the final plan and parameters that
+  would be used to generate the :sql result."
+  [query-rec user-query {:keys [include_total] :as query-options} target]
   ;; Call the query-rec so we can evaluate query-rec functions
   ;; which depend on the db connection type
   (let [allowed-fields (map keyword (queryable-fields query-rec))
@@ -2553,13 +2556,27 @@
                                 (paging/validate-order-by! allowed-fields)
                                 (paging/dealias-order-by query-rec))
         [query-rec user-query] (rewrite-fact-query query-rec user-query)
-        {:keys [plan params]} (->> user-query
-                                   (push-down-context query-rec)
-                                   expand-user-query
-                                   optimize-user-query
-                                   (convert-to-plan query-rec paging-options)
-                                   extract-all-params)
-        sql (plan->sql plan paging-options)
-        paged-sql (jdbc/paged-sql sql paging-options)]
-    (cond-> {:results-query (apply vector paged-sql params)}
-      include_total (assoc :count-query (apply vector (jdbc/count-sql sql) params)))))
+        parameterized-plan (->> user-query
+                                (push-down-context query-rec)
+                                expand-user-query
+                                optimize-user-query
+                                (convert-to-plan query-rec paging-options)
+                                extract-all-params)]
+    (case target
+      :parameterized-plan parameterized-plan
+      :sql (let [{:keys [plan params]} parameterized-plan
+                 sql (plan->sql plan paging-options)
+                 paged-sql (jdbc/paged-sql sql paging-options)]
+             (cond-> {:results-query (apply vector paged-sql params)}
+               include_total (assoc :count-query
+                                    (apply vector (jdbc/count-sql sql)
+                                           params)))))))
+
+(defn compile-user-query->sql
+  "Given a user provided query and a Query instance, convert the
+   user provided query to SQL and extract the parameters, to be used
+   in a prepared statement."
+  ([query-rec user-query]
+   (compile-query query-rec user-query {} :sql))
+  ([query-rec user-query query-options]
+   (compile-query query-rec user-query query-options :sql)))


Remove whitespaces on constants.

Remove whitespaces on constants.

--- frontend/src/uxbox/main/constants.cljs
+++ frontend/src/uxbox/main/constants.cljs
@@ -3,7 +3,6 @@
 ;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
 ;;
 ;; Copyright (c) 2015-2016 Andrey Antukh <niwi@niwi.nz>
-;; Copyright (c) 2015-2016 Juan de la Cruz <delacruzgarciajuan@gmail.com>

 (ns uxbox.main.constants)

@@ -18,5 +17,3 @@
 (def canvas-scroll-padding 50)
 (def canvas-start-scroll-x (- canvas-start-x canvas-scroll-padding))
 (def canvas-start-scroll-y (- canvas-start-y canvas-scroll-padding))
-
-


changing t to timer

changing t to timer

--- src/restaurant_inspections_api/cron/core.clj
+++ src/restaurant_inspections_api/cron/core.clj
@@ -21,10 +21,10 @@
   []
   (let [[hour min sec mili] chime-time]
     (log/info (str "Scheduling Load API Data to run at " hour ":" min ":" sec "." mili))
-    (chime-at (->> (periodic-seq (.. (t/now)
+    (chime-at (->> (periodic-seq (.. (timer/now)
                                      (withZone (DateTimeZone/forID "America/New_York"))
                                      (withTime hour min sec mili))           ; Scheduled to run every day at CHIME-TIME
-                                 (-> 1 t/days)))
+                                 (-> 1 timer/days)))
               (fn [time]
                 (log/info "Starting load data task" time)
                 (process-load-data!)))))


Fix logging and permission checking in notifs

--- src-cljs/frontend/notifs.cljs
+++ src-cljs/frontend/notifs.cljs
@@ -5,13 +5,13 @@

 (defn notifiable-browser [] (= (type (.-Notification js/window)) js/Function))

-(defn notifications-granted?  [] (= (.-permission js/Notification) "default"))
+(defn notifications-granted  [] (= (.-permission js/Notification) "granted"))

 ;; Gotta edit this to only happen when a user first toggles that switch
 ;; This should actually be a little function called n/notify  that simply constructs a notification out of optional keyword arguments! (should have multiple signatures so if you just pass 1 arg it become the title)
 (defn request-permission
   ([]
-   (request-permission (fn [result] (.log js/console "Notifications are now: " result))))
+   (request-permission (fn [result] (utils/mlog "Notifications are now: " result))))
   ([promise-fn]
      (-> js/Notification
                (.requestPermission)
@@ -46,6 +46,4 @@
                      "failed" {:icon (email-path "failed") :body "Looks like some tests failed."}
                      "infrastructure_fail" {:icon (email-path "failed") :body "Darn, something went wrong."}
                      {:icon (email-path "failed") :body "Whoops, no status inforamtion."})]
-    (notify (str project " #"build-num) (merge properties {:data build}))
-    (.log js/console (str build))
-    ))
+    (notify (str project " #"build-num) (merge properties {:data build}))))


Доработки и исправления во время разработки операций перемещения на рубеж и закрепления в комплект

--- src-cljs/ixinfestor/omut.cljs
+++ src-cljs/ixinfestor/omut.cljs
@@ -593,7 +593,7 @@
                     text-success
                     text-info
                     text-warning
-                    text-danger]} app]
+                    text-danger]} @app]
         (dom/div nil
                  (when text-muted
                    (dom/p #js {:className "text-muted"} text-muted))
@@ -619,6 +619,18 @@
                           :text-info
                           :text-warning
                           :text-danger))))
+
+(defn helper-p-clean-and-set!! [app k message]
+  (om/transact! app (fn [app]
+                      (-> app
+                          (dissoc :text-muted
+                                  :text-primary
+                                  :text-success
+                                  :text-info
+                                  :text-warning
+                                  :text-danger)
+                          (assoc k message)))))
+

 ;; END helper
 ;;..................................................................................................
@@ -678,6 +690,19 @@
                           :alert-warning
                           :alert-danger))))

+(defn alert-clean-and-set!! [app k message]
+  (om/transact! app
+                (fn [app]
+                  (-> app
+                      (dissoc :alert-muted
+                              :alert-primary
+                              :alert-success
+                              :alert-info
+                              :alert-warning
+                              :alert-danger)
+                      (assoc k message)))))
+
+
 ;; END alert
 ;;..................................................................................................

@@ -717,6 +742,15 @@
                           :has-success?
                           :has-warning?
                           :has-error?))))
+
+(defn input-css-string-has?-clean-and-set!! [app k]
+  (om/transact! app
+                (fn [app]
+                  (-> app
+                      (dissoc :has-success?
+                              :has-warning?
+                              :has-error?)
+                      (assoc k true)))))

 ;; END has
 ;;..................................................................................................
@@ -794,12 +828,13 @@
   (reify
     om/IRender
     (render [this]
-      (dom/div #js {:className (str "form-group " (input-css-string-has? app))}
-               (dom/label #js {:className label-class+ } label)
-               (dom/div #js {:className input-class+ :style #js {:padding 0}}
-                        (om/build input app {:opts spec-input})
-                        (om/build helper-p app {})
-                        )))))
+      (dom/div nil
+               (dom/div #js {:className (str "form-group " (input-css-string-has? app))}
+                        (dom/label #js {:className (str "control-label " label-class+) } label)
+                        (dom/div #js {:className input-class+ :style #js {:padding 0}}
+                                 (om/build input app {:opts spec-input})
+                                 (om/build helper-p app {})
+                                 ))))))

@@ -873,12 +908,13 @@
   (reify
     om/IRender
     (render [_]
-      (dom/div #js {:className (str "form-group " (input-css-string-has? app))}
-               (dom/label #js {:className label-class+ } label)
-               (dom/div #js {:className input-class+ :style #js {:padding 0}}
-                        (om/build select app {:opts spec-select})
-                        (om/build helper-p app {})
-                        )))))
+      (dom/div nil
+               (dom/div #js {:className (str "form-group " (input-css-string-has? app))}
+                        (dom/label #js {:className (str "control-label " label-class+) } label)
+                        (dom/div #js {:className input-class+ :style #js {:padding 0}}
+                                 (om/build select app {:opts spec-select})
+                                 (om/build helper-p app {})
+                                 ))))))

 ;; END input select
@@ -945,11 +981,12 @@
   (reify
     om/IRender
     (render [this]
-      (dom/div #js {:className (str "form-group " (input-css-string-has? app))}
-               (dom/label #js {:className label-class+ } label)
-               (dom/div #js {:className input-class+ :style #js {:padding 0}}
-                        (om/build input-change-password app {:opts spec-input})
-                        )))))
+      (dom/div nil
+               (dom/div #js {:className (str "form-group " (input-css-string-has? app))}
+                        (dom/label #js {:className (str "control-label " label-class+) } label)
+                        (dom/div #js {:className input-class+ :style #js {:padding 0}}
+                                 (om/build input-change-password app {:opts spec-input})
+                                 ))))))

 ;; END Input password
 ;;..................................................................................................
@@ -1020,11 +1057,12 @@
   (reify
     om/IRender
     (render [this]
-      (dom/div #js {:className (str "form-group " (input-css-string-has? app))}
-               (dom/label #js {:className label-class+ } label)
-               (dom/div #js {:className input-class+ :style #js {:padding 0}}
-                        (om/build textarea app {:opts spec-textarea})
-                        (om/build helper-p app {}) )))))
+      (dom/div nil
+               (dom/div #js {:className (str "form-group " (input-css-string-has? app))}
+                        (dom/label #js {:className (str "control-label " label-class+) } label)
+                        (dom/div #js {:className input-class+ :style #js {:padding 0}}
+                                 (om/build textarea app {:opts spec-textarea})
+                                 (om/build helper-p app {}) ))))))

 ;; END textarea
@@ -1072,11 +1110,12 @@
   (reify
     om/IRender
     (render [this]
-      (dom/div #js {:className (str "form-group " (input-css-string-has? app))}
-               (dom/label #js {:className label-class+ } label)
-               (dom/div #js {:className input-class+ :style #js {:padding 0}}
-                        (om/build toggle-button app {:opts spec-toggle-button})
-                        (om/build helper-p app {}) )))))
+      (dom/div nil
+               (dom/div #js {:className (str "form-group " (input-css-string-has? app))}
+                        (dom/label #js {:className (str "control-label " label-class+) } label)
+                        (dom/div #js {:className input-class+ :style #js {:padding 0}}
+                                 (om/build toggle-button app {:opts spec-toggle-button})
+                                 (om/build helper-p app {}) ))))))

 ;; END toggle batton
 ;;..................................................................................................
@@ -2351,6 +2390,9 @@
 (defn input-form-search-view-get-selected [app]
   (:sel app))

+(defn input-form-search-view-clean [app]
+  (assoc app :sel []))
+

 (defn input-from-search-view [search-view
                               {:keys [label-one
@@ -2405,20 +2447,24 @@
                        :text ui-type--add-button--text })

            :input-select
-           (dom/div #js {:className (str "form-group " class+ " "(input-css-string-has? app))}
+           (dom/div #js {:className (str "form-group " class+ " "(input-css-string-has? @app))}
                     (dom/label #js {:className "control-label col-sm-3 col-md-2 col-lg-1"} ({:one label-one :multi label-multi} selection-type))

                     (condp = selection-type

-                      :one (dom/div #js {:className "input-group col-sm-9 col-md-10 col-lg-11"}
-                                    (dom/input #js {:value (get-in @app [:sel 0 :keyname])
-                                                    :placeholder placeholder
-                                                    :className "form-control"})
-                                    (dom/span #js {:className "input-group-btn"}
-                                              (ui-button {:type :default
-                                                          :on-click #(modal-show (:modal app))
-                                                          :text (dom/span #js {:className "glyphicon glyphicon-list-alt"
-                                                                               :aria-hidden "true"})})))
+                      :one
+                      (dom/div
+                       #js {:className "col-sm-9 col-md-10 col-lg-11" :style #js {:padding 0}}
+                       (dom/div #js {:className "input-group"}
+                                (dom/input #js {:value (get-in @app [:sel 0 :keyname])
+                                                :placeholder placeholder
+                                                :className "form-control"})
+                                (dom/span #js {:className "input-group-btn"}
+                                          (ui-button {:type :default
+                                                      :on-click #(modal-show (:modal app))
+                                                      :text (dom/span #js {:className "glyphicon glyphicon-list-alt"
+                                                                           :aria-hidden "true"})})))
+                       (om/build helper-p app))

                       :multi
                       (dom/div
@@ -2432,7 +2478,9 @@
                                                :warning "panel-warning"
                                                :danger  "panel-danger"}
                                               ui-type--add-button--type))}
-                        (dom/div #js {:className "panel-heading"} (dom/b nil "Выбрано (" (count (@app :sel)) ")"))
+                        (dom/div #js {:className "panel-heading"}
+                                 (dom/b nil "Выбрано (" (count (@app :sel)) ")")
+                                 (om/build helper-p app))
                         (dom/div #js {:className "panel-body" :style #js {:padding 2}}
                                  (ui-table
                                   {:hover? true
@@ -2486,8 +2534,6 @@

            (str "непонятный тип отображения: " ui-type))

-         (om/build helper-p app)
-

          (om/build modal (:modal app)
                    {:opts {:body (om/build search-view (get-in app [:modal :search-view])


Problem added - Intro to iterate

Problem added - Intro to iterate


Whitespace

Whitespace

--- src/grimoire/api/fs/read.clj
+++ src/grimoire/api/fs/read.clj
@@ -68,11 +68,11 @@
         currentv (thing->version thing)               ; version handle
         current  (normalize-version (:name currentv)) ; version string
         added    (-> config
-                     (api/read-meta thing)
-                     (get :added "0.0.0")
-                     normalize-version)               ; version string
+                   (api/read-meta thing)
+                   (get :added "0.0.0")
+                   normalize-version)               ; version string
         versions (->> (:parent currentv)
-                      (api/list-versions config))
+                   (api/list-versions config))
         unv-path (thing->relative-path :version thing)]
     (for [v     versions
           :when (<= 0 (semver/version-compare (:name v) added))
@@ -108,9 +108,9 @@
         handle (thing->meta-handle config thing)]
     (when (.exists handle) ;; guard against missing files
       (-> handle
-          slurp
-          (string/replace #"#<.*?>" "nil") ;; FIXME: Hack to ignore unreadable #<>s
-          edn/read-string))))
+        slurp
+        (string/replace #"#<.*?>" "nil") ;; FIXME: Hack to ignore unreadable #<>s
+        edn/read-string))))

 (defmethod api/read-related :filesystem [config thing]
   ;; FIXME: This assumes the old Grimoire 0.3.X related file format,
@@ -127,5 +127,5 @@
           line  (line-seq (io/reader h))
           :let  [sym (read-string line)]]
       (-> current-version
-          (->Ns  (namespace sym))
-          (->Def (name sym))))))
+        (->Ns  (namespace sym))
+        (->Def (name sym))))))


Api: Fix `update-document!' clearing document-date on update.

--- src-cljs/pepa/api.cljs
+++ src-cljs/pepa/api.cljs
@@ -208,9 +208,7 @@
           title (when-not (= (:title document)
                              (:title server))
                   (:title document))
-          date (when-not (= (:document-date document)
-                            (:document-date server))
-                 (:document-date document))
+          date (:document-date document)
           tags {:added   (remove (set (:tags server))   (:tags document))
                 :removed (remove (set (:tags document)) (:tags server))}
           pages (if-not (= (:pages document)


improve lexical complement filtering

improve lexical complement filtering

--- src/babel/forest.cljc
+++ src/babel/forest.cljc
@@ -200,25 +200,15 @@
           (if (not (nil? semantics))
             (if (not (nil? semantics)) (log/trace (str "  with semantics:" (strip-refs semantics))))))
         (log/trace (str " immediate parent:" (get-in immediate-parent [:rule])))
-        (let [shuffled-candidate-lexical-complements complement-candidate-lexemes
-              complement-pre-check (fn [child parent path-to-child]
-                                     (and (not (fail?
-                                                (unifyc (get-in child [:synsem :cat] :top)
-                                                        (get-in path-to-child [:synsem :cat] :top))))
-                                          (not (fail?
-                                                (unifyc (get-in child [:synsem :subcat :1 :cat] :top)
-                                                        (get-in path-to-child [:synsem :subcat :1 :cat] :top))))
-                                          (not (fail?
-                                                (unifyc (get-in child [:synsem :subcat :2 :cat] :top)
-                                                        (get-in path-to-child [:synsem :subcat :2 :cat] :top))))
-                                          (not (fail?
-                                                (unifyc (get-in child [:synsem :sem :pred] :top)
-                                                        (get-in path-to-child [:synsem :sem :pred] :top))))))
-              filtered-lexical-complements
-              (filter (fn [lexeme]
-                        (complement-pre-check lexeme bolt path))
-                      shuffled-candidate-lexical-complements)
-              debug (log/trace (str "shuffled size: " (count shuffled-candidate-lexical-complements)))
+        (let [complement-pre-check (fn [child parent path-to-child]
+                                     (let [child-in-bolt (get-in bolt path-to-child)]
+                                       (and (not (fail?
+                                                  (unifyc (get-in child [:synsem] :top)
+                                                          (get-in child-in-bolt [:synsem] :top)))))))
+              filtered-lexical-complements (filter (fn [lexeme]
+                                                     (complement-pre-check lexeme bolt path))
+                                                   complement-candidate-lexemes)
+              debug (log/trace (str "pre-filtered size: " (count complement-candidate-lexemes)))
               debug (log/trace (str "filtered size: " (count filtered-lexical-complements)))
               shuffled-candidate-lexical-complements (lazy-shuffle filtered-lexical-complements)

@@ -226,21 +216,18 @@
               (filter (fn [result]
                         (not (fail? result)))
                       (map (fn [complement]
-                             (let [debug
-                                   (if (or true (= (morph bolt) "alzarsi"))
-                                     (log/debug (str "add complement ["
-                                                     (get-in bolt [:rule]) " "
-                                                     (morph bolt) "]: trying lexical complement:" (morph complement)
-                                                     )))
+                             (let [debug (log/debug (str "add complement ["
+                                                         (get-in bolt [:rule]) " "
+                                                         (morph bolt) "]: trying lexical complement:" (morph complement)))
                                    result
                                    (unify (copy bolt)
                                           (path-to-map path
                                                         (copy complement)))
                                    is-fail? (fail? result)]
                                (if is-fail?
-                                 (do
-                                   (log/debug (str "fail-path-between(bolt=val1/comp=val2):" (fail-path-between (strip-refs (get-in bolt path))
-                                                                                (strip-refs complement)))))
+                                 (let [fail-path (fail-path-between (strip-refs (get-in bolt path))
+                                                                    (strip-refs complement))]
+                                   (log/debug (str "fail-path-between(bolt=val1/comp=val2):" fail-path)))
                                  (log/debug (str "Success: returning: " (morph result))))

                                (if is-fail? :fail result)))


core.async: Make `the-sentynil-value` private.

--- test/com/nomistech/clojure_the_language/core_async_mapping_etc_test.clj
+++ test/com/nomistech/clojure_the_language/core_async_mapping_etc_test.clj
@@ -130,7 +130,7 @@

 ;;;; You can replace nil with a sentinel value, like this:

-(def the-sentynil-value
+(def ^:private the-sentynil-value
   "A sentinel value that is put on channels instead of nil."
   ::sentynil)


Temporary comment string related code.

Temporary comment string related code.

--- src/bytebuf/spec.cljx
+++ src/bytebuf/spec.cljx
@@ -295,51 +295,51 @@
       (buffer/write-bytes buff pos size value)
       size)))

-(defn string
-  "Fixed size string type spec constructor."
-  [^long size]
-  (reify
-    IStaticSize
-    (size [_] size)
-
-    ISpec
-    (read [_ buff pos]
-      (let [rawdata (buffer/read-bytes buff pos size)
-            length  (- size (bytes/zeropad-count rawdata))
-            data (String. rawdata 0 length "UTF-8")]
-        [size data]))
-
-    (write [_ buff pos value]
-      (let [input (.getBytes value "UTF-8")
-            length (count input)
-            tmpbuf (byte-array size)]
-        (if (< length size)
-          (System/arraycopy input 0 tmpbuf 0 length)
-          (System/arraycopy input 0 tmpbuf 0 size))
-
-        (when (< length size)
-          (bytes/zeropad! tmpbuf length))
-
-        (buffer/write-bytes buff pos size tmpbuf)
-        size))))
-
-(defn string*
-  "Arbitrary length string type spec constructor."
-  []
-  (reify
-    ISpec
-    (read [_ buff pos]
-      (let [datasize (buffer/read-int buff pos)
-            data (buffer/read-bytes buff (+ pos 4) datasize)
-            data (String. data 0 datasize "UTF-8")]
-        [(+ datasize 4) data]))
-
-    (write [_ buff pos value]
-      (let [input (.getBytes value "UTF-8")
-            length (count input)]
-        (buffer/write-int buff pos length)
-        (buffer/write-bytes buff (+ pos 4) length input)
-        (+ length 4)))))
+;; (defn string
+;;   "Fixed size string type spec constructor."
+;;   [^long size]
+;;   (reify
+;;     IStaticSize
+;;     (size [_] size)
+
+;;     ISpec
+;;     (read [_ buff pos]
+;;       (let [rawdata (buffer/read-bytes buff pos size)
+;;             length  (- size (bytes/zeropad-count rawdata))
+;;             data (String. rawdata 0 length "UTF-8")]
+;;         [size data]))
+
+;;     (write [_ buff pos value]
+;;       (let [input (.getBytes value "UTF-8")
+;;             length (count input)
+;;             tmpbuf (byte-array size)]
+;;         (if (< length size)
+;;           (System/arraycopy input 0 tmpbuf 0 length)
+;;           (System/arraycopy input 0 tmpbuf 0 size))
+
+;;         (when (< length size)
+;;           (bytes/zeropad! tmpbuf length))
+
+;;         (buffer/write-bytes buff pos size tmpbuf)
+;;         size))))
+
+;; (defn string*
+;;   "Arbitrary length string type spec constructor."
+;;   []
+;;   (reify
+;;     ISpec
+;;     (read [_ buff pos]
+;;       (let [datasize (buffer/read-int buff pos)
+;;             data (buffer/read-bytes buff (+ pos 4) datasize)
+;;             data (String. data 0 datasize "UTF-8")]
+;;         [(+ datasize 4) data]))
+
+;;     (write [_ buff pos value]
+;;       (let [input (.getBytes value "UTF-8")
+;;             length (count input)]
+;;         (buffer/write-int buff pos length)
+;;         (buffer/write-bytes buff (+ pos 4) length input)
+;;         (+ length 4)))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Types Alias


Smaller puzzles are solved. Not sure shortest path is found


renaming

renaming

--- src/adventofcode1/twentyfour.clj
+++ src/adventofcode1/twentyfour.clj
@@ -216,11 +216,11 @@
        (recur found board row start-col (inc end-col))))))

-(s/fdef maybe-split-horizontal-path
+(s/fdef split-horizontal-path-at
         :args (s/cat :board ::board :path ::path)
         :ret  (s/coll-of ::path))

-(defn maybe-split-horizontal-path
+(defn split-horizontal-path-at
   [board path]
   (assert (= (first (:from path))
              (first (:to   path)))
@@ -236,12 +236,12 @@
          (range (second (:from path))(inc (second (:to path)))))))

-(s/fdef maybe-split-vertical-path
+(s/fdef split-vertical-path-at
         :args (s/cat :board ::board :path ::path)
         :ret  (s/coll-of ::path))

-(defn maybe-split-vertical-path
+(defn split-vertical-path-at
   [board path]
   (assert (= (second (:from path))
              (second (:to   path)))


Add grade and double-spaced to tactile books

--- src/catalog/vubis.clj
+++ src/catalog/vubis.clj
@@ -278,7 +278,10 @@
                        :braille-grade (braille-music-grade-raw-to-braille-grade braille-music-grade)
                        :volumes (parse-int volumes)
                        :accompanying-material accompanying-material))
-      :taktilesbuch item
+      :taktilesbuch (-> item
+                        (assoc-some
+                         :braille-grade (braille-grade-raw-to-braille-grade braille-grade)
+                         :double-spaced? double-spaced?))
       ; default case that shouldn't really happen. When the MARC21
       ; entry contains a faulty format then just return the item with
       ; the faulty format. The validation will filter the item out.


Use the publish date in millisconds to filter out posts for pagination but use the modified value for sorting to move unseen items to the top.

--- src/oc/storage/db/common.clj
+++ src/oc/storage/db/common.clj
@@ -105,6 +105,7 @@
                                 sort-value-base)]
                 {;; Date of the last added comment on this entry
                  :last-activity-at last-activity-at
+                 :publish-time sort-value-base
                  :sort-value sort-value
                  :unseen unseen-with-cap?
                 })))
@@ -115,9 +116,9 @@
                      (r/or (r/not unseen)
                            (r/default (r/get-field row :unseen) false))
                      (r/or (r/and (= direction :before)
-                                  (r/gt start (r/get-field row :sort-value)))
+                                  (r/gt start (r/get-field row :publish-time)))
                            (r/and (= direction :after)
-                                  (r/le start (r/get-field row :sort-value)))))))
+                                  (r/le start (r/get-field row :publish-time)))))))
             ;; Merge in all the interactions
             (if-not count
               (r/merge query (r/fn [post-row]
@@ -333,7 +334,11 @@
                                    (r/to-epoch-time)
                                    (r/mul 1000)
                                    (r/round)))
-              last-activity-ms (-> last-activity-at (r/iso8601) (r/to-epoch-time) (r/mul 1000) (r/round))
+              last-activity-ms (-> last-activity-at
+                                (r/iso8601)
+                                (r/to-epoch-time)
+                                (r/mul 1000)
+                                (r/round))
               unseen-entry? (r/or (r/not has-seen-at?)
                                   (r/gt published-ms container-seen-ms))
               unseen-cap-ms (-> (r/now) (r/to-epoch-time) (r/mul 1000) (r/round) (r/sub unseen-cap-ms))
@@ -352,6 +357,7 @@
            :comments-count (r/count interactions-base)
            :sort-value sort-value
            :unseen unseen-entry?
+           :last-activity-ms last-activity-ms
            ; :reply-authors (-> interactions-base
            ;                 (r/coerce-to :array)
            ;                 (r/map (r/fn [inter] (r/get-field inter [:author :user-id])))
@@ -377,9 +383,9 @@
                ;  r/not)
                ;; All records after/before the start
                (r/or (r/and (= direction :before)
-                            (r/gt start (r/get-field row :sort-value)))
+                            (r/gt start (r/get-field row :last-activity-ms)))
                      (r/and (= direction :after)
-                            (r/le start (r/get-field row :sort-value))))
+                            (r/le start (r/get-field row :last-activity-ms))))
                ;; Filter on the user's visibility map:
                (r/or ;; has :follow true
                      (-> row


faster and/or if composed of simple boolean expressions. functions that a have a series of tests like nth, get, etc. are significantly faster as we no longer have JS functions wrapped around the test expression.

--- src/clj/cljs/core.clj
+++ src/clj/cljs/core.clj
@@ -32,7 +32,8 @@
                             bit-test bit-shift-left bit-shift-right bit-xor

                             cond-> cond->> as-> some-> some->>])
-  (:require clojure.walk))
+  (:require clojure.walk)
+  (:require cljs.compiler))

 (alias 'core 'clojure.core)

@@ -193,6 +194,11 @@
 (defn bool-expr [e]
   (vary-meta e assoc :tag 'boolean))

+(defn simple-bool-expr? [ast]
+  (core/and
+    (#{:var :invoke :constant :dot} (:op ast))
+    (= (cljs.compiler/infer-tag ast) 'boolean)))
+
 (defmacro and
   "Evaluates exprs one at a time, from left to right. If a form
   returns logical false (nil or false), and returns that value and
@@ -201,8 +207,15 @@
   ([] true)
   ([x] x)
   ([x & next]
-   `(let [and# ~x]
-      (if and# (and ~@next) and#))))
+    (let [forms (concat [x] next)]
+      (if (every? simple-bool-expr?
+            (map #(cljs.analyzer/analyze &env %) forms))
+        (let [and-str (->> (repeat (count forms) "~{}")
+                        (interpose " && ")
+                        (apply core/str))]
+          (bool-expr `(~'js* ~and-str ~@forms)))
+        `(let [and# ~x]
+           (if and# (and ~@next) and#))))))

 (defmacro or
   "Evaluates exprs one at a time, from left to right. If a form
@@ -212,8 +225,15 @@
   ([] nil)
   ([x] x)
   ([x & next]
-      `(let [or# ~x]
-         (if or# or# (or ~@next)))))
+    (let [forms (concat [x] next)]
+      (if (every? simple-bool-expr?
+            (map #(cljs.analyzer/analyze &env %) forms))
+        (let [or-str (->> (repeat (count forms) "~{}")
+                        (interpose " || ")
+                        (apply core/str))]
+          (bool-expr `(~'js* ~or-str ~@forms)))
+        `(let [or# ~x]
+           (if or# or# (or ~@next)))))))

 (defmacro nil? [x]
   `(coercive-= ~x nil))
@@ -925,14 +945,15 @@
                        (core/str "-cljs$lang$protocol_mask$partition" part "$"))]
       `(let [~xsym ~x]
          (if ~xsym
-           (if (or ~(if bit `(unsafe-bit-and (. ~xsym ~msym) ~bit))
-                 ~(bool-expr `(. ~xsym ~(symbol (core/str "-" prefix)))))
-             true
-             ~(if check-native
-                `(if (coercive-not (. ~xsym ~msym))
-                   (cljs.core/type_satisfies_ ~psym ~xsym)
-                   false)
-                false))
+           (let [bit# ~(if bit `(unsafe-bit-and (. ~xsym ~msym) ~bit))]
+             (if (or bit#
+                     ~(bool-expr `(. ~xsym ~(symbol (core/str "-" prefix)))))
+               true
+               ~(if check-native
+                  `(if (coercive-not (. ~xsym ~msym))
+                     (cljs.core/type_satisfies_ ~psym ~xsym)
+                     false)
+                  false)))
            ~(if check-native
               `(cljs.core/type_satisfies_ ~psym ~xsym)
               false))))))


change `cljs.test/run-tests` so providing the environment is optional

--- src/clj/cljs/test.clj
+++ src/clj/cljs/test.clj
@@ -226,19 +226,28 @@
 ;; =============================================================================
 ;; Running Tests

+(defn ns? [x]
+  (and (seq? x) (= (first x) 'quote)))
+
 (defmacro run-tests
   "Runs all tests in the given namespaces; prints results.
   Defaults to current namespace if none given.  Returns a map
   summarizing test results."
   ([] `(run-tests (cljs.test/empty-env) '~ana/*cljs-ns*))
-  ([env] `(run-tests ~env '~ana/*cljs-ns*))
-  ([env & namespaces]
+  ([env-or-ns]
+   (if (ns? env-or-ns)
+     `(run-tests (cljs.test/empty-env) ~env-or-ns)
+     `(run-tests ~env-or-ns '~ana/*cljs-ns*)))
+  ([env-or-ns & namespaces]
    (assert (every?
              (fn [[quote ns]] (and (= quote 'quote) (symbol? ns)))
              namespaces)
      "All arguments to run-tests must be quoted symbols")
-   (let [env-sym (gensym "env")]
-     `(let [~env-sym (assoc ~env :return true)
+   (let [is-ns (ns? env-or-ns)
+         env-sym (gensym "env")]
+     `(let [~env-sym ~(if is-ns
+                        `(assoc (cljs.test/empty-env) :return true)
+                        `(assoc ~env-or-ns :return true))
             summary# (reduce
                        (fn [acc# res#]
                          (merge-with +
@@ -248,7 +257,9 @@
                        [~@(map
                             (fn [ns]
                               `(cljs.test/test-ns ~env-sym ~ns))
-                            namespaces)])]
+                            (if is-ns
+                              (concat [env-or-ns] namespaces)
+                              namespaces))])]
         (do-report ~env-sym
           (assoc summary# :type :summary))
         summary#))))


proper fix for stolen agenda duplication

--- src/clj/game/core.clj
+++ src/clj/game/core.clj
@@ -91,9 +91,10 @@
     (if-let [h (get-card state host)]
       (let [[head tail] (split-with #(not= (:cid %) cid) (:hosted h))]
         (update! state side (assoc h :hosted (vec (concat head [card] (rest tail))))))
-      (let [z (cons side zone)
+      (let [z (cons (to-keyword (:side card)) zone)
             [head tail] (split-with #(not= (:cid %) cid) (get-in @state z))]
-        (swap! state assoc-in z (vec (concat head [card] (rest tail))))))))
+        (when-not (empty? tail)
+          (swap! state assoc-in z (vec (concat head [card] (rest tail)))))))))

 (defn move-zone [state side server to]
   (let [from-zone (cons side (if (sequential? server) server [server]))


Fix batch sending

Fix batch sending

--- src/onyx/metrics/riemann.clj
+++ src/onyx/metrics/riemann.clj
@@ -42,7 +42,7 @@
           timeout-count (atom 0)]

       (while (not (Thread/interrupted))
-        (let [events (first (map metric->riemann-event (read-batch ch batch-size batch-timeout)))]
+        (let [events (map metric->riemann-event (read-batch ch batch-size batch-timeout))]
           (when-not (empty? events)
             (loop [sleep 0]
               ;; Exponential backoff to rate limit errors
@@ -52,7 +52,7 @@

               (let [result (try
                              (-> client
-                                 (r/send-event events)
+                                 (r/send-events events)
                                  (deref defaulted-timeout ::timeout))
                              (catch InterruptedException e
                                ;; Intentionally pass.


dissociate :seen from cards returned from Archives to HQ or R&D

--- src/clj/game/core.clj
+++ src/clj/game/core.clj
@@ -248,7 +248,9 @@
                             (not (:facedown c))))
                  (desactivate state side c) c)
              c (if (= dest [:rig :facedown])(assoc c :facedown true) (dissoc c :facedown))
-             moved-card (assoc c :zone dest :host nil :hosted nil :previous-zone (:zone c))]
+             moved-card (assoc c :zone dest :host nil :hosted nil :previous-zone (:zone c))
+             moved-card (if (and (= side :corp) (#{:hand :deck} (first dest)))
+                          (dissoc moved-card :seen) moved-card)]
          (if front
            (swap! state update-in (cons side dest) #(cons moved-card (vec %)))
            (swap! state update-in (cons side dest) #(conj (vec %) moved-card)))


remove unused namespaces

remove unused namespaces

--- src/open_company/lib/bot.clj
+++ src/open_company/lib/bot.clj
@@ -1,8 +1,6 @@
 (ns open-company.lib.bot
   (:require [amazonica.aws.sqs :as sqs]
             [environ.core :as e]
-            [manifold.deferred :as d]
-            [aleph.http :as http]
             [medley.core :as med]
             [clojure.string :as string]
             [schema.core :as s]))


don't trigger :leave-play for hosted but no installed cards

--- src/clj/game/core.clj
+++ src/clj/game/core.clj
@@ -91,7 +91,9 @@
          c (if (= (:side c) "Runner") (dissoc c :installed :counter :rec-counter :pump) c)
          c (if keep-counter c (dissoc c :counter :rec-counter :advance-counter))]
      (when-let [leave-effect (:leave-play (card-def card))]
-       (when (or (= (:side card) "Runner") (:rezzed card) (= (first (:zone card)) :current))
+       (when (or (and (= (:side card) "Runner") (:installed card))
+                 (:rezzed card)
+                 (= (first (:zone card)) :current))
          (leave-effect state side card nil)))
      (when-let [prevent (:prevent (card-def card))]
        (doseq [[ptype pvec] prevent]


removed events registration from ws data

--- src/clj/game/main.clj
+++ src/clj/game/main.clj
@@ -60,7 +60,7 @@
                                 #(conj % {:user "__system__" :text text}))
           "quit" (system-msg state (keyword side) "left the game"))
         (if (#{"start" "do"} action)
-          (.send socket (generate-string (assoc @(@game-states gameid) :action action)))
+          (.send socket (generate-string (assoc (dissoc @(@game-states gameid) :events) :action action)))
           (.send socket (generate-string "ok")))
         (catch Exception e
           (println "Error " action command (get-in args [:card :title]) e)


removed unnecessary code

removed unnecessary code

--- src/clj/weba/util.clj
+++ src/clj/weba/util.clj
@@ -121,27 +121,18 @@
     cheshire/parse-string
     keywordize-keys))

-(defn uusin-muokkausaika
+(defn newest-lastmodified
   "Returns the last modified time stamp from the given values.
    Polut are get-in style key-paths which define the route to the location of the last modified time stamp."
-  [arvot & polut]
-  (let [muokkausajat (flatten
-                       (for [arvo arvot
-                             polku polut]
-                         (get-in-list arvo polku)))]
-    (reduce max-date (time/date-time 1970 1 1 0 0 1) muokkausajat))))
+  [values & paths]
+  (let [lastmodifieds (flatten
+                        (for [value values
+                              path paths]
+                          (get-in-list value path)))]
+    (reduce max-date (time/date-time 1970 1 1 0 0 1) lastmodifieds))))

 (t/ann ^:no-check clojure.string/lower-case [String -> String])
-(t/ann sisaltaako-kentat? (t/All [k]
-                            [(t/Map k t/Any) (t/Coll k) String -> Boolean]))
-(defn sisaltaako-kentat?
-  "Predikaatti joka palauttaa true, jos annettujen kenttien sisältö sisältää annetun termin. Kirjainkoolla ei ole väliä.
-   Kenttien sisältö konkatenoidaan yhteen välilyönnillä erotettuna."
-  [entity kentat termi]
-  (let [termi (string/lower-case termi)
-        kenttien-sisallot (t/for [kentta :- k kentat] (entity kentta))
-        sisalto (string/lower-case (string/join " " kenttien-sisallot))]
-    (.contains sisalto termi)))
+

 (t/tc-ignore


Try to generate a non-trivial stack with some heap refs, and sleep in leaf.

--- src/org/scode/httpgctest.clj
+++ src/org/scode/httpgctest.clj
@@ -8,9 +8,16 @@
                     FileInputStream
                     File)))

+(defn gen-recursive-garbage [lvl garbage]
+  (if (> 0 lvl)
+    (gen-recursive-garbage (dec lvl) {:some-nice-garbage [1 2 3 4 5 6 7 8 9 10]})
+    (do
+      (Thread/sleep (rand 1000))
+      garbage)))
+
 (defn serve-gengarbage [request]
   (do
-    (Thread/sleep (rand 1000))
+    (gen-recursive-garbage 50 [])
     {:status 200
      :headers {}
      :body "Garbage all around."}))


Add zipper-seq helper fn

Add zipper-seq helper fn

--- src/overtone/helpers/seq.clj
+++ src/overtone/helpers/seq.clj
@@ -1,7 +1,8 @@
 (ns
     ^{:doc "Helper functions for manipulating and testing sequences"
       :author "Sam Aaron"}
-  overtone.helpers.seq)
+  overtone.helpers.seq
+  (:require [clojure.zip :as zip]))

 (defn consecutive-ints?
   "Checks whether seq s consists of consecutive integers
@@ -42,3 +43,11 @@
   "Finds first element of seq s for which pred returns true"
   [pred s]
   (first (filter pred s)))
+
+(defn zipper-seq
+  "Returns a lazy sequence of a depth-first traversal of zipper z"
+  [z]
+  (lazy-seq
+    (if (zip/end? z)
+      nil
+      (cons (zip/node z) (zipper-seq (zip/next z))))))


removed leftover code

removed leftover code

--- src/integration/clojure/com/xebia/visualreview/itest/project_test.clj
+++ src/integration/clojure/com/xebia/visualreview/itest/project_test.clj
@@ -17,15 +17,9 @@
 (ns com.xebia.visualreview.itest.project-test
   (:require [clojure.test :refer :all]
             [com.xebia.visualreview.mock :as mock]
-            [taoensso.timbre :as timbre]
             [com.xebia.visualreview.project :as project]
             [com.xebia.visualreview.persistence :as p]))

-(timbre/set-level! :debug)
-;
-;(background
-;  (before :facts (mock/setup-db))
-;  (around :facts (mock/rebind-db-spec ?form)))
 (use-fixtures :each mock/rebind-db-spec-fixture mock/setup-db-fixture)

 (deftest project-service-store


An attempt to fix a CI-specific failure

An attempt to fix a CI-specific failure

A guard is OK here because the test is concerned with DROP TABLE
more than CREATE TABLE (exercised in a lot of other tests).

--- test/clojurewerkz/cassaforte/schema_test.clj
+++ test/clojurewerkz/cassaforte/schema_test.clj
@@ -58,7 +58,8 @@
                   (column-definitions {:name        :varchar
                                        :title       :varchar
                                        :birth_date  :timestamp
-                                       :primary-key [:name]}))
+                                       :primary-key [:name]})
+                  (if-not-exists))

     (let [td      (describe-table s "new_cql_keyspace" "people")
           columns (describe-columns s "new_cql_keyspace" "people")]


CMR-3812: Added acl checks to subsequent facets searches.

--- search-app/src/cmr/search/services/query_execution.clj
+++ search-app/src/cmr/search/services/query_execution.clj
@@ -141,8 +141,7 @@
                   (facet-condition-resolver/adjust-facet-query field)
                   (assoc :result-features [:facets-v2])
                   (assoc :facet-fields [field])
-                  (assoc :page-size 0)
-                  (assoc :skip-acls? true))]
+                  (assoc :page-size 0))]
     (common-qe/execute-query context query)))

 (defn- merge-facets


Step 8-4: Player eats logos

Step 8-4: Player eats logos

--- desktop/src-common/brain_gain_or_drain/screens/game.clj
+++ desktop/src-common/brain_gain_or_drain/screens/game.clj
@@ -35,18 +35,22 @@
              })
     [(take 20 (sprite-generator {:type :logo :z 2} (width screen) (height screen)))
      (take 15 (sprite-generator {:type :logo :z 1} (width screen) (height screen)))
-     (take 10 (sprite-generator {:type :logo :z 0} (width screen) (height screen)))])
+     (take 10 (sprite-generator {:type :logo :z 0} (width screen) (height screen)))
+     {:type :player :x 32 :y 100 :z 0}])

   :on-render
   (fn [screen entities]
     (clear!)
-    (letfn [(recreate-entity-on-screen [entity]
-              (recreate-entity entity (width screen) (height screen)))]
-      (->> entities
-           (bind-entities (:resources screen))
-           (move-entities (:delta-time screen) (game-input!))
-           (when-entity gone? recreate-entity-on-screen)
-           (render! screen))))
+    (let [entities (bind-entities (:resources screen) entities)
+          player (first (filter player? entities))
+          eaten-by-player? (partial eaten-by? player)]
+      (letfn [(recreate-entity-on-screen [entity]
+                (recreate-entity entity (width screen) (height screen)))]
+        (->> entities
+             (move-entities (:delta-time screen) (game-input!))
+             (when-entity gone? recreate-entity-on-screen)
+             (when-entity eaten-by-player? recreate-entity-on-screen)
+             (render! screen)))))

   :on-resize
   (fn [screen entities]


reorder feature boxes.

reorder feature boxes.

--- src/circleci/web/views/index.clj
+++ src/circleci/web/views/index.clj
@@ -19,11 +19,11 @@
     [:div#content
      [:div#main_content_wide.left
       [:div.box_medium.feature.separator_r
-       [:img {:src "img/icon_feature_01.png"
+       [:img {:src "img/icon_feature_03.png"
               :width 60
               :height 55}]
-       [:h3 "Easy Github Integration"]
-       [:p "Automatically run the tests after every commit"]]
+       [:h3 "No more build breaks"]
+       [:p "Circle runs automated tests, builds artifacts, manages integration branches and deploys to production, with ease" ]]
       [:div.box_medium.feature
        [:img {:src "img/icon_feature_02.png"
               :width 60
@@ -31,11 +31,11 @@
        [:h3 "Staged Deployments"]
        [:p "Control when and how to deploy to automatically production, after the tests pass"]]
       [:div.box_medium.feature.separator_r
-       [:img {:src "img/icon_feature_03.png"
+       [:img {:src "img/icon_feature_01.png"
               :width 60
               :height 55}]
-       [:h3 "No more build breaks"]
-       [:p "CircleCI runs automated tests, builds artifacts, manages integration branches and deploys to production, with ease" ]]
+       [:h3 "Easy Github Integration"]
+       [:p "Automatically run the tests after every commit"]]
       [:div.box_medium.feature
        [:img {:src "img/icon_feature_04.png"
               :width 60


Fix the signed-up form to use sessions instead of cookies.

--- src/circleci/web/views/index.clj
+++ src/circleci/web/views/index.clj
@@ -34,7 +34,7 @@
         (center-vertically
           [:div#left-panel [:h1#cititle "Continuous Integration" [:br] "made easy"]])
         (center-vertically
-          [:div#right-panel (if (cookies/get :signed-up) (youre-done) (signupform))])
+          [:div#right-panel (if (session/get :signed-up) (youre-done) (signupform))])
         [:div.clear]]]

     [:div#content_wrap
@@ -90,17 +90,10 @@
                                      :value "Get Notified"}]]]]])

-
-(defn delete-cookie [name]
-  (cookies/put! name {:value ""
-                      :max-age 0
-                      :expires 0 ; You need expires for IE6-8
-                      :path "/"})
-  "") ; return a string
-
 (defpartial youre-done [& content]
-;  (delete-cookie :signed-up) ; For debugging
-  [:div.move-right
-    [:h2.blue-box "Thanks!" [:br] "We'll be in touch soon!"]])
+  (do
+    (session/remove! :signed-up) ; For debugging
+    [:div.move-right
+      [:h2.blue-box "Thanks!" [:br] "We'll be in touch soon!"]]))


CMR-4499: Attempt to fix failing tests in CI by including relevancy namespace

--- search-app/src/cmr/search/data/elastic_search_index.clj
+++ search-app/src/cmr/search/data/elastic_search_index.clj
@@ -17,6 +17,7 @@
    [cmr.common.util :as util]
    ;; Required to be available at runtime.
    [cmr.search.data.query-to-elastic]
+   [cmr.search.data.elastic-relevancy-scoring]
    [cmr.search.services.query-walkers.collection-concept-id-extractor :as cex]
    [cmr.search.services.query-walkers.provider-id-extractor :as pex]
    [cmr.transmit.index-set :as index-set]))


Added an environment variable to set port.

--- src/clj/back_channeling/core.clj
+++ src/clj/back_channeling/core.clj
@@ -153,7 +153,9 @@
        (wrap-authentication token-base session-base)
        (wrap-defaults (assoc-in site-defaults [:security :anti-forgery] false))
        (wrap-reload))
-   :port (Integer/parseInt (or (:back-channeling-port env) "3009"))
+   :port (Integer/parseInt (or (:back-channeling-port env)
+                               (:port env)
+                               "3009"))
    :websockets [{:path "/ws"
                  :on-message (fn [ch message]
                                (handle-command (edn/read-string message) ch))


Add a few forgotten notes to the last gathering

--- src/clj/chili_dog_night/data.clj
+++ src/clj/chili_dog_night/data.clj
@@ -46,6 +46,8 @@
                           ", and "
                           (el/link-to "https://en.wikipedia.org/wiki/Microaggression_theory" "aggression")
                           [:br]
+                          (el/link-to "http://hoverhands.org/" "Hover Hands")
+                          [:br]
                           (el/link-to "http://www.surlalunefairytales.com/bookstore/europefilms.html" "Russo-Finnish Films")
                           " (e.g., "
                           (el/link-to "http://www.imdb.com/title/tt0058374/" "Jack")
@@ -54,6 +56,12 @@
                           ")"
                           [:br]
                           (el/link-to "https://en.wikipedia.org/wiki/Romani_people" "Romani")
+                          [:br]
+                          "The "
+                          (el/link-to "http://www.feralaudio.com/show/x-files-files/" "X-Files Files")
+                          ", and a "
+                          (el/link-to "https://en.wikipedia.org/wiki/Space_(The_X-Files)" "painful episode")
+                          " (as remembered by Greg)"
                           [:br]
                           (el/link-to "http://www.imdb.com/name/nm1553725/" "Kellan")
                           " "


Do export words w/o a hyphen

Do export words w/o a hyphen

--- src/clj/hyphen_keeper/export.clj
+++ src/clj/hyphen_keeper/export.clj
@@ -42,7 +42,6 @@
       (= (hyphenate/hyphenate word spelling) hyphenation)))
    (map :hyphenation)
    (remove string/blank?) ; drop empty ones
-   (filter #(string/includes? % "-")) ; drop hyphenations w/o a hyphen
    (map string/lower-case) ; make sure it's lowercase
    sort
    (map prepare-for-libhyphen)))


More tweaks to devserver.

More tweaks to devserver.

--- src/clj/io/cogitat/devserver.clj
+++ src/clj/io/cogitat/devserver.clj
@@ -26,9 +26,12 @@
   (route/files "/" {:root "resources/public/"})
   (route/not-found "404"))

-(defn run [port]
-  (httpd/run-server
-    (site (-> server-routes logging)) {:port port}))
+(defn run
+  ([]
+    (run 9999))
+  ([port]
+    (httpd/run-server
+      (site (-> server-routes logging)) {:port port})))

 (defn stop [pid]
   nil)
@@ -38,15 +41,16 @@

 (deftask devserver
   "[NOT READY] start|stop|taillog dev server for Hoplon files."
-  [boot & [[command] {:keys [port pid] :or {:port 9999}}]]
+  [boot command & {:keys [port pid] :or {:port 9999}}]
   (fn [continue]
     (fn [event]
       (case command
         "start" (fn []
-                  (run port)
+                  (run :port port)
                   ; XXX set the pid for for the spawned process in the boot env
                   ; XXX set the log file location
                   )
-        "stop" (stop "pid"))
-        "taillog" (taillog "log file)")
+        "stop" (stop "pid")
+        "taillog" (taillog "log file")
+        "default")
       (continue event))))


Save and restore using localStorage.

Save and restore using localStorage.

--- src/cljs/wrongtangular/core.cljs
+++ src/cljs/wrongtangular/core.cljs
@@ -51,6 +51,30 @@
 (defn- last-action [app]
   (:status (peek (:complete app))))

+;; Stores the current progress in localStorage as an array of status/id pairs.
+(defn- store-in-records [complete]
+  (let [dehydrate (fn [entry] [(:status entry) (-> entry :item :id)])]
+    (util/store :records (mapv dehydrate complete))))
+
+;; Given a dataset, attempts to produce a queue and a complete list from
+;; localStorage data. Returns a [queue complete] pair if successful; nil
+;; otherwise.
+(defn restore-from-records [data]
+  (if-let [records (util/fetch :records)]
+    (let [has-id (fn [id] #(= (:id %) id))
+          find-by-id (fn [id data] (first (filter (has-id id) data)))
+          rehydrate (fn [[status id]]
+                      {:status (keyword status)
+                       :item (find-by-id id data)})
+          complete (mapv rehydrate (sort-by :id records))
+          completed-ids (into #{} (map #(-> % :item :id)) complete)
+          queue (->> data
+                  (remove #(completed-ids (:id %)))
+                  (sort-by :id)
+                  (into cljs.core.PersistentQueue.EMPTY))]
+      (.log js/console "restore-from-records: queue %o" (pr-str queue))
+      [queue complete])))
+
 ;; Given a result keyword :approved or :rejected and an app state cursor,
 ;; removes the current item from the queue and adds it to the complete stack as
 ;; a vector in the form {:status result, :item <item>}.
@@ -60,7 +84,7 @@
   (let [{:keys [queue complete]} app
         complete (conj complete {:status result, :item (peek queue)})
         queue (pop queue)]
-    (util/store :records {:queue queue, :complete complete})
+    (store-in-records complete)
     (assoc app :direction :forward, :queue queue, :complete complete)))

 (defn- approve [app]
@@ -72,28 +96,30 @@
 (defn- undo [app]
   (om/transact! app
     (fn [app]
-      (let [{:keys [queue complete]} app]
-        (assoc app
-               :direction :backward
-               :queue (conj queue (:item (peek complete)))
-               :complete (pop complete))))))
+      (let [{:keys [queue complete]} app
+            queue (conj queue (:item (peek complete)))
+            complete (pop complete)]
+        (store-in-records complete)
+        (assoc app :direction :backward, :queue queue, :complete complete)))))

 (defn- load-initial-data [app]
-  (if-let [records (util/fetch :records)]
-    ; restore records from localStorage without loading JSON
-    (om/transact! app
-      (fn [app]
-        (.log js/console "...restored state from localStorage!")
-        (assoc app
-               :ready? true
-               :queue (:queue records)
-               :complete (:complete records))))
-    ; load data from JSON, then set it in the app
-    (go (let [data (<! (util/get-json data-url))]
-          (.log js/console "...loaded data from JSON!")
+  (go (let [data (sort-by :id (<! (util/get-json data-url)))]
+        (if-let [[queue complete] (restore-from-records data)]
+          ; restore records from localStorage without loading JSON
           (om/transact! app
             (fn [app]
-              (assoc app :ready? true, :queue data)))))))
+              (.log js/console "...restored state from localStorage!")
+              (assoc app
+                     :ready? true
+                     :queue queue
+                     :complete complete)))
+          ; load data from JSON, then set it in the app
+          (om/transact! app
+            (fn [app]
+              (.log js/console "...loaded data from JSON!")
+              (assoc app
+                     :ready? true
+                     :queue (into cljs.core.PersistentQueue.EMPTY data))))))))

 ;; Given an input channel of KEYDOWN events, returns an output channel of
 ;; :approve, :reject, and :undo action keywords. Keystrokes not corresponding
@@ -136,6 +162,9 @@
       (reify
         om/IRender
         (render [_]
+          (.log js/console "root: queue of %d items, current-id %s"
+                (count (:queue app))
+                (-> app :queue peek :id))
           (if-not (:ready? app)
             (om/build views/loading app)
             (if-let [current-id (-> app :queue peek :id)]


Make stack trace check box a button for now

--- src/clojure/nightmod/screens.clj
+++ src/clojure/nightmod/screens.clj
@@ -374,13 +374,6 @@
                     :set-alignment (bit-or (align :left) (align :bottom)))
              (scroll-pane (style :scroll-pane nil nil nil nil nil))
              (assoc :id :text :x pad-small :y (+ text-height (* 2 pad-small))))
-         (-> [(check-box (nc-utils/get-string :stack-trace) ui-skin
-                         :set-name "stack-trace"
-                         :set-checked @u/stack-trace?)
-              (text-button (nc-utils/get-string :copy) ui-skin
-                           :set-name "copy")]
-             (horizontal :space (* 2 pad-small) :pack)
-             (assoc :id :error-buttons :x pad-small :y pad-small))
          (-> [(image-button home-style :set-name "home")
               (image-button restart-style :set-name "restart")
               (image-button screenshot-style :set-name "screenshot")
@@ -397,7 +390,12 @@
               (image-button (texture-drawable "repl_key.png"))]
              (horizontal :space (* 2 pad-small) :pack)
              (assoc :id :menu-keys :x pad-small))
-         (assoc (label " " ui-skin :set-visible false) :menu-label? true)])))
+         (-> [(text-button (nc-utils/get-string :stack-trace) ui-skin
+                           :set-name "stack-trace")
+              (text-button (nc-utils/get-string :copy) ui-skin
+                           :set-name "copy")]
+             (horizontal :space (* 2 pad-small) :pack)
+             (assoc :id :error-buttons :x pad-small :y pad-small))])))

   :on-render
   (fn [screen entities]


[EC] [000000] whitespace

[EC] [000000] whitespace

--- src/com/rentpath/dotenv/core.clj
+++ src/com/rentpath/dotenv/core.clj
@@ -91,10 +91,10 @@
     ([] (dotenv! (System/getenv "PWD")))

     ([dir]
-       (let [filename (make-filename dir)
-             initial  (load-env filename)
-             overide  (if (exists? +env-local+)
-                        (load-env +env-local+)
-                        {})]
-         (doseq [[k v] (merge initial overide)]
-           (set-property! k v))))))
+     (let [filename (make-filename dir)
+           initial  (load-env filename)
+           overide  (if (exists? +env-local+)
+                      (load-env +env-local+)
+                      {})]
+       (doseq [[k v] (merge initial overide)]
+         (set-property! k v))))))


Use guardrails to define core specs

Use guardrails to define core specs

--- src/com/wsscode/pathom/core.cljc
+++ src/com/wsscode/pathom/core.cljc
@@ -9,6 +9,7 @@
         :cljs com.wsscode.common.async-cljs)
      :as casync
      :refer [go-catch <? let-chan chan? <?maybe <!maybe go-promise]]
+    [com.fulcrologic.guardrails.core :refer [>def >defn >fdef => | <- ?]]
     [com.wsscode.pathom.parser :as pp]
     [com.wsscode.pathom.misc :as p.misc]
     [clojure.set :as set]
@@ -21,79 +22,78 @@

 ;; pathom core

-(when p.misc/INCLUDE_SPECS
-  (s/def ::env map?)
-  (s/def ::attribute ::eql/property)
-
-  (s/def ::reader-map (s/map-of keyword? ::reader))
-  (s/def ::reader-seq (s/coll-of ::reader :kind vector? :into []))
-  (s/def ::reader-fn fn?)
-
-  (s/def ::optional? boolean?)
-
-  (s/def ::reader
-    (s/or :fn ::reader-fn
-          :map ::reader-map
-          :list ::reader-seq))
-
-  (s/def ::process-reader
-    (s/fspec :args (s/cat :reader ::reader)
-      :ret ::reader))
-
-  (s/def ::error
-    (s/spec any?
-      :gen #(s/gen #{(ex-info "Generated sample error" {:some "data"})})))
-
-  (s/def ::errors (s/map-of vector? any?))
-
-  (s/def ::errors* #(instance? IAtom %))
-
-  (s/def ::entity any?)
-  (s/def ::entity-key keyword?)
-
-  (s/def ::fail-fast? boolean?)
-
-  (s/def ::map-key-transform
-    (s/fspec :args (s/cat :key any?)
-      :ret string?))
-
-  (s/def ::map-value-transform
-    (s/fspec :args (s/cat :key any? :value any?)
-      :ret any?))
-
-  (s/def ::placeholder-prefixes set?)
-
-  (s/def ::js-key-transform ::map-key-transform)
-
-  (s/def ::js-value-transform ::map-value-transform)
-
-  (s/def ::parser
-    (s/fspec :args (s/cat :env map? :tx ::eql/query)
-      :ret map?))
-
-  (s/def ::wrap-read
-    (s/fspec :args (s/cat :reader ::reader-fn)
-      :ret ::reader-fn))
-
-  (s/def ::wrap-parser
-    (s/fspec :args (s/cat :parser ::parser)
-      :ret ::parser))
-
-  (s/def ::plugin (s/keys :opt [::wrap-read ::wrap-parser]))
-
-  #_(s/def ::plugins
-      (s/with-gen (s/coll-of ::plugin :kind vector?) #(s/gen #{[]})))
-
-  (s/def ::parent-join-key (s/or :prop ::eql/property
-                                 :ident ::eql/ident
-                                 :call ::eql/mutation-key))
-  (s/def ::parent-query ::eql/join-query)
-
-  (s/def ::union-path
-    (s/or :keyword ::eql/property
-          :fn fn?))
-
-  (s/def ::async-request-cache-ch-size pos-int?))
+(>def ::env map?)
+(>def ::attribute ::eql/property)
+
+(>def ::reader-map (s/map-of keyword? ::reader))
+(>def ::reader-seq (s/coll-of ::reader :kind vector? :into []))
+(>def ::reader-fn fn?)
+
+(>def ::optional? boolean?)
+
+(>def ::reader
+  (s/or :fn ::reader-fn
+        :map ::reader-map
+        :list ::reader-seq))
+
+(>def ::process-reader
+  (s/fspec :args (s/cat :reader ::reader)
+    :ret ::reader))
+
+(>def ::error
+  (s/spec any?
+    :gen #(s/gen #{(ex-info "Generated sample error" {:some "data"})})))
+
+(>def ::errors (s/map-of vector? any?))
+
+(>def ::errors* #(instance? IAtom %))
+
+(>def ::entity any?)
+(>def ::entity-key keyword?)
+
+(>def ::fail-fast? boolean?)
+
+(>def ::map-key-transform
+  (s/fspec :args (s/cat :key any?)
+    :ret string?))
+
+(>def ::map-value-transform
+  (s/fspec :args (s/cat :key any? :value any?)
+    :ret any?))
+
+(>def ::placeholder-prefixes set?)
+
+(>def ::js-key-transform ::map-key-transform)
+
+(>def ::js-value-transform ::map-value-transform)
+
+(>def ::parser
+  (s/fspec :args (s/cat :env map? :tx ::eql/query)
+    :ret map?))
+
+(>def ::wrap-read
+  (s/fspec :args (s/cat :reader ::reader-fn)
+    :ret ::reader-fn))
+
+(>def ::wrap-parser
+  (s/fspec :args (s/cat :parser ::parser)
+    :ret ::parser))
+
+(>def ::plugin (s/keys :opt [::wrap-read ::wrap-parser]))
+
+#_(>def ::plugins
+    (s/with-gen (s/coll-of ::plugin :kind vector?) #(s/gen #{[]})))
+
+(>def ::parent-join-key (s/or :prop ::eql/property
+                              :ident ::eql/ident
+                              :call ::eql/mutation-key))
+(>def ::parent-query ::eql/join-query)
+
+(>def ::union-path
+  (s/or :keyword ::eql/property
+        :fn fn?))
+
+(>def ::async-request-cache-ch-size pos-int?)

 (def break-values #{::reader-error ::not-found})

@@ -1205,44 +1205,3 @@
   This is useful when you need to ensure some values are loaded in order to fetch some
   more complex data."
   (entity env attributes))
-
-(when p.misc/INCLUDE_SPECS
-  (s/fdef query->ast
-    :args (s/cat :query (s/nilable ::eql/query))
-    :ret :edn-query-language.ast/root)
-
-  (s/fdef query->ast1
-    :args (s/cat :query ::eql/query)
-    :ret :edn-query-language.ast/root)
-
-  (s/fdef ast->query
-    :args (s/cat :ast :edn-query-language.ast/node)
-    :ret :edn-query-language.ast/root)
-
-  (s/fdef entity
-    :args (s/cat :env ::env :attributes (s/? (s/coll-of ::attribute)))
-    :ret (s/nilable ::entity))
-
-  (s/fdef entity-attr
-    :args (s/cat :env ::env :attribute ::attribute :default (s/? any?))
-    :ret any?)
-
-  (s/fdef entity!
-    :args (s/cat :env ::env :attributes (s/? (s/coll-of ::attribute)))
-    :ret (s/nilable ::entity))
-
-  (s/fdef entity-attr!
-    :args (s/cat :env ::env :attribute ::attribute)
-    :ret any?)
-
-  (s/fdef swap-entity!
-    :args (s/cat :env ::env :fn fn? :args (s/* any?))
-    :ret any?)
-
-  (s/fdef collapse-error-path
-    :args (s/cat :m map? :path vector?)
-    :ret vector?)
-
-  (s/fdef raise-errors
-    :args (s/cat :data (s/keys :opt [::errors]))
-    :ret map?))


(PDB-5484) versioned-well-formed-tests: drop vestigial versioning

cf. 019cf18e18cfa566a9eaa20339b41e0c8dad0e87

--- test/puppetlabs/puppetdb/http/facts_test.clj
+++ test/puppetlabs/puppetdb/http/facts_test.clj
@@ -399,8 +399,10 @@
     {:certname "foo5", :environment "DEV", :name "hostname", :value "foo5"}]))

-(defn versioned-well-formed-tests
-  [version]
+(defn well-formed-tests
+  []
+  ;; The reason for the "common" split is historical.  These
+  ;; non-common tests used to vary based on the endpoint version.
   (merge common-well-formed-tests
          (omap/ordered-map
           nil
@@ -612,7 +614,7 @@

     (testing "fact queries"
       (testing "well-formed queries"
-        (doseq [[query result] (versioned-well-formed-tests version)]
+        (doseq [[query result] (well-formed-tests)]
           (testing (format "Query %s" query)
             (let [request (if query
                             (get-request endpoint (json/generate-string query))


type is required

type is required

--- src/celestial/persistency.clj
+++ src/celestial/persistency.clj
@@ -90,7 +90,7 @@

 (defn validate-system
   [system]
-  (validate! system {:type #{:type-exists} :env #{:required :Keyword}} :error ::non-valid-machine-type )
+  (validate! system {:type #{:required :type-exists} :env #{:required :Keyword}} :error ::non-valid-machine-type )
   ((hyp-to-v (figure-virt system)) system))

 (defn clone-system


Changed read raw fn

Changed read raw fn

--- src/clj/datasplash/pubsub.clj
+++ src/clj/datasplash/pubsub.clj
@@ -8,7 +8,7 @@

 (def message-types
-  {:read {:raw (PubsubIO/readMessages)
+  {:read {:raw (PubsubIO/readMessagesWithAttributes)
           :string (PubsubIO/readStrings)}
    :write {:raw (PubsubIO/writeMessages)
            :string (PubsubIO/writeStrings)}})


Change main method so that you can optionally provide a port num as a command line arg

--- src/clj/decktouch/handler.clj
+++ src/clj/decktouch/handler.clj
@@ -30,4 +30,6 @@
     (if (env :dev?) (wrap-reload (wrap-exceptions handler)) handler)))

 (defn -main [& args]
-  (jetty/run-jetty app {:port 8080}))
+  (jetty/run-jetty app {:port (if (nil? (first args))
+                                8080
+                                (Integer/parseInt (first args)))}))


support prepending unoptimized javascript

NOTE: this does not work with source-maps!!!

--- src/clj/shadow/cljs/build.clj
+++ src/clj/shadow/cljs/build.clj
@@ -779,8 +779,9 @@
     (throw (ex-info "missing :public-dir" {})))

   (time
-   (doseq [{:keys [default js-source source-map-name name js-name] :as mod} modules]
+   (doseq [{:keys [default js-source prepend source-map-name name js-name] :as mod} modules]
      (let [target (io/file public-dir js-name)
+           js-source (str prepend js-source)
            js-source (if (:web-worker mod)
                        (let [deps (:depends-on mod)]
                          (str (str/join "\n" (for [other modules
@@ -903,14 +904,15 @@
      (flush-manifest public-dir build-modules)

      ;; flush fake modules
-     (doseq [{:keys [default js-name name sources] :as mod} build-modules]
+     (doseq [{:keys [default js-name name prepend sources] :as mod} build-modules]
        (let [provided-ns (mapcat #(reverse (get-in state [:sources % :provides]))
                                  sources)
              target (io/file public-dir js-name)

              out (->> provided-ns
                       (map #(str "goog.require('" (comp/munge %) "');"))
-                      (str/join "\n"))
+                      (str/join "\n")
+                      (str prepend))
              out (if default
                    ;; default mod needs closure related setup and goog.addDependency stuff
                    (str (closure-defines-and-base state)


Fix fix fix...

Fix fix fix...

--- src/clj_simple_chart/core.clj
+++ src/clj_simple_chart/core.clj
@@ -22,7 +22,7 @@
 (defonce engine (atom nil))

 (defn -start [this internal-stage]
-  (.setTitle internal-stage "hello world")
+  (.setTitle internal-stage "SVG Output")
   (let [internal-webview (WebView.)
         internal-engine (.getEngine internal-webview)
         layout (VBox. 0.0)
@@ -61,16 +61,16 @@
           (= Worker$State/CANCELLED state) state
           :else (do (Thread/sleep 10) (recur)))))

-(defn render-string [s]
+(defn bootstrap []
   (if @engine
-    (do
-      (Platform/runLater (fn [] (.loadContent @engine s "text/html")))
-      (wait-for-worker)
-      )
+    nil
     (do
       (launch)
-      (.await latch)
-      (recur s))))
+      (.await latch))))
+
+(defn render-string [s]
+  (Platform/runLater (fn [] (.loadContent @engine s "text/html")))
+  (wait-for-worker))

 (defn translate [x y]
   (str "translate(" x "," y ")"))
@@ -82,7 +82,8 @@
 (defn render
   ([filename t]
    (export-to-file filename t)
-   (render t))
+   (render t)
+   (Platform/runLater (fn [] (.setTitle @stage filename))))
   ([t]
    (let [body [:body (style
                        :margin "0 !important"
@@ -93,10 +94,10 @@
          width (:width attrs)
          height (:height attrs)
          s (hiccup.core/html (conj body t))]
+     (bootstrap)
      (Platform/runLater (fn [] (.setPrefHeight @webview height)))
      (Platform/runLater (fn [] (.setPrefWidth @webview width)))
      (render-string s)
-     (wait-for-worker)
      (Platform/runLater (fn [] (.sizeToScene @stage)))
      (Platform/runLater (fn [] (.show @stage)))
      s)))


fix auto-complete

fix auto-complete

--- src/cljs/clj_money/forms.cljs
+++ src/cljs/clj_money/forms.cljs
@@ -91,7 +91,7 @@
       (let [attr (merge (select-keys options [:placeholder
                                               :class])
                         {:type input-type
-                         :autocomplete :off
+                         :auto-complete :off
                          :name (->name field)
                          :id (->id field)
                          :value @text-value


bug: missing argument to the render-cell

--- src/cljs/tictactoe/board.cljs
+++ src/cljs/tictactoe/board.cljs
@@ -20,5 +20,5 @@
      {:view-box (str "0 0 " logic/board-size " " logic/board-size)
       :style {:max-height "500px"}}]
     (for [[x y] logic/coordinates]
-      [render-board-cell board x y])
+      [render-board-cell board x y on-move])
     ))


Throw error when no screens are given

Throw error when no screens are given

--- src/clojure/nightmod/game.clj
+++ src/clojure/nightmod/game.clj
@@ -23,6 +23,8 @@
            (asset-manager! manager/manager :clear)
            (stop-timers!)
            ; make sure the game screens are valid
+           (when-not (seq game-screens)
+             (throw (Exception. "No screen given to set-game-screen!")))
            (doseq [screen game-screens]
              (when-not (every? #(fn? (get screen %))
                                [:show :render :hide :pause :resize :resume])


Set all known possible user classpath precedence paremeters.

--- src/clojure/parkour/cstep.clj
+++ src/clojure/parkour/cstep.clj
@@ -35,6 +35,8 @@
       (.setJarByClass parkour.hadoop.Mappers)
       (conf/assoc! #_job
         "mapreduce.task.classpath.user.precedence" true
+        "mapreduce.job.user.classpath.first" true
+        "mapreduce.user.classpath.first" true
         "avro.serialization.data.model" "abracad.avro.ClojureData"))))

 (defn step-map


Refactor and possibly debug frontier-preservation

--- src/clojush/pushgp/pushgp.clj
+++ src/clojush/pushgp/pushgp.clj
@@ -179,7 +179,6 @@
       (reset! timer-atom (System/currentTimeMillis))
       (swap! timing-map assoc step (+ current-time-for-step (- @timer-atom start-time))))))

-
 (defn process-generation
   "Processes the generation, returning [new novelty archive, return val],
    where new novelty archive will be nil if we are done."
@@ -194,46 +193,50 @@
   (println "Computing errors... ")
   (compute-errors pop-agents rand-gens novelty-archive @push-argmap)
   (println "Done computing errors.")
+  (println "Preserving frontier... ")
   (when (and (:preserve-frontier argmap)
              (or (not (:autoconstructive argmap))
                  (> generation 0)))
-    (println "Preserving frontier... ")
-    (let [diversifying-children (filter :diversifying (map deref pop-agents))
-          diversifying-frontier (filter :diversifying @frontier)
-          verified-frontier (filter (fn [parent]
-                                      (some (fn [child]
-                                              (= (:parent1-genome child)
-                                                 (:genome parent)))
-                                            diversifying-children))
-                                    diversifying-frontier)
-          diversifying-candidates (concat diversifying-children verified-frontier)
-          _ (println "Number of diversifying candidates for frontier preservation:"
-                     (count diversifying-candidates))
-          filtered-candidates (if (empty? diversifying-candidates)
-                                (map deref pop-agents)
-                                (if (< (count diversifying-candidates) (count pop-agents))
-                                  (take (count pop-agents) (cycle diversifying-candidates))
-                                  diversifying-candidates))]
+    (let [filtered-candidates
+          (if (:autoconstructive argmap)
+            (let [diversifying-children (filter :diversifying (map deref pop-agents))
+                  diversifying-frontier (filter :diversifying @frontier)
+                  verified-frontier (filter (fn [parent]
+                                              (some (fn [child]
+                                                      (= (:parent1-genome child)
+                                                         (:genome parent)))
+                                                    diversifying-children))
+                                            diversifying-frontier)
+                  diversifying-candidates (concat diversifying-children verified-frontier)]
+              (println "Number of diversifying candidates for frontier preservation:"
+                       (count diversifying-candidates))
+              (if (empty? diversifying-candidates)
+                (map deref pop-agents)
+                (if (< (count diversifying-candidates) (count pop-agents))
+                  (take (count pop-agents) (cycle diversifying-candidates))
+                  diversifying-candidates)))
+            (concat (map deref pop-agents)
+                    @frontier))]
       (if (= (count filtered-candidates) (count pop-agents))
         (do (dotimes [i population-size]
               ((if use-single-thread swap! send) (nth pop-agents i) (fn [_] (nth filtered-candidates i))))
             (when-not use-single-thread (apply await pop-agents)) ;; SYNCHRONIZE
             (reset! frontier filtered-candidates))
-      (loop [preserved 0
-             new-frontier []
-             candidates filtered-candidates]
-        (if (= preserved population-size)
-          (do (dotimes [i population-size]
-                ((if use-single-thread swap! send) (nth pop-agents i) (fn [_] (nth new-frontier i))))
-              (when-not use-single-thread (apply await pop-agents)) ;; SYNCHRONIZE
-              (reset! frontier new-frontier))
-          (let [to-preserve (select candidates argmap)
-                without-meta-errors (update-in to-preserve
-                                               [:errors]
-                                               #(drop-last (count (:meta-errors to-preserve)) %))]
-            (recur (inc preserved)
-                   (conj new-frontier without-meta-errors)
-                   (remove-one to-preserve candidates))))))))
+        (loop [preserved 0
+               new-frontier []
+               candidates filtered-candidates]
+          (if (= preserved population-size)
+            (do (dotimes [i population-size]
+                  ((if use-single-thread swap! send) (nth pop-agents i) (fn [_] (nth new-frontier i))))
+                (when-not use-single-thread (apply await pop-agents)) ;; SYNCHRONIZE
+                (reset! frontier new-frontier))
+            (let [to-preserve (select candidates argmap)
+                  without-meta-errors (update-in to-preserve
+                                                 [:errors]
+                                                 #(drop-last (count (:meta-errors to-preserve)) %))]
+              (recur (inc preserved)
+                     (conj new-frontier without-meta-errors)
+                     (remove-one to-preserve candidates))))))))
   (timer @push-argmap :fitness)
   ;; calculate solution rates if necessary for historically-assessed hardness
   (calculate-hah-solution-rates pop-agents @push-argmap)
@@ -293,8 +296,6 @@
                                   [next-novelty-archive nil])
           :else [nil (final-report generation best @push-argmap)])))

-
-
 (defn pushgp
   "The top-level routine of pushgp."
   ([] (pushgp '()))


Execute Sim.

Execute Sim.

--- test/onyx/coordinator/simulation_tests/coordinator_simulant_tests.clj
+++ test/onyx/coordinator/simulation_tests/coordinator_simulant_tests.clj
@@ -105,6 +105,9 @@
     (-> @(d/transact sim-conn (sim/construct-basic-sim test sim))
         (tx-ent (:db/id sim)))))

+(defmethod sim/perform-action :action.type/execute-task
+  [action process])
+
 (def model-id (d/tempid :model))

 (def coordinator-model-data
@@ -121,5 +124,32 @@
                    {:db/id (d/tempid :test)
                     :test/duration (hours->msec 1)}))

+(def coordinator-sim
+  (sim/create-sim sim-conn coordinator-test
+                  {:db/id (d/tempid :sim)
+                   :sim/systemURI (str "datomic:mem://" (d/squuid))
+                   :sim/processCount 10}))
+
+(defn assoc-codebase-tx [entities]
+  (let [codebase (u/gen-codebase)
+        cid (:db/id codebase)]
+    (cons
+     codebase
+     (mapv #(assoc {:db/id (:db/id %)} :source/codebase cid) entities))))
+
+@(d/transact sim-conn (assoc-codebase-tx [coordinator-test coordinator-sim]))
+
+(def action-log (sim/create-action-log sim-conn coordinator-sim))
+
+(def sim-clock (sim/create-fixed-clock sim-conn coordinator-sim {:clock/multiplier 960}))
+
+(def pruns
+  (->> #(sim/run-sim-process sim-uri (:db/id coordinator-sim))
+       (repeatedly (:sim/processCount coordinator-sim))
+       (into [])))
+
+(time
+ (mapv (fn [prun] @(:runner prun)) pruns))
+
 (alter-var-root #'system component/stop)


(maint) clarify a test

(maint) clarify a test

In writing docs I wanted to ensure that :unknown still overrode
:starting and :stopping so I tweaked the relevant test.

--- test/puppetlabs/trapperkeeper/services/status/status_service_test.clj
+++ test/puppetlabs/trapperkeeper/services/status/status_service_test.clj
@@ -328,7 +328,7 @@

       (testing "and a service is :unknown"
         (with-status-service app
-          [foo-service baz-service]
+          [foo-service baz-service starting-service stopping-service]
           (let [resp (http-client/get "http://localhost:8180/status/v1/simple")]
             (is (= 503 (:status resp)))
             (is (= "unknown" (slurp (:body resp))))))))


Preamble can be a function

Preamble can be a function

--- org-mode/src/com/gfredericks/org_agenda.clj
+++ org-mode/src/com/gfredericks/org_agenda.clj
@@ -533,7 +533,15 @@
         {:keys [deadlines triage today future past]} agenda]
     (with-atomic-write-to cfg
       (when-let [preamble (:preamble cfg)]
-        (println preamble))
+        (println (cond (string? preamble)
+                       preamble
+
+                       (fn? preamble)
+                       (preamble)
+
+                       :else
+                       (throw (ex-info "Bad preamble"
+                                       {:preamble preamble})))))
       (when (seq deadlines)
         (println "== DEADLINES ==")
         (println "(TODO: show upcoming deadlines based on the -0d cookie)")


Refactoring: show-help and show-error should use cli-options data structure

--- src/arachnida/core.clj
+++ src/arachnida/core.clj
@@ -27,17 +27,14 @@
    ["-c" "--config"  "display current configuration" :id :config]])

 (defn show-help
-    []
+    [summary]
     (println "Usage:")
-    (println "-h" "--help      help")
-    (println "-g" "--git       fetch GIT statistic")
-    (println "-s" "--server    run as HTTP server")
-    (println "-c" "--config    display current configuration"))
+    (println summary))

 (defn show-error
-    []
+    [summary]
     (println "Unknown command line option!")
-    (show-help))
+    (show-help summary))

 (defn display-configuration
     []
@@ -52,9 +49,9 @@
           git?           (options :git)
           server?        (options :server)
           config?        (options :config)]
-        (cond show-help? (show-help)
+        (cond show-help? (show-help (:summary all-options))
               git?       (git-data-fetcher/process)
               server?    (server/start-server)
               config?    (display-configuration)
-              :else      (show-error))))
+              :else      (show-error (:summary all-options)))))


fixing stuff i believe

fixing stuff i believe

--- src/epicea/utils/defmultiple.clj
+++ src/epicea/utils/defmultiple.clj
@@ -33,7 +33,7 @@

 (defn make-method [entry]
   {(:dispatch-value entry)
-   (eval `(fn ~@(:function entry)))})
+   `(fn ~@(:function entry))})

 (defn make-method-map [methods]
   (reduce merge (map make-method methods)))
@@ -58,7 +58,7 @@
      (let [dispatch-fun# ~(:dispatch-fun x)
            method-map# ~(make-method-map (:methods x))
            default-key# ~(if (contains? x :default)
-                           (eval (-> x :default :value))
+                           (-> x :default :value)
                            :default)]
        (defn ~(:name x) [& args#]
          (eval-multi (quote ~(:name x))
@@ -75,18 +75,25 @@
                 (spec/explain ::defmultiple args))))
       (defmultiple-sub parsed))))

-(defn defmultiple-extra-sub [parsed]
+(defn add-extra-methods [name methods-to-add]
   (swap!
    extra-methods
    (fn [extra-method-map]
      (update-in
-      extra-method-map [(:name parsed)]
+      extra-method-map [name]
       (fn [methods]
         (reduce
          merge
          methods
-         (map make-method
-              (:methods parsed))))))))
+         methods-to-add))))))
+
+(defn defmultiple-extra-sub [parsed]
+  `(add-extra-methods
+    (quote ~(:name parsed))
+    (quote ~(map make-method
+                 (:methods parsed)))))
+
+

 (defmacro defmultiple-extra [& args]
   (let [parsed (spec/conform ::defmultiple-extra args)]


Clean up autocomplete fuzzy search, check for nil

--- src/braid/client/ui/views/autocomplete.cljs
+++ src/braid/client/ui/views/autocomplete.cljs
@@ -33,18 +33,19 @@
 ;                text to replace message with

 (defn normalize [s]
-  (-> (.toLowerCase s)
-     (string/replace #"\s" "")))
+  (-> (string/lower-case s)
+      (string/replace #"\s" "")))

 (defn simple-matches?
   [m s]
   (not= -1 (.indexOf m s)))

 (defn fuzzy-matches? [m s]
-  (let [m (normalize m)
-        s (normalize s)]
-    (or (simple-matches? m s)
-        (< (fuzzy/levenshtein m s) 2))))
+  (when (and (some? s) (some? m))
+    (let [m (normalize m)
+          s (normalize s)]
+      (or (simple-matches? m s)
+          (< (fuzzy/levenshtein m s) 2)))))

 (defn emoji-view
   [emoji]


rename

rename

--- examples/lesson-carousel-starter-kit/src/carousel/core.cljs
+++ examples/lesson-carousel-starter-kit/src/carousel/core.cljs
@@ -21,22 +21,22 @@
 (defn create-dots [root-node]
   (let [root-dot (.. root-node addChild)]
     (doseq [i (range 5)]
-      (.. root-dot addChild)))
-  root-dot)
+      (.. root-dot addChild))
+    root-dot))

 (defn Carousel [selector data]
   (let [context (.. FamousEngine (createScene selector))
-        root (.. context addChild)
-        back-node (.. root addChild)
-        next-node (.. root addChild)
-        dots (create-dots root)
-
+        root-node (.. context addChild)
+        back-node (.. root-node addChild)
+        next-node (.. root-node addChild)
+        dots (create-dots root-node)
+
         back (decorate-arrow-node back-node "<")
         next (decorate-arrow-node next-node ">")
         carousel-obj {:context  context
-                      :root     root
-                      :back back
-                      :next next}]
+                      :root     root-node
+                      :back back-node
+                      :next next-node}]
     (.. back-node
         (setSizeMode 1 1)
         (setAbsoluteSize 40 40)


Factor out lb-name, fixes several bugs in deployment.

--- src/circle/backend/action/load_balancer.clj
+++ src/circle/backend/action/load_balancer.clj
@@ -13,11 +13,14 @@
   (:require [circle.backend.ec2 :as ec2])
   (:require [clojure.string :as str]))

+(defn get-lb-name [build]
+  (-> @build :node :lb-name))
+
 (defaction add-instances []
   {:name "add to load balancer"}
   (fn [build]
     (try
-      (let [lb-name (-> @build :node :lb-name)
+      (let [lb-name (get-lb-name build)
             _ (throw-if-not lb-name "build LB name must not be null. Is it in your DB/yml?")
             instance-ids (-> @build :instance-ids)
             _ (doseq [i instance-ids
@@ -44,7 +47,7 @@
   {:name "wait for nodes LB healthy"}
   (fn [build]
     (let [instance-ids (-> @build :instance-ids)
-          lb-name (-> @build :lb-name)]
+          lb-name (get-lb-name build)]
       (try
         (wait-for
          {:sleep (lb-healthy-sleep)
@@ -71,7 +74,7 @@
   {:name "remove old revisions"}
   (fn [build]
     (try
-      (let [lb-name (-> @build :lb-name)
+      (let [lb-name (get-lb-name build)
             old-instances (get-old-revisions lb-name
                                              (-> @build :vcs_revision))
             terminated-instances (lb/terminated-instances lb-name)]


whitespace

whitespace

--- src-cljs/frontend/components/pieces/topbar.cljs
+++ src-cljs/frontend/components/pieces/topbar.cljs
@@ -21,7 +21,7 @@
           [:div
            [:div.navs-container
             [:a.logomark {:href "/dashboard"
-                                         :aria-label "Dashboard"}
+                          :aria-label "Dashboard"}
              (common/ico :logo)]
             [:ul.nav-items.collapsing-nav
               [:li


on reading from clojure: closures + pure functions + referential transparency

--- src/clojure_learning/with-clojure-playing-chap-7-FP.clj
+++ src/clojure_learning/with-clojure-playing-chap-7-FP.clj
@@ -190,3 +190,70 @@
 ;; small doseq demo
 (doseq [x [1 2 3]]
   (println "each: " x)); each 1...each 3
+
+;; pure function:
+;;   + a function which given a domain of values -> always returns the same values foreach invocation
+;;   + means it is not touching the outside world, apart from the given domain of args
+;;   + means it does not has any side effects on outside world(no mutation of outside world)
+;;   + means it will NOT rely on the outside world for any dependencies
+
+(doc select-keys); 	Returns a map containing only those entries in map whose key is in keys
+(select-keys {:a 1 :b 2 :c 3} [:a :b]); {:b 2 :a 1}
+(vals {:a 1 :b 2}); (1 2)
+
+;; lets build a pure-function which is said to be referential transparent. Stop but what means RT?
+;; a function is said to be referential transparent if it is a pure function first. It can be
+;; seen as a constant during time, and "the reference to function is transparent during time"
+;; and being a constant, it can be replaced with its result value and the program executes just as
+;; if nothing has changed.
+;; demo: this function returns a map with a function applied on the corresponding values bounded to key-args
+(defn keys-apply
+  [func ks m]
+  (let [only (select-keys m ks)]
+    (zipmap (keys only) (map func (vals only)))))
+
+(keys-apply
+   clojure.string/upper-case
+   [:foo :bar]
+   {:foo "some-foo" :bar "some-bar" :zip "some-zip"})
+; {:foo "SOME-FOO", :bar "SOME-BAR"}
+
+;; then a new function can be build that operates on top of keys-apply, this is also a pure function
+;; since it never changes the outside world, and always yields the same result given the same args
+(defn manip-map
+  [func ks m]
+  (merge m (keys-apply func ks m)))
+
+(manip-map clojure.string/upper-case [:foo] {:foo "cclaudiu" :bar "cosar"})
+; {:foo "CCLAUDIU", :bar "cosar"} -> do some processing on :foo key -> and merge into the same passed map
+; -> replace -> merge mechanism
+
+(doc merge); returns a new map, that consists of the tail-maps-args conj-ed onto the first: "m" in this case
+
+(doc zipmap); ([keys vals])
+(clojure.string/upper-case "this")
+
+;;;;;;;;;;;;;;;;;;
+; Clojure provides idiomatic named-arguments of functions, via destructuring in conjunction with "&" varargs:
+(defn learn-clj
+  [& {:keys [book practice] :or {book "Clojure Programming" practice "lighttable"}}]
+   (format "Learning clojure from book: %1s, practicing via : %2s" book practice))
+(learn-clj :book "The Joy of Clojure")
+(learn-clj :practice "4clojure")
+
+;; the & makes the func take varargs. there should be PAIRS normally, that's the meaning of NAMED-ARGS anyway
+;; each-pair(if a single one) is passed as func arg -> the destructuring starts working -> by decomposing
+;; them into a hash-map first and then looking up by keys, else taking defaults provided via :or macro
+
+;; Clojure has a powerfull support on DbC: via {:pre [(eval-to-true-1) (eval-to-true-2)]
+;;                                              :post [(....)]}
+
+;; Clojure Closures :)
+;; In a sentence a closure is a function that has access to the values of the outer-context - where it has been created
+(defn times-two []
+  (let [two 2]
+    (fn [x] (* two x))))
+((times-two) 5) ; 10
+;; first time the function times-two is invoked it creates a closure, that's the returned function, which closure
+;; has access over the values from the context where it was created, although there's no reference to the times-two function
+;; the returned closure captures them.


Releasing modular.less 0.1.1

Releasing modular.less 0.1.1

--- modules/less/project.clj
+++ modules/less/project.clj
@@ -1,6 +1,6 @@
 ;; Copyright © 2014 JUXT LTD.

-(defproject juxt.modular/less "0.1.0"
+(defproject juxt.modular/less "0.1.1"
   :description "A modular extension that lets you compile Less files into CSS"
   :url "https://github.com/juxt/modular/tree/master/modules/less"
   :license {:name "The MIT License"


Change route

Change route

--- src/bookshelf/core.clj
+++ src/bookshelf/core.clj
@@ -71,7 +71,7 @@
           [:td (make-notes row counts)]])]])))

 (defroutes handler
-  (compojure/GET "/" [] (library-files-html))
+  (compojure/GET "/hiccup" [] (library-files-html))
   (route/not-found "Invalid request"))

 (def app


Moved all the workflow code out.

Moved all the workflow code out.


Update config.clj

Update config.clj

--- src/bukkure/config.clj
+++ src/bukkure/config.clj
@@ -20,7 +20,7 @@
        (catch Exception ~(symbol "e") nil))))

 (defmacro defcns
-  "Wrapper around [[defn]] to map a list to it, and execute the form returned"
+  "Wrapper around [[defcn]] to map a list to it, and execute the form returned"
   [& types]
   (let [forms (map defcn types)]
     `(do ~@forms)))


send msg to users & channels

send msg to users & channels


[scamp] Refactor 'do-comm-test to use 'world-with-subs.

Update test result to match new input world.

--- modules/scamp/test/scamp/core_test.clj
+++ modules/scamp/test/scamp/core_test.clj
@@ -71,7 +71,7 @@
 (deftest do-comm-test
   (scamp-test
    #(binding [scamp.core/*rand* testing-rand*]
-      (let [world comm-test-world
+      (let [world (world-with-subs 3)
             end-world (-> (reduce
                            (fn [world _n] (core/do-comm world))
                            world
@@ -80,32 +80,29 @@
                           purge-world-envelope-ids)]
         (is (= end-world
                {:message-envelopes
-                [[:message-envelope "node-id3" :add-upstream "node-id1"]
-                 [:message-envelope "node-id3" :forwarded-subscription "node-id3"]
-                 [:message-envelope "node-id3" :forwarded-subscription "node-id3"]
-                 [:message-envelope "node-id1" :forwarded-subscription "node-id2"]
-                 [:message-envelope "node-id1" :forwarded-subscription "node-id2"]],
+                [[:message-envelope "node-id3" :forwarded-subscription "node-id3"]],
                 :network
                 {"node-id0"
                  {:self {:id "node-id0"},
                   :upstream #{"node-id1"},
                   :downstream #{"node-id2"},
-                  :messages-seen {"1" 1, "2" 1, "3" 1}},
+                  :messages-seen {"1" 1, "2" 1, "3" 7, "8" 1}},
                  "node-id1"
                  {:self {:id "node-id1"},
                   :upstream #{"node-id2"},
-                  :downstream #{"node-id3" "node-id0"},
-                  :messages-seen {"4" 1, "5" 1, "6" 1}},
+                  :downstream #{"node-id2" "node-id3" "node-id0"},
+                  :messages-seen {"2" 1, "3" 9, "6" 1, "7" 1, "8" 1}},
                  "node-id2"
                  {:self {:id "node-id2"},
-                  :upstream #{"node-id3" "node-id0"},
-                  :downstream #{"node-id1"},
-                  :messages-seen {"1" 1, "2" 1, "3" 1}},
+                  :upstream #{"node-id3" "node-id0" "node-id1"},
+                  :downstream #{"node-id3" "node-id1"},
+                  :messages-seen {"4" 1, "2" 1, "3" 10, "5" 1, "7" 1, "8" 1}},
                  "node-id3"
                  {:self {:id "node-id3"},
-                  :upstream #{},
+                  :upstream #{"node-id2" "node-id1"},
                   :downstream #{"node-id2"},
-                  :messages-seen {}}}}))))))
+                  :messages-seen {"9" 1, "7" 1, "10" 1}}}}
+               ))))))

 (deftest notify-add-upstream-test
   (scamp-test


Removed normalisation of sector indicies

--- src/hphelper/shared/indicies.clj
+++ src/hphelper/shared/indicies.clj
@@ -63,7 +63,6 @@
   [indicies]
   (log/trace "normalise-all-indicies:" indicies)
   (->> indicies
-      (normalise-specific-indicies sectorIndicies)
       (normalise-specific-indicies (map key (remove (partial some (into #{} sectorIndicies)) indicies)))))

 (defn fuzzify-indicies


adding env for filtering

adding env for filtering

--- src/celestial/jobs.clj
+++ src/celestial/jobs.clj
@@ -93,8 +93,10 @@
   {:queued :queued :locked :processing :recently-done :done :backoff :backing-off nil :unkown})

 (defn- message-desc [type js]
-  (mapv (fn [[jid {:keys [identity args tid] :as message}]]
-          {:type type :status (readable-status (status type jid)) :id identity :jid jid :tid tid}) (apply hash-map js)))
+  (mapv
+    (fn [[jid {:keys [identity args tid env] :as message}]]
+      {:type type :status (readable-status (status type jid))
+       :env env :id identity :jid jid :tid tid}) (apply hash-map js)))

 (defn queue-status
   "The entire queue message statuses"
@@ -127,7 +129,10 @@
 (defn by-env
    "filter jobs status by envs"
    [envs js]
-   (filter (fn [{:keys [env]}] (envs env)) js))
+   (filter (fn [{:keys [env]}] (info env) (envs env)) js))
+
+#_(defn jobs-status [envs]
+  (merge {:jobs (running-jobs-status)} (done-jobs-status)))

 (defn jobs-status [envs]
   (map-vals