checkpoint - halfway through adding joined/unjoined model fn-ality

--- dada2-core/src/test/clojure/org/dada2/test_join_model.clj
+++ dada2-core/src/test/clojure/org/dada2/test_join_model.clj
@@ -137,13 +137,17 @@
        (permute [[]] [[:a1 :a2][:b1 :b2 :b3][:c1]]))))

 ;;--------------------------------------------------------------------------------
+;; TODO: split the calculation of the joins and their transposition...
+
+(defn- transpose [lhs join-fn permutations]
+  (map (fn [permutation] (apply join-fn lhs permutation)) permutations))

 (defn- lhs-join [rhs-indeces lhs-fk-keys lhs join-fn]
   "calculate the set of joins for a newly arriving lhs"
   (let [permutations (permute [[]] (rhses-get rhs-indeces lhs-fk-keys lhs))]
         (if (= [[]] permutations)
           nil
-          (map (fn [args] (apply join-fn lhs args)) permutations))))
+          (transpose lhs join-fn permutations))))

 (defn- rhs-join [rhs-indeces lhs-fk-keys join-fn lhs-indeces i fk]
   "calculate the set of joins for a newly arriving rhs"
@@ -263,7 +267,21 @@
     [[lhs-indeces new-rhs-indeces new-joins]
      (fn [_]
        (on-deletes joined-model stale-joins)
-       (on-upserts joined-model fresh-joins))]
+       (on-upserts joined-model fresh-joins)
+
+       (println "STALE: " stale-joins)
+       (println "FRESH: " fresh-joins)
+       (let [stale (not (empty? stale-joins))
+             fresh (not (empty? fresh-joins))]
+         (if (not (= stale fresh))
+           (if stale
+             (do
+               (if rhs-joined-model (on-delete rhs-joined-model rhs))
+               (if rhs-unjoined-model (on-upsert rhs-unjoined-model rhs)))
+             (do
+               (if rhs-unjoined-model (on-delete rhs-unjoined-model rhs))
+               (if rhs-joined-model (on-upsert rhs-joined-model rhs)))
+             ))))]
     ))

 ;;; TODO - ugly, slow, ...
@@ -403,6 +421,8 @@
 	c2 (->C :c2 0 :c "c2-data")]
     (is (= [[{}{}{}] [[{}{}][{}{}]] [{}{}{}]] (data join)))
     (is (= {} (data joined-model)))
+    (is (= {} (data a-b-joined-model)))
+    (is (= {} (data a-b-unjoined-model)))

     (attach join view)
     (is (= nil (data view)))
@@ -411,11 +431,15 @@
     (on-upsert bs b1)
     (is (= [[{}{}{}] [[{:b1 b1}{:b {:b1 b1}}][{}{}]] [{}{}{}]] (data join)))
     (is (= {} (data joined-model)))
+    (is (= {} (data a-b-joined-model)))
+    ;;(is (= {:b1 b1} (data a-b-unjoined-model)))

     ;; rhs insertion - no join
     (on-upsert cs c1)
     (is (= [[{}{}{}] [[{:b1 b1}{:b {:b1 b1}}][{:c1 c1}{:c {:c1 c1}}]] [{}{}{}]] (data join)))
     (is (= {} (data joined-model)))
+    (is (= {} (data a-b-joined-model)))
+    ;;;(is (= {:b1 b1} (data a-b-unjoined-model)))

     ;; lhs-insertion - first join
     (on-upsert as a1)
@@ -429,6 +453,8 @@
             ]
            (data join)))
     (is (= {[:a1 :b1 :c1] (->ABC [:a1 :b1 :c1] [0 0 0] "b1-data" "c1-data")} (data joined-model)))
+;;    (is (= {:b1 b1} (data a-b-joined-model)))
+    (is (= {} (data a-b-unjoined-model)))

     ;; join - new rhs - b2
     (on-upsert bs b2)
@@ -449,6 +475,9 @@
          [:a1 :b2 :c1] (->ABC [:a1 :b2 :c1] [0 0 0] "b2-data" "c1-data")
          }
          (data joined-model)))
+    ;;;(is (= {:b1 b1 :b2 b2} (data a-b-joined-model)))
+    (is (= {:b2 b2} (data a-b-joined-model)))
+    (is (= {} (data a-b-unjoined-model)))

     ;; join - new rhs - c2
     (on-upsert cs c2)
@@ -474,7 +503,10 @@
            [:a1 :b2 :c2] (->ABC [:a1 :b2 :c2] [0 0 0] "b2-data" "c2-data")
            }
            (data joined-model)))
-
+    ;;(is (= {:b1 b1 :b2 b2} (data a-b-joined-model)))
+    (is (= {:b2 b2} (data a-b-joined-model)))
+    (is (= {} (data a-b-unjoined-model)))
+
     ;; join - new lhs - a2
     (on-upsert as a2)
     (is (=
@@ -517,6 +549,9 @@
     	   [:a2 :b2 :c2] (->ABC [:a2 :b2 :c2] [0 0 0] "b2-data" "c2-data")
     	   }
     	   (data joined-model)))
+    ;;(is (= {:b1 b1 :b2 b2} (data a-b-joined-model)))
+    (is (= {:b2 b2} (data a-b-joined-model)))
+    (is (= {} (data a-b-unjoined-model)))

     ;; lhs update - relevant joins should update
     (on-upsert as a1v1)
@@ -560,6 +595,9 @@
     	   [:a2 :b2 :c2] (->ABC [:a2 :b2 :c2] [0 0 0] "b2-data" "c2-data")
     	   }
     	   (data joined-model)))
+    ;;;(is (= {:b1 b1 :b2 b2} (data a-b-joined-model)))
+    (is (= {:b2 b2} (data a-b-joined-model)))
+    (is (= {} (data a-b-unjoined-model)))

     ;; rhs update - relevant joins should update
     (on-upsert bs b1v1)
@@ -601,6 +639,9 @@
     	   [:a2 :b2 :c2] (->ABC [:a2 :b2 :c2] [0 0 0] "b2-data" "c2-data")
     	   }
     	   (data joined-model)))
+    ;;(is (= {:b1 b1v1 :b2 b2} (data a-b-joined-model)))
+    (is (= {:b2 b2} (data a-b-joined-model)))
+    (is (= {} (data a-b-unjoined-model)))

     ;; rhs update - relevant joins should update
     (on-upsert cs c1v1)
@@ -642,6 +683,8 @@
     	   [:a2 :b2 :c2] (->ABC [:a2 :b2 :c2] [0 0 0] "b2-data" "c2-data")
     	   }
     	   (data joined-model)))
+    (is (= {:b2 b2} (data a-b-joined-model)))
+    (is (= {} (data a-b-unjoined-model)))

     ;; join - delete lhs - a2
     (on-delete as a2)
@@ -667,6 +710,8 @@
     	   [:a1 :b2 :c2] (->ABC [:a1 :b2 :c2] [1 0 0] "b2-data" "c2-data")
     	   }
     	   (data joined-model)))
+    (is (= {:b2 b2} (data a-b-joined-model)))
+    (is (= {} (data a-b-unjoined-model)))

     ;; join - delete rhs - b2
     (on-delete bs b2)
@@ -684,6 +729,8 @@
     	   [:a1 :b1 :c2] (->ABC [:a1 :b1 :c2] [1 1 0] "b1v1-data" "c2-data")
     	   }
     	   (data joined-model)))
+;;    (is (= {} (data a-b-joined-model)))
+;;;    (is (= {:b2 b2} (data a-b-unjoined-model)))

     ;; join - delete rhs - c2
     (on-delete cs c2)
@@ -757,6 +804,13 @@
     	   (data joined-model)))

     ;; TODO:
+
+    ;; unjoined models:
+    ;; need  lhs-joined/unjoined, rhs-joined/unjoined models
+    ;; should the joined ones contain singleton or tuple entries ?
+    ;; need to refresh views on connection to models
+    ;; need to split permutation and transposition of joins into two stages so we can populate joined models
+
     ;;  support custom join/get/lookup fns
     ;;  support use of custom collection
     ;;; support use of custom assoc/dissoc fns
@@ -765,7 +819,6 @@
     ;;  batch operations
     ;;  test listener receives correct events
     ;;  test downstream model receives correct events
-    ;;  unjoined models...
     ;;  move prod code out of this file
     ;;  refactor and document
     ;;  where can I find a persistant navigable map ?


add catchup config options

add catchup config options

