[#12310] "Unknown" screen if press a tag in timeline of another user in user's profile and tap back

Signed-off-by: andrey <b713972e59b8e606e23253c4a13e948139fea4d1@gmail.com>

--- src/status_im/chat/models.cljs
+++ src/status_im/chat/models.cljs
@@ -217,6 +217,8 @@
             (fn [{:keys [db]}]
               {:db (assoc db :current-chat-id chat-id :ignore-close-chat true)})
             (preload-chat-data chat-id)
+            (navigation/change-tab :chat)
+            (navigation/pop-to-root-tab :chat-stack)
             (navigation/navigate-to-cofx :chat nil)))

 (fx/defn handle-clear-history-response


add docs on keys

add docs on keys

--- src/strictly_specking/core.clj
+++ src/strictly_specking/core.clj
@@ -71,7 +71,7 @@

   )

-#_ (init-rules)
+#_ (init-test-rules)

 ;; * strict-keys macro

@@ -619,6 +619,21 @@
      #_ (map println)))
   )

+;; * docs on keys
+;;
+
+;; our own private registry for data on keys
+
+(defonce ^:private registry-ref (atom {}))
+
+(defn def-key-doc [k d]
+  (swap! registry-ref assoc-in [k ::doc] d))
+
+(defn key-doc [k]
+  (get-in @registry-ref [k ::doc]))
+
+
+
 ;; pprint is in annotated-pprint.clj

 ;; create an extra error message addendum


add free to ctas on pricing page

add free to ctas on pricing page

--- src-cljs/frontend/components/outer.cljs
+++ src-cljs/frontend/components/outer.cljs
@@ -254,7 +254,7 @@
                {:href "/trial/solo"
                 :title "Start your free, 2 week trial."
                 :role "button"}
-               "Start trial"]]]
+               "Start free trial"]]]
             [:section.price-divide.left
              [:div.price-divide-line]]
             [:div.price-block.price-team
@@ -271,7 +271,7 @@
                {:href "/trial/team"
                 :title "Start your free, 2 week trial."
                 :role "button"}
-               "Start trial"]]]
+               "Start free trial"]]]
             [:section.price-divide.right
              [:div.price-divide-line]]
             [:div.price-block.price-corp


[#1266] If a migration fails, the exception will have the tenant that failed

--- backend/src/akvo/lumen/migrate.clj
+++ backend/src/akvo/lumen/migrate.clj
@@ -63,10 +63,12 @@
      (do-migrate (ragtime-jdbc/sql-database tenant-manager-db)
                  (:tenant-manager migrations))
      (doseq [tenant (all-tenants tenant-manager-db)]
-       (do-migrate (ragtime-jdbc/sql-database
-                    {:connection-uri (aes/decrypt (get-in system [:config :config :encryption-key])
-                                                  (:db_uri tenant))})
-                   (:tenants migrations))))))
+       (try
+         (do-migrate (ragtime-jdbc/sql-database
+                          {:connection-uri (aes/decrypt (get-in system [:config :config :encryption-key])
+                                                        (:db_uri tenant))})
+                        (:tenants migrations))
+         (catch Exception e (throw (ex-info "Migration failed" {:tenant (:label tenant)} e))))))))

 (defn migrate-tenant


Update selmer to "1.12.12"

Update selmer to "1.12.12"

--- backend/project.clj
+++ backend/project.clj
@@ -45,7 +45,7 @@
                  [ring/ring-core "1.7.1" :exclusions [ring/ring-codec]]
                  [ring/ring-defaults "0.3.2"]
                  [ring/ring-json "0.4.0"]
-                 [selmer "1.11.8"]
+                 [selmer "1.12.12" :exclusions [com.fasterxml.jackson.dataformat/jackson-dataformat-smile com.fasterxml.jackson.dataformat/jackson-dataformat-cbor cheshire]]
                  [net.postgis/postgis-jdbc "2.2.1" :exclusions [org.postgresql/postgresql]]
                  [iapetos "0.1.8" :exclusions [io.prometheus/simpleclient]]
                  [io.prometheus/simpleclient_hotspot "0.5.0"]


Fix call to engine/diff-columns

Fix call to engine/diff-columns

--- backend/src/akvo/lumen/transformation/multiple_column.clj
+++ backend/src/akvo/lumen/transformation/multiple_column.clj
@@ -3,7 +3,7 @@
             [akvo.lumen.transformation.engine :as t.engine]
             [akvo.lumen.transformation.multiple-column.caddisfly :as t.m-c.caddisfly]
             [clojure.tools.logging :as log]
-            [clojure.walk :refer (keywordize-keys)]))
+            [clojure.walk :refer (keywordize-keys stringify-keys)]))

 (defmethod t.engine/valid? :core/extract-multiple
   [op-spec]
@@ -18,5 +18,7 @@
   [deps table-name columns op-spec]
   (let [{:keys [onError op args] :as op-spec} (keywordize-keys op-spec)]
     ;; so far we only implement `caddisfly` in other case we throw exception based on core/condp impl
-    (condp = (-> args :selectedColumn :multipleType)
-      "caddisfly" (t.m-c.caddisfly/apply-operation deps table-name columns op-spec))))
+    (update
+     (condp = (-> args :selectedColumn :multipleType)
+       "caddisfly" (t.m-c.caddisfly/apply-operation deps table-name columns op-spec))
+     :columns stringify-keys)))


Load index.html file

Load index.html file

--- src/wishlistd/views/common.clj
+++ src/wishlistd/views/common.clj
@@ -2,6 +2,8 @@
   (:use noir.core
         hiccup.core
         hiccup.page-helpers))
+
+(defn new-layout [] (slurp "resources/public/index.html"))

 (def initialize-js
 "
@@ -45,7 +47,7 @@
                   [:p {:style "margin-left:700px;margin-right:-100px"}
                    [:input {:id "create-wishlist" :class "btn primary" :type "submit" :value "New wishlist"}]]]
                 [:div.row
-                 [:div.span10
+                 [:div.span10 {:id "box"}
                   [:p "Activate JavaScript, dummy!"]]]]
                 [:footer
                  [:p "© _ME_ 2011"]]]]))


Cleanup from last commit

Cleanup from last commit

--- src/polismath/conversation.clj
+++ src/polismath/conversation.clj
@@ -72,8 +72,8 @@
                           :base-k 50
                           :max-k 12
                           :group-iters 10
-                          :max-ptpts 100000
-                          :max-cmts 1000}
+                          :max-ptpts 80000
+                          :max-cmts 800}
                     opts))

    :zid         (plmb/fnk [conv votes]
@@ -335,9 +335,8 @@
            :else             small-conv-update)
               {:conv conv :votes votes :opts opts})
         ; Remove the :votes key from customs; not needed for persistence
-        (assoc-in
-          [:customs :votes]
-          [])))
+        (assoc-in [:customs :votes] [])
+        (dissoc :keep-votes)))
     (catch Exception e
       ; XXX - hmm... have to figure out how to deal with this hook in production. Shouldn't save things to
       ; disk that are too big, and in fact won't be able to save to disk at all on heroku


yo i changed the message

yo i changed the message

--- src/api/core.clj
+++ src/api/core.clj
@@ -7,4 +7,4 @@
   [request]
   {:status 200
    :headers {"Content-Type" "text/html"}
-   :body "Welcome to Optly beta.  Optly will help you optimize your time with a cutting edge todo list manager."})
+   :body "Welcome to Optly beta.  Optly will help you optimize your time with a cutting edge todo list manager. Don't be a loser use our app! "})


[Fix #3609] Remove showing users profile from 'Creating New Chat' flow

Signed-off-by: Julien Eluard <c768e13f1ba4c3ebed2909a1fc1e4b50bb021a2f@gmail.com>

--- src/status_im/ui/screens/add_new/new_chat/views.cljs
+++ src/status_im/ui/screens/add_new/new_chat/views.cljs
@@ -15,7 +15,7 @@

 (defn- render-row [row _ _]
   [contact-view/contact-view {:contact       row
-                              :on-press      #(re-frame/dispatch [:show-profile (:whisper-identity %)])
+                              :on-press      #(re-frame/dispatch [:start-chat (:whisper-identity %) {:navigation-replace? true}])
                               :show-forward? true}])

 (views/defview new-chat []


changed index hiccup?

changed index hiccup?

--- src/demo/web.clj
+++ src/demo/web.clj
@@ -61,7 +61,7 @@
                    (println "close code:" code "reason:" reason))}))

 (def graph-page
-  (dh/hello true))
+  (dh/index-page true))

 (defroutes routes
 ;  (GET "/counter"  [] counter)


minors

minors

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -81,8 +81,8 @@

 (deftask images-resize
   "Resize images to the provided resolutions.
-  Each image file would have resolution appended to it's name:
-  e.x. san-francisco.jpg would become san-francisco-3840.jpg"
+   Each image file would have resolution appended to it's name:
+   e.x. san-francisco.jpg would become san-francisco-3840.jpg"
   [o out-dir     OUTDIR       str    "the output directory"
    r resolutions RESOLUTIONS  #{int} "resoulitions to which images should be resized"]
   (boot/with-pre-wrap fileset
@@ -106,9 +106,9 @@
 (deftask markdown
   "Parse markdown files

-  This task will look for files ending with `md` or `markdown`
-  and add a `:content` key to their metadata containing the
-  HTML resulting from processing markdown file's content"
+   This task will look for files ending with `md` or `markdown`
+   and add a `:content` key to their metadata containing the
+   HTML resulting from processing markdown file's content"
   [o options OPTS edn "options to be passed to endophile"]
   (let [pod       (create-pod markdown-deps)
         prev-meta (atom {})
@@ -223,7 +223,7 @@
 (defn ^:private default-slug-fn [filename]
   "Parses `slug` portion out of the filename in the format: YYYY-MM-DD-slug-title.ext

-  Jekyll uses the same format by default."
+   Jekyll uses the same format by default."
   (->> (string/split filename #"[-\.]")
        (drop 3)
        drop-last


Suppress output for indirectly run tests

In particular this means we don't print this anymore when running
test.check's test suite:

lein test :only clojure.test.check.clojure-test-test/this-is-supposed-to-fail

FAIL in (this-is-supposed-to-fail) (clojure_test.cljc:22)
expected: result
  actual: false

--- src/test/clojure/clojure/test/check/clojure_test_test.cljc
+++ src/test/clojure/clojure/test/check/clojure_test_test.cljc
@@ -51,9 +51,8 @@

 (defn- capture-test-var
   [v]
-  (doto (with-out-str #?(:clj  (binding [*test-out* *out*] (test-var v))
-                         :cljs (test-var v)))
-    println))
+  (with-out-str #?(:clj  (binding [*test-out* *out*] (test-var v))
+                   :cljs (test-var v))))

 (defn test-ns-hook
   []


Une première version fonctionnelle de l'exercice "Run-length encoding" de Exercism dans la track Clojure

--- exercism/clojure/run-length-encoding/src/run_length_encoding.clj
+++ exercism/clojure/run-length-encoding/src/run_length_encoding.clj
@@ -2,10 +2,8 @@
   (:require [clojure.string :as string :only join]))

 ;; Pensez à faire une version avec reduce
-;; Changer les noms des variables c ==> current-char
-;; Variabiliser (peek (peek acc)) dans un let
 (defn plain-text-to-vector
-  "transform the plain text in a vector of vector of characters"
+  "transforms the plain text in a vector of vector of characters"
   [plain-text]
   (loop [acc [] char-seq plain-text]
     (let [current-char (first char-seq) current-vector (peek acc)]
@@ -15,7 +13,7 @@
             (= current-char (peek current-vector)) (recur (conj (vec (butlast acc)) (conj current-vector current-char)) (rest char-seq)))))))

 (defn vector-to-cipher-text
-  "transform a vector of vector of characters in the run-length encoded string"
+  "transforms a vector of vector of characters in the run-length encoded string"
   [char-seq]
   (->> char-seq
        (map #(vector (let [number-of-chars (count %)]
@@ -33,4 +31,10 @@

 (defn run-length-decode
   "decodes a run-length-encoded string"
-  [cipher-text])
+  [cipher-text]
+  (loop [acc "" char-seq cipher-text stack []]
+    (let [current-char (first char-seq)]
+      (cond
+        (empty? char-seq) acc
+        (java.lang.Character/isDigit current-char) (recur acc (rest char-seq) (vector (if (empty? stack) (java.lang.Character/digit current-char 10) (+ (java.lang.Character/digit current-char 10) (* 10 (last stack))))))
+        :else (recur (str acc (if (empty? stack) (str current-char) (string/join (repeat (last stack) (str current-char))))) (rest char-seq) [])))))


Reference files in input dir in incise middleware.

This is done to avoid deleted files during development still showing
up in the parses atom.

--- src/ring/middleware/incise.clj
+++ src/ring/middleware/incise.clj
@@ -1,10 +1,11 @@
 (ns ring.middleware.incise
   (:require [clojure.java.io :refer [file]]
+            [clojure.set :refer [difference]]
             [ns-tracker.core :refer [ns-tracker]]
             (incise [utils :refer [delete-recursively directory?]]
                     [load :refer [load-parsers-and-layouts]]
                     [config :as conf])
-            [incise.parsers.core :refer [parse]])
+            [incise.parsers.core :refer [parse dissoc-parses]])
   (:import [java.io File]))

 (defonce ^:private file-modification-times (atom {}))
@@ -17,6 +18,17 @@
     (swap! file-modification-times assoc a-file (.lastModified a-file))
     (or (nil? previous-modification-time)
         (< previous-modification-time last-modification-time))))
+
+(def paths-set (atom #{}))
+(defn reference-files
+  "Pass files through with side effects. Call dissoc-parses on deleted paths."
+  [files]
+  (let [old-paths-set @paths-set
+        new-paths-set (set (map (memfn getCanonicalPath) files))
+        deleted-paths (difference old-paths-set new-paths-set)]
+    (dissoc-parses deleted-paths)
+    (reset! paths-set new-paths-set))
+  files)

 (defn wrap-incise-parse
   "Call parse on each modified file in the given dir with each request."
@@ -31,8 +43,9 @@
         (->> (conf/get :in-dir)
              (file)
              (file-seq)
+             (remove directory?)
+             (reference-files)
              (filter modified?)
-             (remove directory?)
              (map parse)
              (dorun)))
       (handler request))))


apparently only need render

apparently only need render

--- src/sierpinski_sieve/core.cljs
+++ src/sierpinski_sieve/core.cljs
@@ -39,8 +39,8 @@
           (paint-row ctx y row size))
         (.fill ctx)))))