--- etc/subrosa.clj
+++ etc/subrosa.clj
@@ -1,5 +1,9 @@
 {:host "localhost"
  :network "Subrosa"
+ :catchup {:max-msgs-per-room 100
+           :default-catchup-size 40
+           :date-format "MM-dd"
+           :time-format "HH:mm:ss"}
  :ssl {:keystore nil
        :password nil}
  :password nil


Ready to release lein-template

Ready to release lein-template

--- lein-template/project.clj
+++ lein-template/project.clj
@@ -1,7 +1,7 @@
 ;; Copyright © 2014 JUXT LTD.

 ;; We call this project modular to make the invocation: lein new modular appname
-(defproject modular/lein-template "0.6.4"
+(defproject modular/lein-template "0.6.5"
   :description "Leiningen template for a full-featured component based app using modular extensions."
   :license {:name "The MIT License"
             :url "http://opensource.org/licenses/MIT"}


scheduler: Fix datomic attribute name for label key.

--- scheduler/src/cook/mesos/api.clj
+++ scheduler/src/cook/mesos/api.clj
@@ -100,7 +100,7 @@
                               (let [label-var-id (d/tempid :db.part/user)]
                                 [[:db/add id :job/label label-var-id]
                                  {:db/id label-var-id
-                                  :label/name k
+                                  :label/key k
                                   :label/value v}]))
                             labels)
                 ;; These are optionally set datoms w/ default values


Added unauthenticated-handler and unauthorized-handler for application/json.

--- web/src/sound_effector/web.clj
+++ web/src/sound_effector/web.clj
@@ -1,5 +1,6 @@
 (ns sound-effector.web
   (:require
+    [clojure.data.json :as json]
     [migratus.core :as migratus]
     [ring.adapter.jetty :as ring]
     [ring.logger :as logger]
@@ -26,9 +27,30 @@
            (resources "/")
            (not-found (layout/response-404)))

+(defn- unauthenticated-handler [request]
+  (let [media-type (get-in request [:headers "accept"])]
+    (if (= media-type "application/json")
+      (->
+        (response (json/write-str {:message "You need to login first. ;)"}))
+        (status 403)
+        (content-type "application/json"))
+      (friend/default-unauthenticated-handler request))))
+
+(defn- unauthorized-handler [request]
+  (let [media-type (get-in request [:headers "accept"])]
+    (if (= media-type "application/json")
+      (->
+        (response (json/write-str {:message "You don't have the permission."}))
+        (status 403)
+        (content-type "application/json"))
+      (friend/default-unauthorized-handler request))))
+
 (def application
   (-> site-routes
-      (friend/authenticate {:allow-anon? true :workflows [(auth-facebook-with-friend/workflow)]})
+      (friend/authenticate {:allow-anon?             true
+                            :workflows               [(auth-facebook-with-friend/workflow)]
+                            :unauthenticated-handler unauthenticated-handler
+                            :unauthorized-handler    unauthorized-handler})
       (wrap-defaults site-defaults)))

 (defn start [port]


Only use ident for the item component

Only use ident for the item component

--- fulcro-todo/src/main/app/ui.cljs
+++ fulcro-todo/src/main/app/ui.cljs
@@ -6,8 +6,7 @@
 (defui ^:once ItemAdder
   static om/IQuery
   (query [this] [:item-adder/input-value])
-  static
-  fc/InitialAppState
+  static fc/InitialAppState
   (initial-state [c params] {:item-adder/input-value ""})
   Object
   (render [this]
@@ -32,13 +31,15 @@
 (def ui-item-adder (om/factory ItemAdder))

 (defui ^:once Item
+  static om/Ident
+  (ident [this props] [:item/by-id (:db/id props)])
   static om/IQuery
-  (query [this] [:item/added-at :item/text :item/checked?])
-  static
-  fc/InitialAppState
-  (initial-state [c {:keys [added-at text]}] {:item/added-at added-at
-                                              :item/text text
-                                              :item/checked? false})
+  (query [this] [:db/id :item/added-at :item/text :item/checked?])
+  static fc/InitialAppState
+  (initial-state [c {:keys [id added-at text]}] {:db/id id
+                                                 :item/added-at added-at
+                                                 :item/text text
+                                                 :item/checked? false})
   Object
   (render [this]
           (let [{:keys [item/added-at item/text item/checked?]} (om/props this)]
@@ -68,19 +69,17 @@

 (defui ^:once ItemList
   static om/IQuery
-  (query [this] [:item-list/sort-by-desc-added-at {:item-list/items (om/get-query Item)}])
-  static
-  fc/InitialAppState
-  (initial-state [c params] {:item-list/sort-by-desc-added-at true
-                             :item-list/items [(fc/get-initial-state Item {:added-at 1508175827181
-                                                                           :text "hello"
-                                                                           :checked? false})
-                                               (fc/get-initial-state Item {:added-at 1508175970713
-                                                                           :text "world"
-                                                                           :checked? true})]})
+  (query [this] [{:item-list/items (om/get-query Item)}])
+  static fc/InitialAppState
+  (initial-state [c params] {:item-list/items [(fc/get-initial-state Item {:id 1
+                                                                           :added-at 1508175827181
+                                                                           :text "hello"})
+                                               (fc/get-initial-state Item {:id 2
+                                                                           :added-at 1508175970713
+                                                                           :text "world"})]})
   Object
   (render [this]
-          (let [{:keys [item-list/items]} (om/props this)]
+          (let [{:keys [item-list/items]} (om/props his)]
             (if (empty? items)
               (dom/div
                #js {:className "item-list"}
@@ -113,8 +112,7 @@
   (query [this] [:ui/react-key
                  {:item-adder (om/get-query ItemAdder)}
                  {:item-list (om/get-query ItemList)}])
-  static
-  fc/InitialAppState
+  static fc/InitialAppState
   (initial-state [c params] {:item-adder (fc/get-initial-state ItemAdder {})
                              :item-list (fc/get-initial-state ItemList {})})


Few additions.

Few additions.

--- src/pe_datomic_utils/core.clj
+++ src/pe_datomic_utils/core.clj
@@ -1,6 +1,7 @@
 (ns pe-datomic-utils.core
   (:require [datomic.api :refer [q db] :as d]
             [clj-time.core :as t]
+            [clojure.java.io :refer [resource]]
             [clojure.tools.logging :as log]))

 (defn txn-time
@@ -20,3 +21,23 @@
   [conn txnmap]
   (let [tx @(d/transact conn [txnmap])]
     (d/resolve-tempid (d/db conn) (:tempids tx) (:db/id txnmap))))
+
+(defn refresh-db [db-uri schema-files]
+  (do
+    (d/delete-database db-uri)
+    (d/create-database db-uri)
+    (let [conn (d/connect db-uri)]
+      (doseq [schema-file schema-files]
+        @(d/transact conn (read-string (slurp (resource schema-file)))))
+      conn)))
+
+(defn entity-for-parent-by-id
+  [conn parent-entid entity-entid parent-attr]
+  {:pre [(not (nil? parent-entid))
+         (not (nil? entity-entid))]}
+  (let [entity (into {} (d/entity (d/db conn) entity-entid))]
+    ; if entity has no entries (count = 0), then effectively the given
+    ; entity-entid is not associated with any entities in the database
+    (when (and (> (count entity) 0)
+               (= parent-entid (get-in entity [parent-attr :db/id])))
+      [entity-entid (dissoc entity parent-attr)])))


clean up some stuff around permalink opts

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -77,17 +77,16 @@
       (u/info "Remove draft files. Remaining %s files\n" (count updated-files))
       fs-with-meta)))

-(defn- create-filepath [file options]
-  (let [file-path (str (:target options) "/" (:filename file) "/index.html")]
-    (assoc file :filepath file-path)))
+(defn- create-filepath [file]
+  (assoc file :filepath (str  "/" (:filename file) "/index.html")))

 (deftask permalink
   "Make files permalinked. E.x. about.html will become about/index.html"
   []
   (boot/with-pre-wrap fileset
-    (let [files (:metadata (meta fileset))
-          updated-files (perun/map-vals #(create-filepath % *opts*) files)
-          fs-with-meta (with-meta fileset {:metadata updated-files})]
+    (let [files         (:metadata (meta fileset))
+          updated-files (perun/map-vals create-filepath files)
+          fs-with-meta  (with-meta fileset {:metadata updated-files})]
       (u/info "Added permalinks to %s files\n" (count updated-files))
       fs-with-meta)))


finished reading ch 11

finished reading ch 11

--- src/joy/ch11.clj
+++ src/joy/ch11.clj
@@ -1,7 +1,8 @@
 (ns joy.ch11
   (:require (clojure [xml :as xml]))
   (:require (clojure [zip :as zip]))
-  (:require [joy.ch10 :as ten])
+  (:require [joy.ch10 :as ten]
+            [clojure.core.reducers :as r])
   (:import (java.util.regex Pattern)))

 (time (let [x (future (do (Thread/sleep 5000)
@@ -176,3 +177,10 @@
      #(keyword "3rd"))
     doall
     time)
+
+;; 11.4 reducers
+(def big-vec (vec (range (* 1000 1000))))
+
+(time (reduce + big-vec))
+
+(time (r/fold + big-vec))


add missing dependency

add missing dependency

--- src/replikativ/p2p/hooks.cljc
+++ src/replikativ/p2p/hooks.cljc
@@ -3,7 +3,7 @@
   to more CRDTs synchronously to the update propagation."
   (:require #?(:clj
                 [clojure.core.async :as async
-                 :refer [>! timeout chan put! go-loop pub sub unsub close! chan]]
+                 :refer [>! timeout chan put! go-loop pub sub unsub close! chan go]]
                :cljs
                 [cljs.core.async :as async :refer [>! timeout chan put! pub sub unsub close!]])


Refactor pipeline code

Refactor pipeline code

--- src/attercop/spider.clj
+++ src/attercop/spider.clj
@@ -86,15 +86,13 @@
         (recur (rest rules) url)))))

-;; TODO! Use channels for pipeline as it may involve I/O
 (defn- pipe-results
   "Takes a pipeline which is a sequence of functions transforming or
   doing something with the result and pipes the result through each of
   the functions in order."
-  [pipeline result]
-  (when-let [func (first pipeline)]
-    (let [new-result (mapv func result)]
-      (recur (rest pipeline) new-result))))
+  [pipeline results]
+  (doseq [result results]
+    (reduce (fn [acc f] (f acc)) result pipeline)))

 (defn- init-throttle
@@ -182,8 +180,8 @@
                                   (remove skip?)))]
                  (doseq [link links]
                    (go (>! ch-urls link)))
-                 (when-let [result (scrape resp)]
-                   (pipe result)))
+                 (when-let [results (scrape resp)]
+                   (pipe results)))
                (recur))))
        ch-urls])))


more cleanup

more cleanup

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -242,37 +242,6 @@
        (add-to-bolt-at-path bolt path model)
        (add-comp-to-bolts (rest bolts) path model)))))

-(defn hd [] :head)
-
-(defn comp-paths
-  "Find all paths to all complements (both terminal and non-terminal) given a depth. Returned in
-   ascending length (shortest first)."
-  ;; e.g., a tree of depth 2
-  ;; will have the following paths:
-  ;;   [:comp] [:head :comp]
-  ;;   because it looks like:
-  ;;
-  ;;   H
-  ;;  / \
-  ;; C   H
-  ;;    / \
-  ;;   H   C
-  ;;
-  [depth]
-  (cond
-    (= depth 0)
-    []
-    (= depth 1)
-    (list [:comp])
-    true
-    (cons
-     (concat (take (- depth 1)
-                   (repeatedly hd))
-             [:comp])
-     (comp-paths (- depth 1)))))
-
-;; {:synsem {:cat :verb, :infl :imperfect, :sem {:tense :past, :aspect :progressive}, :subcat []}}
-
 (defn add-to-bolt-at-path
   "generate all complements for bolt at given path, and create a partial tree: bolt + complement => partial tree"
   [bolt path model]
@@ -286,6 +255,33 @@
            (if (:default-fn model)
              (first ((:default-fn model) partial-tree))
              partial-tree)))))
+
+(defn comp-paths
+  "Find all paths to all complements (both terminal and non-terminal) given a depth. Returned in
+   ascending length (shortest first)."
+  ;; e.g., a tree of depth 2
+  ;; will have the following paths:
+  ;;   [:comp] [:head :comp]
+  ;;   because it looks like:
+  ;;
+  ;;   H
+  ;;  / \
+  ;; C   H
+  ;;    / \
+  ;;   H   C
+  ;;
+  [depth]
+  (cond
+    (= depth 0)
+    []
+    (= depth 1)
+    (list [:comp])
+    true
+    (cons
+     (concat (take (- depth 1)
+                   (repeatedly hd))
+             [:comp])
+     (comp-paths (- depth 1)))))

 (defn get-lexemes [model spec]
   "Get lexemes matching the spec. Use a model's index if available, where the index is a function that we call with _spec_ to get a set of indices. otherwise use the model's entire lexeme."


variable renaming

variable renaming

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -56,26 +56,43 @@
      ;; for each such map in each bolt, find all possible combinations of complements, taking one complement per path.
      ;; the result is a trellis for each bolt, and a path through this trellis is one complement for each complement position.
      (map (fn [each-bolt-and-comps]
-            (map (fn [each-path-through-trellis]
-                   (zipmap (keys each-bolt-and-comps)
-                           each-path-through-trellis))
-                 (apply combo/cartesian-product (vals each-bolt-and-comps)))))
+            (let [paths-to-comps (keys each-bolt-and-comps)
+                  vals (vals each-bolt-and-comps)]
+              (map (fn [each-path-through-trellis]
+                     (zipmap paths-to-comps
+                             each-path-through-trellis))
+                   (apply combo/cartesian-product vals)))))

      (mapcat (fn [bolt-group]
                (->> bolt-group
                     (map (fn [bolt-and-comps]
                            (let [bolt (get bolt-and-comps [])
                                  paths-and-comps (dissoc bolt-and-comps [])
-                                 paths (keys paths-and-comps)]
+                                 paths-to-comps (keys paths-and-comps)]
                              (apply unify
                                     (cons bolt
-                                          (map (fn [path]
-                                                 (let [result (assoc-in bolt path (get paths-and-comps path))]
+                                          (map (fn [path-to-comp]
+                                                 (let [complement (get paths-and-comps path-to-comp)
+                                                       result (assoc-in bolt path-to-comp complement)]
                                                    (if (= true truncate)
-                                                     (dissoc-paths result [path])
+                                                     (dissoc-paths result [path-to-comp])
                                                      result)))
-                                               paths)))))))))
+                                               paths-to-comps)))))))))
      (map #(do-defaults % model)))))
+
+(defn generate-all2 [spec model & [depth max-depth]]
+  (let [depth (or depth 0)
+        truncate truncate
+        max-depth (or max-depth max-total-depth)]
+    (log/debug (str "generate-all:" depth "/" max-depth ";pred=" (get-in spec [:synsem :sem :pred])))
+    (->>
+     (lightning-bolts model spec depth max-depth)
+
+     ;; for each bolt, create a map of complement positions
+     ;; within the bolt to possible complements for that position
+     (map #(assoc
+            (comp-paths-to-complements % model depth max-depth)
+            [] (list %))))))

 (defn generate
   "Return one (by default) or _n_ (using :take _n_) expressions matching spec _spec_ given the model _model_."
@@ -150,7 +167,7 @@
   (log/info (str "comp-paths-to-complements: bolt:" ((:morph-ps model) bolt)))
   (into {}
         (map (fn [path]
-               [path (filter not-fail? (comp-path-to-complements bolt path model depth max-depth))])
+               [path (comp-path-to-complements bolt path model depth max-depth)])
              (find-comp-paths bolt))))

 (defn comp-path-to-complements
@@ -163,7 +180,7 @@
                    (generate-all (get-in bolt path) model
                                  (+ 1 depth) max-depth))
         lexemes-before-phrases
-        (lexemes-before-phrases depth max-depth)]
+        (or true (lexemes-before-phrases depth max-depth))]
     (if (not (nil? bolts-at)) (log/info (str "realized? of bolts-at:" (realized? bolts-at))))
     (cond (nil? bolts-at)
           (lazy-seq lexemes)


+(defn generate [spec]): use babel.directory's model

--- src/babel/italiano.cljc
+++ src/babel/italiano.cljc
@@ -45,6 +45,9 @@
    (morph/analyze surface-form (:lexicon model))))

 (defn generate
+  ([spec]
+   (let [model @@(get babel.directory/models :it)]
+     (generate spec model)))
   ([spec model & {:keys [do-enrich max-total-depth truncate]
             :or {do-enrich true
                  max-total-depth generate/max-depth


Fix api port number after removing mobile server

--- src/braid/base/conf.clj
+++ src/braid/base/conf.clj
@@ -13,7 +13,7 @@
     ;; TODO don't special case these here
     ;; ports should come from config
     {:db-url "datomic:mem://braid"
-     :api-domain (str "localhost:" (:port (mount/args)))
+     :api-domain (str "localhost:" (inc (:port (mount/args))))
      :site-url (str "http://localhost:" (:port (mount/args)))
      :hmac-secret "secret"}
     @ports-config ; overrides api-domain & site url when port is automatically found


Housekeeping

Housekeeping

--- src/taoensso/carmine/ring.clj
+++ src/taoensso/carmine/ring.clj
@@ -17,7 +17,9 @@
   (delete-session [_ key] (wcar* (car/del key)) nil)
   (write-session  [_ key data]
     (let [key  (or key (new-session-key prefix))
-          data (assoc data :session-id key)]
+          ;; TODO Deprecate? Ring request already has :session/key
+          data (assoc data :session-id key)
+          ]
       (if expiration
         (wcar* (car/setex key expiration data))
         (wcar* (car/set key data)))
@@ -37,4 +39,4 @@
   [& [s1 s2 & sn :as sigs]]
   (if (instance? taoensso.carmine.connections.ConnectionPool s1)
     (carmine-store {:pool s1 :spec s2} (apply hash-map sn))
-    (apply carmine-store sigs)))+    (apply carmine-store sigs)))


don't let `load-file` et al. change the current namespace

--- src/cljs/lumo/repl.cljs
+++ src/cljs/lumo/repl.cljs
@@ -475,9 +475,8 @@
             eval-opts
             (fn [{:keys [ns value error] :as ret}]
               (if-not error
-                (do
-                  (when expression?
-                    (println (pr-str value)))
+                (when expression?
+                  (println (pr-str value))
                   (vreset! current-ns ns))
                 (handle-repl-error error)))))))
     (catch :default e
@@ -490,8 +489,6 @@
     (execute-path source-or-path opts)
     (execute-text source-or-path opts)))

-;; TODO: need to separate execution paths of coming from the REPL vs. not
-;; wrt. to special fns visibility (which must not be seen when executing a source file)
 (defn ^:export execute
   [type source-or-path expression? setNS]
   (when setNS


Add the ability to add contacts

Add the ability to add contacts

--- src/cljs/pplz/core.cljs
+++ src/cljs/pplz/core.cljs
@@ -2,12 +2,28 @@
   (:require-macros [cljs.core.async.macros :refer [go]])
   (:require [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true]
-            [cljs.core.async :refer [put! chan <!]]))
+            [cljs.core.async :refer [put! chan <!]]
+            [clojure.data :as data]
+            [clojure.string :as string]))

 (defonce app-state (atom {:contacts [
                                      {:first "Vincent" :last "Chase"}
                                      {:first "Ari" :last "Gold"}
                                      {:first "Johnny" :last "Drama"}]}))
+
+(defn build-contact
+  [contact]
+  (let [[first last :as full-name] (string/split contact #"\s+")]
+    {:first first :last last}))
+
+(defn add-contact
+  [contacts owner]
+  (let [new-contact (-> (om/get-node owner "new-contact")
+                        .-value
+                        (build-contact contact))]
+    (when new-contact
+      (om/transact! contacts :contacts #(conj % new-contact))
+      (om/set-state! owner :text ""))))

 (defn contact-view
   [contact owner]
@@ -22,40 +38,51 @@
                               (dom/button #js {:onClick
                                                (fn [e] (put! delete @contact))} "Delete")))))))