-(reagent/render-component [render-canvas]
-                          (. js/document (getElementById "app")))
+(reagent/render [render-canvas]
+                (. js/document (getElementById "app")))

 (defn on-js-reload []
   ;; optionally touch your app-state to force rerendering depending on


♻ Move notified-refresh-thread-factory closer to where it is used

--- src/territory_bro/gis_sync.clj
+++ src/territory_bro/gis_sync.clj
@@ -92,6 +92,11 @@
             (recur))))
       (log/info "Stopped listening for GIS changes"))))

+(defn- until-interrupted [task]
+  (fn []
+    (while (not (.isInterrupted (Thread/currentThread)))
+      (task))))
+
 (defonce ^:private notified-refresh-thread-factory
   (-> (ThreadFactoryBuilder.)
       (.setNameFormat "territory-bro.gis-sync/notified-refresh-%d")
@@ -99,11 +104,6 @@
       (.setUncaughtExceptionHandler executors/uncaught-exception-handler)
       (.build)))

-(defn- until-interrupted [task]
-  (fn []
-    (while (not (.isInterrupted (Thread/currentThread)))
-      (task))))
-
 (mount/defstate notified-refresh
   :start (doto (Executors/newFixedThreadPool 1 notified-refresh-thread-factory)
            (.submit ^Callable (until-interrupted


indentation

indentation

--- src/app/cljs/one/sample/controller.cljs
+++ src/app/cljs/one/sample/controller.cljs
@@ -36,7 +36,7 @@
 (defn get-document
   ([id] (get-document id #(dispatch/fire :document-retrieved %)))
   ([id callback]
-      (callback (get @docs id {:id id :who (:who @state)}))))
+     (callback (get @docs id {:id id :who (:who @state)}))))

 (dispatch/react-to #{:document-requested}
                    (fn [t d]


Update docstring.

Update docstring.

--- src/app/cljs/one/sample/controller.cljs
+++ src/app/cljs/one/sample/controller.cljs
@@ -102,7 +102,8 @@
 (defn add-ns-callback
   "This is the success callback function which will be called when a
   request is successful. Accepts a map of response data.
-  Sets the current state to `:ns-navigating` and adds the `:all-ns` and `:ns-nav` to the application's state."
+  Sets the current state to `:ns-navigating` and adds the `:all-ns` and
+  `:ns-nav` to the application's state."
   [response]
   (swap! state-fnx (fn [old]
                      (assoc old


changed all the future and conditional spanish endings

--- src/babel/espanol/morphology/verbs.cljc
+++ src/babel/espanol/morphology/verbs.cljc
@@ -52,76 +52,76 @@
      (get-in word [:condicional number-and-person])

      (and (= person :1st) (= number :sing) ar-type)
-     (str stem "aría")
+     (str stem "ía")
      (and (= person :1st) (= number :sing) er-type)
-     (str stem "ería")
+     (str stem "ía")
      (and (= person :1st) (= number :sing) ir-type)
-     (str stem "iría")
+     (str stem "ía")

      (and (= person :2nd) (= number :sing) ar-type)
-     (str stem "arías")
+     (str stem "ías")
      (and (= person :2nd) (= number :sing) er-type)
-     (str stem "erías")
+     (str stem "ías")
      (and (= person :2nd) (= number :sing) ir-type)
-     (str stem "irías")
+     (str stem "ías")

      (and (= person :2nd) (= number :sing) ar-type (= usted true))
-     (str stem "aría")
+     (str stem "ía")
      (and (= person :2nd) (= number :sing) er-type (= usted true))
-     (str stem "ería")
+     (str stem "ía")
      (and (= person :2nd) (= number :sing) ir-type (= usted true))
-     (str stem "iría")
+     (str stem "ía")

      (and (= person :3rd) (= number :sing) ar-type)
-     (str stem "aría")
+     (str stem "ía")
      (and (= person :3rd) (= number :sing) er-type)
-     (str stem "ería")
+     (str stem "ía")
      (and (= person :3rd) (= number :sing) ir-type)
-     (str stem "iría")
+     (str stem "ía")

      (and (= person :1st) (= number :plur) ar-type)
-     (str stem "aríamos")
+     (str stem "íamos")

      (and (= person :1st) (= number :plur) er-type)
-     (str stem "eríamos")
+     (str stem "íamos")

      (and (= person :1st) (= number :plur) ir-type)
-     (str stem "iríamos")
+     (str stem "íamos")

      ;; <second person plural conditional>

      (and (= person :2nd) (= number :plur) ar-type vosotros)
-     (str stem "aríais")
+     (str stem "íais")

      (and (= person :2nd) (= number :plur) er-type vosotros)
-     (str stem "eríais")
+     (str stem "íais")

      (and (= person :2nd) (= number :plur) ir-type vosotros)
-     (str stem "iríais")
+     (str stem "íais")

      (and (= person :2nd) (= number :plur) ar-type ustedes)
-     (str stem "arían")
+     (str stem "ían")

      (and (= person :2nd) (= number :plur) er-type ustedes)
-     (str stem "erían")
+     (str stem "ían")

      (and (= person :2nd) (= number :plur) ir-type ustedes)
-     (str stem "irían")
+     (str stem "ían")

      ;; </second person plural conditional>

      ;; <third person plural conditional>
      (and (= person :3rd) (= number :plur)
           ar-type)
-     (str stem "arían")
+     (str stem "ían")

      (and (= person :3rd) (= number :plur)
           er-type)
-     (str stem "erían")
+     (str stem "ían")

      (and (= person :3rd) (= number :plur)
           ir-type)
-     (str stem "irían")
+     (str stem "ían")

      ;; </third person plural conditional>

@@ -129,7 +129,7 @@
      (and (= (get-in word [:agr]) :top)
           (string? (get-in word [:espanol])))
      (get-in word [:espanol])
-
+
      :else
      (exception (str "get-string-1: conditional regular inflection: don't know what to do with input argument: " (strip-refs word))))))

@@ -160,84 +160,84 @@
      (get-in word [:futuro number-and-person])

      (and (= person :1st) (= number :sing) ar-type)
-     (str stem "aré")
+     (str stem "é")
      (and (= person :1st) (= number :sing) er-type)
-     (str stem "eré")
+     (str stem "é")
      (and (= person :1st) (= number :sing) ir-type)
-     (str stem "iré")
+     (str stem "é")

      (and (= person :2nd) (= number :sing) ar-type)
-     (str stem "aras")
+     (str stem "as")
      (and (= person :2nd) (= number :sing) ir-type)
-     (str stem "iras")
+     (str stem "as")
      (and (= person :2nd) (= number :sing) er-type)
-     (str stem "eras")
-
+     (str stem "as")
+
      (and (= person :2nd) (= number :sing) ar-type (= usted true))
-     (str stem "ará")
+     (str stem "á")
      (and (= person :2nd) (= number :sing) ir-type (= usted true))
-     (str stem "irá")
+     (str stem "á")
      (and (= person :2nd) (= number :sing) er-type (= usted true))
-     (str stem "erá")
+     (str stem "á")

      (and (= person :3rd) (= number :sing) ar-type)
-     (str stem "ará")
+     (str stem "á")
      (and (= person :3rd) (= number :sing) ir-type)
-     (str stem "irá")
+     (str stem "á")
      (and (= person :3rd) (= number :sing) er-type)
-     (str stem "erá")
+     (str stem "á")

      (and (= person :1st) (= number :plur) ar-type)
-     (str stem "aremos")
+     (str stem "emos")

      (and (= person :1st) (= number :plur) er-type)
-     (str stem "eremos")
+     (str stem "emos")

      (and (= person :1st) (= number :plur) ir-type)
-     (str stem "iremos")
+     (str stem "emos")

      ;; <second person plural future>

      (and (= person :2nd) (= number :plur) ar-type vosotros)
-     (str stem "arais")
+     (str stem "ais")

      (and (= person :2nd) (= number :plur) er-type vosotros)
-     (str stem "erais")
+     (str stem "ais")

      (and (= person :2nd) (= number :plur) ir-type vosotros)
-     (str stem "irais")
+     (str stem "ais")

      (and (= person :2nd) (= number :plur) ar-type ustedes)
-     (str stem "aran")
+     (str stem "an")

      (and (= person :2nd) (= number :plur) er-type ustedes)
-     (str stem "eran")
-
+     (str stem "an")
+
      (and (= person :2nd) (= number :plur) ir-type ustedes)
-     (str stem "iran")
+     (str stem "an")

      ;; </second person plural future>

      ;; <third person plural future>
      (and (= person :3rd) (= number :plur)
           ar-type)
-     (str stem "aran")
+     (str stem "an")

      (and (= person :3rd) (= number :plur)
           er-type)
-     (str stem "eran")
+     (str stem "an")

      (and (= person :3rd) (= number :plur)
           ir-type)
-     (str stem "iran")
-
+     (str stem "an")
+
      ;; </third person plural future>

      ;; agreement is underspecified, but an infinitive form (the :espanol key) exists, so just return that infinitive form.
      (and (= (get-in word [:agr]) :top)
           (string? (get-in word [:espanol])))
      (get-in word [:espanol])
-
+
      :else
      (let [message (str "get-string-1: future regular inflection: don't know what to do with input argument: " (strip-refs word))]
        (if (= suppress-morph-exceptions true)
@@ -330,7 +330,7 @@
      (and (= person :3rd) (= number :plur)
           ir-type)
      (str stem "ían")
-
+
      ;; </third person plural imperfecto>

      ;; agreement is underspecified, but an infinitive form (the :espanol key) exists, so just return that infinitive form.
@@ -363,7 +363,7 @@
                        (exception (str "Can't regex-find on non-string: " infinitive " from word: " word))))
         er-type (re-find #"er$" infinitive)
         ir-type (re-find #"ir$" infinitive)
-
+
         stem (cond (and (get-in word [:boot-stem])
                         (or (= (get-in word [:agr :number])
                                :sing)
@@ -374,7 +374,7 @@
                    (get-in word [:boot-stem])
                    true
                    (string/replace infinitive #"[iae]r$" ""))
-
+
         last-stem-char-is-i (re-find #"ir$" infinitive)
         last-stem-char-is-e (re-find #"er$" infinitive)
         is-care-or-gare? (re-find #"[cg]ar$" infinitive)
@@ -384,7 +384,7 @@
     (cond
      (get-in word [:present number-and-person])
      (get-in word [:present number-and-person])
-
+
      (and (= person :1st) (= number :sing))
      (str stem "o")

@@ -393,7 +393,7 @@

      (and (= person :2nd) (= number :sing) ar-type usted)
      (str stem "a")
-
+
      (and (= person :2nd) (= number :sing) (or ir-type er-type) (= false usted))
      (str stem "es")

@@ -413,7 +413,7 @@

      (and (= person :1st) (= number :plur) ir-type)
      (str stem "imos")
-
+
      ;; <second person plural present>

      (and (= person :2nd) (= number :plur) ar-type vosotros)
@@ -448,7 +448,7 @@
      (str stem "en")

      ;; </third person plural present>
-
+
      ;; agreement is underspecified, but an infinitive form (the :espanol key) exists, so just return that infinitive form.
      (and (= (get-in word [:agr]) :top)
           (string? (get-in word [:espanol])))
@@ -510,7 +510,7 @@
    true (regular-preterito word {:usted usted
                                  :vosotros vosotros
                                  :ustedes ustedes})))
-
+
 (defn regular-preterito [word {usted :usted
                                vosotros :vosotros
                                ustedes :ustedes}]
@@ -524,10 +524,10 @@
         ir-type (re-find #"ir$" infinitive)

         zar-type (re-find #"zar$" infinitive)
-
+
         ;; default stem: will be used except under certain conditions, as described in next check.
         stem (string/replace infinitive #"[iae]r$" "")
-
+
         stem (if (get-in word [:preterito-stem])
                (get-in word [:preterito-stem])
                stem)
@@ -537,29 +537,29 @@
                       (= number :sing))
                (string/replace infinitive #"zar$" "c")
                stem)
-
+
         last-stem-char-is-i (re-find #"ir$" infinitive)
         last-stem-char-is-e (re-find #"er$" infinitive)
         is-care-or-gare? (re-find #"[cg]ar$" infinitive)
         vosotros (if vosotros vosotros true)
         ustedes (if ustedes ustedes false)]
-
+
     (cond
      (and (= person :1st) (= number :sing) ar-type)
      (str stem "é")
-
+
      (and (= person :1st) (= number :sing) (or ir-type er-type))
      (str stem "í")
-
+
      (and (= person :2nd) (= number :sing) ar-type (= usted false))
      (str stem "aste")
-
+
      (and (= person :2nd) (= number :sing) (or ir-type er-type) (= usted false))
      (str stem "iste")
-
+
      (and (= person :2nd) (= number :sing) ar-type (= usted true))
      (str stem "ó")
-
+
      (and (= person :2nd) (= number :sing) (or ir-type er-type) (= usted true))
      (str stem "ió")

@@ -582,10 +582,10 @@

      (and (= person :2nd) (= number :plur) ar-type vosotros)
      (str stem "asteis")
-
+
      (and (= person :2nd) (= number :plur) er-type vosotros)
      (str stem "isteis")
-
+
      (and (= person :2nd) (= number :plur) ir-type vosotros)
      (str stem "isteis")

@@ -617,7 +617,7 @@
      (and (= (get-in word [:agr]) :top)
           (string? (get-in word [:espanol])))
      (get-in word [:espanol])
-
+
      :else
      (let [message (str "get-string-1: conditional regular inflection: don't know what to do with input argument: " (strip-refs word))]
        (if (= suppress-morph-exceptions true)


use today if base-date is not specified

use today if base-date is not specified

--- src/cljs/searchbot/input/timerange.cljs
+++ src/cljs/searchbot/input/timerange.cljs
@@ -12,7 +12,9 @@

 (defn- ->moment
   ([] (js/moment))
-  ([timestamp] (js/moment timestamp)))
+  ([timestamp] (if timestamp
+                 (js/moment timestamp)
+                 (-> (js/moment) (.startOf "day")))))

 (defn- gen-query!
   [cursor]
@@ -60,7 +62,7 @@
                (-> (om/get-node owner "base-date")
                    js/$
                    (.pickadate (clj->js
-                                {:format (:format opts) :max (:base-date cursor) :min (.format min-date)
+                                {:format (:format opts) :max (or (:base-date cursor) true) :min (.format min-date)
                                  :onSet (fn [context]
                                           (if-let [selected (-> context (.. -select))]
                                             (do


Removed fact library - not part of core Compojure libs

--- test/fact.clj
+++ test/fact.clj
@@ -1,209 +0,0 @@
-(ns fact)
-
-(defn rand-ints
-  "Generate an infinite sequence of random integers."
-  ([]
-    (rand-ints -65535 65535))
-  ([min max]
-    (repeatedly #(+ (rand-int (- max min)) min))))
-
-(defn rand-elems
-  "Generate an infinite sequence of random elements from a collection."
-  [coll]
-  (let [v (vec coll)]
-    (repeatedly
-      #(v (rand-int (count v))))))
-
-(defn rand-seqs
-  "Generate an infinite sequence of random length sequences created by
-  a function f."
-  ([f]
-    (rand-seqs f 0 100))
-  ([f min max]
-    (map #(take % (f))
-          (rand-ints min max))))
-
-(def ascii-lower   "abcdefghijklmnopqrstuvwxyz")
-(def ascii-upper   "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
-(def ascii-letters (str ascii-upper ascii-lower))
-(def digits        "01234567890")
-(def punctuation   ".,:;!?\"'`<>()[]{}-")
-(def white-space   " \t\n")
-
-(defn rand-strs
-  "Generate a sequence of random strings."
-  ([]
-    (rand-strs
-      (str ascii-letters digits punctuation white-space)))
-  ([chars]
-    (rand-strs chars 0 100))
-  ([chars min max]
-    (map (partial apply str)
-         (rand-seqs #(rand-elems chars) min max))))
-
-(defstruct fact-info
-  :doc
-  :test
-  :pending?
-  :params
-  :values)
-
-(defmacro fact
-  "Define a documented fact that can be verified via a series of test values
-  applied to a test expression. If the expression evaluates to true for all
-  values, the fact is verified.
-
-  e.g. (fact \"The length of a list equals the sum of the length of its parts\"
-         [x (rand-seqs rand-ints)
-          y (rand-seqs rand-ints)]
-         (= (count (concat x y))
-            (+ (count x) (count y))))"
-  ([doc]
-   `(fact ~doc nil))
-  ([doc value-map & expr]
-    (let [pairs  (partition 2 value-map)
-          params (map first pairs)
-          values (map second pairs)]
-     `(def ~(gensym "fact")
-        (struct-map fact-info
-          :doc      ~doc
-          :test     (fn [~@params] ~@expr)
-          :pending? ~(nil? value-map)
-          :params  '~(vec params)
-          :values   ~(vec values))))))
-
-(defmacro stub
-  "Create function stubs for isolated unit tests.
-  e.g. (stub [(f 1 2) 3
-              (f 3 2) 5]
-         (= (+ (f 1 2) (f 3 2))
-            8))"
-  [stubs & body]
-  (let [stub-pairs (partition 2 stubs)
-        fold-map   (fn [acc [[f & args] ret]]
-                      (assoc-in acc [f `(list ~@args)] ret))
-        bind-stub  (fn [[fname fhash]]
-                     `(~fname (fn [& args#] (~fhash args#))))]
-    `(binding
-       [~@(mapcat bind-stub (reduce fold-map {} stub-pairs))]
-       ~@body)))
-
-(def #^{:doc "The maximum amount of test values to use per fact."}
-  *max-amount* 50)
-
-(defn- test-cases
-  "Make a sequence of test cases from a number of test value sequences. The
-  number of test cases is limited to *max-amount*. If the values sequences
-  are of uneven length, the sequences are repeated up to the length of the
-  largest value sequence."
-  [vals]
-  (if (seq vals)
-    (let [bounded-vals   (map #(take *max-amount* %) vals)
-          max-count      (apply max (map count bounded-vals))
-          same-size-vals (map #(take max-count (cycle %)) bounded-vals)]
-      (apply map vector same-size-vals))
-    [[]]))
-
-(defn- run-tests
-  "Run a function with a collection of test-cases and return the results."
-  [func test-cases]
-  (map
-    (fn [vals]
-      (try
-        (if (apply func vals)
-          [:success vals]
-          [:failure vals])
-      (catch Exception e
-        [:exception [e vals]])
-      (catch Error e
-        [:exception [e vals]])))
-    test-cases))
-
-(defn- filter-category
-  "Filter a sequence of results matching the supplied category."
-  [category results]
-  (map second
-    (filter #(= category (first %)) results)))
-
-(defstruct result
-  :fact
-  :successes
-  :failures
-  :exceptions)
-
-(defn verify
-  "Verify a single fact."
-  [fact]
-  (if (fact :pending?)
-    (struct result fact nil nil nil)
-    (let [results (run-tests
-                    (fact :test)
-                    (test-cases (fact :values)))]
-      (struct-map result
-        :fact       fact
-        :successes  (filter-category :success   results)
-        :failures   (filter-category :failure   results)
-        :exceptions (filter-category :exception results)))))
-
-(defn- get-facts
-  "Get all the functions beginning with 'fact' from a namespace."
-  [ns]
-  (map (comp var-get second)
-       (filter
-         (fn [[k f]] (.startsWith (name k) "fact"))
-         (ns-publics ns))))
-
-(defn verify-facts
-  "Get a lazy list of results from all the facts in a namespace."
-  ([]   (verify-facts *ns*))
-  ([ns] (map verify (get-facts ns))))
-
-(def #^{:doc "PrintWriter to which test results are printed; defaults to
-  System.out."}
-  *test-out* System/out)
-
-(defn- format-params
-  "Format a collection of parameters and values to a string."
-  [params values]
-  (pr-str
-    (apply hash-map
-      (interleave params values))))
-
-(defn- format-exception
-  "Format an exception thrown by a test as a string."
-  [result]
-  (let [[exception values] (first (result :exceptions))]
-    (str "\n  EXCEPTION: "
-      (format-params ((result :fact) :params) values)
-      "\n  => " exception)))
-
-(defn- format-failure
-  "Format a failed result as a string."
-  [result]
-  (str "\n  FAILURE: "
-    (format-params ((result :fact) :params)
-                   (first (result :failures)))))
-
-(defn- format-result
-  "Format a single result from a verified fact."
-  [result]
-  (let [fact (result :fact)]
-    (str
-      "- " (fact :doc)
-      (if (fact :pending?)
-        " (pending)"
-        (cond
-          (seq (result :exceptions)) (format-exception result)
-          (seq (result :failures))   (format-failure result))))))
-
-(defn print-results
-  "Prints a summary of the results from a set of verified facts to *test-out*."
-  [& results]
-  (let [results (apply concat results)]
-    (doseq [result results]
-      (.println *test-out* (format-result result)))
-    (.println *test-out*
-      (str (count results) " facts, "
-           (count (filter (comp :pending? :fact) results)) " pending, "
-           (count (filter (comp seq :failures) results)) " failed, "
-           (count (filter (comp seq :exceptions) results)) " exceptions"))))


First draft of incremental update of wishlists

--- src/wishlistd/models/redis.clj
+++ src/wishlistd/models/redis.clj
@@ -46,3 +46,12 @@
   (r/with-server db
     (when-let [old (read-wishlist code)]
       (update-wishlist (merge old wishlist)))))
+
+(defn update-merge-new [{:keys [code] :as wishlist}]
+  "Allows incremental updates by merging old and new wishlist maps."
+  (r/with-server db
+    (when-let [old (read-wishlist code)]
+      (let [wishes (merge (:wishes old) (:wishes wishlist))
+            no-nils (remove-map-nils wishes)
+            neu (assoc wishlist :wishes no-nils)]
+      (update-wishlist (merge old neu)))))


B-spline instead of catmull-rom, far smoother

--- desktop/src-common/ds3/splines.clj
+++ desktop/src-common/ds3/splines.clj
@@ -7,7 +7,7 @@

 (declare calibrate-spline points-to-vector-2 update-spline)

-(def speed (c/screen-to-world 6.0))
+(def speed (c/screen-to-world 6))

 (def d-time (/ 1.0 60))

@@ -27,14 +27,14 @@
         x-left (< x hw)
         x-fn (if x-left + -)
         x1 (if x-left hook-near-x hook-width-near-x)
-        x2 (if x-left hook-width-far-x hook-far-x)
+        x2 (if x-left hook-width-near-x hook-near-x)
         x3 (if x-left 0 (c/screen-to-world c/game-width))
         ty (- y hook-near-x)
-        dy (/ (- ty hook-near-x) 4.0)
+        dy (/ (- ty hook-near-x) 5)
         points [[x y][x y][x (+ y hook-near-x)][(x-fn x hook-near-x) (+ y hook-near-x)][(x-fn x hook-near-x) ty]
-                [x1 (- ty dy)][x2 (- ty (* 2 dy))][x2 (- ty (* 3 dy))][x1 hook-near-x][x3 (- hook-far-x)][x3 (- hook-far-x)]]
+                [x1 (- ty dy)][x1 (- ty (* 2 dy))][x2 (- ty (* 3 dy))][x2 (- ty (* 4 dy))][x1 hook-near-x][x3 (- hook-far-x)][x3 (- hook-far-x)]]
         points-vec (points-to-vector-2 points)
-        spline (catmull-rom-spline points-vec false)]
+        spline (b-spline points-vec 3 false)]
     spline))

@@ -45,16 +45,14 @@
                          (- (:current-time entity) 1)
                          (:current-time entity))
           spline (:spline entity)
-          v (catmull-rom-spline! spline :value-at (vector-2 0 0) current-time)
-          dv (catmull-rom-spline! spline :derivative-at (vector-2 0 0) current-time)
+          v (b-spline! spline :value-at (vector-2 0 0) current-time)
+          dv (b-spline! spline :derivative-at (vector-2 0 0) current-time)
           l (vector-2! dv :len)
           a (- (vector-2! dv :angle) 90)
           new-delta (/ (* delta-time speed) l)
           x (x v)
           y (y v)]
       (body-position! entity x y a)
-      (assoc entity
-        ;:x x :y y :angle a
-        :current-time (+ current-time new-delta)))
+      (assoc entity :current-time (+ current-time new-delta)))
     ))


using goog.string

using goog.string

--- src-cljs/flatride/frontend.cljs
+++ src-cljs/flatride/frontend.cljs
@@ -1,9 +1,11 @@
 (ns flatride.frontend
     (:use-macros
         [dommy.macros :only [node sel sel1]])
-    (:use [flatride.utils :only [log]])
+    (:use [flatride.utils :only [log slope-diff]])
     (:require
         [flatride.core :as core]
+        [goog.string :as gstring]
+        [goog.string.format]
         [dommy.core :as dommy]))


Fixed kibit errors in index-set.

Fixed kibit errors in index-set.

Also reformatted some of the long lines.

--- index-set-app/src/cmr/index_set/services/index_service.clj
+++ index-set-app/src/cmr/index_set/services/index_service.clj
@@ -56,7 +56,8 @@
            {(keyword index-name) (gen-valid-index-name prefix-id index-name)})))

 (defn prune-index-set
-  "Returns the index set with only the id, name, and a map of concept types to the index name map."
+  "Returns the index set with only the id, name, and a map of concept types to
+  the index name map."
   [index-set]
   (let [prefix (:id index-set)]
     {:id (:id index-set)
@@ -94,7 +95,7 @@
   [index-set]
   (let [index-set-id (get-in index-set [:index-set :id])
         json-index-set-str (json/generate-string index-set)]
-    (when-not (and (integer? index-set-id) (> index-set-id 0))
+    (when-not (and (integer? index-set-id) (pos? index-set-id))
       (m/invalid-id-msg index-set-id json-index-set-str))))

 (defn id-name-existence-check
@@ -156,7 +157,8 @@
     (es/save-document-in-elastic context index-name idx-mapping-type doc-id es-doc)))

 (defn create-index-set
-  "Create indices listed in index-set. Rollback occurs if indices creation or index-set doc indexing fails."
+  "Create indices listed in index-set. Rollback occurs if indices creation or
+  index-set doc indexing fails."
   [context index-set]
   (validate-requested-index-set context index-set false)
   (let [index-names (get-index-names index-set)
@@ -194,7 +196,8 @@
     (index-requested-index-set context index-set)))

 (defn delete-index-set
-  "Delete all indices having 'id_' as the prefix in the elastic, followed by index-set doc delete"
+  "Delete all indices having 'id_' as the prefix in the elastic, followed by
+  index-set doc delete"
   [context index-set-id]
   (let [index-names (get-index-names (get-index-set context index-set-id))
         {:keys [index-name mapping]} es-config/idx-cfg-for-index-sets
@@ -208,8 +211,10 @@
   (if rebalancing-colls
     (if (contains? (set rebalancing-colls) concept-id)
       (errors/throw-service-error
-       :bad-request
-       (format "The index set already contains rebalancing collection [%s]" concept-id))
+        :bad-request
+        (format
+          "The index set already contains rebalancing collection [%s]"
+          concept-id))
       (conj rebalancing-colls concept-id))
     #{concept-id}))

@@ -220,18 +225,22 @@
     (if (contains? rebalancing-colls-set concept-id)
       (seq (disj rebalancing-colls-set concept-id))
       (errors/throw-service-error
-       :bad-request
-       (format "The index set does not contain the rebalancing collection [%s]" concept-id)))))
+        :bad-request
+        (format
+          "The index set does not contain the rebalancing collection [%s]"
+          concept-id)))))

 (defn- add-new-granule-index
-  "Adds a new granule index for the given collection. Validates the collection does not already have
-   an index."
+  "Adds a new granule index for the given collection. Validates the collection
+  does not already have an index."
   [index-set collection-concept-id]
   (let [existing-index-names (->> (get-in index-set [:index-set :granule :indexes]) (map :name) set)
         _ (when (contains? existing-index-names collection-concept-id)
             (errors/throw-service-error
              :bad-request
-             (format "The collection [%s] already has a separate granule index" collection-concept-id)))
+             (format
+               "The collection [%s] already has a separate granule index"
+               collection-concept-id)))
         individual-index-settings (get-in index-set [:index-set :granule :individual-index-settings])]
     (update-in index-set [:index-set :granule :indexes]
                conj
@@ -242,29 +251,43 @@
   "Marks the given collection as rebalancing in the index set."
   [context index-set-id concept-id]
   (let [index-set (get-index-set context index-set-id)
-        ;; Add the collection to the list of rebalancing collections. Also does validation.
-        index-set (update-in index-set [:index-set :granule :rebalancing-collections]
-                   add-rebalancing-collection concept-id)
+        ;; Add the collection to the list of rebalancing collections. Also
+        ;; does validation.
+        index-set (update-in
+                    index-set
+                    [:index-set :granule :rebalancing-collections]
+                    add-rebalancing-collection concept-id)
         index-set (add-new-granule-index index-set concept-id)]

-    ;; Update the index set. This will create the new collection indexes as needed.
+    ;; Update the index set. This will create the new collection indexes as
+    ;; needed.
     (update-index-set context index-set)))

 (defn finalize-collection-rebalancing
   "Removes the collection from the list of rebalancing collections"
   [context index-set-id concept-id]
   (let [index-set (get-index-set context index-set-id)
-        ;; Remove the collection from the list of rebalancing collections. Also does validation.
-        index-set (update-in index-set [:index-set :granule :rebalancing-collections]
-                   remove-rebalancing-collection concept-id)]
+        ;; Remove the collection from the list of rebalancing collections.
+        ;; Also does validation.
+        index-set (update-in
+                    index-set
+                    [:index-set :granule :rebalancing-collections]
+                    remove-rebalancing-collection
+                    concept-id)]
     (update-index-set context index-set)))

 (defn reset
-  "Put elastic in a clean state after deleting indices associated with index-sets and index-set docs."
+  "Put elastic in a clean state after deleting indices associated with index-
+  sets and index-set docs."
   [context]
   (let [{:keys [index-name mapping]} es-config/idx-cfg-for-index-sets
         idx-mapping-type (first (keys mapping))
-        index-set-ids (map #(first %) (es/get-index-set-ids (context->es-store context) index-name idx-mapping-type))]
+        index-set-ids (map
+                        first
+                        (es/get-index-set-ids
+                          (context->es-store context)
+                          index-name
+                          idx-mapping-type))]
     ;; delete indices assoc with index-set
     (doseq [id index-set-ids]
       (delete-index-set context (str id)))))
@@ -278,5 +301,3 @@
     {:ok? ok?
      :dependencies {:elastic_search elastic-health
                     :echo echo-rest-health}}))
-
-


Use CLBlast's omatcopy for ge-copy.

Use CLBlast's omatcopy for ge-copy.

--- src/clojure/uncomplicate/neanderthal/opencl/clblast.clj
+++ src/clojure/uncomplicate/neanderthal/opencl/clblast.clj
@@ -211,7 +211,7 @@

 ;; =============== Common GE matrix macros and functions =======================

-(defmacro ^:private ge-swap-copy [queue method a b]
+(defmacro ^:private ge-swap [queue method a b]
   `(when (< 0 (.count ~a))
      (let [ld-a# (.stride ~a)
            sd-a# (.sd ~a)
@@ -237,6 +237,14 @@
              (~method sd-a# buff-a# (+ offset-a# (* ld-a# j#)) 1 buff-b# (+ offset-b# j#) fd-b#
               ~queue nil)
              nil))))))
+
+(defmacro ^:private ge-copy [queue method a b]
+  `(when (< 0 (.count ~a))
+     (with-check error
+       (~method (.order ~a) (if (= (.order ~a) (.order ~b)) NO_TRANS TRANS) (.mrows ~a) (.ncols ~a)
+        1.0 (cl-mem (.buffer ~a)) (.offset ~a) (.ld ~a) (cl-mem (.buffer ~b)) (.offset ~b) (.ld ~b)
+        ~queue nil)
+       nil)))

 (defmacro ^:private ge-scal-set [queue method alpha a]
   `(when (< 0 (.count ~a))
@@ -602,10 +610,10 @@
     (equals-ge ctx queue prog ^CLGEMatrix a ^CLGEMatrix b))
   BLAS
   (swap [_ a b]
-    (ge-swap-copy queue CLBlast/CLBlastDswap ^CLGEMatrix a ^CLGEMatrix b)
+    (ge-swap queue CLBlast/CLBlastDswap ^CLGEMatrix a ^CLGEMatrix b)
     a)
   (copy [_ a b]
-    (ge-swap-copy queue CLBlast/CLBlastDcopy ^CLGEMatrix a ^CLGEMatrix b)
+    (ge-copy queue CLBlast/CLBlastDomatcopy ^CLGEMatrix a ^CLGEMatrix b)
     b)
   (scal [_ alpha a]
     (ge-scal-set queue CLBlast/CLBlastDscal alpha ^CLGEMatrix a)
@@ -643,10 +651,10 @@
     (equals-ge ctx queue prog ^CLGEMatrix a ^CLGEMatrix b))
   BLAS
   (swap [_ a b]
-    (ge-swap-copy queue CLBlast/CLBlastSswap ^CLGEMatrix a ^CLGEMatrix b)
+    (ge-swap queue CLBlast/CLBlastSswap ^CLGEMatrix a ^CLGEMatrix b)
     a)
   (copy [_ a b]
-    (ge-swap-copy queue CLBlast/CLBlastScopy ^CLGEMatrix a ^CLGEMatrix b)
+    (ge-copy queue CLBlast/CLBlastSomatcopy ^CLGEMatrix a ^CLGEMatrix b)
     b)
   (scal [_ alpha a]
     (ge-scal-set queue CLBlast/CLBlastSscal alpha ^CLGEMatrix a)


the joy of clojure: more about defrecord and deftypes

--- src/clojure_learning/chap-9-combining-data-and-code.clj
+++ src/clojure_learning/chap-9-combining-data-and-code.clj
@@ -13,12 +13,10 @@
 ;; switching to a new namespace + creating if not already:
 (in-ns 'chap9)
 (def books [:clojure])
-
 books ; [:clojure]

 ;; switching to a new namespace
 (in-ns 'other-ns)
-
 ;; refer to chap9 ns
 (refer 'chap9)

@@ -43,30 +41,289 @@
 ;; the :use directive says use everything from that ns, without the need for prefixing the things.
 ;; the :as defines an alias for the given things.

+;; NOTE: after reading the braveclojure-multimethods tut, we can dig further into the fun-clojure.
+;; When the time comes and we [derive] many types, from a type that is augmented with the multi-method
+;; protocol, we may want to [prefer-method] a certain method over other. if we didnt specify a
+;; [prefer-method] than we would have a runtime exception: no prefered-method is defined, dont know
+;; which one to choose.
+;; Clojure maintains a global schema resolution for type hierarchies, that consults to yield a
+;; certain multi-method implementation by the value returned by dispatching-function.
+;; Clojure provides the option to not polute the global data-structure with all the type derivations
+;; in the form of a custom-hierarchy. this is possible so that we can define more specific the
+;; type-hierarchy schema resolution for dispatching multi-methods.
+
+;; using [juxt] we can model some neat dynamic output of the dispatching function.
+(doc juxt)
+(defn juxt-funcs [vectorize mk-hash-set] (juxt vectorize mk-hash-set))
+(def juxt-args (juxt-funcs #(vec %) #(apply hash-set %)))
+(juxt-args '(1 2 3)) ; [[1 2 3] #{1 3 2}]
+
+;; juxt takes a set of functions, and returns a curried function back, the returned closure
+;; takes an argument and applies each "fixed" function(from the partial funcs) on the argument.
+;; (juxt func1 func2 -> (fn [arg] [(func1 arg) (func2 arg)])
+
+((juxt vec hash-set) [1 2 3]) ; [[1 2 3] #{[1 2 3]}]
+
+;; notice here that without using "apply", "hash-set" invoked on vector -> yields #{[]}.
+
+;; THERE'S SOME INTERESTING THINGS WITH MULTI-METHODS AND JUXT :) READ ON FROM JOY-CLOJURE
+;; we can define a multi-method which uses the [juxt] power to build a dynamic dispatching value:
+(defmulti compile-cmd (juxt :os :compiler))
+(defmethod compile-cmd ['unix 'gcc]
+  [context] (str "/usr/bin/" (get context :c-compiler)))
+(defmethod compile-cmd ['ios 'gacc]
+  [context] (str "some path for ios devices: " (get context :c-compiler)))
+
+;; demo:
+(compile-cmd {:os 'unix :compiler 'gcc}) ;; /usr/bin/
+(compile-cmd {:os 'ios :compiler 'gacc :c-compiler "ios-compiler-here"})
+
+;; the dispatch values for the compile-cmd is a vector, that is the result of invoking the dispatching
+;; function: using [juxt] take the 2 functions which when invoked on the bound values for each defined method
+;; yield the right "annotated" method for dispatching to.
+
+
+;; multimethods allow for polymorphic dispatch based on arbitrary functions.
+
+(defn present [name] (str "name is " name))
+(defn ask-question [question] (str "asking a stupid question: " question))
+((juxt present ask-question) "maxi max")
+
+;; The use of defrecord buys you several important benefits. For instance, it provides a
+;; simple and specific idiom for documenting the expected fields of the object. But it
+;; also delivers several important performance improvements. A record is created more
+;; quickly, consumes less memory, and looks up keys in itself more quickly than the
+;; equivalent array map or hash map. Record types can also store primitive values (byte,
+;; int, long, and so on), which take up considerably less memory than the equivalent
+
+;; playground: implement the binary-tree from chap5 using Records, instead of Maps, this should be much faster
+;; Requirements:
+;; the binary-tree should have 2 funcs: xconj + xseq; class-based object versions.

 (defrecord TreeNode [val l-branch r-branch])
-(def customer (->TreeNode 4 nil nil))
-
-(str (:val customer)) ; "cclaudiu"
-(keys customer)       ; (:val :l-branch :r-branch)
+(TreeNode. 5 nil nil)  ; user.TreeNode{:val 5, :l-branch nil, :r-branch nil}
+(->TreeNode 3 nil nil)
+(map->TreeNode {:l-branch nil :r-branch nil :val "cclaudiu"})
+;; 3 ways of instantiating the defrecord Type.
+
+;; use-case for TreeNode:
+;; (xconj num-types (range 1 4))
+;; (xconj num-types (range 5 8))
+
+;;           TreeNode
+;;       val: nums-category
+;;   l-branch     r-branch
+;;   ----------|---------
+;;   |                  |
+;; even                odd
+;; val: 2 4 6        val: 1 3 5
+;; l:nil r:nil      l:nil   r:nil
+
+(ns records
+  (:import java.util.Date))
+
+(defrecord TreeNode [value l-branch r-branch])

 (defn xconj
-  [node val]
-  (if (nil? node)
-    (->TreeNode val nil nil)
-    (if (< val (:val node))
-      (->TreeNode (:val node) (xconj (:l-branch node) val) (:r-branch node))
-      (->TreeNode (:val node) (:l-branch node) (xconj (:r-branch node) val)))))
-
-(def job (xconj customer 2))
-job                      ;; TreeNode{:val 4,
-;;    :l-branch                                               :r-branch nil}
-;; #user.TreeNode{:val 2, :l-branch nil, :r-branch nil}
-
-
-;; listing a binary tree:
+  [tree nums]
+  (if (nil? tree)
+    (->TreeNode nums nil nil)
+    (if-let [even-nums (seq (filter even? nums))]
+      (if-let [odd-nums (seq (remove even? nums))]
+        (->TreeNode (:value tree) (xconj (:l-branch tree) even-nums) (xconj (:r-branch tree) odd-nums))
+        (->TreeNode (:value tree) (xconj (:l-branch tree) even-nums) (:r-branch tree)))
+      (->TreeNode (:value tree) (:l-branch tree) (xconj (:r-branch tree) (remove even? nums)))
+     )))
+
+;; define one start binary-tree
+(def num-container (->TreeNode "numeric-aggregations" nil nil))
+
+;; conj into the binary-tree num container
+(def nums-categorization (xconj num-container (range 1 6)))
+;; output-readable-format:
+
+;;         TreeNode{:value "numeric-aggregations",
+;;    :l-branch                           :r-branch
+;;    TreeNode{:value (2 4),              TreeNode{:value (1 3 5),
+;; :l-branch nil, :r-branch nil},         :l-branch nil, :r-branch nil}}
+
+;; denormalizing into a seqable collection the binary-tree numeric values:
 (defn xseq [tree]
   (when tree
-    (lazy-cat (xseq (:l-branch tree)) [(:val tree)] (xseq (:r-branch tree)))))
-(xseq job) ; (2 4)
-
+    (lazy-cat (xseq (:l-branch tree)) (seq (:value tree)) (xseq (:r-branch tree)))))
+(filter number? (xseq nums-categorization))  ;; (2 4, 1 3 5)
+
+;;;;;;;;;;;;;;;
+;; Protocols in Clojure
+;;;;;;;;;;;;;;;
+;; A procotol in clojure is a collection of abstract functions(signatures) each with at least one parameter
+;; that have a collective name. They are like interfaces in Java.
+;; The type of the first parameter is important as the dispatching is done polymorphically based on it.
+;; But in order for a protocol to do any good, something must implement it. Protocols
+;; are implemented using one of the extend forms: extend, extend-type,5 or
+;; extend-protocol.
+;; Each of these does essentially the same thing, but extend-type and
+;; extend-protocol are convenience macros for when you want to provide multiple
+;; functions for a given type
+(defprotocol FIXO
+  (fixo-push [fixo value])
+  (fixo-pop [fixo])
+  (fixo-peek [fixo]))
+
+(extend-type TreeNode
+  FIXO
+  (fixo-push
+     [node value]
+     (xconj node value)))
+
+;; this is better than defining a single-self-contained function, because protocols allows for polymorphism.
+;; -> the same function can have a different implementation for a extended-type.
+
+;; we can extend core-vector implementation by augmenting it with the FIXO protocol:
+(extend-type clojure.lang.IPersistentVector
+  FIXO
+  (fixo-push [vc value]
+    (conj vc value)))
+
+(fixo-push [] "some") ; ["some"]
+
+;; here we're augmenting the Interface not a concrete class, that means any impl that extends from this interface
+;; will have out of the box the protocol implementation at its use.
+
+;; one thing to mention is that we cannot define partially that a type extends a protocol, and bind implementation
+;; partially (not for all the functions defined by the protocol). In clojure augmenting a Type with a protocol
+;; is Protocol based and does not augment on function granularity. There's a small trick here. Using clojure's
+;; mixins, we can workaround this issue.(say we dont have yet all the functions in place for that protocol).
+(defprotocol StringOps
+  (rev [that])
+  (upper [that]))
+
+(extend-type String
+  StringOps
+  (rev [that] (clojure.string/reverse that)))
+
+;; ok partially -> although not all the protocol's implementation is bound to String
+(extend-type String StringOps
+  (upper [that] (.toUpperCase that)))
+
+(-> "cclaudiu" rev upper) ;; --> Exception: no implementation for method :rev of protocol found
+;; partially implementing the protocol -> last attempt of protocol implementation will override the first one.
+
+;; mixins to the rescue! Define maps that when [merge] 'd together will provide a fully-mixin that can
+;; be used as the protocol implementation
+(def rev-mixin {:rev #(clojure.string/reverse %)})
+(def upper-mixin {:upper #(.toUpperCase %)})
+
+;; then we can merge the two maps into one:
+(def fully-mixin (merge rev-mixin upper-mixin))
+
+;; not the [extend] use here!!! and not the [extend-type] ***
+(extend String StringOps fully-mixin)
+
+;; demo:
+(-> "claudiu" rev upper) ;; UIDUALC
+
+;; Mixins in Clojure refer to the creation of discrete MAPS CONTAINING PROTOCOL FUNCTION
+;; IMPLEMENTATIONS that are combined in such a way as to CREATE A COMPLETE IMPLEMENTATION
+;; OF A PROTOCOL.
+
+;; *** only after we have all the procotol's implementation in place we can EXTEND-TYPE!
+
+;; this is IMPOSSIBLE in Java or C++, as any concrete classes must at the creation time specify
+;; all the interface-functions it implements:
+;; With either of those languages, the concrete type (such as TreeNode
+;; or vector) must name at the time it’s defined all the interfaces or classes it’s going to
+;; implement.
+;; + the interfaces in java|c++ must exist when the concrete classes are created. Here we ve taken
+;; the other way around. we had a TreeNode concrete type(defrecord) and after we defined the protocol
+;; FIXO(First-In-X-Out).
+
+;; Clojure's polymorphism lives in protocol's functions and not in the classes.
+;; threating nil? requires that nil object implement the correspondent protocol.
+
+;; as a lesson, always use [extend-type] to provide full protocol's implementation of those
+;; polymorphic functions, and use [extend] when you provide mixins-implementation through the
+;; [map] interface.
+
+;; How about sharing some implementations? Other languages provide the notation to build an
+;; abstract-base class in which one provides all the common behavior shared among the descendants,
+;; while every descendant defines it's own specific behavior, inheriting from this base-class.
+;; Clojure prefers the notaion of sharing. Building a factory-polymorphic-dispatcher function
+;; outside which polymorphically will delegate using the protocol's polymorphism to the
+;; right Type implementation.
+;; same but in other words:
+;; The simplest solution is to write a regular function that builds on the protocol’s
+;; methods. For example, Clojure’s own into takes a collection and uses the conj implementation
+;; provided by the collection
+
+(def tree-node-fixo
+  {:fixo-push (fn [node value] (xconj node value))
+   :fix-pop (fn [node] ())}) ;; and so on
+(extend TreeNode FIXO tree-node-fixo)
+;; extend the type TreeNode WITH protocol FIXO BY PROvIDING map-fixo-mixin implementation of those methods.
+
+;; one note about protocol's methods namespacing:
+;; methods of the protocol are namespaced in a way that Java and C++ interfaces aren’t.
+;; In those languages, all methods of a class
+;; share the same effective namespace, regardless of interfaces they’re implementing. In
+;; Clojure, the methods always use the same namespace as the protocol,
+;; that is in clojure there might be protocol-methods sharing the same names with other
+;; protocol-methods, and don't collide each with each. because their namespaces are different.
+;; this provides a great deal of flexibility when combining third party APIs into one codebase.
+;; therefore every protocol-method will be namespace-bounded to the namespace where the protocol
+;; is defined.
+;; one important thing here: because the protocol-methods share the NAMESPACE, we CANNOT have
+;; 2 methods defined in 2 protocols and 1 namespace having the same name!
+;; since protocol-methods are namespace dependendant.
+
+;;;;;;;;;;;;;;;;
+;; method implementation in defrecord:
+;;;;;;;;;;;;;;;;
+;; this is when you know the protocol you want to implement by heart at the moment of defrecord creation Type.
+;; is like implementing FIXO's protocol methods INLINE.
+(defrecord TreeNode [value l-branch r-branch]
+  FIXO
+  (fixo-push [node value] (xconj node value)))
+
+;; apart from defining the record Type, and the labels, we define also the protocol implementation for this
+;; particular TreeNode record INLINE.
+
+;; the normal defrecord signature was:
+(defrecord TreeNode [value l-branch r-branch])
+
+;; this idiom is also powerful for performance, because declaring a protocol's implementation methods
+;; inline is several times faster than later-declaring the protocol and using [extend] to extend the
+;; type with that protocol.
+;; another neat part is that once declared the protocol inline, the fields of the extended-type are
+;; also available locally by the protocol-methods implementation.
+
+;; We've been using the custom xseq function, but because clojure provides the ISeqable interface, we can
+;; implement that interface for our new Type.
+(defrecord SomeCustomType [cust-val]
+  clojure.lang.ISeq
+  (seq [custom-rec] (lazy-seq (cons cust-val (seq custom-rec)))))
+;; --> Exception: Duplicate method name&signature in class file user/SomeCustomType
+;; we get this exception, because clojure-records are maps under the hood, that ALREADY implement the
+;; map funcs: seq, assoc, dissoc, get and so forth. Because these funcs are already provided we CANNOT implement
+;; them again <- the resulting exception.
+;; the neat part here is also how we can implement a lazy-sequence using recursion:
+;; cons cust-val is trying to push something to the next-recursive-call to seq on that cust-rec passed to [seq]
+;; function. the next recursive call is in fact a lazy-seq, hence a lazy-list we can say.
+
+;; for the rare cases where we want to implement our own data-structure, other than what clojure provides
+;; (for instance defrecord) we can use the [deftype] construct, that is similar with [defrecord] but does not
+;; provide anything at all!
+(deftype SomeCustomType [cust-val]
+  clojure.lang.ISeq
+  (seq [some-rec]
+       (lazy-seq (cons cust-val (seq some-rec)))))
+(take 3 (seq (->SomeCustomType 3))) ;; (3 3 3)
+
+;; we can clearly see that for recursive invocation we don't need any exit branch out of the recursive calls!
+;; because it's a lazy-seq by definition <- the need to explicitly state to [take] only the first 3 items.
+
+(:cust-val (->SomeCustomType 3)) ;; nil
+;; well this is because our custom type, defined with [deftype] does NOT implement anything out-of-the-box
+;; like [defrecord] does, hence no: get, assoc in-place!
+;; for these reasons, we can still lookup the value bound to the new custom-type using java interoperability:
+(.cust-val (->SomeCustomType 3)) ;; 3


working input handling

working input handling

--- src/hackerrank/fp/perimeter-polygon.clj
+++ src/hackerrank/fp/perimeter-polygon.clj
@@ -34,3 +34,22 @@
             [1 0]])

 ;; (reduce #(+ %1 (distance )))
+
+(def input
+"4\n
+0 0\n
+0 1\n
+1 1\n
+1 0")
+
+(with-in-str input
+  (let [n (Integer/parseInt (read-line))]
+    (println n)
+    (dotimes [_ n]
+      (let [line (read-line)
+            numbers (map #(Integer/parseInt (str %))
+                         (take-nth 2 (vec (read-line))))]
+        (println numbers)))))
+
+(map #(Integer/parseInt (str %)) (take-nth 2 (vec "1 0")))
+


about:blank is currently considered a valid page

https://app.asana.com/0/50978096561390/65511564590923

--- test/relevance/test/utils.cljs
+++ test/relevance/test/utils.cljs
@@ -37,6 +37,7 @@
                -596725840 "https://www.google.com/somePath?q=v"
                -327774960 "http://numergent.com/tags/khroma/"
                -526558523 "http://numergent.com/opensource/"
+               93819220 "about:blank"
                ))

 (deftest test-host-key


Do not lookup missing status pub when we are behind

--- src/onyx/messaging/aeron/subscriber.clj
+++ src/onyx/messaging/aeron/subscriber.clj
@@ -238,11 +238,11 @@
           ret (if (< rv-msg replica-version)
                 ControlledFragmentHandler$Action/CONTINUE
                 (if (> rv-msg replica-version)
-                  (do
-                   ;; update heartbeat since we're blocked and it's not upstream's fault
-                   (-> (short-id-status-pub (:short-id message))
-                       (status-pub/set-heartbeat!))
-                   ControlledFragmentHandler$Action/ABORT)
+                  ;; TODO, set marker here, so we don't boot off peers that are
+                  ;; sending us messages but when we are behind the cluster
+                  ;; We cannot update the heartbeat because we do not know the
+                  ;; short-id mapping yet
+                  ControlledFragmentHandler$Action/ABORT
                   (if-let [spub (get short-id-status-pub (:short-id message))]
                     (case (int (:type message))
                       0 (if (>= (count batch) batch-size) ;; full batch, get out
@@ -250,8 +250,7 @@
                           (let [_ (status-pub/set-heartbeat! spub)
                                 session-id (.sessionId header)
                                 ;; TODO: slow
-                                ticket (lookup-ticket ticket-counters replica-version
-                                                      (:short-id message) session-id)
+                                ticket (lookup-ticket ticket-counters replica-version (:short-id message) session-id)
                                 ticket-val ^long (.get ticket)
                                 position (.position header)
                                 got-ticket? (and (< ticket-val position)


CMR-2148: Updated output in migration.

CMR-2148: Updated output in migration.

--- metadata-db-app/src/migrations/025_create_groups_table.clj
+++ metadata-db-app/src/migrations/025_create_groups_table.clj
@@ -39,16 +39,16 @@
   (h/sql "CREATE SEQUENCE cmr_groups_seq"))

 (defn up
-  "Migrates the database up to version 24."
+  "Migrates the database up to version 25."
   []
-  (println "migrations.024-setup-groups-table up...")
+  (println "migrations.025-setup-groups-table up...")
   (create-groups-table)
   (create-groups-indices)
   (create-groups-sequence))

 (defn down
-  "Migrates the database down from version 24."
+  "Migrates the database down from version 25."
   []
-  (println "migrations.024-setup-groups-table down...")
+  (println "migrations.025-setup-groups-table down...")
   (h/sql "DROP SEQUENCE METADATA_DB.cmr_groups_seq")
   (h/sql "DROP TABLE METADATA_DB.cmr_groups"))


CMR-5497: Sort requires.

CMR-5497: Sort requires.

--- mock-echo-app/src/cmr/mock_echo/client/mock_urs_client.clj
+++ mock-echo-app/src/cmr/mock_echo/client/mock_urs_client.clj
@@ -3,12 +3,12 @@
   operations"
   (:require
    [cheshire.core :as json]
+   [clojure.string :as string]
    [cmr.common.mime-types :as mt]
    [cmr.common.services.errors :as errors]
    [cmr.transmit.config :as config]
    [cmr.transmit.connection :as conn]
-   [cmr.transmit.http-helper :as h]
-   [clojure.string :as string]))
+   [cmr.transmit.http-helper :as h]))

 (defn- create-users-url
   "Call to create users in mock URS. Depending on how tests are being run the context for URS URLs


Refactor tests

Refactor tests

--- test/superstring/core_test.clj
+++ test/superstring/core_test.clj
@@ -592,7 +592,7 @@
 (deftest distance-throws-on-unknown
   (is (thrown? IllegalArgumentException (str/distance :unknown-algorithm))))

-(deftest longest-common-substring
+(defexamples longest-common-substring
   (str/longest-common-substring "fooquxbar" "foobar") #{"foo" "bar"}
   (str/longest-common-substring "FOOquxbar" "foobar") #{"bar"}
   (str/longest-common-substring "foo" "bar") #{})
@@ -604,7 +604,7 @@
                                    1000)
                  lcs (gen/such-that #(> (count %) 5) (gen/not-empty gen/string)
                                     1000)]
-    (is ((str/longest-common-substring (str s1 lcs) (str lcs s2)) lcs))))
+    (seq ((str/longest-common-substring (str s1 lcs) (str lcs s2)) lcs))))

 (defspec length-test 100
   (prop/for-all [s gen/string]


fix spelling error

fix spelling error

--- ssclj/jar/src/main/clojure/com/sixsq/slipstream/ssclj/es/acl.clj
+++ ssclj/jar/src/main/clojure/com/sixsq/slipstream/ssclj/es/acl.clj
@@ -117,7 +117,7 @@
                         r rules
                         :when (rule-allow-capacity? r c)] true)))
       data
-      (throw (cu/ex-response (str "Unautorized. ACL " (:acl data)
+      (throw (cu/ex-response (str "Unauthorized. ACL " (:acl data)
                                   " does not authorize [" (:user-name options) "/"
                                   (s/join "," (:user-roles options)) "] for action " action)
                              403 (:id data))))))


fix typo

fix typo

--- src/overtone/sc/machinery/ugen/metadata/unaryopugen.clj
+++ src/overtone/sc/machinery/ugen/metadata/unaryopugen.clj
@@ -10,7 +10,7 @@
    "not-pos?"    {:summary "Check for non positive signal"
                   :doc "Determines whether the signal is negative or
                         not. If it is less than or equal to 0 then
-                        outputs 1, otherwise outputs b0
+                        outputs 1, otherwise outputs 0

                         i.e. 1 -> 0,  -0.5 -> 1, 0 -> 1"}


Test parser when libspec is list instead of vector

--- src/test/clojure/clojure/tools/namespace/parse_test.clj
+++ src/test/clojure/clojure/tools/namespace/parse_test.clj
@@ -12,7 +12,7 @@
                                 six))
      (:use (com.example seven
                         [eight :as eight]
-                        [nine :only (c d)]
+                        (nine :only (c d))
                         [ten]))))

 ;; Some people like to write prefix lists as vectors, not lists. The
@@ -29,7 +29,7 @@
      (:use [com.example
             seven
             [eight :as eight]
-            [nine :only (c d)]
+            (nine :only (c d))
             [ten]])))

 (def deps-from-prefix-list


formatting

formatting

--- src/ads_txt_crawler/process.clj
+++ src/ads_txt_crawler/process.clj
@@ -1,11 +1,6 @@
 (ns ads-txt-crawler.process
   (:require [ads-txt-crawler.domains :as d]
             [org.httpkit.client :as http]))
-
-;; @see http://travis-whitton.blogspot.com/2009/07/network-sweeping-with-clojure.html
-
-;; ignore pages which are HTML
-;; For example on FIOS you'll get a Verizon page for http://junk3432535.com/ads.txt

 (defn clean
   "Clean values by trimming strings and return a blank string to prevent nils from printing"
@@ -64,11 +59,6 @@
       (if (is-text headers)
         (remove nil? (map process-line (clojure.string/split-lines body)))))))

-
-;; (defn process [domains]
-;;   (map process-url (map build-url domains)))
-
-
 (defn urls
   "For a given domain build it's ads.txt url and return the urls it contains"
   [domain]


+ragazzo

+ragazzo

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -1789,6 +1789,11 @@
              :agr {:gender :fem}
              :sem {:pred :girl
                    :human true}}}
+   "ragazzo"
+   {:synsem {:cat :noun
+             :agr {:gender :masc}
+             :sem {:pred :boy
+                   :human true}}}

    "restare" {:synsem {:essere true
                             :cat :verb


Rerun tests by clicking on test results

Rerun tests by clicking on test results

--- test/reagenttest/runtests.cljs
+++ test/reagenttest/runtests.cljs
@@ -32,21 +32,22 @@
     (+ (:pass m) (:fail m) (:error m)) "assertions.")
   (println (:fail m) "failures," (:error m) "errors."))

+(defn run-tests []
+  (reset! test-results nil)
+  (if r/is-client
+    (js/setTimeout all-tests 100)
+    (all-tests)))
+
 (defn test-output-mini []
   (let [res @test-results]
-    [:div {:style test-box-style}
+    [:div {:style test-box-style
+           :on-click run-tests}
      (if res
        (if (zero? (+ (:fail res) (:error res)))
          "All tests ok"
          [:span "Test failure: "
           (:fail res) " failures, " (:error res) " errors."])
        "testing")]))
-
-(defn run-tests []
-  (reset! test-results nil)
-  (if r/is-client
-    (js/setTimeout all-tests 100)
-    (all-tests)))

 (defn init! []
   (when (some? (test/deftest empty-test))


Update android libraries

Update android libraries

--- template/src/leiningen/new/play_clj/android-project.clj
+++ template/src/leiningen/new/play_clj/android-project.clj
@@ -5,11 +5,10 @@
                  [com.badlogicgames.gdx/gdx-backend-android "1.5.3"]
                  [com.badlogicgames.gdx/gdx-box2d "1.5.3"]
                  [com.badlogicgames.gdx/gdx-bullet "1.5.3"]
-                 [neko/neko "3.0.2"]
+                 [neko/neko "3.1.1"]
                  [org.clojure-android/clojure "1.6.0-RC1" :use-resources true]
                  [play-clj "0.4.4"]]
-  :profiles {:dev {:dependencies [[android/tools.nrepl "0.2.0-bigstack"]
-                                  [compliment "0.1.4"]]
+  :profiles {:dev {:dependencies [[org.clojure-android/tools.nrepl "0.2.6"]]
                    :android {:aot :all-with-unused}}
              :release {:android
                        {;; Specify the path to your private


Force Integer

Force Integer

--- talkpocket-api/src/talkpocket_api/storage/cassandra.clj
+++ talkpocket-api/src/talkpocket_api/storage/cassandra.clj
@@ -35,7 +35,7 @@
 (defn- update-article-state
   [id new-state]
   (alia/execute session "USE talkpocket;")
-  (alia/execute session @update-entry-state-prepared {:values [id new-state]}))
+  (alia/execute session @update-entry-state-prepared {:values [id (int new-stat)]}))

 (defn- get-entry
   [id]
@@ -68,4 +68,3 @@
            (>! out (get-all))
           )))
     out))
-


nth important

nth important

--- src/Miscellaneous/warehouse.clj
+++ src/Miscellaneous/warehouse.clj
@@ -11,15 +11,20 @@
   (:import [com.mongodb MongoOptions ServerAddress WriteConcern];the following two is for mongo use
            org.bson.types.ObjectId))

-#_(mg/connect! {:host "192.168.3.53" :port 7017})
+(mg/connect! {:host "192.168.3.53" :port 7017})

-(mg/connect!)
+#_(mg/connect!)

-#_(mg/set-db! (mg/get-db "test"))
+(mg/set-db! (mg/get-db "test"))

-(mg/set-db! (mg/get-db "star"))
+#_(mg/set-db! (mg/get-db "star"))

 (declare extract-text extract-tieba extract-tianya extract-weibo extract-douban extract-youku)
+
+(defn insert-by-part
+  [collection data]
+  (let [parts (partition-all 500 data)]
+    (map #(mc/insert-batch collection %) parts)))

 (defn integrate-text
   [& {:as source}]
@@ -28,15 +33,21 @@
         job (filter s m)]
     (mapcat #(extract-text % (get source %)) job)))

-(mc/insert-batch "xuetest" (integrate-text :tianya "tianya" :douban 2 :tieba "tieba" :gada "haha" :weibo "weibo"))
+(insert-by-part "xuetest" (integrate-text :tianya "star_tianya_content"
+                                          :douban "star_douban_shortcomments"
+                                          :tieba "star_baidutieba_contents"
+                                          :gada "haha"
+                                          :weibo "star_weibo_history"
+                                          :youku "star_youku_video"))
+

 (defn extract-text
   [source-key source-address]
   (cond (= source-key :tianya) (extract-tianya source-address)
         (= source-key :tieba) (extract-tieba source-address)
         (= source-key :weibo) (extract-weibo source-address)
-        (= source-key :douban) (println "This is douban")
-        (= source-key :youku) (println "This is youku")))
+        (= source-key :douban) (extract-douban source-address)
+        (= source-key :youku) (extract-youku source-address)))

 (defn extract-tieba
   [source-address]
@@ -77,19 +88,21 @@
          (map f)
          (map g))))

-;(extract-weibo "weibo")
+(defn extract-douban
+  [source-address]
+  (let [m (mc/find-maps source-address)
+        f #(select-keys % [:_id :comment])
+        g #(assoc {} :mid (:_id %) :text (:comment %) :level (Integer. 0) :source "douban")]
+    (->> m
+         (map f)
+         (map g))))

-
-
-
-
-
-(mc/insert-batch "xuetest" (extract-tieba "tieba"))
-
-;(extract-tieba "star_baidutieba_contents")
-
-
-
+(defn extract-youku
+  [source-address]
+  (let [m (mc/find-maps source-address)
+        f #(select-keys % [:_id :text])]
+    (map #(assoc % :level (Integer. 0) :source "youku") (map f m))
+  ))

@@ -100,4 +113,3 @@

 (flatten [[{:a 2} {:b 3}] [{:c 4} {:d 5}]])

-


slight update to static docs.

slight update to static docs.

--- src/clj/forma/source/static.clj
+++ src/clj/forma/source/static.clj
@@ -66,8 +66,8 @@
   "This query is for a point grid at higher resolution than the
   reference grid, which is the MODIS grid in this case. (This is a
   constraining assumption, since MODIS is hard-coded into this
-  function.  The aggregator function should be called as follows:
-  c/sum, c/max, where c is the prefix refering to cascalog.ops."
+  function.  The aggregator function must be either `cascalop.ops/sum`
+  or `cascalog.ops/max`."
   [dataset m-res ascii-info ascii-tap agg]
   (let [indexer (modis-indexer m-res ascii-info)]
     (construct ["?dataset" "?m-res" "?t-res" "?tilestring" "?sample" "?line" "?outval"]


Presentation improvements.

Presentation improvements.

--- src/clj/freestuffly/scraper.clj
+++ src/clj/freestuffly/scraper.clj
@@ -50,7 +50,9 @@

 (defn- presentable
   [results]
-  (str "FOUND\n\n\n\n" (string/join "\n\n" results)))
+  (str "<h1>FOUND<h1>\n\n\n\n"
+       (string/join "\n\n\n"
+                    (map vals results))))

 (defn scraped-content
   []


Turntable leaves agenda counters in place (per FAQ)

--- src/clj/game/cards-hardware.clj
+++ src/clj/game/cards-hardware.clj
@@ -449,7 +449,7 @@
                                                        (fn [coll] (conj (remove-once #(not= (:cid %) (:cid sw)) coll) st)))
                                                      (swap! state update-in [:runner :scored]
                                                        (fn [coll] (conj (remove-once #(not= (:cid %) (:cid st)) coll)
-                                                                        (dissoc sw :counter :abilities :events))))
+                                                                        (dissoc sw :abilities :events))))
                                                      (gain-agenda-point state :runner (- swpts stpts))
                                                      (gain-agenda-point state :corp (- stpts swpts))
                                                      (doseq [c (get-in @state [:corp :scored])]


don't install Harbinger if trashed from hand by the Runner

--- src/clj/game/cards-programs.clj
+++ src/clj/game/cards-programs.clj
@@ -198,7 +198,7 @@

    "Harbinger"
    {:trash-effect
-     {:req (req (not (some #{:facedown} (:previous-zone card))))
+     {:req (req (not (some #{:facedown :hand} (:previous-zone card))))
        :effect (effect (runner-install card {:facedown true}))}}

    "Hemorrhage"


Disabled :absolute-redirects

Disabled :absolute-redirects

--- src/clj/salava/core/handler.clj
+++ src/clj/salava/core/handler.clj
@@ -55,6 +55,7 @@
         (wrap-defaults (-> site-defaults
                            (assoc-in [:security :anti-forgery] false)
                            (assoc-in [:session] false)
+                           (assoc-in [:responses :absolute-redirects] false) ;; Disabled for OAuth2 custom redirect_uri schemes
                            (assoc-in [:static :files] (get-data-dir ctx))
                            ))
         (remove-x-frame-options)


remove unnecessary else

remove unnecessary else

--- src/cljs/avalon/pages/play.cljs
+++ src/cljs/avalon/pages/play.cljs
@@ -26,8 +26,7 @@
       (= role "percival") [:h4 "Merlin is one of the following:"]
       (= role "mordred") [:h4 "The following are your minions:"]
       ; (= role "morgana") [:h4 "The following are the other minions of Modred:"]
-      (some #{role} '("morgana" "assassin" "bad")) [:h4 "The following are Modred and his other minions:"]
-      :else [:h3 "Your role is " [:strong name]])
+      (some #{role} '("morgana" "assassin" "bad")) [:h4 "The following are Modred and his other minions:"])
     )

 (defn info-view []


Make sure that the waypoints can't be destroyed twice

--- src/cljs/comic_reader/main.cljs
+++ src/cljs/comic_reader/main.cljs
@@ -152,7 +152,8 @@
           (reset! waypoints [wp-up wp-down])))
       :component-will-unmount
       (fn []
-        (map #(.destroy %) @waypoints))
+        (map #(.destroy %) @waypoints)
+        (reset! waypoints nil))
       :reagent-render
       (fn [site location {:keys [tag]}]
         [:div.row


Remove duplicate import.

Remove duplicate import.

--- src/clojure/clj_chess/core.cljc
+++ src/clojure/clj_chess/core.cljc
@@ -2,8 +2,7 @@
   (:refer-clojure :exclude [ancestors])
   (:require [clj-chess.board :as b]
             [clj-chess.game :as g]
-    #?(:cljs [jschess.chess :as jsc])
-            [clj-chess.board :as board])
+    #?(:cljs [jschess.chess :as jsc]))
   #?(:clj (:import (chess Square Piece SquareSet))))

 (def ^:private color-to-keyword
@@ -196,13 +195,13 @@
    (defmethod piece-type-on Long
      [board square]
      (piece-type-to-keyword
-       (Piece/type (board/piece-on board square)))))
+       (Piece/type (b/piece-on board square)))))

 #?(:clj
    (defmethod piece-type-on Integer
      [board square]
      (piece-type-to-keyword
-       (Piece/type (board/piece-on board square)))))
+       (Piece/type (b/piece-on board square)))))

 #?(:clj
    (defmethod piece-type-on String
@@ -213,7 +212,7 @@
    (defmethod piece-type-on js/Number
      [board square]
      (piece-type-to-keyword
-       (jsc/pieceType (board/piece-on board square)))))
+       (jsc/pieceType (b/piece-on board square)))))

 #?(:cljs
    (defmethod piece-type-on js/String
@@ -228,12 +227,12 @@
 #?(:clj
    (defmethod piece-color-on Long
      [board square]
-     (color-to-keyword (Piece/color (board/piece-on board square)))))
+     (color-to-keyword (Piece/color (b/piece-on board square)))))

 #?(:clj
    (defmethod piece-color-on Integer
      [board square]
-     (color-to-keyword (Piece/color (board/piece-on board square)))))
+     (color-to-keyword (Piece/color (b/piece-on board square)))))

 #?(:clj
    (defmethod piece-color-on String
@@ -243,7 +242,7 @@
 #?(:cljs
    (defmethod piece-color-on js/Number
      [board square]
-     (color-to-keyword (jsc/pieceColor (board/piece-on board square)))))
+     (color-to-keyword (jsc/pieceColor (b/piece-on board square)))))

 #?(:cljs
    (defmethod piece-color-on js/String
@@ -272,9 +271,9 @@
      (e.g (piece-count board :black :rook)) or two arguments representing
      board and piece with color (e.g. (piece-count board :wb))."
      ([board piece]
-      (board/piece-count board (piece-from-keyword piece)))
+      (b/piece-count board (piece-from-keyword piece)))
      ([board piece color]
-      (board/piece-count board (piece-make piece color)))))
+      (b/piece-count board (piece-make piece color)))))

 (defn parent
   "The parent board of the current board (i.e. the board as it was before the


Fix `with-meta` for dcpaths.

Fix `with-meta` for dcpaths.

--- src/clojure/parkour/io/dval.clj
+++ src/clojure/parkour/io/dval.clj
@@ -20,7 +20,7 @@
         dcpath* (fn dcpath* [md]
                   (proxy [Path IObj] [path]
                     (meta [] md)
-                    (withMeta [md] (dcpath* md path))))]
+                    (withMeta [md] (dcpath* md))))]
     (dcpath* {:type ::dcpath, ::dcname dcname})))

 (defn dcpath


parse integer from env params

parse integer from env params

--- src/clojure_web_app/handler.clj
+++ src/clojure_web_app/handler.clj
@@ -36,5 +36,5 @@
       (wrap-defaults site-defaults)))

 (defn -main [& [port]]
-  (let [port (or port (env :port) 3000)]
+  (let [port (Integer. (or port (env :port) 3000))]
     (jetty/run-jetty (site #'app) {:port port :join? false})))


refactor retrieve-shards!

refactor retrieve-shards!

--- elephantdb-server/src/clj/elephantdb/common/domain.clj
+++ elephantdb-server/src/clj/elephantdb/common/domain.clj
@@ -193,23 +193,17 @@
                         (open-shard! local-store idx version
                                      :allow-writes (.allowWrites domain))
                         (catch Throwable e
-                          (log/error (format "Error opening shard %s of version %s for domain %s: %s"
-                                             idx version domain e))
-                          (throw e))))
-        close! (fn [idx]
-                 (let [shard (open-shard! local-store idx version
-                                          :allow-writes (.allowWrites domain))]
-                   (close-shard! shard)))]
+                          (log/error (format "Error opening shard %s of version %s for domain %s: %s" idx version domain e))
+                          nil)))]
     (assert (has-version? local-store version)
             (str version "  doesn't exist."))
-    (try
-      (u/with-ret (->> (doall (map open! shards))
-                       (zipmap shards))
-        (log/info "Finished opening domain at " (.getRoot local-store)))
-      (catch Exception e
-        (map close! shards)
-        (log/error (format "Error retrieving shards for version %s: %s" version e))
-        (throw e)))))
+    (u/with-ret (let [lps (map open! shards)]
+                  (if (some nil? lps)
+                    (do
+                      (map close-shard! (filter nil? lps))
+                      (u/throw-runtime (format "Error retrieving shards for version %s" version)))
+                    (zipmap shards lps)))
+      (log/info "Finished opening domain at " (.getRoot local-store)))))

 (defn load-version!
   "Takes a domain, a version number (a long!), and a read-write lock,


revert debugging code

revert debugging code

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@8944 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- acqEngine/src/org/micromanager/sequence_generator.clj
+++ acqEngine/src/org/micromanager/sequence_generator.clj
@@ -124,13 +124,12 @@
   (if (pos? (count slices))
     (let [middle-slice (get slices (unchecked-divide-int (count slices) 2))]
       (filter
-        #(let [x (or
-                   (= middle-slice (% :slice))
-                   (nil? (% :channel))
-                   (get-in % [:channel :use-z-stack]))]
-           (println x) x)
+        #(or
+           (= middle-slice (% :slice))
+           (nil? (% :channel))
+           (get-in % [:channel :use-z-stack]))
         events))
-    1))
+    events))

 (defn different [e1 e2 selector]
   "Determines where values in two event maps


Some reformatting and comments

Some reformatting and comments

--- src/cylon/oauth/impl/client.clj
+++ src/cylon/oauth/impl/client.clj
@@ -43,15 +43,17 @@
             (s/with-fn-validation
               (register-client+
                reg
-               (select-keys this [:client-id
-                                  :client-secret
-                                  :application-name
-                                  :homepage-uri
-                                  :description
-                                  :redirection-uri
-                                  :required-scopes
-                                  :requires-user-acceptance?
-                                  ])))]
+               (select-keys
+                this
+                [:client-id
+                 :client-secret
+                 :application-name
+                 :homepage-uri
+                 :description
+                 :redirection-uri
+                 :required-scopes
+                 :requires-user-acceptance?
+                 ])))]
         ;; In case these are generated
         (assoc this :client-id client-id :client-secret client-secret))

@@ -64,9 +66,9 @@
   WebService
   (request-handlers [this]
     {::redirection-endpoint ; used by the authorization server to return
-                            ; responses containing authorization
-                            ; credentials to the client via the resource
-                            ; owner user-agent.
+                                        ; responses containing authorization
+                                        ; credentials to the client via the resource
+                                        ; owner user-agent.
      (->
       (fn [req]
         (let [params (:query-params req)
@@ -92,10 +94,22 @@
                      ;; authentication scheme (or other password-based
                      ;; HTTP authentication schemes)."

-                     :body (format "client_id=%s&client_secret=%s&code=%s"
+                     ;; TODO Support Basic Authentication in preference
+                     ;; to client secrets.
+
+                     ;; 4.1.3. Access Token Request redirect_uri
+                     ;; REQUIRED, if the "redirect_uri" parameter was
+                     ;; included in the authorization request as
+                     ;; described in Section 4.1.1, and their values
+                     ;; MUST be identical.
+
+                     ;; TODO: Better if we could construct this string
+                     ;; with the help of some utility function.
+                     :body (format "grant_type=%s&code=%s&client_id=%s&client_secret=%s"
+                                   "authorization_code"
+                                   code
                                    (:client-id this)
-                                   (:client-secret this)
-                                   code)}
+                                   (:client-secret this))}
                     #(if (:error %)
                        %
                        (update-in % [:body] (comp decode-stream io/reader))))]


comment out logging

comment out logging

--- support/src/figwheel/client/socket.cljs
+++ support/src/figwheel/client/socket.cljs
@@ -55,6 +55,7 @@
       (let [socket (js/WebSocket. websocket-url)]
         (set! (.-onmessage socket) (fn [msg-str]
                                      (when-let [msg (read-string (.-data msg-str))]
+                                       #_(.log js/console (prn-str msg))
                                        (and (map? msg)
                                             (:msg-name msg)
                                             ;; don't forward pings


[#3145] Adapt tests

[#3145] Adapt tests

--- backend/test/akvo/lumen/lib/transformation_test.clj
+++ backend/test/akvo/lumen/lib/transformation_test.clj
@@ -956,7 +956,7 @@
         apply-transformation (partial async-tx-apply {:tenant-conn *tenant-conn*} origin-dataset-id)
         tx                   (gen-transformation "core/merge-datasets"
                                                  {::transformation.merge-datasets.source.s/aggregationDirection "DESC"
-                                                  ::transformation.merge-datasets.source.s/mergeColumns         ["c4" "c3" "c2"]}
+                                                  ::transformation.merge-datasets.source.s/mergeColumns         ["c2" "c3" "c4"]}
                                                  [:source :aggregationColumn] nil
                                                  [:target :mergeColumn] "c1"
                                                  [:source :mergeColumn] "c1"


Cleanup

Cleanup

--- src/nube/app.clj
+++ src/nube/app.clj
@@ -36,10 +36,8 @@
           (let [body (:body res)]
             (if (clojure.string/blank? body)
               {}
-              (json/read-str body :key-fn keyword)))
-          (do
-            (println res)
-            (throw (Exception. (str "Docker remote api error. Status: " status))))))))
+              (json/read-str body :key-fn keyword)))
+          (throw (Exception. (str "Docker remote api error. Status: " status)))))))

 (defn ssplit [s] (when s (clojure.string/split s #":")))
 (defn create-token [] (let [token (sha1 (pr-str (java.util.Date.)))] (redis! (car/set :token token)) token))


Try to reboot vpeers when start up fails.

--- src/onyx/api.clj
+++ src/onyx/api.clj
@@ -3,7 +3,7 @@
             [clojure.core.async :refer [chan >!! <!!]]
             [com.stuartsierra.component :as component]
             [clj-http.client :refer [post]]
-            [taoensso.timbre :refer [info]]
+            [taoensso.timbre :refer [warn]]
             [onyx.coordinator.impl :as impl]
             [onyx.system :as system]
             [onyx.extensions :as extensions]))
@@ -39,6 +39,18 @@
           true
           (do (<!! ch)
               (recur)))))))
+
+(defn try-start-peer* [v-peer opts]
+  (loop []
+    (let [rets
+          (try
+            (component/start v-peer)
+            (catch Exception e
+              (warn e)
+              (warn "Starting virtual peer failed, backing off and retrying...")
+              (Thread/sleep (or (:onyx.peer/retry-start-interval opts) 2000))
+              nil))]
+      (or rets (recur)))))

 ;; A coordinator that runs strictly in memory. Peers communicate with
 ;; the coordinator by directly accessing its channels.
@@ -97,10 +109,11 @@
   (doall
    (map
     (fn [_]
-      (let [v-peer (component/start (system/onyx-peer config))]
-        (let [rets {:runner (future (try @(:payload-thread (:peer v-peer))
-                                         (catch Exception e
-                                           (info e))))
+      (let [v-peer (try-start-peer* (system/onyx-peer config) config)]
+        (let [rets {:runner (future
+                              (try @(:payload-thread (:peer v-peer))
+                                   (catch Exception e
+                                     (warn e))))
                     :shutdown-fn (fn [] (component/stop v-peer))}]
           (register-peer coord (:node (:peer (:peer v-peer))))
           rets)))


whitespace

whitespace

--- src/babel/francais/grammar.cljc
+++ src/babel/francais/grammar.cljc
@@ -464,6 +464,7 @@
                             :rule "vp-pronoun-nonphrasal"
                             :synsem {:aux false
                                      :cat :verb}})
+
                    (unify h10
                            {:head {:phrasal false
                                    :synsem {:cat :sent-modifier}}


incorporate universal aspects about preds: :say and :tell - subject must be human

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -871,17 +871,21 @@
                             :sem {:pred :paint}}
                    :italiano {:passato "dipinto"}}

-   "dire" (let [shared-part-of-dire
+   "dire" (let [universal-say (:say universals)
+                universal-tell (:tell universals)
+                shared-part-of-dire
                 {:synsem {:cat :verb}
                  :italiano {:infinitive "dicere"
                             :drop-e false
                             :passato "detto"
                             :future-stem "dir"
                             :present {:2plur "dite"}}}]
-               [(unify shared-part-of-dire
-                       {:synsem {:sem {:pred :say}}})
-                (unify shared-part-of-dire
-                       {:synsem {:sem {:pred :tell}}})])
+            [(unify shared-part-of-dire
+                    universal-say
+                    {:synsem {:sem {:pred :say}}})
+             (unify shared-part-of-dire
+                    universal-tell
+                    {:synsem {:sem {:pred :tell}}})])

       "divertirsi" (let [subject-semantics (atom {:human true})
                          subject-agr (atom :top)]


Fix name in group-env, add minted-to-pre xform

--- src/clj/com/hypirion/subtex.clj
+++ src/clj/com/hypirion/subtex.clj
@@ -57,28 +57,32 @@

 ;; This doesn't really make sense because we can't really drag out the first
 ;; value, but oh well.
-(defn raw-env-name [env]
-  ;; yess. I don't even.
+(defn raw-env-name
+  [env]
   (get-in env [:args 0 :value 0 :value]))

-(def group-env
-  (rexf/group-with
-   (fn [elem] (case (:type elem)
-               :invoke (case (:name elem)
-                         "\\begin" true
-                         "\\end" (throw (ex-info "Unmatched environment ending" {:value elem}))
-                         false)
-               false))
-   (fn [start end]
-     (and
-      (identical? (:type end) :invoke)
-      (= "\\end" (:name end))
-      (= (first (:args start)) (first (:args start)))))
-   (fn [start val _]
-     {:type :env
-      :name (raw-env-name start)
-      :args (vec (rest (:args start)))
-      :value val})))
+;; TODO: Passing a function IN isn't really that sensical I believe. It should
+;; rather be done downstream
+(defn group-env
+  ([] (group-env raw-env-name))
+  ([env-fn]
+   (rexf/group-with
+    (fn [elem] (case (:type elem)
+                :invoke (case (:name elem)
+                          "\\begin" true
+                          "\\end" (throw (ex-info "Unmatched environment ending" {:value elem}))
+                          false)
+                false))
+    (fn [start end]
+      (and
+       (identical? (:type end) :invoke)
+       (= "\\end" (:name end))
+       (= (first (:args start)) (first (:args start)))))
+    (fn [start val _]
+      {:type :env
+       :name (env-fn start)
+       :args (vec (rest (:args start)))
+       :value val}))))

 (def remove-comments
   (rexf/stateful-xf
@@ -132,10 +136,22 @@
                 :else
                 (rf res input))))))))

+(def minted-to-pre
+  (rexf/stateless-xf
+   (fn [rf]
+     (fn ([] (rf))
+       ([res] (rf res))
+       ([res input]
+        (if (identical? :minted (:type input))
+          (rf res [:pre (:value input)])
+          (rf res input)))))))
+
 (defn read
   [data]
   (rexf/into [:body]
              (comp minted/process remove-comments match-braces
-                   group-calls group-env hiccup/item-to-li hiccup/itemize-to-ul
-                   hiccup/enumerate-to-ol hiccup/common-invokes shrink-text)
+                   group-calls (group-env #(get-in % [:args 0 :value 0])) hiccup/item-to-li
+                   hiccup/itemize-to-ul hiccup/enumerate-to-ol
+                   hiccup/common-invokes shrink-text hiccup/paragraphiphy
+                   minted-to-pre)
              (iterator-seq (Tokenise. data))))


Use keep instead of map+filter-ident

Use keep instead of map+filter-ident

--- src/clj/comic_reader/scrape.clj
+++ src/clj/comic_reader/scrape.clj
@@ -12,8 +12,7 @@

 (defn extract-list [html selector normalize]
   (->> (html/select html selector)
-       (map normalize)
-       (filter identity)))
+       (keep normalize)))

 (defn fetch-list [{:keys [url selector normalize]}]
   (when (every? (complement nil?) [url selector normalize])


Renamed some vars in mask

Renamed some vars in mask

--- src/clj/forma/trends/filter.clj
+++ src/clj/forma/trends/filter.clj
@@ -32,7 +32,6 @@
     (deseasonalize 23 (s/sample-uniform 200))"
   [freq ts]
   {:pre [(>= (count ts) freq)
-         (when nil? ts)
          (< 1 freq)]}
   (let [x (dummy-mat freq (i/nrow ts))
           xt (i/trans x)
@@ -138,15 +137,15 @@
                  (- right left))))

 (defn mask
-  "Apply `pred` to `coll1` to create a mask over `coll2`, returning a vector of
-   valid values and nils. If a value in `coll1` passes `pred`, the value in the
-   corresponding location in `coll2` will be included in the output vector.
+  "Apply `pred` to `coll-a` to create a mask over `coll-b`, returning a vector of
+   valid values and nils. If a value in `coll-a` passes `pred`, the value in the
+   corresponding location in `coll-b` will be included in the output vector.
    Otherwise, that location will be set to `nil`."
-  [pred coll1 coll2]
-  {:pre [(= (count coll1) (count coll2))]}
+  [pred coll-a coll-b]
+  {:pre [(= (count coll-a) (count coll-b))]}
   (map #(when-not (pred %2) %1)
-       coll2
-       coll1))
+       coll-b
+       coll-a))

 (defn replace-index-set
   "replace values in `coll` with `new-val` for all indices in