+(defn handle-change
+  [e owner {:keys [text]}]
+  (om/set-state! owner :text (.. e -target -value)))
+
+
 (defn contacts-view
   [contacts owner]
   (reify
     om/IInitState
     (init-state
       [_]
-      {:delete (chan)})
+      {:delete (chan)
+       :text ""})
     om/IWillMount
     (will-mount
       [_]
       (let [delete (om/get-state owner :delete)]
         (go (loop
-              []
+                []
               (let [contact (<! delete)]
                 (om/transact! contacts :contacts
                               (fn
-                                [xs]
-                                (vec (remove #(= contact %) xs))))
+                                [contacts]
+                                (vec (remove #(= contact %) contacts))))
                 (recur))))))
     om/IRenderState
     (render-state
-      [this {:keys [delete]}]
-      (dom/table nil
-                 (dom/thead nil
-                            (dom/tr nil
-                                    (dom/td nil "First")
-                                    (dom/td nil "Last")
-                                    (dom/td nil "Actions")))
-                 (apply dom/tbody nil
-                        (om/build-all contact-view (:contacts contacts)
-                                      {:init-state {:delete delete}}))))))
+      [this state]
+      (dom/div nil
+               (dom/table nil
+                          (dom/thead nil
+                                     (dom/tr nil
+                                             (dom/td nil "First")
+                                             (dom/td nil "Last")
+                                             (dom/td nil "Actions")))
+                          (apply dom/tbody nil
+                                 (om/build-all contact-view (:contacts contacts)
+                                               {:init-state {:delete delete}})))
+               (dom/div nil
+                        (dom/input #js {:type "text" :ref "new-contact" :value (:text state)
+                                        :onChange #(handle-change % owner state)})
+                        (dom/button #js {:onClick #(add-contact contacts owner)} "Add Contact"))))))

 (defn main []
   (om/root
-    contacts-view app-state
-    {:target (. js/document (getElementById "app"))}))
+   contacts-view app-state
+   {:target (. js/document (getElementById "app"))}))


include group name in version badge link, fixes #216

--- src/clojars/web/jar.clj
+++ src/clojars/web/jar.clj
@@ -33,11 +33,11 @@

 (defn badge-markdown [jar]
   (str "[![Clojars Project]"
-       "(http://clojars.org/"
-       (:jar_name jar)
+       "(http://clojars.org"
+       (jar-url jar)
        "/latest-version.svg)]"
-       "(http://clojars.org/"
-       (:jar_name jar)
+       "(http://clojars.org"
+       (jar-url jar)
        ")"))

 (defn dependency-section [title id dependencies]


just simply prints wired and wireless compliance lists

--- src/trend_compliance/core.clj
+++ src/trend_compliance/core.clj
@@ -1,7 +1,8 @@
 (ns trend-compliance.core
   (:require [clojure.data.csv :as csv]
             [clojure.java.io :as io]
-            [clojure.string :as str])
+            [clojure.string :as str]
+            [clojure.pprint :as pp])
   (:gen-class))

 (defn trend-installed?
@@ -27,24 +28,26 @@
   (filter trend-installed? ping-successful-list)))

 (defn create-data-map
-  "parse the list of lists returned from read-csv"
+  "parse the list of lists returned from read-csv
+  If you want more data returned un-comment the fields below"
   [item]
   (let [[ip cp-name domain mac-ad off-scan-status ping prod-name platform os-server version patt-file scan-eng prev-pol cp-des rem-install] item]
     {:ip ip
-     :cp-name cp-name
-     :domain domain
-     :mac-ad mac-ad
+     ;; :cp-name cp-name
+     ;; :domain domain
+     ;; :mac-ad mac-ad
      :off-scan-status off-scan-status
      :ping ping
-     :prod-name prod-name
+     ;; :prod-name prod-name
      :platform platform
-     :os-server os-server
-     :version version
-     :patt-file patt-file
-     :scan-eng scan-eng
-     :prev-pol prev-pol
-     :cp-des cp-des
-     :rem-install rem-install}))
+     ;; :os-server os-server
+     ;; :version version
+     ;; :patt-file patt-file
+     ;; :scan-eng scan-eng
+     ;; :prev-pol prev-pol
+     ;; :cp-des cp-des
+     ;; :rem-install rem-install
+     }))

 (defn read-csv
   "read in a csv file"
@@ -56,8 +59,18 @@
 (defn -main
   "do some fun stuff with csv files"
   [& args]
-  (println "give me a file: ")
-    (let [file-name (read-line)
-          csv-data (read-csv file-name)
-          data-map (map create-data-map csv-data)]
-    (create-final-list data-map)))
+  (println "Files (<path/to/WIRED.csv> <path/to/WIRELSS.csv> <path/to/DETAIL>): ")
+    (let [in (read-line)
+          file-names (str/split in #" ")
+          wired (first file-names)
+          wireless (second file-names)
+          wired-csv-data (read-csv wired)
+          wireless-csv-data (read-csv wireless)
+          wired-data-map (map create-data-map wired-csv-data)
+          wireless-data-map (map create-data-map wireless-csv-data)
+          wired-list (create-final-list wired-data-map)
+          wireless-list (create-final-list wireless-data-map)]
+      (println "=============== Wired List: ===============")
+      (pp/pprint wired-list)
+      (println "\n=============== Wireless List: ===============")
+      (pp/pprint wireless-list)))


fixed issue with getting value for Event-Timestamp

--- src/trend_compliance/core.clj
+++ src/trend_compliance/core.clj
@@ -65,16 +65,13 @@
     (swap! state assoc :date str-line)
     (swap! state assoc
       (keyword (re-find #"(?x)\S+" (str (first line))))
-      (if (= (str (second line)) (re-find #"\w{3} \d{2} \d{4} \d{2}:\d{2}:\d{2} EST" (str (second line))))
-        (str (second line))
-        (re-find #"[^\\\"]\S+[^\\\"]" (str (second line))))))))
+      (re-find #"[^\\\"]+" (str (second line)))))))

 (defn read-detail
   "read in a large detail file"
   [file-name]
   (with-open [rdr (io/reader file-name)]
-    (let [line (line-seq rdr)
-          split-lines (doall (map parse-line line))]
+    (let [split-lines (doall (map parse-line (line-seq rdr)))]
       ;; (println split-lines))))
       (map line-to-map split-lines))))


Rephrasing introduction

Rephrasing introduction

--- src/ui/relevance/display.cljs
+++ src/ui/relevance/display.cljs
@@ -217,12 +217,13 @@
     [:h1 "Welcome!"]]
    [:div {:class "col-sm-10 col-sm-offset-1"}
     [:h2 "Thanks for installing Relevance"]
+    [:p "Relevance is a smart tab organizer. It’s nonintrusive and fully private. When you activate it your tabs are sorted based on the duration you are actively viewing it combined with the total time you actively browse pages on that domain. It will allow you to discover greater insights about your browsing habits."]
+    [:p "Relevance will keep track of the pages you actually read, and how long you spend reading them. This information is kept completely private, on your local browser. As you open tabs, its knowledge of what's important to you grows, and when you activate it the tabs  for your current window are ordered depending on how long you have spent reading them."]
+    [:p "This creates a natural arrangement where the tabs you have spent the longest on, which are expected to be the most relevant, are placed first, and the ones you haven't read at all are shunted to the end."]
     [:p "I'm a tab-aholic. I normally do a search, start opening the tabs that seem interesting, and then as I flip through them, I end up opening even more links on tabs as they seem relevant."]
     [:p "Next thing I know I have a huge mess of tabs, and it's hard to remember which one I've read, or which one is more relevant."]
-    [:p "I wrote Relevance to help manage that."]
-    [:p "When you install Relevance, it'll keep track of the pages you actually read, and how long you spend reading them. This information is kept completely private, on your local browser. As you open tabs, its knowledge of what's important to you grows, and when you activate it, the tabs  for your current window are ordered depending on how long you have spent reading them."]
-    [:p "This ordering creates a natural arrangement where the tabs you have spent the longest on, which are expected to be the most relevant, are placed first, and the ones you haven't read at all are shunted to the end."]
-    [:p "I've found this very useful in organizing what I should be focusing on."]]
+    [:p "I wrote Relevance to help manage that. I've found it very useful in organizing what I should be focusing on, and I hope it'l be useful for you as well."]
+    ]
    [:div {:class "col-sm-10 col-sm-offset-1"}
     [:h2 "Preview software"]
     [:p "Relevance is a software preview, and I'll be happy to hear your comments. If you have any suggestions on what you think might make Relevance better, "


params mapping for search-exact

params mapping for search-exact

--- src/wb_es/web/integration.clj
+++ src/wb_es/web/integration.clj
@@ -51,9 +51,13 @@

 (defn wrap-search-exact [handler]
   (fn [request]
-    (let [response (handler request)
+    (let [params (:params request)
+          response (handler (assoc request :params {:q (get params :q (:query params))
+                                                    :type (get params :type (:class params))
+                                                    :species (:species params)}))
+          pack-function pack-search-obj
           content-new (->> (get-in response [:body :hits :hits])
-                           (map pack-search-obj)
+                           (map pack-function)
                            (first))]
       (assoc response :body content-new))))


find "middle" triangle

find "middle" triangle

--- stuf/src/sandbox/4clojure.clj
+++ stuf/src/sandbox/4clojure.clj
@@ -934,10 +934,18 @@
 (defn b->m [b]
   (let [l (count (Integer/toString (apply max b) 2))
         frm (str "~" l ",'0B")]
-    (map #(clojure.pprint/cl-format nil frm %) b)))
-
-(defn f [b line lenth]
-  (let [n (count (first b))
-        start (/ (- n lenth) 2) ]
-    (for [i (range start (+ start lenth))] (get-in b [line i]))))
+    (mapv #(clojure.pprint/cl-format nil frm %) b)))
+
+(defn f
+  ([b] (f b inc))
+  ([b itr] (filter identity (map #(f b % itr) (range (count b)))))
+  ([b line itr] (f b line (count (first b)) [] itr))
+  ([b line len res itr]
+   (when (and (odd? (count (first b))) (>= line  0) (< line (count b)))
+     (let [n (count (first b))
+           start (/ (- n len) 2)
+           segm (for [i (range start (+ start len))] (get-in b [line i]))]
+       (if (<= len 1)
+         (cons (get-in b [line start]) res)
+         (f b (itr line) (- len 2) (concat segm res) itr))))))


Detect external links using correct value

The token is the path without the leading slash. We need the leading
slash to match against the secretary routes. That's `attr-href`, not
`new-token`.

This fixes an issue where all links were treated as external.

--- src-cljs/frontend/history.cljs
+++ src-cljs/frontend/history.cljs
@@ -127,12 +127,11 @@
 (defn setup-link-dispatcher! [history-imp top-level-node]
   (events/listen
    top-level-node "click"
-   #(let [-target (.. % -target)
-          {:keys [attr-href attr-target host-name]} (closest-a-tag-and-populate-properties -target)
+   #(let [{:keys [attr-href attr-target host-name]} (closest-a-tag-and-populate-properties (.-target %))
           new-token (when (seq attr-href) (subs attr-href 1))]
       (when (and (= (-> js/window .-location .-hostname)
                     host-name)
-                 (sec/locate-route new-token) ; Returns nil when no route is found in the app.
+                 (sec/locate-route attr-href) ; Returns nil when no route is found in the app.
                  (not (or (new-window-click? %)
                           (= attr-target "_blank"))))
         (.preventDefault %)


Factored out compilation, loading, and running unit tests

--- jvm-runner/src/clojure/codewars/runner/java.clj
+++ jvm-runner/src/clojure/codewars/runner/java.clj
@@ -6,26 +6,40 @@
            [java.net URLClassLoader]
            [javax.tools ToolProvider]
            [org.junit.runner JUnitCore]
-           [codewars.java CwRunListener]))
+           [codewars.java CwRunListener]
+           [java.io IOException]))

-(defn- write-code-and-load! [class-loader dir code]
-  (let [{:keys [:file-name :class-name]}
-        (util/write-code! "java" dir code)]
-    (-> (ToolProvider/getSystemJavaCompiler)
-        (.run nil nil nil
-              (into-array [(str file-name)])))
-    (Class/forName (str class-name) true class-loader)))
+(defn- compile! [& files]
+  ;; TODO: Add classpath option, other goodies
+  (let [compilation-result
+        (-> (ToolProvider/getSystemJavaCompiler)
+            (.run nil nil nil
+                  (into-array (map str files))))]
+    (if (zero? compilation-result)
+      0
+      (throw (IOException. "Java compilation error")))))
+
+(defn- load-class [dir class-name]
+  "Load a java class in a specified directory"
+  ;; TODO: Make the classpath include all the classes on the system classpath
+  (let [class-loader
+        (URLClassLoader/newInstance
+         (into-array [(-> dir .toURI .toURL)]))]
+    (Class/forName (name class-name) true class-loader)))
+
+(defn- run-junit-tests [fixture-class]
+  (let [runner (JUnitCore.)]
+    (.addListener runner (CwRunListener.))
+    (.run runner (into-array [fixture-class]))))

 (defmethod run "java"
-  [{:keys [:setup :fixture :solution]}]
+  [{:keys [:fixture :setup :solution]}]
   (let [dir (TempDir/create "java")
-        class-loader (URLClassLoader/newInstance
-                      (into-array [(-> dir .toURI .toURL)]))
-        fixture-class (write-code-and-load!
-                       class-loader dir fixture)
-        runner (JUnitCore.)]
-    (when (not (nil? setup)) (write-code-and-load! class-loader dir setup))
-    (write-code-and-load! class-loader dir solution)
-
-    (.addListener runner (CwRunListener.))
-    (.run runner (into-array [fixture-class]))))
+        fixture (util/write-code! "java" dir fixture)
+        setup (when (not (empty? setup)) (util/write-code! "java" dir setup))
+        solution (util/write-code! "java" dir solution)
+        files (for [{:keys [:file-name]} [fixture setup solution]
+                    :when (not (nil? file-name))]
+                file-name)]
+    (apply compile! files)
+    (->> fixture :class-name (load-class dir) run-junit-tests)))


Fix API routes

Fix API routes

--- src/foreclojure/api.clj
+++ src/foreclojure/api.clj
@@ -11,8 +11,8 @@
        (GET "/api/problem/:id" [id]
          (when-let [problem (fetch-one :problems :where {:_id (as-int id)
                                                          :approved true})]
-           (-> problem
-               (dissoc :_id :approved)
-               (update-each [:restricted :tags]
-                            #(or % ()))))))
+           {:body (-> problem
+                      (dissoc :_id :approved)
+                      (update-each [:restricted :tags]
+                                   #(or % ())))})))
       (wrap-json)))


Get rid of unused code

Get rid of unused code

--- src/freecoin/params.clj
+++ src/freecoin/params.clj
@@ -34,20 +34,6 @@
 (def host
   {:address "fork"
    :port 8000})
-
-(defn- get-mongo-uri []
-  (let [mongo-ip (get env/env :mongo-port-27017-tcp-addr "localhost")
-        db-name "fxctest1"]
-    (format "mongodb://%s:27017/%s" mongo-ip db-name)))
-
-(def webapp
-  {:db-config {:url (get-mongo-uri)}
-
-   :host host
-   :cookie-config {;; see: https://github.com/ring-clojure/ring/wiki/Cookies
-                   :secure false ;restrict the cookie to HTTPS URLs if true
-                   :http-only true}})
-

 ;; defaults
 (def encryption


fix missing orthologues in heatmap

fix missing orthologues in heatmap

--- src/cljs/gointermod/heatmap/handlers.cljs
+++ src/cljs/gointermod/heatmap/handlers.cljs
@@ -26,7 +26,6 @@
   "merges results from all organisms into one big fat map, and filters out the other two go branches"
   (filter
     (fn [result]
-      (.log js/console "XXX" (clj->js result))
       (= (:ontology-branch result) go-branch))
      (apply concat (map (fn [[_ organism]]
        organism
@@ -44,7 +43,7 @@
   (reduce (fn [new-map result]
       (update-in new-map
         [(:ortho-organism result)
-         (:display-ortholog-d result)
+         (:display-ortholog-id result)
          (:go-term result)] inc)
     ) {} results)
   )
@@ -60,7 +59,8 @@
 (defn build-result-matrix [go-terms aggregate-ortholog-counts]
   "This is basically a matrix representation of the table we'll output. We can't just use maps because the order is important, and maps can't be trusted."
   (apply concat (map (fn [[organism orthologs]]
-    (map (fn [[ortholog terms]]
+    (.log js/console "XXX" (clj->js organism) (clj->js orthologs))
+  (map (fn [[ortholog terms]]
       (concat [organism ortholog] (map-terms go-terms terms))
     ) orthologs)
   ) aggregate-ortholog-counts)))
@@ -84,7 +84,7 @@
         organisms-present (keys counts)
         missing-organisms (find-missing-organisms counts)]
     ;  (.clear js/console)
-      (.log js/console "C"(clj->js merged-results))
+    ;  (.log js/console (clj->js merged-results))
     {:rows final-heatmap-matrix :headers go-terms :max-count max-count :missing-organisms missing-organisms }
     ))


use goog.net.WebSocket

use goog.net.WebSocket

--- src-cljs/tranjlator/sockets.cljs
+++ src-cljs/tranjlator/sockets.cljs
@@ -1,7 +1,11 @@
 (ns tranjlator.sockets
   (:require [cljs.core.async :refer [<! >!] :as a]
-            [chord.client :refer [ws-ch]])
-  (:require-macros [cljs.core.async.macros :refer [go]]))
+            [chord.client :refer [ws-ch]]
+            [goog.events :as evt]
+            [cljs.reader :refer [read-string]])
+  (:require-macros [cljs.core.async.macros :refer [go-loop go]])
+  (:import [goog.net WebSocket]
+           [goog.net.WebSocket EventType]))

 (def +ws-url+ "/wsapp/")

@@ -20,9 +24,27 @@
        (recur)))))

 (defn make-socket [listener-ch sender-ch]
-  (go
-   (let [{:keys [ws-channel error]} (<! (ws-ch (str "ws://" (.. js/window -location -host) +ws-url+)))]
-     (when ws-channel
-       (do
-         (handle-incoming listener-ch ws-channel)
-         (handle-outgoing sender-ch ws-channel))))))
+  (let [ws (doto (WebSocket.)
+             (.open (str "ws://" (.. js/window -location -host) +ws-url+)))]
+
+    (.dir js/console ws)
+    (.dir js/console EventType)
+    (evt/listen ws (.-CLOSED EventType)  #(do (a/close! listener-ch)
+                                              (a/close! sender-ch)))
+    (evt/listen ws (.-OPENED EventType)  #(println "WS Connected"))
+    (evt/listen ws (.-MESSAGE EventType) #(a/put! listener-ch (read-string (.-message %))))
+    (evt/listen ws (.-ERROR EventType )  #(println "WS Error:" %))
+
+    (go-loop []
+      (when-some [msg (<! sender-ch)]
+        (.send ws (pr-str msg))
+        (recur))
+      (a/close! listener-ch)
+      (.close ws)
+      (.disposeInternal ws))
+
+    ;; (when ws-channel
+    ;;   (do
+    ;;     (handle-incoming listener-ch ws-channel)
+    ;;     (handle-outgoing sender-ch ws-channel)))
+    ))


Rename cat to avoid conflict with new fn in 1.7, close #23

--- lein-light-nrepl/src/lighttable/nrepl/sonar.clj
+++ lein-light-nrepl/src/lighttable/nrepl/sonar.clj
@@ -144,10 +144,10 @@
   (when (coll? f)
     (= (first f) 'clojure.core/deref)))

-(defn cat [func expr]
+(defn cat-expr [func expr]
   (apply concat
     (when-let [res (func expr)] [res])
-    (map (partial cat func) (:children expr))))
+    (map (partial cat-expr func) (:children expr))))

 (defn ops [expr]
   (when-let [o (:op expr)]
@@ -162,7 +162,7 @@
   (let [non-symbol-forms (filter #(and (not (symbol? %))
                                        (not (nil? %))
                                        (not (deref-form? %))) forms)
-        vars (cat (by-op-type :var)
+        vars (cat-expr (by-op-type :var)
                   (cljs-env/with-compiler-env (cljs-env/default-compiler-env)
                                               (cljs/analyze {:locals {}} non-symbol-forms)))]
     (reduce (fn [all cur]


RR: make base-uri mutable

RR: make base-uri mutable

--- src/hatti/ona/urls.cljs
+++ src/hatti/ona/urls.cljs
@@ -1,7 +1,8 @@
 (ns hatti.ona.urls
-  (:require [hatti.utils :refer [url format]]))
+  (:require [hatti.utils :refer [url format]]
+            [hatti.shared :refer [app-state]]))

-(def base-uri "//api.ona.io/api/v1")
+(def base-uri (atom "//api.ona.io/api/v1/"))

 (defn media-url [id fname]
-  (url base-uri "files" (format "%s?filename=%s" id fname)))
+  (url (str @base-uri "files") (format "%s?filename=%s" id fname)))


Fix assoc for when assoc a new key value to a sub node


actually delete the file

actually delete the file


Animation refactoring

Animation refactoring

Former-commit-id: 5c83b09db623bfb36add56ab70f27ee54ef914aa

--- src/status_im/chat/handlers.cljs
+++ src/status_im/chat/handlers.cljs
@@ -49,27 +49,28 @@
         (assoc-in [:chats current-chat-id :command-input] {})
         (update-in [:chats current-chat-id :input-text] safe-trim))))

-(defn animate-cancel-command [db height-anim-value]
-  (let [to-value 1]
+(defn animate-cancel-command! [db]
+  (let [height-anim-value (get-in db [:animations :response-suggestions-height])
+        to-value 1]
     (anim/add-listener height-anim-value
                        (fn [val]
                          (when (<= (- to-value delta) (anim/value val) (+ to-value delta))
                            (anim/remove-all-listeners height-anim-value)
                            (dispatch [:cancel-command]))))
-    (anim/stop-animation height-anim-value)
     (anim/start (anim/spring height-anim-value {:toValue    to-value
                                                 :speed      10
-                                                :bounciness 1}))
-    (assoc-in db [:animations :response-input-is-hiding?] true)))
+                                                :bounciness 1}))))

 (register-handler :start-cancel-command
-  (fn [{{height-anim-value :response-suggestions-height
-         hiding?           :response-input-is-hiding?} :animations :as db} _]
-    (if-not hiding?
-      (animate-cancel-command db height-anim-value)
-      db)))
-
-(defn update-response-suggestions-height [db]
+  (after animate-cancel-command!)
+  (fn [db _]
+    (let [current-chat-id (:current-chat-id db)
+          hiding? (get-in db [:animations :response-input-is-hiding?])]
+      (if-not hiding?
+        (assoc-in db [:animations :response-input-is-hiding?] true)
+        db))))
+
+(defn update-response-suggestions-height! [db]
   (when (and (not (get-in db [:animations :response-input-is-hiding?]))
              (commands/get-chat-command-to-msg-id db))
     (let [command (commands/get-chat-command db)
@@ -82,19 +83,17 @@
                                                    suggestions)))
           height (+ suggestions-height response-styles/request-info-height)
           anim-value (get-in db [:animations :response-suggestions-height])]
-      (anim/stop-animation anim-value)
       (anim/start
         (anim/spring anim-value {:toValue    height
                                  :speed      10
-                                 :bounciness 10}))))
-  db)
+                                 :bounciness 10})))))

 (register-handler :set-chat-command-content
+  (after update-response-suggestions-height!)
   (fn [{:keys [current-chat-id] :as db} [_ content]]
     (-> db
         (commands/set-chat-command-content content)
-        (assoc-in [:chats current-chat-id :input-text] nil)
-        (update-response-suggestions-height))))
+        (assoc-in [:chats current-chat-id :input-text] nil))))

 (defn update-input-text
   [{:keys [current-chat-id] :as db} text]
@@ -111,10 +110,9 @@
       (commands/stage-command db command-info))))

 (register-handler :set-response-chat-command
+  (after update-response-suggestions-height!)
   (fn [db [_ to-msg-id command-key]]
-    (-> db
-        (commands/set-response-chat-command to-msg-id command-key)
-        (update-response-suggestions-height))))
+    (commands/set-response-chat-command db to-msg-id command-key)))

 (defn update-text
   [db [_ text]]


[#2156] Remove :key true from columns generated

--- backend/specs/akvo/lumen/specs/import.clj
+++ backend/specs/akvo/lumen/specs/import.clj
@@ -7,39 +7,45 @@
             [clojure.string :as string]
             [clojure.tools.logging :as log]))

-(defn sample-imported-dataset [types-gens-tuple rows-count]
-  (let [adapt-spec (fn [k] (-> k lumen.s/keyname (string/replace "/body" "/value" ) keyword))
-        kw->spec (fn [s h] (->> (name h) (format s) keyword))
-        kw->column-spec (fn [h] (kw->spec "akvo.lumen.specs.import.column.%s/header" h))
-        kw->body-spec (fn [h] (kw->spec "akvo.lumen.specs.import.column.%s/body" h))
-        header-types (map (fn [t] (if (sequential? t) (first t) t)) types-gens-tuple)
-        headers   (map kw->column-spec header-types)
-        columns   (->> (map (fn [t]
-                              (if (sequential? t)
-                                (lumen.s/sample-with-gen (kw->column-spec (first t)) (if (map? (last t))
-                                                                                (last t)
-                                                                                {(adapt-spec (first t)) (last t)})  1)
-                                (list (lumen.s/sample (kw->column-spec t) 1)))) types-gens-tuple)
-                       (mapv #(assoc (first %2)
-                                     :id (str "c" (inc %))
-                                     :title (str "Column" (inc %)))
-                             (range (count headers))))
-        _         (do
-                    ;; "ensure columns headers are valid specs"
-                    (reduce (fn [_ i] (u/conform ::c/header i)) [] columns))
-        row-types (map (fn [t]
-                         (let [t (if (sequential? t) (first t) t)]
-                           (kw->body-spec t))) types-gens-tuple)
-        rows0     (reduce (fn [c _] (conj c (mapv (fn [t tg]
-                                                    (last (if (sequential? tg)
-                                                            (lumen.s/sample-with-gen t
-                                                                                (if (map? (last tg))
-                                                                                (last tg)
-                                                                                {(adapt-spec t) (last tg)})  10)
-                                                            (lumen.s/sample t 10)))) row-types types-gens-tuple)))
-                          [] (range rows-count))
-        _         (do
-                   ;;  "ensure column bodies (cells) are valid specs"
-                    (reduce (fn [_ i] (u/conform ::c/body i)) [] (flatten rows0)))
-        rows      (mapv #(mapv (fn [c] (dissoc c :type)) %) rows0)]
-    {:columns columns :rows rows}))
+(defn sample-imported-dataset
+  ([types-gens-tuple rows-count]
+   (sample-imported-dataset types-gens-tuple rows-count true))
+  ([types-gens-tuple rows-count columns-no-keys?]
+   (let [adapt-spec (fn [k] (-> k lumen.s/keyname (string/replace "/body" "/value" ) keyword))
+         kw->spec (fn [s h] (->> (name h) (format s) keyword))
+         kw->column-spec (fn [h] (kw->spec "akvo.lumen.specs.import.column.%s/header" h))
+         kw->body-spec (fn [h] (kw->spec "akvo.lumen.specs.import.column.%s/body" h))
+         header-types (map (fn [t] (if (sequential? t) (first t) t)) types-gens-tuple)
+         headers   (map kw->column-spec header-types)
+         columns   (->> (map (fn [t]
+                               (if (sequential? t)
+                                 (lumen.s/sample-with-gen (kw->column-spec (first t)) (if (map? (last t))
+                                                                                (last t)
+                                                                                {(adapt-spec (first t)) (last t)})  1)
+                                 (list (lumen.s/sample (kw->column-spec t) 1)))) types-gens-tuple)
+                        (mapv #(assoc (first %2)
+                                      :id (str "c" (inc %))
+                                      :title (str "Column" (inc %)))
+                              (range (count headers)))
+                        (mapv #(if columns-no-keys?
+                                 (dissoc % :key)
+                                 %)))
+         _         (do
+                     ;; "ensure columns headers are valid specs"
+                     (reduce (fn [_ i] (u/conform ::c/header i)) [] columns))
+         row-types (map (fn [t]
+                          (let [t (if (sequential? t) (first t) t)]
+                            (kw->body-spec t))) types-gens-tuple)
+         rows0     (reduce (fn [c _] (conj c (mapv (fn [t tg]
+                                                     (last (if (sequential? tg)
+                                                             (lumen.s/sample-with-gen t
+                                                                                (if (map? (last tg))
+                                                                                (last tg)
+                                                                                {(adapt-spec t) (last tg)})  10)
+                                                             (lumen.s/sample t 10)))) row-types types-gens-tuple)))
+                           [] (range rows-count))
+         _         (do
+                     ;;  "ensure column bodies (cells) are valid specs"
+                     (reduce (fn [_ i] (u/conform ::c/body i)) [] (flatten rows0)))
+         rows      (mapv #(mapv (fn [c] (dissoc c :type)) %) rows0)]
+     {:columns columns :rows rows})))


Remove forgotten log statement

Remove forgotten log statement

--- frontend/src/faceboard/views/boards/people/card.cljs
+++ frontend/src/faceboard/views/boards/people/card.cljs
@@ -43,7 +43,6 @@
                              (let [corr-right (- card-right-edge (- window-width screen-edge-padding))
                                    fixed-cpx-right (if (pos? corr-right) (- card-pos-x corr-right) card-pos-x)
                                    fixed-cpx (if (neg? fixed-cpx-right) screen-edge-padding fixed-cpx-right)]
-                               (log id card-right-edge window-width corr-right fixed-cpx)
                                (str
                                  "translateX(" (if extended? fixed-cpx card-pos-x) "px)"
                                  "translateY(" (:top layout) "px)"


Reformat day8.re-frame-10x.view.container ns

--- src/day8/re_frame_10x/view/container.cljs
+++ src/day8/re_frame_10x/view/container.cljs
@@ -25,8 +25,8 @@
   [panel-id title]
   (let [selected-tab @(rf/subscribe [:settings/selected-tab])]
     [rc/v-box
-     :style    {:margin-bottom "-8px"
-                :z-index       1}
+     :style {:margin-bottom "-8px"
+             :z-index       1}
      :children [[:button {:class    (str "tab button bm-heading-text " (when (= selected-tab panel-id) "active"))
                           :on-click #(rf/dispatch [:settings/selected-tab panel-id])} title]
                 [:img {:src   (str "data:image/svg+xml;utf8," triangle-down)
@@ -56,18 +56,18 @@
      :height           common/gs-12s}]
    [:.pulse-previous
     {:animation-duration "1000ms"
-     :animation-name     "pulse-previous-re-frame-10x"}] ;; Defined in day8.re-frame-10x.styles/at-keyframes
+     :animation-name     "pulse-previous-re-frame-10x"}]    ;; Defined in day8.re-frame-10x.styles/at-keyframes
    [:.pulse-next
     {:animation-duration "1000ms"
-     :animation-name     "pulse-next-re-frame-10x"}]
-   ])
+     :animation-name     "pulse-next-re-frame-10x"}]])
+

 (defn right-hand-buttons [external-window?]
   (let [selected-tab      (rf/subscribe [:settings/selected-tab])
         showing-settings? (= @selected-tab :settings)]
     [rc/h-box
-     :align    :center
+     :align :center
      :children [(when showing-settings?
                   [:button {:class    "bm-active-button"
                             :on-click #(rf/dispatch [:settings/toggle-settings])} "Done"])
@@ -123,9 +123,9 @@
   (let [older-epochs-available? @(rf/subscribe [:epochs/older-epochs-available?])
         newer-epochs-available? @(rf/subscribe [:epochs/newer-epochs-available?])]
     [[rc/h-box
-      :align    :center
-      :size     "auto"
-      :gap      common/gs-12s
+      :align :center
+      :size "auto"
+      :gap common/gs-12s
       :children [[:span.arrow.epoch-nav
                   (if older-epochs-available?
                     {:on-click #(do (rf/dispatch [:component/set-direction :previous])
@@ -151,10 +151,10 @@
                     {:class "arrow__disabled"
                      :title "Already showing latest epoch"})
                   [:img
-                   {:src      (str "data:image/svg+xml;utf8," (if newer-epochs-available? skip-to-end skip-to-end-disabled))
-                    :style    {:cursor        (if newer-epochs-available? "pointer" "default")
-                               :height        "12px"
-                               :margin-bottom "-1px"}}]]]]
+                   {:src   (str "data:image/svg+xml;utf8," (if newer-epochs-available? skip-to-end skip-to-end-disabled))
+                    :style {:cursor        (if newer-epochs-available? "pointer" "default")
+                            :height        "12px"
+                            :margin-bottom "-1px"}}]]]]
      [rc/gap-f :size common/gs-12s]
      [rc/line :size "2px" :color common/sidebar-heading-divider-color]
      [right-hand-buttons external-window?]]))
@@ -173,21 +173,21 @@
      :style {:background-color common/standard-background-color}
      :children [(if showing-settings?
                   [rc/h-box
-                   :class    "panel-content-top nav"
-                   :style    {:padding "0px 19px"}
+                   :class "panel-content-top nav"
+                   :style {:padding "0px 19px"}
                    :children (settings-header external-window?)]
                   [rc/h-box
-                   :class    "panel-content-top nav"
-                   :style    {:padding "0px 19px"}
+                   :class "panel-content-top nav"
+                   :style {:padding "0px 19px"}
                    :children (standard-header external-window?)])
                 (when-not showing-settings?
                   [rc/h-box
-                   :class    "panel-content-tabs"
-                   :justify  :between
+                   :class "panel-content-tabs"
+                   :justify :between
                    :children [[rc/h-box
-                               :gap      "7px"
-                               :align    :end
-                               :height   "50px"
+                               :gap "7px"
+                               :align :end
+                               :height "50px"
                                :children [[tab-button :event "Event"]
                                           [tab-button :fx "fx"]
                                           [tab-button :app-db "app-db"]
@@ -230,21 +230,21 @@
                     :label "Dismiss"
                     :on-click #(rf/dispatch [:errors/dismiss-popup-failed])]])
                 [rc/v-box
-                 :class    "tab-wrapper"
-                 :size     "1"
-                 :style    {:margin-left common/gs-19s
-                            :overflow-y  (if (contains? #{:event :fx :parts :timing :debug :settings} @selected-tab)
-                                           "auto"
-                                           "initial")}
+                 :class "tab-wrapper"
+                 :size "1"
+                 :style {:margin-left common/gs-19s
+                         :overflow-y  (if (contains? #{:event :fx :parts :timing :debug :settings} @selected-tab)
+                                        "auto"
+                                        "initial")}
                  :children [(case @selected-tab
-                              :event    [event/render]
-                              :fx       [fx/render]
-                              :app-db   [app-db/render db/app-db]
-                              :subs     [subs/render]
-                              :views    [views/render]
-                              :parts    [parts/render]
-                              :timing   [timing/render]
-                              :traces   [traces/render]
-                              :debug    [debug/render]
+                              :event [event/render]
+                              :fx [fx/render]
+                              :app-db [app-db/render db/app-db]
+                              :subs [subs/render]
+                              :views [views/render]
+                              :parts [parts/render]
+                              :timing [timing/render]
+                              :traces [traces/render]
+                              :debug [debug/render]
                               :settings [settings/render]
                               [app-db/render db/app-db])]]]]))


Add negative test for multi-arity featurec

--- test/desdemona/query_test.clj
+++ test/desdemona/query_test.clj
@@ -195,7 +195,11 @@
        [{:ip "10.0.0.2"    ;; ip clause succeeded
          :type "egress"}]
        [{:ip "10.0.0.2"    ;; ip clause succeeded
-         :type "ingress"}]])))
+         :type "ingress"}]]))
+  (testing "multi-arity featurec with literal"
+    (are [query results] (= results (q/run-dsl-query 10 query events))
+      '(= (:ip x) (:ip y) "1.2.3.4")
+      [])))

 (deftest run-logic-query-tests
   (are [query results] (= results (#'q/run-logic-query query events))


Better documentation on existing test suite

--- test/kixi/hecuba/dev_test.clj
+++ test/kixi/hecuba/dev_test.clj
@@ -3,12 +3,21 @@
         kixi.hecuba.protocols
         kixi.hecuba.dev))

+
 (deftest query
   (let [r (ref {})
         commander (->RefCommander r)
         querier (->RefQuerier r)]
+
+    ;; Add some data
     (upsert! commander {:hecuba/name "Project X" :hecuba/type :project})
     (upsert! commander {:hecuba/name "Project Y" :hecuba/type :project})
     (upsert! commander {:hecuba/name "Falling Water" :hecuba/type :property})
-    (is (= (count (items querier)) 3))
-    (is (= (count (items querier {:hecuba/type :project})) 2))))
+
+    (is (= (count (items querier)) (count @r))
+        "Without a constraint argument, items should return all the items in the ref")
+
+    (is (= (count (items querier {:hecuba/type :project}))
+           (count (filter #(= :project (:hecuba/type %)) (vals @r))))
+        "With a constraint, just the items that satisfy the constraint"
+        )))


Adds TODOs

Adds TODOs

--- src/loudmoauth/core.clj
+++ src/loudmoauth/core.clj
@@ -5,6 +5,10 @@
             [clojure.data.json :as json]
             [clj-http.util :as util]
             [clj-http.client :as client]))
+
+;TODO - Deal with errors and exceptions
+;TODO - Deal with missing :redirect-uri key, if that is possible?
+;TODO - Make the oauth-params map accept keys on this format :client-id instead of :client_id.

 (def code-chan (a/chan))


Test for (where (... event ...))

Test for (where (... event ...))

--- test/riemann/test/streams.clj
+++ test/riemann/test/streams.clj
@@ -480,6 +480,11 @@
                     (doseq [e events] (s e))
                     (is (= expect (deref r)))))

+         (testing "event binding"
+           (test-stream (where (= event 2))
+                        [1 2 3 2]
+                        [2 2]))
+
          (testing "regex"
                   (test-stream (where (service #"^foo"))
                                [{}


Simplified the definition of the comparators

--- ccw.core/src/clj/ccw/debug/serverrepl.clj
+++ ccw.core/src/clj/ccw/debug/serverrepl.clj
@@ -347,43 +347,37 @@
   (let [i (.indexOf x s)]
     (when (not= -1 i) i)))

-(def string-comparator
-  (reify java.util.Comparator
-    (compare [_ x y] (.compareTo ^String x ^String y))))
-
 (defn compose-comparators
   "Create a comparator made of comparators. When called for x & y,
    applies first comparator to x and y. If x equals y, applies next
    comparator, etc."
   [& comparators]
   (letfn [(chain [[c & tail] x y]
-            (let [r (.compare ^java.util.Comparator c x y)]
+            (let [r (c x y)]
               (if (and (zero? r) tail)
                 (recur tail x y)
                 r)))]
-         (reify java.util.Comparator
-           (compare [_ x y] (chain comparators x y)))))
-
-(def length-comparator
-  (reify java.util.Comparator
-    (compare [_ x y] (- (count x) (count y)))))
+         (fn [x y] (chain comparators x y))))
+
+(defn length-comparator
+  [x y]
+  (- (count x) (count y)))

 (defn distance-comparator
-  [s distance-fn ^java.util.Comparator if-same-distances-comparator
-   & [^java.util.Comparator if-nil-distances-comparator]]
-  (reify java.util.Comparator
-    (compare [_ x y]
-      (let [idxx (distance-fn x s)
-            idxy (distance-fn y s)]
-        (cond
-          (and idxx idxy)
-            (if (= idxx idxy)
-              (.compare if-same-distances-comparator x y)
-              (- idxx idxy))
-          (and idxx (not idxy)) -1
-          (and idxy (not idxx)) 1
-          if-nil-distances-comparator
-            (.compare if-nil-distances-comparator x y))))))
+  [s distance-fn if-same-distances-comparator
+   & [if-nil-distances-comparator]]
+  (fn [x y]
+    (let [idxx (distance-fn x s)
+          idxy (distance-fn y s)]
+      (cond
+        (and idxx idxy)
+        (if (= idxx idxy)
+          (if-same-distances-comparator x y)
+          (- idxx idxy))
+        (and idxx (not idxy)) -1
+        (and idxy (not idxx)) 1
+        if-nil-distances-comparator
+        (if-nil-distances-comparator x y)))))

 ;; TODO instead of this monolithic piece of code
 ;; see if we can instead compose comparators
@@ -400,11 +394,11 @@
   (distance-comparator
     s
     index-of-distance
-    (compose-comparators length-comparator string-comparator)
+    (compose-comparators length-comparator compare)
     (distance-comparator
       s
       textmate-distance
-      (compose-comparators length-comparator string-comparator))))
+      (compose-comparators length-comparator compare))))

 (defmulti filter-completion
   (fn [match-symbol ^String prefix filter-fn] (prefix-kind prefix)))
@@ -482,10 +476,10 @@
                    (if (<= (count completions) limit)
                      (textmate-comparator prefix)
                      (distance-comparator
-                       s
+                       prefix
                        index-of-distance
-                       string-comparator
-                       string-comparator))
+                       compare
+                       compare))
                    completions))))))

 ;; To filter with "textmate-like" logic, and also sort with


Move from s to string as alias

Move from s to string as alias

--- planck-cljs/src/planck/repl.cljs
+++ planck-cljs/src/planck/repl.cljs
@@ -1,7 +1,7 @@
 (ns planck.repl
   (:require-macros [cljs.env.macros :refer [with-compiler-env]]
                    [planck.repl :refer [with-err-str]])
-  (:require [clojure.string :as s]
+  (:require [clojure.string :as string]
             [goog.string :as gstring]
             [cljs.analyzer :as ana]
             [cljs.compiler :as comp]
@@ -35,7 +35,7 @@
 (def ^:private could-not-eval-expr (str "Could not eval " expression-name))

 (defn- calc-x-line [text pos line]
-  (let [x (s/index-of text "\n")]
+  (let [x (string/index-of text "\n")]
     (if (or (nil? x)
             (< pos (inc x)))
       {:cursorX    pos
@@ -90,7 +90,7 @@

 (defn- drop-macros-suffix
   [ns-name]
-  (if (s/ends-with? ns-name "$macros")
+  (if (string/ends-with? ns-name "$macros")
     (apply str (drop-last 7 ns-name))
     ns-name))

@@ -529,7 +529,7 @@
   position in that line."
   [pos buffer previous-lines]
   (let [previous-lines  (js->clj previous-lines)
-        previous-source (s/join "\n" previous-lines)
+        previous-source (string/join "\n" previous-lines)
         total-source    (if (empty? previous-lines)
                           buffer
                           (str previous-source "\n" buffer))
@@ -579,7 +579,7 @@

 (defn- is-macros?
   [cache]
-  (s/ends-with? (str (:name cache)) "$macros"))
+  (string/ends-with? (str (:name cache)) "$macros"))

 (defn- form-build-affecting-options
   []
@@ -656,7 +656,7 @@

 (defn- add-suffix
   [file suffix]
-  (let [candidate (s/replace file #".clj[sc]?$" suffix)]
+  (let [candidate (string/replace file #".clj[sc]?$" suffix)]
     (if (gstring/endsWith candidate suffix)
       candidate
       (str file suffix))))
@@ -694,7 +694,7 @@

 (defn- strip-first-line
   [source]
-  (subs source (inc (s/index-of source "\n"))))
+  (subs source (inc (string/index-of source "\n"))))

 (defn- cached-callback-data
   [name path macros cache-prefix source source-modified raw-load]
@@ -913,7 +913,7 @@
   [ns]
   {:pre [(symbol? ns)]}
   (let [ns-str        (str ns)
-        munged-ns-str (s/replace ns-str #"\." "$")]
+        munged-ns-str (string/replace ns-str #"\." "$")]
     (into {} (for [sym (ns-syms ns)]
                [(str munged-ns-str "$" (munge sym)) (symbol ns-str (str sym))]))))

@@ -946,7 +946,7 @@

 (defn- gensym?
   [sym]
-  (s/starts-with? (name sym) "G__"))
+  (string/starts-with? (name sym) "G__"))

 (defn- demunge-sym
   [munged-sym]
@@ -1007,7 +1007,7 @@
          message             (if (instance? ExceptionInfo error)
                                (ex-message error)
                                (.-message error))]
-     (when (or (not ((fnil s/starts-with? "") printed-message message))
+     (when (or (not ((fnil string/starts-with? "") printed-message message))
              include-stacktrace?)
        (println (((if roa? :rdr-ann-err-fn :ex-msg-fn) theme) message)))
      (when include-stacktrace?
@@ -1040,7 +1040,7 @@
 (defn- all-macros-ns
   []
   (->> (all-ns)
-    (filter #(s/ends-with? (str %) "$macros"))))
+    (filter #(string/ends-with? (str %) "$macros"))))

 (defn- get-var
   [env sym]
@@ -1055,8 +1055,8 @@
 (defn- get-file-source
   [filepath]
   (if (symbol? filepath)
-    (let [without-extension (s/replace
-                              (s/replace (name filepath) #"\." "/")
+    (let [without-extension (string/replace
+                              (string/replace (name filepath) #"\." "/")
                               #"-" "_")]
       (or
         (first (js/PLANCK_LOAD (str without-extension ".clj")))
@@ -1064,9 +1064,9 @@
         (first (js/PLANCK_LOAD (str without-extension ".cljs")))))
     (let [file-source (first (js/PLANCK_LOAD filepath))]
       (or file-source
-          (first (js/PLANCK_LOAD (s/replace filepath #"^out/" "")))
-        (first (js/PLANCK_LOAD (s/replace filepath #"^src/" "")))
-        (first (js/PLANCK_LOAD (s/replace filepath #"^/.*/planck-cljs/src/" "")))))))
+          (first (js/PLANCK_LOAD (string/replace filepath #"^out/" "")))
+        (first (js/PLANCK_LOAD (string/replace filepath #"^src/" "")))
+        (first (js/PLANCK_LOAD (string/replace filepath #"^/.*/planck-cljs/src/" "")))))))

 (defn- fetch-source
   [var]
@@ -1144,7 +1144,7 @@
   [str-or-pattern]
   (let [matches? (if (instance? js/RegExp str-or-pattern)
                    #(re-find str-or-pattern (str %))
-                   #(s/includes? (str %) (str str-or-pattern)))]
+                   #(string/includes? (str %) (str str-or-pattern)))]
     (sort (mapcat (fn [ns]
                     (let [ns-name (drop-macros-suffix (str ns))]
                       (map #(symbol ns-name (str %))
@@ -1162,7 +1162,7 @@
   ;; after newlines with two.
   (when-not (nil? s)
     (if (re-find #"[^\n]*\n\n?      ?\S.*" s)
-      (s/replace-all s #"\n      ?" "\n  ")
+      (string/replace-all s #"\n      ?" "\n  ")
       s)))

 (defn- doc*


More inlining and code elision

More inlining and code elision

--- src/active/clojure/record.cljc
+++ src/active/clojure/record.cljc
@@ -228,21 +228,9 @@
 (defn- validate-fields
   ""
   [fields name]
-  (when-not (vector? fields)
-    (throw (AssertionError. "No fields vector given.")))
   (let [specials '#{__meta __hash __hasheq __extmap}]
     (when (some specials fields)
-      (throw (AssertionError. (str "The names in " specials " cannot be used as field names for types or records.")))))
-  (let [non-syms (remove symbol? fields)]
-    (when (seq non-syms)
-      (throw (clojure.lang.Compiler$CompilerException.
-              *file*
-              (.deref clojure.lang.Compiler/LINE)
-              (.deref clojure.lang.Compiler/COLUMN)
-              (AssertionError.
-               (str "defrecord and deftype fields must be symbols, "
-                    *ns* "." name " had: "
-                    (apply str (interpose ", " non-syms)))))))))
+      (throw (AssertionError. (str "The names in " specials " cannot be used as field names for types or records."))))))

 (defn throw-illegal-argument-exception
   [msg]
@@ -362,23 +350,20 @@
           (throw (throw-illegal-argument-exception (str "constructor argument " ?constructor-arg " is not a field in " *ns* " " (meta &form)))))))

     `(do
-       ~(let [name ?type
-              fields (mapv first ?field-triples)
-              opts+specs ?opt+specs]
-          (validate-fields fields name)
-          (let [gname name
-                [interfaces methods opts] (parse-opts+specs opts+specs)
+       ~(let [fields (mapv first ?field-triples)]
+          (validate-fields fields ?type)
+          (let [[interfaces methods opts] (parse-opts+specs ?opt+specs)
                 ns-part (namespace-munge *ns*)
-                classname (symbol (str ns-part "." gname))
+                classname (symbol (str ns-part "." ?type))
                 hinted-fields fields
                 fields (vec (map #(with-meta % nil) fields))]
             `(let []
-               (declare ~(symbol (str  '-> gname)))
-               (declare ~(symbol (str 'map-> gname)))
-               ~(emit-defrecord name gname (vec hinted-fields) (vec interfaces) methods opts)
+               (declare ~(symbol (str  '-> ?type)))
+               (declare ~(symbol (str 'map-> ?type)))
+               ~(emit-defrecord ?type ?type (vec hinted-fields) (vec interfaces) methods opts)
                (import ~classname)
-               ~(build-positional-factory gname classname fields)
-               (defn ~(symbol (str 'map-> gname))
+               ~(build-positional-factory ?type classname fields)
+               (defn ~(symbol (str 'map-> ?type))
                  ~(str "Factory function for class " classname ", taking a map of keywords to field values.")
                  ([m#] (~(symbol (str classname "/create"))
                         (if (instance? clojure.lang.MapEquivalence m#) m# (into {} m#)))))


Better arglists for define-record-type-defined functions.

--- src/active/clojure/record.cljc
+++ src/active/clojure/record.cljc
@@ -32,49 +32,60 @@
                               (fn [m]
                                 (if (contains? m :doc)
                                   m
-                                  (assoc m :doc doc)))))]
+                                  (assoc m :doc doc)))))
+        document-with-arglist (fn [n arglist doc]
+                                (vary-meta n
+                                           (fn [m]
+                                             (let [m (if (contains? m :doc)
+                                                       m
+                                                       (assoc m :doc doc))]
+                                               (if (contains? m :arglists)
+                                                 m
+                                                 (assoc m :arglists `'(~arglist)))))))]
+

-    (let [?field-names (set (map first ?field-pairs))]
-      (doseq [?constructor-arg ?constructor-args]
-        (when-not (contains? ?field-names ?constructor-arg)
-          (throw (IllegalArgumentException. (str "constructor argument " ?constructor-arg " is not a field in " *ns* " " (meta &form)))))))
+    (let [?field-names (map first ?field-pairs)]
+      (let [?field-names-set (set ?field-names)]
+        (doseq [?constructor-arg ?constructor-args]
+          (when-not (contains? ?field-names-set ?constructor-arg)
+            (throw (IllegalArgumentException. (str "constructor argument " ?constructor-arg " is not a field in " *ns* " " (meta &form)))))))

-    `(do
-       (defrecord ~?type
-           [~@(map first ?field-pairs)]
-         ~@?opt+specs)
-       (defn ~(document ?predicate (str "Is object a " ?type " record?"))
-         [x#]
-         (instance? ~?type x#))
-       (defn ~(document ?constructor (str "Construct a `" ?type "` record."))
-         [~@?constructor-args]
-         (new ~?type
-              ~@(map (fn [[?field _]]
-                       (if (contains? ?constructor-args-set ?field)
-                         `~?field
-                         `nil))
-                     ?field-pairs)))
-       ~@(map (fn [[?field ?accessor]]
-                (let [?rec (with-meta `rec# {:tag ?type})]
-                  `(defn ~(document ?accessor (str "Access the `" ?field "` field from a `" ?type "` record."))
-                     [~?rec]
-                     (check-type ~?type ~?rec ~?accessor)
-                     (. ~?rec ~(symbol (str "-" ?field))))))
-              ?field-pairs)
-       ~@(map (fn [[?field ?accessor ?lens]]
-                (let [?data `data#
-                      ?v `v#]
-                  `(def ~(document ?lens (str "Lens for the `" ?field "` field from a `" ?type "` record."))
-                     (active.clojure.lens/lens ~?accessor
-                                               (fn [~?data ~?v]
-                                                 (~?constructor ~@(map
-                                                                   (fn [[?shove-field ?shove-accessor]]
-                                                                     (if (= ?field ?shove-field)
-                                                                       ?v
-                                                                       `(~?shove-accessor ~?data)))
-                                                                   ?field-pairs)))))))
-              ?field-pairs-lense)))))
+      `(do
+         (defrecord ~?type
+             [~@(map first ?field-pairs)]
+           ~@?opt+specs)
+         (def ~(document-with-arglist ?predicate '[thing] (str "Is object a [[" ?type "]] record?"))
+           (fn [x#]
+             (instance? ~?type x#)))
+         (def ~(document ?constructor (str "Construct a [[" ?type "]] record."))
+           (fn [~@?constructor-args]
+             (new ~?type
+                  ~@(map (fn [[?field _]]
+                           (if (contains? ?constructor-args-set ?field)
+                             `~?field
+                             `nil))
+                         ?field-pairs))))
+         ~@(map (fn [[?field ?accessor]]
+                  (let [?rec (with-meta `rec# {:tag ?type})]
+                    `(def ~(document-with-arglist ?accessor (vector ?type)  (str "Access the `" ?field "` field from a [[" ?type "]] record."))
+                       (fn [~?rec]
+                         (check-type ~?type ~?rec ~?accessor)
+                         (. ~?rec ~(symbol (str "-" ?field)))))))
+                ?field-pairs)
+         ~@(map (fn [[?field ?accessor ?lens]]
+                  (let [?data `data#
+                        ?v `v#]
+                    `(def ~(document-with-arglist ?lens (vector ?type 'val) (str "Lens for the `" ?field "` field from a [[" ?type "]] record."))
+                       (active.clojure.lens/lens ~?accessor
+                                                 (fn [~?data ~?v]
+                                                   (~?constructor ~@(map
+                                                                     (fn [[?shove-field ?shove-accessor]]
+                                                                       (if (= ?field ?shove-field)
+                                                                         ?v
+                                                                         `(~?shove-accessor ~?data)))
+                                                                     ?field-pairs)))))))
+                ?field-pairs-lense))))))


rename select-filter -> do-filter

rename select-filter -> do-filter

--- src/main/clojure/org/dada/demo/whales.clj
+++ src/main/clojure/org/dada/demo/whales.clj
@@ -353,7 +353,7 @@
 ;; filtration
 ;;----------------------------------------

-(defn select-filter
+(defn do-filter
   "apply a filter view to a model"
   ([model filter-fn view dummy]
    (connect model (make-filter filter-fn view))
@@ -361,9 +361,9 @@
   ([model filter-fn filter-name]
    (let [view-name (str (.getName model) "." filter-name)
 	 view (clone-model model view-name)]
-     (select-filter model filter-fn view "dummy"))))
-
-(def blue-whales (select-filter whales #(= "blue whale" (.getType %)) "type='blue whale'"))
+     (do-filter model filter-fn view "dummy"))))
+
+(def blue-whales (do-filter whales #(= "blue whale" (.getType %)) "type='blue whale'"))
 (insert *metamodel* blue-whales)

 ;;----------------------------------------
@@ -408,7 +408,7 @@
       filter-attr-accessor (make-accessor Whale filter-attr-type filter-attr-key)
       filter-name (str (name filter-attr-key) "='" filter-attr-value "'")
       filter-fn #(= filter-attr-value (filter-attr-accessor %))
-      filtration (select-filter model filter-fn filter-name)
+      filtration (do-filter model filter-fn filter-name)

       aggregator-attr-key :weight
       aggregator-symbol 'count ;; 'sum, 'average, 'count


minor

minor

--- cljs-cheatsheet/cljs_cheatsheet/core.cljs
+++ cljs-cheatsheet/cljs_cheatsheet/core.cljs
@@ -21,6 +21,8 @@
 (def search-input-sel (str "#" search-input-id))
 (def symbol-tooltip-id "symbolTooltip")
 (def symbol-tooltip-sel (str "#" symbol-tooltip-id))
+
+;; TODO: rename "symbol tooltips" to "inline tooltips" throughout the code

 ;;------------------------------------------------------------------------------
 ;; Highlight Related Links


simplify.clj: started on local degree 2 adjustment function

--- clojure/org/gavrog/clojure/simplify3d.clj
+++ clojure/org/gavrog/clojure/simplify3d.clj
@@ -27,10 +27,19 @@
           E (walk ds C 0 1)
           [F G] (map #(s ds 3 %) [D E])
           [D* E* F* G*] (map #(s ds 1 %) [D E F G])
-          ops* (ops ds)
-          ops* (assoc ops* 1 (conj (ops* 1)
-                                   [D E*] [E D*] [D* E] [E* D]
-                                   [F G*] [G F*] [F* G] [G* F]))
-          tmp (DSymbol. 3 (size ds) ops* (vs ds))]
+          ops* (assoc (ops ds) 1 (conj ((ops ds) 1)
+                                       [D E*] [E D*] [D* E] [E* D]
+                                       [F G*] [G F*] [F* G] [G* F]))
+          tmp (make-dsymbol 3 (size ds) ops* (vs ds))]
       (collapse tmp 3 (orbit-elements tmp [0 1 3] C)))
     ds))
+
+(defn- deg-2-element [ds D]
+  (and (= 2 (m ds 1 2 D))
+       (let [E (walk ds D 2 3)]
+         (not #{E (walk ds E 0 1) (walk ds E 1 0)} D))))
+
+(defn- fix-degree-2-vertex [ds]
+  (if-let [D (first (filter (partial deg-2-element ds)) (orbit-reps ds [1 2]))]
+    nil ;; TODO code here
+    ds))


Validate before building nil window-map.

--- src/onyx/http_query.clj
+++ src/onyx/http_query.clj
@@ -276,12 +276,12 @@
                {:keys [db state-indices grouped? idx->window]} store
                idx (get state-indices window)
                window-map (get idx->window idx)
-               wext (wc/resolve-window-extension window-map)
                _ (when-not store (throw (ex-info "Peer state store not found."
                                                  {:job-id job-id
                                                   :task task
                                                   :slot-id slot-id
-                                                  :allocation-version allocation-version})))]
+                                                  :allocation-version allocation-version})))
+               wext (wc/resolve-window-extension window-map)]
            (if grouped?
              (let [groups (get-in request [:query-params "groups"])
                    groups (if groups


Three tests in db_interface module: set-word-status, delete-word, and undelete-word

--- test/zg/db_interface_test.clj
+++ test/zg/db_interface_test.clj
@@ -51,3 +51,20 @@
         (is (callable? 'zg.db-interface/add-new-word-into-dictionary))))

+(deftest test-set-word-status-existence
+    "Check that the zg.db-interface/set-word-status definition exists."
+    (testing "if the zg.db-interface/set-word-status definition exists."
+        (is (callable? 'zg.db-interface/set-word-status))))
+
+
+(deftest test-delete-word-existence
+    "Check that the zg.db-interface/delete-word definition exists."
+    (testing "if the zg.db-interface/delete-word definition exists."
+        (is (callable? 'zg.db-interface/delete-word))))
+
+
+(deftest test-undelete-word-existence
+    "Check that the zg.db-interface/undelete-word definition exists."
+    (testing "if the zg.db-interface/undelete-word definition exists."
+        (is (callable? 'zg.db-interface/undelete-word))))
+


:wrench: Remove unused LDAP config spec

:wrench: Remove unused LDAP config spec

Co-authored-by: Mathieu Brunot <cbb78c9d6ecc8139b4697c3352cc1f1edbdf61d7@monogramm.io>

--- backend/src/uxbox/config.clj
+++ backend/src/uxbox/config.clj
@@ -94,7 +94,6 @@

 (s/def ::ldap-auth-host ::us/string)
 (s/def ::ldap-auth-port ::us/integer)
-(s/def ::ldap-auth-version ::us/string)
 (s/def ::ldap-bind-dn ::us/string)
 (s/def ::ldap-bind-password ::us/string)
 (s/def ::ldap-auth-ssl ::us/boolean)


rename 'relative-clause-complement' to 'slash-obj'

--- src/babel/english/grammar.cljc
+++ src/babel/english/grammar.cljc
@@ -387,7 +387,7 @@
                         :synsem {:cat :sent-modifier}}
                  :rule "s-modifier"})

-   ;;      noun-phrase3      ->  noun-phrase[1,2] relative-clause-complement
+   ;;      noun-phrase3      ->  noun-phrase[1,2] slash-obj
    ;; e.g. "the man you saw" ->  "the man"        "you saw"
    (unify-check
     {:rule "noun-phrase3"
@@ -414,7 +414,7 @@
                        :mod head-mod
                        :sem head-sem}}
        :comp {:phrasal true
-              :rule "relative-clause-complement"
+              :rule "slash-obj"
               :synsem {:cat :verb
                        :sem comp-sem}}})

@@ -425,7 +425,7 @@
    (unify-check
     (let [first-arg (atom :top)
           second-arg (atom {:reflexive false})]
-      {:rule "relative-clause-complement"
+      {:rule "slash-obj"
        :phrasal true
        :slash true
        :synsem {:cat :verb
@@ -446,9 +446,8 @@

     head-last

-    {:comp {:phrasal false}}
-
-    {:comp {:synsem {:pronoun true
+    {:comp {:phrasal false
+            :synsem {:pronoun true
                      :case :nom
                      :cat :noun}}}


fix typo

fix typo

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -1135,7 +1135,7 @@
      :english {:past "kept"}}
     {:synsem {:cat :verb
               :sem {:pred :keep-safe}}
-     :english {:note "(something safe)"
+     :english {:note "something safe"
                :past "kept"}}]

    "key" {:synsem {:cat :noun


added se lever

added se lever

--- src/babel/francais/lexicon.clj
+++ src/babel/francais/lexicon.clj
@@ -511,6 +511,21 @@
                                        :reflexive true
                                        :sem subject-semantics}}}})

+  "se lever" (let [subject-semantics (ref {:human true})
+                    subject-agr (ref :top)]
+                {:synsem {:cat :verb
+                          :essere true
+                          :sem {:pred :get-up
+                                :reflexive true
+                                :subj subject-semantics
+                                :obj subject-semantics}
+                          :subcat {:1 {:agr subject-agr
+                                       :sem subject-semantics}
+                                   :2 {:agr subject-agr
+                                       :pronoun true
+                                       :reflexive true
+                                       :sem subject-semantics}}}})
+
   "soulever" {:synsem {:cat :verb
                        :sem {:pred :lift}}}


Bug Fix! Control-bus asynchronous message multiplexing issue.

Previously, multiple control-bus value getting commands for different
busses were randomly mixed when received. Now specific checking fns have
been added to ensure the right response goes to the right requester.

These bugs are super annoying and nasty. It's nice to squash another!

--- src/overtone/sc/bus.clj
+++ src/overtone/sc/bus.clj
@@ -133,7 +133,7 @@
   "Get the current value of a control bus."
   [bus]
   (let [id (to-sc-id bus)
-        p  (server-recv "/c_set")]
+        p  (server-recv "/c_set" (fn [info] (= id (first (:args info)))))]
     (snd "/c_get" id)
     (second (:args (deref! p (str "attempting to read the current value of bus " (with-out-str (pr bus))))))))

@@ -148,7 +148,8 @@
   "Get a range of consecutive control bus values."
   [bus len]
   (let [id (to-sc-id bus)
-        p  (server-recv "/c_setn")]
+        p  (server-recv "/c_setn" (fn [info] (and (= id (first (:args info)))
+                                                 (= len (second (:args info))))))]
     (snd "/c_getn" id len)
     (drop 2 (:args (deref! p (str "attempting to get a range of consecutive control bus values of length " len " from bus " (with-out-str (pr bus))))))))


hack to fetch entity ids when app starts

--- src-cljs/frontend/core.cljs
+++ src-cljs/frontend/core.cljs
@@ -23,6 +23,7 @@
             [frontend.history :as history]
             [frontend.browser-settings :as browser-settings]
             [frontend.utils :as utils :refer [mlog merror third]]
+            [frontend.utils.ajax :as ajax]
             [frontend.datetime :as datetime]
             [secretary.core :as sec])
   (:require-macros [cljs.core.async.macros :as am :refer [go go-loop alt!]]
@@ -245,6 +246,9 @@
   []
   (goog.dom.setProperties (sel1 "#app") #js {:id "om-app"}))

+(defn fetch-entity-ids [api-ch eid-count]
+  (ajax/ajax :post "/api/entity-ids" :entity-ids api-ch :params {:count eid-count}))
+
 (defn ^:export setup! []
   (apply-app-id-hack)
   (let [state (app-state)
@@ -254,6 +258,7 @@
     (def debug-state state)
     (browser-settings/setup! state)
     (main state top-level-node history-imp)
+    (fetch-entity-ids (get-in @state [:comms :api]) 10)
     (if-let [error-status (get-in @state [:render-context :status])]
       ;; error codes from the server get passed as :status in the render-context
       (put! (get-in @state [:comms :nav]) [:error {:status error-status}])


Adds aditional rule to the cadence? validator.

This rule checks that the :training-phrase key on the sesion is not null
indicating that the current user was in fact in the middle of a training
process.

--- src/cadence/model/validators.clj
+++ src/cadence/model/validators.clj
@@ -1,6 +1,7 @@
 (ns cadence.model.validators
-  (:require [cadence.model :as m])
-  (:require [cadence.model.recaptcha :as recaptcha])
+  (:require [cadence.model :as m]
+            [noir.session :as sess]
+            [cadence.model.recaptcha :as recaptcha])
   (:use noir.validation))

 (defn user?
@@ -55,23 +56,25 @@
           [:cadence (str "User input has incorrect keys."
                          "Got: '" cad-keys "' should be: '#{:timeline :phrase}'")])
     (rule (and
-          ; Veirfy that both parts exist
-          (not (nil? phrase))
-          (not (nil? timeline))
-          ; Make sure the length of timeline is the same is the length of the
-          ; phrase
-          (= (count timeline) (.length phrase))
-          ; Ensure that each event contains the correct keys of the proper types
-          (reduce (fn [x y] (and x (timeline-event? y)))
-                  true timeline)
-          ; Verify that the times and timeDifferences add up properly
-          (get (reduce (fn [x y]
-                         (let [new-time (+ (:time x) (:timeDifference y))
-                               new-ok (= new-time (:time y))]
-                           {:ok new-ok :time new-time}))
-                       {:ok true :time 0} timeline) :ok)
-          (= phrase (reduce (fn [x y] (str x (:character y))) "" timeline)))
-        [:cadence "The returned timeline is invalid."])
-  (rule (= phrase (m/get-phrase))
-        [:cadence "The input phrase does not match the given one."])
-  (not (errors? :cadence))))
+            ; Veirfy that both parts exist
+            (not (nil? phrase))
+            (not (nil? timeline))
+            ; Make sure the length of timeline is the same is the length of the
+            ; phrase
+            (= (count timeline) (.length phrase))
+            ; Ensure that each event contains the correct keys of the proper types
+            (reduce (fn [x y] (and x (timeline-event? y)))
+                    true timeline)
+            ; Verify that the times and timeDifferences add up properly
+            (get (reduce (fn [x y]
+                           (let [new-time (+ (:time x) (:timeDifference y))
+                                 new-ok (= new-time (:time y))]
+                             {:ok new-ok :time new-time}))
+                         {:ok true :time 0} timeline) :ok)
+            (= phrase (reduce (fn [x y] (str x (:character y))) "" timeline)))
+          [:cadence "The returned timeline is invalid."])
+    (rule (not (nil? (sess/get :training-phrase)))
+          [:cadence "There is no training phrase to compare to."])
+    (rule (= phrase (:phrase (sess/get :training-phrase)))
+          [:cadence "The input phrase does not match the given one."])
+    (not (errors? :cadence))))


Replace m/extract with p/extract.

Replace m/extract with p/extract.

That implies performance improvements avoiding
unnecessary call forwarding and call directly
the protocol method.

--- src/cats/monad/maybe.cljc
+++ src/cats/monad/maybe.cljc
@@ -286,7 +286,7 @@
   {:pre [(maybe? m)]}
   (if (nothing? m)
     default
-    (f (m/extract m))))
+    (f (p/extract m))))

 (defn seq->maybe
   "Given a collection, return a nothing if its empty or a just with its
@@ -303,14 +303,14 @@
   {:pre [(maybe? m)]}
   (if (nothing? m)
     (lazy-seq [])
-    (lazy-seq [(m/extract m)])))
+    (lazy-seq [(p/extract m)])))

 ;; TODO: use a transducer when we support 1.7.0+
 (defn cat-maybes
   "Given a collection of maybes, return a sequence of the values that the
    just's contain."
   [coll]
-  (map m/extract (filter just? coll)))
+  (map p/extract (filter just? coll)))

 (defn map-maybe
   "Given a maybe-returning function and a collection, map the function over