Added comment note

Added comment note

--- src/clojush/problems/software/string_differences.clj
+++ src/clojush/problems/software/string_differences.clj
@@ -13,6 +13,9 @@
 ;;    4 e a
 ;;
 ;; input stack has the 2 input strings
+;;
+;; NOTE: I could add a second error value per case. For example, comparing the
+;; number of newlines to the correct number of newlines. Or something similar.

 (ns clojush.problems.software.string-differences
   (:use clojush.pushgp.pushgp
@@ -155,7 +158,7 @@
                            (when @global-print-behavioral-diversity
                              (swap! behavior conj result))
                            ; Error is Levenshtein distance of printed strings
-                           (levenshtein-distance correct-output result))))]
+                           (levenshtein-distance correct-output result))))] ;;NOTE: SEE NOTE IN INTRO
           (when @global-print-behavioral-diversity
             (swap! population-behaviors conj @behavior))
           errors)))))


accept ':password' and ':passphrase' for repo auth.

--- src/ancient_clj/io.clj
+++ src/ancient_clj/io.clj
@@ -44,10 +44,10 @@
   ([url-or-map group-id artifact-id]
    (slurp-metadata! url-or-map nil group-id artifact-id))
   ([url-or-map file-name group-id artifact-id]
-   (let [{:keys [url username password]} (if (map? url-or-map)
-                                           url-or-map
-                                           {:url url-or-map})
+   (let [{:keys [url username password passphrase]} (if (map? url-or-map)
+                                                      url-or-map
+                                                      {:url url-or-map})
          u (build-metadata-url url group-id artifact-id file-name)]
-     (when-let [xml (fetch-url! u username password)]
+     (when-let [xml (fetch-url! u username (or password passphrase))]
        (verbose "  Got " (count xml) " byte(s) of data.")
        xml))))


removed a instance of global mutable state :)

--- src/server/handlers/ws.clj
+++ src/server/handlers/ws.clj
@@ -6,7 +6,6 @@
             [server.db.queries :as q]))

 (timbre/refer-timbre)
-(defonce state (atom { :stream :closed }))

 (defn capture-ws [req]
   (let [capture (-> req :resources :capture)
@@ -25,10 +24,8 @@
 (defn configure-ws [req]
   (let [{:keys [mode stream]} (:body req)
         caputre (-> req :resources :capture) ]
-    (dosync
       (swap! (:state caputre) assoc :mode (keyword mode))
-      (swap! state assoc :stream (keyword stream)))
-    (res {:msg "Statue Updated"})))
+    (res {:msg "State Updated"})))

 (defn init [req]
   (let [capture (-> req :resources :capture)
@@ -37,6 +34,5 @@
        current-recording (q/find-active-recording conn) ]
     (res {:msg "init"
           :data {:mode (:mode @capture-state)
-                 :stream (:stream @state)
                  :patient-id 1
                  :current-recording current-recording}})))


add (reflexive-to-infinitive) in two places where needed

--- src/babel/espanol/morphology/verbs.clj
+++ src/babel/espanol/morphology/verbs.clj
@@ -113,7 +113,7 @@
 (defn future [word & [ {usted :usted
                            vosotros :vosotros
                            ustedes :ustedes}]]
-  (let [infinitive (get-in word '(:espanol))
+  (let [infinitive (reflexive-to-infinitive (get-in word '(:espanol)))
         ar-type (try (re-find #"ar$" infinitive)
                      (catch Exception e
                        (throw (Exception. (str "Can't regex-find on non-string: " infinitive " from word: " word)))))
@@ -403,7 +403,7 @@
 (defn preterito [word & [ {usted :usted
                            vosotros :vosotros
                            ustedes :ustedes}]]
-  (let [infinitive (get-in word '(:espanol))
+  (let [infinitive (reflexive-to-infinitive (get-in word '(:espanol)))
         ar-type (try (re-find #"ar$" infinitive)
                      (catch Exception e
                        (throw (Exception. (str "Can't regex-find on non-string: " infinitive " from word: " word)))))


support multiple engines

support multiple engines

--- src/chat/client/views/new_message.cljs
+++ src/chat/client/views/new_message.cljs
@@ -89,7 +89,10 @@
                           (> x z) z
                           (< x a) a
                           :else x))
-            results ((get-in engines [0]) text (config :thread-id))
+            results (let [engine-results (map (fn [e] (e text (config :thread-id))) engines)]
+                      (if (every? nil? engine-results)
+                         nil
+                        (apply concat engine-results)))
             highlight-next!
             (fn []
               (om/update-state! owner :highlighted-result-index


Replace `set mapcat` to `apply union map`.

--- src/smallex/reductions.clj
+++ src/smallex/reductions.clj
@@ -1,5 +1,6 @@
 (ns smallex.reductions
-  (:require [clojure.walk :as walk]))
+  (:require [clojure.set :as set]
+            [clojure.walk :as walk]))

 (defn- find-alias-deps
   "Returns a set of alias deps, given an expression."
@@ -7,7 +8,7 @@
   (case (:type expr)
     (:string :char-set) #{}
     :symbol #{(:value expr)}
-    :op (set (mapcat find-alias-deps (:args expr)))))
+    :op (apply set/union (map find-alias-deps (:args expr)))))

 (defn check-cyclic-aliases
   "Given a grammar, returns an error if there is a cyclic alias. Returns nil if


refactored ease functions

refactored ease functions

--- src/cljs/infinitelives/utils/ease.cljs
+++ src/cljs/infinitelives/utils/ease.cljs
@@ -9,31 +9,52 @@
 ;; b - initial value
 ;; c - change (final value - initial value)

+;; *-f functions take t in range 0 to 1
+;;     and return value v in range 0 to 1
+
+(def linear-f identity)
+
+(defn- quad-in-f [t]
+  (* t t))
+
+(defn- quad-out-f
+  "v = -(x-1)^2 + 1
+  =>   v = -x^2 + 2x
+  =>   v = x * (2-x)"
+
+  [t]
+  (* t (- 2 t)))
+
+(defn- quad-in-out-f [t]
+  (if (< t 0.5)
+    (* 2 t t)
+    (+ -1 (* t (- 4 (* 2 t))))))
+
+(defn- make-ease-fn [func]
+  (fn [t b c d]
+    (+ b (* c (func (/ t d))))))
+
 (defn linear [t b c d]
   (+ b (* c (/ t d))))

-(defn quad-in
-  "quadtratic curve, starting easy to start, then
-  speeding up to the destination"
-  [t b c d]
-  (let [rt (/ t d)]
-    (+ b (* c (* rt rt)))))

-(defn quad-out
-  "quadratic curve, starting fast, and then slowing
-  down to a stop at the destination."
-  [t b c d]
-  (let [rt (- (/ t d) 1)]
-    (+ b (* c (- 1 (* rt rt))))))
+(def
+  ^{:arglist '([t b c d])
+    :doc "quadtratic curve, starting easy to start, then
+  speeding up to the destination"}

-(defn quad-in-out
-  "two quadratic curves: starting easy to start, then
+  quad-in (make-ease-fn quad-in-f))
+
+(def
+  ^{:arglist '([t b c d])
+    :doc "quadratic curve, starting fast, and then slowing
+  down to a stop at the destination."}
+  quad-out (make-ease-fn quad-out-f))
+
+(def
+  ^{:arglist '([t b c d])
+    :doc "two quadratic curves: starting easy to start, then
   speeding up to the halfway point, then continuing
   fast through the halfway point and then slowing down
-  to stop at the destination"
-  [t b c d]
-  (let [hd (/ d 2)
-        hc (/ c 2)]
-    (if (< t hd)
-      (quad-in t b hc hd)
-      (quad-out (- t hd) (+ b hc) hc hd))))
+  to stop at the destination"}
+  quad-in-out (make-ease-fn quad-in-out-f))


change my pages to pages, small ui fix

change my pages to pages, small ui fix

--- src/cljs/salava/badge/ui/settings.cljs
+++ src/cljs/salava/badge/ui/settings.cljs
@@ -198,7 +198,7 @@
        [:div.evidence-info (t :badge/Evidenceinfo)]

        [:div.row.form-horizontal
-        [:div.row
+        [:div
          [:div.col-md-12.resource-options
           [:div
            [:div [:a {:class (if (= :url_input @input-mode) "active-resource" "")
@@ -214,7 +214,7 @@
                                     (evidence/toggle-input-mode :page_input state)
                                     )
                        }
-                   [:i.fa.fa-file-text] (t :page/Mypages)]]
+                   [:i.fa.fa-file-text] (t :page/Pages)]]
            [:div  [:a {:class (if (= :file_input @input-mode) "active-resource" "")
                        :href "#":on-click #(do
                                              (.preventDefault %)


log state

log state

--- src/cljs/swarmpit/component/state.cljs
+++ src/cljs/swarmpit/component/state.cljs
@@ -17,6 +17,7 @@
                                       :form {}}
                           :node      {:list {}}
                           :service   {:list   {}
+                                      :log    {}
                                       :wizard {:image      {:public  {}
                                                             :private {}
                                                             :other   {}}


cldeanup

cldeanup

--- src/clojure/zensols/actioncli/util.clj
+++ src/clojure/zensols/actioncli/util.clj
@@ -31,31 +31,6 @@
   [timeout-millis & body]
   {:style/indent 1}
   `(cj/thunk-timeout (fn [] ~@body) ~timeout-millis))
-
-(defmacro prime-resource-factory
-  "Create a function and name space resources that create a shared per/thread."
-  [name create-fn]
-  `(do
-     (def ^:private monitor# (Object.))
-     (def ^:private init-inst# (atom false))
-     (def ^:private ~name
-       {:init-inst init-inst#
-        :create-fn (fn [& create-args#]
-                     (let [res# (volatile! nil)
-                           res-name# ~name]
-                       (log/debugf "access resource: %s" res-name#)
-                       (locking monitor#
-                         (when-not (deref init-inst#)
-                           (log/debugf "start priming: %s" res-name#)
-                           (vreset! res# (apply ~create-fn create-args#))
-                           (reset! init-inst# true)
-                           (log/debug "end prime")))
-                       (if (deref res#)
-                         (do (log/debug "reusing prime result")
-                             (deref res#))
-                         (do (log/debug "no prime result, calling now")
-                             (apply ~create-fn create-args#)))))})))
-

 (defn parse-macro-arguments [arg-list]
   (let [args (java.util.LinkedList. arg-list)


CMR-742: Added sanity check that index names are not changing when updating an index set.

--- src/cmr/indexer/data/elasticsearch.clj
+++ src/cmr/indexer/data/elasticsearch.clj
@@ -22,6 +22,28 @@
   (fn [context concept umm-concept]
     (cs/concept-id->type (:concept-id concept))))

+(defn index-set->index-names
+  "Returns the names of the indexes assigned to each concept type of an index set."
+  [index-set]
+  {:collection (get-in index-set [:index-set :collection :index-names])
+   :granule (get-in index-set [:index-set :granule :index-names])})
+
+(defn validate-index-names-not-changing
+  "Takes an existing index set and an index set to update. Validates that the index names are not
+  different than what was expected. Throws an error if they are different."
+  [context existing update]
+  (let [existing-index-names (index-set->index-names existing)
+        update-index-names (index-set->index-names update)]
+    (when-not (= existing-index-names update-index-names)
+      (error "Detected index name change."
+             "Existing index names" (pr-str existing-index-names)
+             "Expected index names" (pr-str update-index-names))
+      (error "System environment variables:" (pr-str (System/getenv)))
+      (error "Configured collections with separate granule indexes:"
+             (pr-str ((get-in context [:system :colls-with-separate-indexes-fn]))))
+      (errors/internal-error!
+        "Discovered existing index set with index names different than expected."))))
+
 (defn create-indexes
   "Create elastic index for each index name"
   [context]
@@ -40,6 +62,7 @@
       (do
         (info "Index set does not match so updating it. Expecting:" (pr-str index-set) "Actual:"
               (pr-str existing-index-set))
+        (validate-index-names-not-changing context existing-index-set index-set)
         (idx-set/update context index-set))

       :else


partial rewrite deep-trace2

partial rewrite deep-trace2

--- src/com/billpiel/sayid/deep_trace2.clj
+++ src/com/billpiel/sayid/deep_trace2.clj
@@ -221,11 +221,11 @@
              :return ::placeholder)
       atom))

-(declare produce-parent-tree-atom)
-
-(defn get-recent-parent-at-inner-path
-  [path recent-parents]
-  (let [entry (@recent-parents path)]
+(declare produce-recent-parent-tree-atom!)
+
+(defn get-recent-tree-at-inner-path
+  [path recent-trees]
+  (let [entry (@recent-trees path)]
     (if (not (some->> entry
                       deref
                       keys
@@ -233,63 +233,64 @@
       entry
       nil)))

-(defn assoc-to-recent-parents!
-  [tree-atom parent-tree-atom recent-parents]
-  (swap! recent-parents
+(defn assoc-to-recent-trees!
+  [tree-atom parent-tree-atom recent-trees]
+  (swap! recent-trees
          assoc
          (:inner-path @tree-atom)
          tree-atom)
   (when parent-tree-atom
     (swap! (-> @parent-tree-atom
                :inner-path
-               (@recent-parents)
+               (@recent-trees)
                deref
                :children)
            conj
            tree-atom)))

-(defn mk-recent-parent-at-inner-path
-  [inner-path recent-parents]
+(defn mk-recent-tree-at-inner-path
+  [inner-path recent-trees]
   (if (nil? inner-path)
     (let [new-parent (get-temp-root-parent)]
-      (assoc-to-recent-parents! new-parent
+      (assoc-to-recent-trees! new-parent
                                 nil
-                                recent-parents)
+                                recent-trees)
       new-parent)
-    (let [new-grandparent (produce-parent-tree-atom inner-path
-                                                    recent-parents)
+    (let [new-grandparent (produce-recent-parent-tree-atom! inner-path
+                                                    recent-trees)
           new-parent (-> (trace/mk-tree :parent new-grandparent)
                          (assoc :inner-path inner-path)
                          atom)]
-      (assoc-to-recent-parents! new-parent
+      (assoc-to-recent-trees! new-parent
                                 new-grandparent
-                                recent-parents)
+                                recent-trees)
       new-parent)))

-(defn produce-parent-tree-atom
-  [inner-path recent-parents]
+(defn produce-recent-tree-atom!
+  [inner-path recent-trees]
+  (if-let [tree-atom (get-recent-tree-at-inner-path inner-path
+                                                      recent-trees)]
+    tree-atom
+    (mk-recent-tree-at-inner-path inner-path
+                                    recent-trees)))
+
+(defn produce-recent-parent-tree-atom!
+  [inner-path recent-trees]
   (let [parent-inner-path (some-> inner-path
                                   not-empty
                                   drop-last
                                   vec)]
-    (if-let [parent (get-recent-parent-at-inner-path parent-inner-path
-                                                     recent-parents)]
+    (if-let [parent (get-recent-tree-at-inner-path parent-inner-path
+                                                     recent-trees)]
       parent
-      (mk-recent-parent-at-inner-path parent-inner-path recent-parents))))
-
-(binding [trace/*trace-log-parent* {:depth 0 :path []}]
-  (let [rp (atom {})]
-    (-/p [(produce-parent-tree-atom [1 2] rp)
-          (produce-parent-tree-atom [1 3] rp)
-          rp])))
+      (mk-recent-tree-at-inner-path parent-inner-path recent-trees))))

 (defn capture-fn
-  [inner-path [recent-parents src-map] template f]
+  [inner-path [recent-trees src-map] template f]
   (fn [& args]
-    (let [parent (produce-parent-tree-atom inner-path
-                                           recent-parents)
-          this (-> @parent
-                   (trace/mk-tree :parent)
+    (let [parent (produce-recent-parent-tree-atom! inner-path
+                                                   recent-trees)
+          this (-> (trace/mk-tree :parent @parent)
                    (assoc :args (vec args)
                           :arg-map (delay (zipmap (:arg-forms template)
                                                   args))
@@ -304,19 +305,28 @@
                        :return value
                        :throw throw ;;TODO not right
                        :ended-at (trace/now))]
-      (assoc-to-recent-parents! (atom this')
-                                parent
-                                recent-parents)
+      (assoc-to-recent-trees! (atom this')
+                              parent
+                              recent-trees)
       value)))

 (defn tr-macro
-  [path [log] mcro v]
-  (swap! log conj [path v :macro mcro])
+  [path [recent-trees] mcro v]
+  (let [tree-atom (produce-recent-tree-atom! path
+                                    recent-trees)])
+  (swap!
+         assoc
+         :return v
+         :inner-tags [:macro mcro])
   v)

 (defn tr-if-ret
-  [path [log] v]
-  (swap! log conj [path v])
+  [path [recent-trees] v]
+  (swap! (produce-recent-tree-atom! path
+                                    recent-trees)
+         assoc
+         :return v
+         :inner-tags [:if])
   v)

 (defn tr-if-clause


update the version of lein-environ

update the version of lein-environ

--- src/leiningen/new/chestnut/project.clj
+++ src/leiningen/new/chestnut/project.clj
@@ -20,7 +20,7 @@
                  [environ "1.0.1"]{{{project-clj-deps}}}]

   :plugins [[lein-cljsbuild "1.0.5"]
-            [lein-environ "1.0.0"]{{{project-plugins}}}]
+            [lein-environ "1.0.1"]{{{project-plugins}}}]

   :min-lein-version "2.5.0"


Upgrade figwheel-sidecar to 0.5.18

Upgrade figwheel-sidecar to 0.5.18

--- src/leiningen/new/re_frame/project.clj
+++ src/leiningen/new/re_frame/project.clj
@@ -46,7 +46,7 @@
    {:dependencies [[binaryage/devtools "0.9.10"]{{#10x?}}
                    [day8.re-frame/re-frame-10x "0.4.0"]
                    [day8.re-frame/tracing "0.5.1"]{{/10x?}}{{#cider?}}
-                   [figwheel-sidecar "0.5.16"]
+                   [figwheel-sidecar "0.5.18"]
                    [cider/piggieback "0.3.5"]{{/cider?}}{{#re-frisk?}}
                    [re-frisk "0.5.4.1"]{{/re-frisk?}}]


migrating ip address and hostname access

--- src/aws/networking.clj
+++ src/aws/networking.clj
@@ -12,7 +12,7 @@
 (ns aws.networking
   "AWS networking functions"
   (:require
-    [aws.sdk.ec2 :as ec2]
+    [amazonica.aws.ec2 :as ec2]
     [slingshot.slingshot :refer  [throw+]]
     [celestial.model :refer (hypervisor)]
     [supernal.sshj :refer (execute)]
@@ -22,18 +22,13 @@
     [celestial.persistency.systems :as s]))

 (defn pub-dns [endpoint instance-id]
-  (instance-desc endpoint instance-id :public-dns))
-
-(defn pubdns-to-ip
-  "Grabs public ip from dnsname ec2-54-216-121-122.eu-west-1.compute.amazonaws.com"
-  [pubdns]
-  (join "." (rest (re-find #"ec2\-(\d+)-(\d+)-(\d+)-(\d+).*" pubdns))))
+  (instance-desc endpoint instance-id :public-dns-name))

 (defn update-ip [spec endpoint instance-id]
   "updates public dns in the machine persisted data"
   (when (s/system-exists? (spec :system-id))
-    (let [ec2-host (pub-dns endpoint instance-id)]
-      (s/partial-system (spec :system-id) {:machine {:ip (pubdns-to-ip ec2-host)}}))))
+    (let [public-ip (instance-desc endpoint instance-id :public-ip-address)]
+      (s/partial-system (spec :system-id) {:machine {:ip public-ip}}))))

 (defn override-hostname
   "sets hostname and hosts file"


Use proper vertex identifiers for obtain the corresponding point.

--- src/uxbox/common/geom.cljs
+++ src/uxbox/common/geom.cljs
@@ -154,10 +154,10 @@
 (defn- get-rect-vertext-point
   [{:keys [x1 y1 x2 y2]} id]
   (case id
-    1 (gpt/point x1 y1)
-    2 (gpt/point x2 y1)
-    3 (gpt/point x1 y2)
-    4 (gpt/point x2 y2)))
+    :top-left (gpt/point x1 y1)
+    :top-right (gpt/point x2 y1)
+    :bottom-left (gpt/point x1 y2)
+    :bottom-right (gpt/point x2 y2)))

 (defn- get-circle-vertext-point
   [{:keys [rx ry]} id]


better REPL support

better REPL support

--- src/brevis/ui/core.clj
+++ src/brevis/ui/core.clj
@@ -153,7 +153,7 @@
 (defn get-text-from-tab
   "Return the text from a tab."
   [tab-idx]
-  (let [component (.getTabComponentAt (:tabbed-panel @editor-window) tab-idx)]
+  (let [component (.getComponentAt (:tabbed-panel @editor-window) tab-idx)]
     (.getText (.getTextArea component))))

 (defn current-tab-index
@@ -161,9 +161,14 @@
   []
   (.getSelectedIndex (:tabbed-panel @editor-window)))

+(defn current-tab-filename
+  "Return the filename corresponding to the current tab."
+  []
+  (.getToolTipTextAt (:tabbed-panel @editor-window) (current-tab-index)))
+
 (defn a-save [e]
   (let [tab-idx (current-tab-index)]
-    (spit (.getToolTipTextAt (:tabbed-panel @editor-window) tab-idx)
+    (spit (current-tab-filename)
           (get-text-from-tab tab-idx))))

 (defn a-save-as [e]
@@ -229,6 +234,12 @@
     #_(write-value-repl (:value (last response-vals)))
     #_(println (:value (last response-vals)))
     #_(with-out-str (pprint (doall response-vals)))))
+
+(declare set-REPL-to-current-tab)
+(defn a-set-REPL-to-project
+  "Setup the repl for the current project."
+  [e]
+  (set-REPL-to-current-tab))

 (defn a-eval-file
   "Evaluate a file."
@@ -354,7 +365,7 @@
            a-paste (action :handler a-paste :name "Paste" :tip "Paste text from the clipboard.")
            a-cut (action :handler a-cut :name "Cut" :tip "Cut text to the clipboard.")
            a-save-as (action :handler a-save-as :name "Save As" :tip "Save the current file.")
-           a-eval-file (action :handler a-eval-file :name "Evaluate" :tip "Evaluate the current file.")
+           a-eval-file (action :handler a-eval-file :name "Evaluate" :tip "Evaluate the current file.")
            a-projects (map #(action :handler (make-a-active-project %)
                                     :name (str (:group %) "/" (:name %))
                                     :tip (str (:group %) "/" (:name %)))
@@ -535,6 +546,7 @@
         action-cut (action :handler a-cut :name "Cut" :tip "Cut text to the clipboard.")
         action-save-as (action :handler a-save-as :name "Save As" :tip "Save the current file.")
         action-eval-file (action :handler a-eval-file :name "Evaluate" :tip "Evaluate the current file.")
+        action-set-REPL-to-project (action :handler a-set-REPL-to-project :name "Restart project REPL" :tip "Restart REPL for current file's project.")
         action-restart-brevis
         (action :handler (fn [e]
                            (System/exit 1))
@@ -547,7 +559,7 @@
         menus (menubar
                 :items [(menu :text "File" :items [action-new action-open action-save action-save-as action-close-tab action-exit])
                         (menu :text "Edit" :items [action-copy action-cut action-paste])
-                        (menu :text "Run" :items [action-eval-file])
+                        (menu :text "Run" :items [action-set-REPL-to-project action-eval-file])
                         (menu :text "Projects" :items (into [] action-projects))
                         (menu :text "Git" :items [])
                         (menu :text "Brevis" :items [action-restart-brevis])
@@ -609,6 +621,40 @@
         (doseq [filename (:open-files saved-state)]
           (add-content-tab-from-filename filename @content-pane-params))))))

+(defn is-directory-leiningen-project?
+  "Return true if a directory represents a leiningen project."
+  [directory]
+  (some #(= "project.clj" (.getName %))
+        (file-seq (file directory))))
+
+(defn set-REPL-to-current-tab
+  "Setup the REPL for the project corresponding to the current tab."
+  []
+  (when @repl
+    (let [{:keys [server connection client]} @repl]
+      (nrepl.server/stop-server server)))
+  (when-let [tab-idx (current-tab-index)]
+    (let [filename (current-tab-filename)
+          path (string/split filename (re-pattern (java.util.regex.Pattern/quote File/separator)))
+          paths (loop [rem (butlast path)
+                       paths []]
+                  (if-not (empty? rem)
+                    (recur (butlast rem)
+                           (conj paths (string/join File/separator rem)))
+                    paths))
+          project-dir (some is-directory-leiningen-project?
+                            paths)]
+      (if-not project-dir
+        (println "File is not within a valid Leiningen project.")
+        (let [project (project/read (str (:current-project @current-profile) File/separator "project.clj"))
+              repl-cfg {:host (repl/repl-host project)
+                        :port (repl/repl-port project)}
+              repl-server (nrepl.server/start-server :port 59258)
+              repl-connection (nrepl/connect :port 59258)
+              repl-client (nrepl/client repl-connection Long/MAX_VALUE)]
+          (reset! repl {:server repl-server
+                        :connection repl-connection
+                        :client repl-client}))))))

 (defn -main
   "Start from command line."


Use :invalid-op for status info.

Use :invalid-op for status info.

--- src/cbfg/world/t2.cljs
+++ src/cbfg/world/t2.cljs
@@ -16,7 +16,7 @@
     "coll-state"
     [coll-state (assoc m :status :ok :value coll-state)]

-    [coll-state (assoc m :status :invalid :status-info [:unknown-op m])]))
+    [coll-state (assoc m :status :invalid :status-info :invalid-op)]))

 (defn make-coll [actx rev path kvs-mgr-ch]
   (let [coll-ch (achan actx)]


Don't let user authenticate to a coll on a different realm.

--- src/cbfg/world/t2.cljs
+++ src/cbfg/world/t2.cljs
@@ -79,11 +79,9 @@
       [server-state (assoc (dissoc m :pswd) :status :invalid :status-info :args)])

     "realms-list"
-    (let [{:keys [cur-user-realm cur-user]} m
-          realm-keys (if (and (= cur-user-realm "_system")
-                              (= cur-user "admin"))
+    (let [realm-keys (if (= (:cur-user-realm m) "_system")
                        (keys (:realms server-state))
-                       [cur-user-realm])]
+                       [(:cur-user-realm m)])]
       (act realms-list actx [realm-keys realm-keys]
            (doseq [realm-key realm-keys]
              (aput realms-list (:res-ch m)
@@ -147,13 +145,16 @@
 (defn lane-handler [actx lane-state m]
   (case (:op m)
     :update-user-realm
-    [(assoc lane-state
-       :cur-realm (:realm m)
-       :cur-realm-collset (:realm-collset m)
-       :cur-realm-collset-coll (:realm-collset-coll m)
-       :cur-user-realm (:user-realm m)
-       :cur-user (:user m))
-     (assoc m :status :ok)]
+    (if (or (= (:user-realm m) (:realm m))
+            (= (:user-realm m) "_system"))
+      [(assoc lane-state
+         :cur-realm (:realm m)
+         :cur-realm-collset (:realm-collset m)
+         :cur-realm-collset-coll (:realm-collset-coll m)
+         :cur-user-realm (:user-realm m)
+         :cur-user (:user m))
+       (assoc m :status :ok)]
+      [lane-state (assoc m :status :invalid :status-info :wrong-realm)])

     "lane-state"
     [lane-state (assoc m :status :ok :value lane-state)]


remove debugging println

remove debugging println

--- src/babel/reader.clj
+++ src/babel/reader.clj
@@ -145,8 +145,7 @@
                    (filter lexical-filter-fn)))})
         target-expression
         (target-timing-fn
-         (binding [babel.generate/truncate? true
-                   babel.generate/println? true]
+         (binding [babel.generate/truncate? true]
            (babel.generate/generate target-spec target-model)))
         source-spec
         (u/strip-refs ;; TODO: consider removing strip-refs; not clear if there is any reason why we need to do it.


log target-language

log target-language

--- src/babel/reader.clj
+++ src/babel/reader.clj
@@ -90,7 +90,7 @@
    by this set.
    To rephrase, the set of expressions in the target language share an identical semantics,
    and the single expression in the source language contains that semantics."
-  (log/debug (str "generate target language set with spec: " target-spec))
+  (log/debug (str "generate target language set with target-language:" target-language " ;spec: " target-spec))
   (let [target-spec (unify target-spec
                            {:synsem {:subcat '()}})]
     (cond (= target-language "la")


Improved log and pr-log functions.

Improved log and pr-log functions.

--- src/beicon/core.cljs
+++ src/beicon/core.cljs
@@ -370,7 +370,7 @@
   ([ob]
    (tap #(println %) ob))
   ([prefix ob]
-   (tap #(println (str prefix %)) ob)))
+   (tap #(println prefix (str %)) ob)))

 (defn pr-log
   "Print all values passed through the given
@@ -378,7 +378,7 @@
   ([ob]
    (tap #(println (pr-str %)) ob))
   ([prefix ob]
-   (tap #(println (str prefix (pr-str %))) ob)))
+   (tap #(println prefix (pr-str %)) ob)))

 (defn throttle
   "Returns an observable sequence that emits only the


add comment

add comment

--- src/clj/ceres/core.clj
+++ src/clj/ceres/core.clj
@@ -12,10 +12,6 @@
             [clojure.java.io :as io]
             [clojure.core.async :refer [close! put! timeout sub chan <!! >!! <! >! go go-loop] :as async]
             [taoensso.timbre :as timbre]))
-
-(timbre/refer-timbre)
-#_(timbre/set-config! [:appenders :spit :enabled?] true)
-#_(timbre/set-config! [:shared-appender-config :spit-filename] "resources/collector.log")

 (deftemplate static-page
@@ -48,6 +44,9 @@

 (def server-state (atom nil))

+(timbre/refer-timbre)
+#_(timbre/set-config! [:appenders :spit :enabled?] true)
+#_(timbre/set-config! [:shared-appender-config :spit-filename] (:logfile @server-state))

 (defn dispatch
   "Dispatch incoming websocket-requests"
@@ -79,7 +78,7 @@
                     (send! channel (str (dispatch (read-string data)))))))))

 (defn stream-handler
-  "Reacts to incoming tweets"
+  "React to incoming tweets"
   [state tweet]
   (do
     (info (str "Storing tweet") (:id tweet))
@@ -95,7 +94,7 @@
      tweet)))

 (defn initialize
-  "Initializes the server state using a given config file"
+  "Initialize the server state using a given config file"
   [state path]
   (reset!
    state
@@ -105,7 +104,9 @@
        (assoc-in [:app :recent-tweets] []))))

-(defn handle-export [query]
+(defn handle-export
+  "Parse date from query and create edn-string"
+  [query]
   (let [[m d] (mapv read-string (clojure.string/split (get query "date") #"-" ))]
     (export-edn m d)))

@@ -141,8 +142,8 @@

   (stop-stream)

-  (def server (run-server (site #'all-routes) {:port (:port @server-state) :join? false}))
+  (def stop-server (run-server (site #'all-routes) {:port (:port @server-state) :join? false}))

-  (server)
+  (stop-server)

 )


Implement Searchlight, Self-destruct.

Implement Searchlight, Self-destruct.

--- src/clj/game/cards.clj
+++ src/clj/game/cards.clj
@@ -1686,6 +1686,18 @@
                                                       {:msg "gain 2 [Credits] instead of accessing"
                                                        :effect (effect (gain :credit 2))} st nil))})))}}}

+   "Self-destruct"
+   {:abilities [{:label "Trace X - Do 3 net damage"
+                 :effect (req (let [serv (card->server state card)
+                                    cards (concat (:ices serv) (:content serv))]
+                                   (trash state side card)
+                                   (doseq [c cards] (trash state side c))
+                                   (resolve-ability
+                                     state side
+                                     {:trace {:base (req (dec (count cards)))
+                                              :effect (effect (damage :net 3))
+                                              :msg "do 3 net damage"}} card nil)))}]}
+
    "Self-Destruct Chips"
    {:effect (effect (lose :runner :max-hand-size 1))}

@@ -2767,8 +2779,9 @@

    "Searchlight"
    {:advanceable :always
-    :abilities [{:msg "give the Runner 1 tag" :effect (effect (gain :runner :tag 1))}]}
-
+    :abilities [{:label "Trace X - Give the runner 1 tag"
+                 :trace {:base (req (:advance-counter card)) :effect (effect (gain :runner :tag 1))
+                         :msg "give the Runner 1 tag"}}]}
    "Shadow"
    {:advanceable :always
     :abilities [{:msg "gain 2 [Credits]" :effect (effect (gain :credit 2))}


fix compilation problem

fix compilation problem

--- src/clj/hsm/system.clj
+++ src/clj/hsm/system.clj
@@ -11,6 +11,7 @@
         [hsm.controllers.post :as cont-post]
         [hsm.controllers.discussion :as cont-disc]
         [hsm.integration.ghub :as ghub]
+        [hsm.schema :as db]
         [compojure.handler :as handler :refer [api]]
         [compojure.route :as route :refer [resources]]
         [ring.middleware.reload :as reload]


Add s/fdef for complete-hash

Add s/fdef for complete-hash

Replaced assert with instrument

--- src/clj_git/object.clj
+++ src/clj_git/object.clj
@@ -2,6 +2,7 @@
   (:use clj-message-digest.core)
   (:require [clojure.java.io :as io])
   (:require [clojure.spec.alpha :as s])
+  (:require [clojure.spec.test.alpha :as stest])
   (:use clj-git.util)
   (:use clj-git.repo)
   (:gen-class))
@@ -18,7 +19,9 @@
 (s/def ::sha-1-prefix
   (s/and
     string?
-    #(<= (count %) SHA-1-HEX-LENGTH)))
+    #(<= (count %) SHA-1-HEX-LENGTH)
+    #(> (count %) 0)
+))

 (defn decompress-zlib [data]
   (let [buffer (byte-array (alength data))
@@ -136,8 +139,12 @@
                          (.getName %)) are-files)]
     (filter is-valid-hash-str names)))

+(s/fdef complete-hash
+  :args (s/cat :hash-prefix ::sha-1-prefix)
+  :ret ::sha-1-hash
+)
+
 (defn complete-hash [hash-prefix]
-  (s/assert ::sha-1-prefix hash-prefix)
   (let [len (count hash-prefix)
         all (all-objects)
         ps (map #(subs % 0 len) all)
@@ -151,6 +158,8 @@
       (throw (Exception.
                (str "Ambiguous object prefix '" hash-prefix "'")))
       :else (second (first matches)))))
+
+(stest/instrument `complete-hash)

 (defn read-object [hash-prefix]
   (let [hash-hex (complete-hash hash-prefix)


Fixup math cljs namespace issue.

Fixup math cljs namespace issue.

--- src/cljx/c2/maths.cljx
+++ src/cljx/c2/maths.cljx
@@ -2,7 +2,7 @@
         (:use [c2.util :only [combine-with]]))

 ^:cljs (ns c2.maths
-         (:use-util [c2.macros :only [combine-with]]))
+         (:use-macros [c2.util :only [combine-with]]))

 (def Pi 3.141592653589793)


fit the project res

fit the project res


CMR-2840 Delete old test

CMR-2840 Delete old test

--- umm-lib/test/cmr/umm/test/dif/dif_collection_tests.clj
+++ umm-lib/test/cmr/umm/test/dif/dif_collection_tests.clj
@@ -189,16 +189,6 @@
           parsed (c/parse-collection xml)
           expected-parsed (umm->expected-parsed-dif collection)]
       (is (= expected-parsed parsed)))))
-
-(defspec generate-and-parse-collection-between-formats-test 100
-  (for-all [collection coll-gen/collections]
-    (let [xml (dif/umm->dif-xml collection)
-          parsed-dif (c/parse-collection xml)
-          echo10-xml (echo10/umm->echo10-xml parsed-dif)
-          parsed-echo10 (echo10-c/parse-collection echo10-xml)
-          expected-parsed (test-echo10/umm->expected-parsed-echo10 (umm->expected-parsed-dif collection))]
-      (and (= expected-parsed parsed-echo10)
-           (= 0 (count (echo10-c/validate-xml echo10-xml)))))))

 (deftest generate-and-parse-collection-between-formats-test
   (checking "dif parse between formats" 100


Warn that array-eq is not constant time

Warn that array-eq is not constant time

--- src/caesium/util.clj
+++ src/caesium/util.clj
@@ -3,7 +3,9 @@
            (org.abstractj.kalium.encoders Encoder)))

 (defn array-eq
-  "Compares two byte arrays for equality."
+  "Compares two byte arrays for equality.
+
+  Please note that this is not constant time!"
   [^bytes a ^bytes b]
   (Arrays/equals a b))


Tighten up code (under 400 loc), move hit detection to protocol.


only set favicon to red if there are unread chats

--- src-cljs/frontend/controllers/controls.cljs
+++ src-cljs/frontend/controllers/controls.cljs
@@ -495,7 +495,8 @@
     (let [db @(:db current-state)
           last-time (get-in current-state (state/last-read-chat-time-path (:document/id current-state)))
           unread-chats? (pos? (chat-model/compute-unread-chat-count db last-time))]
-      (favicon/set-unread!))))
+      (when unread-chats?
+        (favicon/set-unread!)))))

 (defmethod control-event :chat-body-changed
   [target message {:keys [value]} state]


added aeteindre and corrected imperfect stem for etreindre

--- src/babel/francais/lexicon.cljc
+++ src/babel/francais/lexicon.cljc
@@ -306,7 +306,22 @@

    "essayer" {:synsem {:cat :verb
                       :sem {:pred :try}}}
-   "être"
+
+    "éteindre" {:synsem {:cat :verb
+                         :sem {:pred :turn-off}
+                         :essere false}
+                :français {:future-stem "éteind"
+                           :infinitive "éteindre"
+                           :present {:1sing "éteins"
+                                     :2sing "éreins"
+                                     :3sing "éteint"
+                                     :1plur "éteignons"
+                                     :2plur "éteignez"
+                                     :3plur "éteignent"}
+                          :past-participle "étreint"
+                          :imperfect-stem "éteign"}}
+
+    "être"
    (let [common
          {:synsem {:cat :verb
                    :essere false}
@@ -349,7 +364,7 @@
                                      :2plur "étreignez"
                                      :3plur "étreignent"}
                           :past-participle "étreint"
-                          :imperfect-stem "étreindr"}}
+                          :imperfect-stem "étreign"}}

    "étudier" {:synsem {:cat :verb
                        :sem {:pred :study}}}


pre-compute bolts in grammar

pre-compute bolts in grammar

--- src/babel/italiano/grammar.cljc
+++ src/babel/italiano/grammar.cljc
@@ -1,6 +1,7 @@
 (ns babel.italiano.grammar
   (:refer-clojure :exclude [get-in resolve])
   (:require
+   [babel.generate :as generate :refer [lightning-bolts]]
    [babel.index :refer [create-indices intersection-with-identity lookup-spec map-subset-by-path]]
    [babel.italiano.lexicon :refer [deliver-lexicon lexicon]]
    [babel.italiano.morphology :refer [analyze fo]]
@@ -738,27 +739,58 @@
         ;; indices from paths to subsets of the lexicon
         debug (log/info "  indices..")
         indices (create-indices lexicon-for-generation index-lexicon-on-paths)
-        debug (log/info "  finalizing..")]
-
-    {:index-fn (fn [spec] (lookup-spec spec indices index-lexicon-on-paths))
-     :default-fn default-fn
-     :name "medium"
-     :generate {:lexicon lexicon-for-generation}
-     :grammar grammar
-     :language "it"
-     :language-keyword :italiano
-     :lexical-cache (atom (cache/fifo-cache-factory {} :threshold 1024))
-     :lexicon lexicon
-     :lookup (fn [arg]
-               (analyze arg parse-lexicon))
-     :morph (fn [expression & {:keys [from-language show-notes]}] (fo expression))
-     :morph-ps fo-ps
-
-     :rules rules
-     :rule-map (zipmap rules
-                       grammar)
-     }))
-
+        debug (log/info "  finalizing..")
+        retval
+        {:index-fn (fn [spec] (lookup-spec spec indices index-lexicon-on-paths))
+         :default-fn default-fn
+         :name "medium"
+         :generate {:lexicon lexicon-for-generation}
+         :grammar grammar
+         :language "it"
+         :language-keyword :italiano
+         :lexical-cache (atom (cache/fifo-cache-factory {} :threshold 1024))
+         :lexicon lexicon
+         :lookup (fn [arg]
+                   (analyze arg parse-lexicon))
+         :morph (fn [expression & {:keys [from-language show-notes]}] (fo expression))
+         :morph-ps fo-ps
+
+         :rules rules
+         :rule-map (zipmap rules
+                           grammar)
+         }]
+    (merge retval
+           {:generate-fn (fn [spec]
+                           (generate/generate spec retval))
+            :bolts {
+
+                    {:depth 3
+                     :synsem {:subcat []
+                              :cat :verb
+                              :sem {:tense :present
+                                    :reflexive true
+                                    :aspect :perfect}}}
+                    (lightning-bolts retval
+                                       {:synsem {:subcat []
+                                                 :cat :verb
+                                                 :sem {:tense :present
+                                                       :reflexive true
+                                                       :aspect :perfect}}}
+                                       0 3)
+
+                    {:depth 2
+                     :synsem {:subcat []
+                              :cat :verb
+                              :sem {:tense :present
+                                    :reflexive true
+                                      :aspect :simple}}}
+                    (lightning-bolts retval
+                                     {:synsem {:subcat ()
+                                               :cat :verb
+                                               :sem {:tense :present
+                                                     :reflexive true
+                                                     :aspect :simple}}}
+                                     0 2)}})))
 (defn np-grammar []
   (deliver-lexicon)
   (let [lexicon @lexicon


[Add] Library timbre.profiling

[Add] Library timbre.profiling

--- src/clj_elm/core.clj
+++ src/clj_elm/core.clj
@@ -3,7 +3,8 @@
             [clj-elm.data :as data]
             [clj-elm.util :refer :all]
             [incanter.core :as c :exclude [update]]
-            [clojure.core.match :refer [match]])
+            [clojure.core.match :refer [match]]
+            [taoensso.timbre.profiling :refer [profile p]])
   (:import [clj_elm.data DataSet])
   (:gen-class))


fix typo

fix typo

--- src/clojush/args.clj
+++ src/clojush/args.clj
@@ -27,7 +27,7 @@
           ;; Function that takes a program and returns a list of errors.

           :error-threshold 0
-          ;; Pushgp will stop and return the best program if its total error
+          ;; Pushgp will stop and return the best program if its total error
           ;; is <= error-threshold.

           :atom-generators (into @registered-instructions
@@ -43,28 +43,28 @@
           ;; The maximum number of generations to run GP.

           :max-point-evaluations 10e100
-          ;; The limit for the number of point (instruction) evaluations to
+          ;; The limit for the number of point (instruction) evaluations to
           ;; execute during the run.

           :max-points 200
-          ;; Maximum size of push programs and push code, as counted by points
-          ;; in the program. 1/4 this limit is used as the limit for sizes of
+          ;; Maximum size of push programs and push code, as counted by points
+          ;; in the program. 1/4 this limit is used as the limit for sizes of
           ;; Plush genomes.

           :max-genome-size-in-initial-program 50
-          ;; Maximum size of initial Plush genomes in generation 0. Keep in mind
+          ;; Maximum size of initial Plush genomes in generation 0. Keep in mind
           ;; that genome lengths will otherwise be limited by 1/4 of :max-points.

           :evalpush-limit 150
-          ;; The number of Push instructions that can be evaluated before stopping
+          ;; The number of Push instructions that can be evaluated before stopping
           ;; evaluation.

           :evalpush-time-limit 0
-          ;; The time in nanoseconds that a program can evaluate before stopping,
+          ;; The time in nanoseconds that a program can evaluate before stopping,
           ;; 0 means no time limit.

           :reuse-errors true
-          ;; When true, children produced through direct reproduction will not be
+          ;; When true, children produced through direct reproduction will not be
           ;; re-evaluated but will have the error vector of their parent.

           ;;----------------------------------------
@@ -169,7 +169,7 @@
           ;; The probability of a child being reverted to its parent by a genetic operator that
           ;; has been made revertable, if the child is not as good as the parent on at least one
           ;; test case.
-
+
           :tag-enrichment 0
           ;; The number of extra copies of tag-related instructions that will be included in
           ;; the atom-generators.
@@ -200,7 +200,7 @@
           ;; If true, then during autoconstruction a child will be allowed to survive even if it
           ;; fails the diversification test, if it has lower errors than both of its parents
           ;; on at least one case.
-
+
           :autoconstructive-require-error-change false
           ;; If true, then during autoconstruction a child will be allowed to survive only if its
           ;; error vector differs from that of its first parent.
@@ -296,7 +296,7 @@
           ;; :max-error), :e-over-e-plus-1 (e/(e+1) = 1 - 1/(e+1))

           :max-error 1000
-          ;; If :normalization is set to :divide-by-max-error, will use this number for
+          ;; If :normalization is set to :divide-by-max-error, will use this number for
           ;; normalization.

           :meta-error-categories []
@@ -485,7 +485,7 @@
 (defn load-push-argmap
   [argmap]
   (doseq [[argkey argval] argmap]
-    (assert (contains? @push-argmap argkey)
+    (assert (contains? @push-argmap argkey)
             (str "Argument key " argkey " is not a recognized argument to pushgp."))
     (swap! push-argmap assoc argkey argval))
   (swap! push-argmap assoc :run-uuid (java.util.UUID/randomUUID))
@@ -572,7 +572,7 @@
                                   (fn [] (lrand-nth [true false]))))
     (swap! push-argmap assoc
            :atom-generators (conj (:atom-generators @push-argmap)
-                                  (tag-instruction-erc
+                                  (tag-instruction-erc
                                     [:integer :boolean :exec :float :char :string :code] 10000)))
     (swap! push-argmap assoc
            :atom-generators (conj (:atom-generators @push-argmap)
@@ -582,14 +582,14 @@
                                   (tagged-instruction-erc 10000)))
     (dotimes [n (:autoconstructive-integer-rand-enrichment @push-argmap)]
       (swap! push-argmap assoc
-             :atom-generators (conj (:atom-generators @push-argmap)
+             :atom-generators (conj (:atom-generators @push-argmap)
                                     'autoconstructive_integer_rand)))
     (if (neg? (:autoconstructive-integer-rand-enrichment @push-argmap))
       (swap! push-argmap assoc :atom-generators (remove #(= % 'autoconstructive_integer_rand)
                                                         (:atom-generators @push-argmap))))
     (dotimes [n (:autoconstructive-boolean-rand-enrichment @push-argmap)]
       (swap! push-argmap assoc
-             :atom-generators (conj (:atom-generators @push-argmap)
+             :atom-generators (conj (:atom-generators @push-argmap)
                                     'autoconstructive_boolean_rand)))
     (if (neg? (:autoconstructive-boolean-rand-enrichment @push-argmap))
       (swap! push-argmap assoc
@@ -597,11 +597,11 @@
                                       (:atom-generators @push-argmap))))
     (swap! push-argmap assoc
            :replace-child-that-exceeds-size-limit-with :empty))
-  (when (> (:tag-enrichment argmap) 0)
-    (swap! push-argmap assoc
-           :atom-generators
-           (let [tag-instructions [(tag-instruction-erc
-                                     [:integer :boolean :exec :float
+  (when (> (:tag-enrichment @push-argmap) 0)
+    (swap! push-argmap assoc
+           :atom-generators
+           (let [tag-instructions [(tag-instruction-erc
+                                     [:integer :boolean :exec :float
                                       :char :string :code] 10000)
                                    (untag-instruction-erc 10000)
                                    (tagged-instruction-erc 10000)
@@ -614,11 +614,11 @@
                                    'integer_tag_char_instruction
                                    'integer_tag_string_instruction]]
              (into (:atom-generators @push-argmap)
-                   (take (* (:tag-enrichment argmap) (count tag-instructions))
+                   (take (* (:tag-enrichment @push-argmap) (count tag-instructions))
                          (cycle tag-instructions)))))))

 (defn reset-globals
-  "Resets all Clojush globals according to values in @push-argmap. If an argmap argument
+  "Resets all Clojush globals according to values in @push-argmap. If an argmap argument
   is provided then it is loaded into @push-argmap first."
   ([]
    (doseq [[gname gatom] (filter (fn [[a _]] (.startsWith (name a) "global-"))
@@ -629,4 +629,3 @@
   ([argmap]
    (load-push-argmap argmap)
    (reset-globals)))
-


saving state; I really need to learn how to use branches correctly

--- cljs-server/cljsinfo_server/html.cljs
+++ cljs-server/cljsinfo_server/html.cljs
@@ -109,7 +109,8 @@
           [:tr.even-ff837
             [:td.label-9e0b7 "Examine"]
             [:td
-              [:span.literal-block-5dec8 "(my-vec idx)" [:i.fa.fa-info-circle.tooltip-link-0e91b]]
+              [:span.literal-block-5dec8 "(my-vec idx)"
+                [:i.fa.fa-info-circle.tooltip-link-0e91b {:data-tooltip-id "vector-as-fn"}]]
               [:span.literal-block-5dec8 "(" [:a.inside-fn-c7607 "nth"] " my-vec idx)"]
               [:a.fn-a8476 "get"]
               [:a.fn-a8476 "peek"]]]
@@ -196,6 +197,15 @@
     [:p "A ClojureScript Vector is not the same thing as a JavaScript Array."
       " ie: " [:code "(.indexOf my-vec)"] " will not work on a ClojureScript Vector."]]

+  [:div#tooltip-vector-as-fn.tooltip-53dde {:style "display:none"}
+    [:i.fa.fa-thumb-tack.pin-0ad63]
+    ;;[:h4.tt-title-02d39 "Vectors"]
+    [:p "A Vector can be used as a function in order to access it's elements."]
+    ;;[:p "All vectors are also sequences and support the generic sequence functions."]
+    ; [:p "A ClojureScript Vector is not the same thing as a JavaScript Array."
+    ;   " ie: " [:code "(.indexOf my-vec)"] " will not work on a ClojureScript Vector."]
+      ]
+
   [:div#tooltip-maps.tooltip-53dde {:style "display:none"}
     [:i.fa.fa-thumb-tack.pin-0ad63]
     [:h4.tt-title-02d39 "Maps"]


Add with-df-> macro

Add with-df-> macro

--- src/dataframe/core.clj
+++ src/dataframe/core.clj
@@ -18,4 +18,21 @@

 (defn col [^Frame df & args] (apply dataframe.frame/col (concat [df] args)))

-(defn max [^Series srs] (apply core/max (:data srs)))+(defn max [^Series srs] (apply core/max (:data srs)))
+
+
+(defn- replace-kws
+  [expr replace-fn]
+  (cond (keyword? expr)  (replace-fn expr)
+        (vector? expr)   (apply vec (map #(replace-kws % replace-fn) expr))
+        (list? expr)     (apply list (map #(replace-kws % replace-fn) expr))
+        (map? expr)      (into (sorted-map) (map (fn [[k v]] [(replace-kws k replace-fn) (replace-kws v replace-fn)]) expr))
+        :else            expr))
+
+
+(defmacro with-df->
+  [df & exprs]
+  (let [transformation (fn [kw] `(get ~df ~kw ~kw))
+        mapped-exprs (map #(replace-kws % transformation) exprs)]
+    (prn mapped-exprs)
+    `(-> ~df ~@mapped-exprs)))


Return eduction instead of filter from search

Fully lazy!

--- src/datascript/db.cljc
+++ src/datascript/db.cljc
@@ -564,28 +564,28 @@
         [(set/slice eavt (datom e a v tx) (datom e a v tx))                   ;; e a v tx
          (set/slice eavt (datom e a v tx0) (datom e a v txmax))               ;; e a v _
          (->> (set/slice eavt (datom e a nil tx0) (datom e a nil txmax))      ;; e a _ tx
-              (filter (fn [^Datom d] (= tx (datom-tx d)))))
+              (->Eduction (filter (fn [^Datom d] (= tx (datom-tx d))))))
          (set/slice eavt (datom e a nil tx0) (datom e a nil txmax))           ;; e a _ _
          (->> (set/slice eavt (datom e nil nil tx0) (datom e nil nil txmax))  ;; e _ v tx
-              (filter (fn [^Datom d] (and (= v (.-v d))
-                                          (= tx (datom-tx d))))))
+              (->Eduction (filter (fn [^Datom d] (and (= v (.-v d))
+                                          (= tx (datom-tx d)))))))
          (->> (set/slice eavt (datom e nil nil tx0) (datom e nil nil txmax))  ;; e _ v _
-              (filter (fn [^Datom d] (= v (.-v d)))))
+              (->Eduction (filter (fn [^Datom d] (= v (.-v d))))))
          (->> (set/slice eavt (datom e nil nil tx0) (datom e nil nil txmax))  ;; e _ _ tx
-              (filter (fn [^Datom d] (= tx (datom-tx d)))))
+              (->Eduction (filter (fn [^Datom d] (= tx (datom-tx d))))))
          (set/slice eavt (datom e nil nil tx0) (datom e nil nil txmax))       ;; e _ _ _
          (if (indexing? db a)                                                   ;; _ a v tx
            (->> (set/slice avet (datom e0 a v tx0) (datom emax a v txmax))
-                (filter (fn [^Datom d] (= tx (datom-tx d)))))
+                (->Eduction (filter (fn [^Datom d] (= tx (datom-tx d))))))
            (->> (set/slice aevt (datom e0 a nil tx0) (datom emax a nil txmax))
-                (filter (fn [^Datom d] (and (= v (.-v d))
-                                            (= tx (datom-tx d)))))))
+                (->Eduction (filter (fn [^Datom d] (and (= v (.-v d))
+                                            (= tx (datom-tx d))))))))
          (if (indexing? db a)                                                   ;; _ a v _
            (set/slice avet (datom e0 a v tx0) (datom emax a v txmax))
            (->> (set/slice aevt (datom e0 a nil tx0) (datom emax a nil txmax))
-                (filter (fn [^Datom d] (= v (.-v d))))))
+                (->Eduction (filter (fn [^Datom d] (= v (.-v d)))))))
          (->> (set/slice aevt (datom e0 a nil tx0) (datom emax a nil txmax))  ;; _ a _ tx
-              (filter (fn [^Datom d] (= tx (datom-tx d)))))
+              (->Eduction (filter (fn [^Datom d] (= tx (datom-tx d))))))
          (set/slice aevt (datom e0 a nil tx0) (datom emax a nil txmax))       ;; _ a _ _
          (filter (fn [^Datom d] (and (= v (.-v d))
                                      (= tx (datom-tx d)))) eavt)                ;; _ _ v tx


Distinguish ISeq and ICollection

Distinguish ISeq and ICollection

--- src/devtools/core.cljs
+++ src/devtools/core.cljs
@@ -4,6 +4,7 @@
 (def max-coll-elements 10)
 (def max-map-elements 5)
 (def max-set-elements 7)
+(def max-seq-elements 20)
 (def abbreviation "…")
 (def line-index-separator ":")
 (def formatter-key "devtoolsFormatter")
@@ -76,20 +77,25 @@
       (concat rendered-items [abbreviation])
       rendered-items)))

+(defn header-map-template [value]
+  (let [renderer (fn [[key value]] [(inlined-value-template key) (spacer) (inlined-value-template value)])
+        items (header-inlined-templates value renderer max-map-elements)]
+    (template "span" "color:#000" "{" items "}")))
+
+(defn header-set-template [value]
+  (let [renderer (fn [item] [(inlined-value-template item)])
+        items (header-inlined-templates value renderer max-set-elements)]
+    (template "span" "color:#000" "#{" items "}")))
+
+(defn header-seq-template [value]
+  (let [renderer (fn [item] [(inlined-value-template item)])
+        items (header-inlined-templates value renderer max-seq-elements)]
+    (template "span" "color:#000" "(" items ")")))
+
 (defn header-coll-template [value]
   (let [renderer (fn [item] [(inlined-value-template item)])
         items (header-inlined-templates value renderer max-coll-elements)]
     (template "span" "color:#000" "[" items "]")))
-
-(defn header-map-template [value]
-  (let [renderer (fn [[key value]] [(inlined-value-template key) (spacer) (inlined-value-template value)])
-        items (header-inlined-templates value renderer max-map-elements)]
-    (template "span" "color:#000" "{" items "}")))
-
-(defn header-set-template [value]
-  (let [renderer (fn [item] [(inlined-value-template item)])
-        items (header-inlined-templates value renderer max-set-elements)]
-    (template "span" "color:#000" "#{" items "}")))

 (defn generic-template [value]
   (template "span" "color:#000" (reference value)))
@@ -109,6 +115,7 @@
   (cond
     (map? value) (header-map-template value)
     (set? value) (header-set-template value)
+    (seq? value) (header-seq-template value)
     (coll? value) (header-coll-template value)
     ))


fix for empty search results

fix for empty search results

still need to set results to the empty list, otherwise we can't tell the
search is done with no results

--- src/chat/client/dispatcher.cljs
+++ src/chat/client/dispatcher.cljs
@@ -148,7 +148,7 @@
     [:chat/search query]
     15000
     (fn [reply]
-      (when (seq (:thread-ids reply))
+      (when (:thread-ids reply)
         (store/set-search-results! reply)))))

 (defmethod dispatch! :load-threads [_ {:keys [thread-ids on-complete]}]


We were missing a route for signup

We were missing a route for signup

--- src/clj/memento/routes/home.clj
+++ src/clj/memento/routes/home.clj
@@ -10,5 +10,6 @@
   (GET "/" [] (home-page))
   (GET "/record" [] (home-page))
   (GET "/login" [] (home-page))
+  (GET "/signup" [] (home-page))
   (GET "/remember" [] (home-page))
   (GET "/thread/*" [] (home-page)))


Quick tweak to the router

Quick tweak to the router

--- src/clj/picard/http/routing.clj
+++ src/clj/picard/http/routing.clj
@@ -90,7 +90,7 @@

 (defn match
   ([path target]        (match* nil path target true))
-  ([method path target] (match* method path target true)))
+  ([method path target] (match* (name method) path target true)))

 (defn scope
   [path & targets]
@@ -114,8 +114,6 @@
     (fn [dn]
       (let [state (atom nil)]
         (fn [evt val]
-          (when (= :abort evt)
-            (.printStackTrace val))
           (if (= :request evt)
             (handle-request state routes dn val)
             (if-let [upstream @state]


Use Precept's retract for remove-entity impl rule

--- src/clj/precept/impl/rules.cljc
+++ src/clj/precept/impl/rules.cljc
@@ -37,4 +37,4 @@
   =>
   (println "Fulfilling remove entity request " ?entity)
   (doseq [tuple ?entity]
-    (clara.rules/retract! tuple)))
+    (precept.util/retract! tuple)))


Improve documentation of defsnippet.

Improve documentation of defsnippet.

--- src/clj/quil/snippets/macro.clj
+++ src/clj/quil/snippets/macro.clj
@@ -2,17 +2,43 @@
   (:require [quil.util :as u]))

 (defmacro defsnippet
-  "Defines a snippet by storing its parts in a list
-  quil.snippets.all-snippets/all-snippets that can be later
-  access from clj or cljs to run tests or prepare samples.
+  "Defines a snippet. Snippet is a smalll example of how to use specific
+  Quil function. Snippets used in Quil docs as well as they used for release
+  testing.
+
+  If snippet is intended for clj-only or cljs-only function - use reader conditionals
+  (https://clojure.org/reference/reader#_reader_conditionals) to define snippet only in
+  clj or cljs. Also you can use reader conditionals inside snippet itself if needed.
+
+  If the snippet is not trivial and has multiple parts - it should have comments. These
+  comments will help Quil users to understand better what snippet does when they read
+  Quil API. Because standard clojure comments (the one that start with ;) are stripped in
+  macros instead comments should be added using (comment) macro. Like the following:
+
+  (comment \"Do foo bar\")
+  (foo-bar 123)
+
+  All (comment) forms will be converted into ';' comments when generating documentation.
+
+  Snippets are stored in https://github.com/quil/quil/tree/master/src/cljc/quil/snippets
+
+  More info about snippets: https://github.com/quil/quil/wiki/Snippets
+
+  This macro works by storing its parts in a list quil.snippets.all-snippets/all-snippets
+  that later used to generate tests for release testing or generate documentation.

   Params:
-    name Name of snippet.
-    fns Quil function name that the snippet tests or collection of names.
+    name Name of snippet. Doesn't really matter, needs to be unique
+        in the current file. Good default name is the same as function
+        this snippets tests.
+    fns Name of the Quil function name that the snippet tests. Used to
+        to find all snippets for each function when generating documentation.
+        Supports a collection of names if snippet tests few related Quil
+        functions at the same time.
     opts Map of extra options. Supported options:
       :renderer Renderer to use for snippet, if not default.
       :setup Setup function to use. Default is empty.
-    body Body of draw function of the snippet"
+    body Body of draw function of the snippet."
   [snip-name fns opts & body]
   (let [setup (:setup opts '())]
     `(swap! quil.snippets.all-snippets-internal/all-snippets


Make special encounters spawn at a minimum distance away from starting pos

--- src/cljc/robinson/worldgen.cljc
+++ src/cljc/robinson/worldgen.cljc
@@ -341,8 +341,8 @@
         player-pos            (get-in state [:world :player :pos] starting-pos)
         encounter             (if (and starting-pos
                                        (rc/farther-than? starting-pos player-pos 80))
-                                :normal
-                                (rand-nth [:normal :pirate-ship :temple]))]
+                                (rand-nth [:normal :pirate-ship :temple])
+                                :normal)]
     {:seed seed
      :pos {:x x :y y}
      :spawned-monsters {}


Use vector literal and conj instead of partial

It feels a little more natural and reads a bit better

--- src/cljs/comic_reader/main.cljs
+++ src/cljs/comic_reader/main.cljs
@@ -133,8 +133,8 @@
                  [:br]]]
             (when comic-imgs
               (into component
-                    (map (partial vector
-                                  img-component site location)
+                    (map #(conj [img-component site location]
+                                %)
                          comic-imgs)))))))))

 (defn comic-reader []


use parsets data for dimensional charts

use parsets data for dimensional charts

--- src/cljs/searchbot/parsets.cljs
+++ src/cljs/searchbot/parsets.cljs
@@ -17,25 +17,16 @@
     {:order {sort-field "desc"}}
     {}))

-(defn- build-parsets-agg
-  [terms sub-aggs]
+(defn- build-parsets-agg [{:keys [terms sub-aggs size] :or {size 5}}]
   (reduce (fn [agg-query a-term]
             {:aggs (merge
                     {(keyword a-term)
                      (merge {:terms
-                             (merge {:field a-term :size 5}
+                             (merge {:field a-term :size size}
                                     (sort-sub sub-aggs))}
                             agg-query)}
                     sub-aggs)})
           (build-sub-aggs sub-aggs) terms))
-
-(defn- build-terms-agg [prefix terms sub-aggs]
-  (let [terms-aggs (for [term terms]
-                     {(str prefix (name term)) (merge {:terms (merge {:field (name term) :size 5}
-                                                                     (sort-sub sub-aggs))}
-                                                      (build-sub-aggs sub-aggs))})
-        terms-aggs (reduce merge terms-aggs)]
-    terms-aggs))

 (defn- walk-buckets [de-buck bucket prefix steps value-path]
   (map #(de-buck % de-buck prefix (first steps) (rest steps) value-path)
@@ -51,33 +42,23 @@
   (vec (flatten (walk-buckets <-buckets agg-result {} steps value-path))))

 (defn- ->query
-  [{:keys [agg-terms sub-aggs agg-prefix-terms show-dimensions? filters default-filter]}]
-  (let [agg-query (build-parsets-agg (reverse agg-terms) sub-aggs)
-        agg-query (if (show-dimensions?)
-                    {:aggs (merge (:aggs agg-query)
-                                  (build-terms-agg agg-prefix-terms agg-terms sub-aggs))}
-                    agg-query)
+  [{:keys [agg-terms sub-aggs show-dimensions? filters default-filter size] :or {size 5}}]
+  (let [agg-query (build-parsets-agg {:terms (reverse agg-terms) :sub-aggs sub-aggs :size size})
         agg-query (filtered-agg (merge {:body agg-query}
                                  (merge {:filter default-filter}
                                         (:combined-query filters))))]
     agg-query))

-(defn- update-terms-aggs [owner terms-aggs]
-  (om/update-state! owner :parsets-cursor #(assoc-in % [:terms-aggs :aggregations] terms-aggs)))
-
 (defn- reset-highlighted [owner]
   (-> js/d3 (.select (om/get-node owner "parsets-dims")) (.selectAll ".mg-bar") (.classed "highlight" false)))

 (defn- do-parsets-agg
   [owner]
-  (let [{:keys [continue? comm url agg-prefix-terms get-agg-terms make-agg-query value-path]} (om/get-state owner)
+  (let [{:keys [continue? comm url get-agg-terms make-agg-query value-path]} (om/get-state owner)
         {es-settings :es-settings} (om/get-shared owner)]
     (when continue?
       (go (.log js/console "# running parsets aggregation:" (pr-str (get-agg-terms)))
           (let [{agg-result :aggregations} (<! (es-agg (or url (:url-agg (es-settings))) (make-agg-query)))]
-            (let [term-keys (->> (get-agg-terms) (map #(->> % name (str agg-prefix-terms) keyword)))
-                  terms-aggs (-> agg-result (select-keys term-keys))]
-              (update-terms-aggs owner terms-aggs))
             (let [parsets-data (agg->parsets agg-result (get-agg-terms) value-path)]
               (reset-highlighted owner)
               (om/update-state! owner #(assoc % :parsets-data parsets-data))
@@ -106,9 +87,6 @@
       (.dimensions (clj->js (map name (get-parsets-agg))))
       (.value (fn [d i] (. d -value)))))

-(defn- dim-accessor [sub-agg]
-  (or sub-agg :doc_count))
-
 (defn highlight [data facets]
   (filter #(every? (fn [[k sel]] (or (empty? sel) (contains? sel (k %)))) facets) data))

@@ -121,17 +99,19 @@
     (om/update-state! owner #(assoc % :highlighted sel-facets))
     (put! (:comm (om/get-state owner)) (highlight parsets-data sel-facets))))

-(defn- build-bar [cursor owner agg-prefix-terms term-name sub-agg]
+(defn- build-bar [owner term-name]
   (let [chart-id (str (clojure.string/replace term-name #"\." "-") "_bar")
         chart-sel (str "#" chart-id)]
     (om/build mg/mg-bar
-              cursor
+              (om/get-render-state owner :parsets-data)
               {:opts {:id chart-id :title term-name :height 150
-                      :x (-> (dim-accessor sub-agg) name) :y "key"
+                      :x "value" :y "key"
                       :trans-fn (fn [data-cursor]
-                                  (-> data-cursor
-                                      (get-agg-buckets [:terms-aggs :aggregations (keyword (str agg-prefix-terms term-name)) :buckets])
-                                      (flatten-agg-buckets [:key (dim-accessor sub-agg)])))
+                                  (let [reduced-data (->> data-cursor
+                                                          (group-by (keyword term-name))
+                                                          (mapv (fn [g] {:key (first g) :value (->> g last (map :value) (reduce +))}))
+                                                          (sort-by :value >))]
+                                    reduced-data))
                       :on-click-cb (fn [d i]
                                      (let [the-bar (-> js/d3 (.select chart-sel) (.selectAll ".mg-bar") js->clj (get-in [0 i]))
                                            was-highlighted? (-> js/d3 (.select the-bar) (.classed "highlight"))
@@ -141,17 +121,16 @@

 (defcomponent parsets [cursor owner {:keys [agg value-path url height] :or {height 600 value-path ["doc_count"]} :as opts}]
   (init-state [_]
-              (let [{:keys [es-settings ref-state]} (om/get-shared owner)
-                    prefix-terms "terms_"]
+              (let [{:keys [es-settings ref-state]} (om/get-shared owner)]
                 {:continue? true
                  :comm (chan)
                  :url url
-                 :agg-prefix-terms prefix-terms
                  :parsets-agg (->> agg :terms (map keyword))
                  :get-agg-terms #(:parsets-agg (om/get-state owner))
-                 :make-agg-query #(->query {:agg-prefix-terms prefix-terms
-                                            :agg-terms ((:get-agg-terms (om/get-state owner)))
+                 :size (get-in opts [:dimensions :size])
+                 :make-agg-query #(->query {:agg-terms ((:get-agg-terms (om/get-state owner)))
                                             :sub-aggs (:sub agg)
+                                            :size (:size (om/get-state owner))
                                             :show-dimensions? (:show-dimensions? (om/get-state owner))
                                             :filters (ref-state :filters)
                                             :default-filter (get-in (es-settings) [:default :filter])})
@@ -160,12 +139,11 @@
                  :svg nil
                  :parsets-data []
                  :highlighted {}
-                 :parsets-cursor (om/root-cursor (atom {:div {:width "90%" :height 200}}))
                  :show-dimensions (get-in opts [:dimensions :show])
                  :show-dimensions? #(:show-dimensions (om/get-state owner))}))
   (will-mount [_]
               (do-parsets-agg owner))
-  (render-state [_ {:keys [parsets-agg get-agg-terms agg-prefix-terms parsets-cursor show-dimensions]}]
+  (render-state [_ {:keys [parsets-agg get-agg-terms parsets-data show-dimensions]}]
                 (html
                  [:.card {:ref "parsets-card"}
                   [:.card-content
@@ -189,10 +167,7 @@
                    [:.row
                     [:.col {:class (if show-dimensions "s9" "s12") :id "parsets" :ref "parsets-div"}]
                     [:.col {:class (if show-dimensions "s3" "hide") :ref "parsets-dims"}
-                     (if (:terms-aggs parsets-cursor)
-                       (for [term (get-agg-terms)]
-                         (let [term-name (name term)]
-                           (build-bar parsets-cursor owner agg-prefix-terms term-name (-> (:sub agg) keys first)))))
+                     (when-not (empty? parsets-data) (map #(build-bar owner (name %)) (get-agg-terms)))
                      ]
                     ]]]
                  ))


Remove whitespace line on hash ns.

Remove whitespace line on hash ns.

--- src/clojure/buddy/core/hash.clj
+++ src/clojure/buddy/core/hash.clj
@@ -27,7 +27,6 @@
            org.bouncycastle.crypto.digests.SHA512Digest
            clojure.lang.IFn
            clojure.lang.Keyword))
-

 (def ^{:doc "Available digests."
        :dynamic true}


Bug fix for cursor update issue.

Bug fix for cursor update issue.

--- src/clojure/freactive/core.cljc
+++ src/clojure/freactive/core.cljc
@@ -341,10 +341,12 @@
             (new-reactive-id)
             this
             ckey
-            (fn [cur] (get (.rawDeref this) ckey))
+            (fn [cur]
+              (get (.rawDeref this) ckey))
             (fn [cur f & args]
               (.updateChild this ckey f args))
             (fn [cur]
+              (.registerOne this)
               (set! child-cursors (update child-cursors ckey conj cur)))
             (fn [cur]
               (set! child-cursors
@@ -352,7 +354,8 @@
                             (fn [cursors]
                               (let [cursors (remove #(= % cur) cursors)]
                                 (when-not (empty? cursors)
-                                  cursors))))))
+                                  cursors)))))
+              (.unregisterOne this))
             nil
             nil
             nil
@@ -505,7 +508,7 @@
         (let [new-value (apply f (.-state cur) args)]
           (when-let [validate (.-validator cur)]
             (assert (validate new-value) "Validator rejected reference state"))
-          (.updateCursor cur new-value)))
+          (.updateCursor cur new-value *change-ks*)))
       (fn [])
       (fn [])
       nil
@@ -554,7 +557,7 @@
                  (fn [x] (setter x (apply f (getter x) args)))))
         (fn [this]
           ((.-add-watch binding-info) parent id
-           (fn [k r o n] (.updateCursor this (getter n)))))
+           (fn [k r o n] (.updateCursor this (getter n) *change-ks*))))
         (fn [this] ((.-remove-watch binding-info) parent id))
         nil
         nil


Updated lens watch behavior.

Updated lens watch behavior.

--- src/clojure/freactive/core.cljs
+++ src/clojure/freactive/core.cljs
@@ -107,6 +107,27 @@
      (-remove-watch ref key)
      (sully))))

+(defn get-add-watch* [ref]
+  (cond
+    (satisfies? IInvalidates ref)
+    add-invalidation-watch
+    (satisfies? IWatchable ref)
+    add-watch))
+
+(defn get-remove-watch* [ref]
+  (cond
+    (satisfies? IInvalidates ref)
+    remove-invalidation-watch
+    (satisfies? IWatchable ref)
+    remove-watch))
+
+(defn get-add-remove-watch* [ref]
+  (cond
+    (satisfies? IInvalidates ref)
+    [add-invalidation-watch remove-invalidation-watch]
+    (satisfies? IWatchable ref)
+    [add-watch remove-watch]))
+
 (deftype ReactiveComputation [^:mutable state ^:mutable dirty f ^:mutable deps meta
                               ^:mutable watches ^:mutable invalidation-watches sully]
   Object
@@ -123,11 +144,7 @@
       state
       (binding [*register-dep*
                 (fn [ref]
-                  (cond
-                    (satisfies? IInvalidates ref)
-                    (-add-invalidation-watch ref this sully)
-                    (satisfies? IWatchable ref)
-                    (-add-watch ref this sully)))]
+                  ((get-add-watch* ref) ref this sully))]
         (set! dirty false)
         (let [old-val state
               new-val (f)]
@@ -172,12 +189,31 @@
     (set! (.-sully reactive) (make-sully-fn reactive))
     reactive))

-(defn- do-update-state [a new-value]
-  (let [old-value (.-state a)]
+(declare update-lens-state)
+
+(defn- add-lens-watch [lens ref]
+  ((get-add-watch* ref)
+   ref lens
+   (fn sully-lens
+     ([]
+      (set! (.-dirty lens) true)
+      (when-not (empty? (.-watches lens))
+        (update-lens-state lens ref)))
+     ([_ _]
+      (remove-invalidation-watch ref lens))
+     ([_ _ old-value new-value]
+      (remove-watch ref lens)
+      (sully-lens)))))
+
+(defn- update-lens-state [lens ref]
+  (set! (.-dirty lens) false)
+  (add-lens-watch lens ref)
+  (let [new-value ((.-getter lens) @ref)
+        old-value (.-state lens)]
     (when (not= old-value new-value)
-      (set! (.-state a) new-value)
-      (when-not (empty? (.-watches a))
-        (-notify-watches a old-value new-value)))
+      (set! (.-state lens) new-value)
+      (when-not (empty? (.-watches lens))
+        (-notify-watches lens old-value new-value)))
     new-value))

 (defn- lens-swap! [ref getter setter f]
@@ -185,7 +221,7 @@
          (fn [cur]
            (setter cur (f (getter cur))))))

-(deftype ReactiveLens [ref getter setter state meta watches]
+(deftype ReactiveLens [ref getter setter dirty state meta watches]
   Object
   (equiv [this other]
     (-equiv this other))
@@ -198,7 +234,9 @@
   cljs.core/IDeref
   (-deref [this]
     (register-dep this)
-    state)
+    (if dirty
+      (update-lens-state this ref)
+      state))

   IMeta
   (-meta [_] meta)
@@ -236,11 +274,8 @@
   ([ref getter]
    (lens ref getter (fn [_ _] (assert false "Lens does not support updates"))))
   ([ref getter setter]
-   (let [lens (ReactiveLens. ref getter setter nil nil nil)]
-     (add-watch ref lens
-                (fn [_ _ old-value new-value]
-                  (do-update-state lens (getter new-value))))
-     (set! (.-state lens) (getter @ref))
+   (let [lens (ReactiveLens. ref getter setter true nil nil nil)]
+     (add-lens-watch lens ref)
      lens)))

 (defn cursor [ref korks]


Populate a matrix with a non-singular shape to 'm in REPL helper

--- src/clojure/gpu/matrix/repl.clj
+++ src/clojure/gpu/matrix/repl.clj
@@ -8,7 +8,7 @@
      (require '[clojure.core.matrix :as m])
      (require 'gpu.matrix)
      (def x 1)
-     (def m (mp/construct-matrix  (gpu.matrix.NDArray.) [[1 2 3]]))
+     (def m (mp/construct-matrix  (gpu.matrix.NDArray.) [[1 2 3] [4 5 6]]))
      (def arr (mp/construct-matrix (gpu.matrix.NDArray.) [1 2 3]))))

 (defn populate []


onyx core now supplies trigger context as part of opts map

--- src/onyx_peers/functions/functions.clj
+++ src/onyx_peers/functions/functions.clj
@@ -11,6 +11,7 @@
 (defn update-state-log [{:keys [bookkeeper/ledger-handle] :as event}
                         window
                         trigger
-                        {:keys [window-id upper-bound lower-bound]}
+                        {:keys [window-id upper-bound lower-bound context]}
                         state]
-  (.addEntry ledger-handle (nippy/zookeeper-compress [lower-bound upper-bound state])))
+  (when (= :task-complete context)
+    (.addEntry ledger-handle (nippy/zookeeper-compress [lower-bound upper-bound state]))))


Small refactoring, still working on implicit.


Fix async queries

Fix async queries

--- src/clojure/clojurewerkz/cassaforte/cql.clj
+++ src/clojure/clojurewerkz/cassaforte/cql.clj
@@ -145,15 +145,14 @@
 (defn insert-async
   "Same as insert but returns a future"
   [^Session session & query-params]
-  (comment
-    (cc/executeasync- session query-params q/insert-query)))
+  (cc/async
+   (apply insert session query-params)))

 (defn ^:private batch-query-from-
   [table records]
   (->> records
        (map (comp (partial apply (partial q/insert-query table)) flatten vector))
-       (apply q/queries)
-       ))
+       (apply q/queries)))

 (defn insert-batch
   "Performs a batch insert (inserts multiple records into a table at the same time).
@@ -166,9 +165,8 @@
 (defn insert-batch-async
   "Same as insert-batch but returns a future"
   [^Session session table records]
-  (let [query (batch-query-from- table records)]
-    (comment
-      (cc/executeasync- session query))))
+  (cc/async
+   (insert-batch session table records)))

 (defn atomic-batch
   "Executes a group of operations as an atomic batch (BEGIN BATCH ... APPLY BATCH)"
@@ -187,8 +185,8 @@
 (defn update-async
   "Same as update but returns a future"
   [^Session session & query-params]
-  (comment
-    (cc/executeasync- session query-params q/update-query)))
+  (cc/async
+   (apply update session query-params)))

 (defn delete
   "Deletes columns and rows. If the `columns` clause is provided,
@@ -203,8 +201,8 @@
 (defn delete-async
   "Same as delete but returns a future"
   [^Session session table & query-params]
-  (comment
-    (cc/executeasync- session (cons table query-params) q/delete-query)))
+  (cc/async
+   (apply delete session table query-params)))

 (defn select
   "Retrieves one or more columns for one or more rows in a table.
@@ -216,8 +214,8 @@
 (defn select-async
   "Same as select but returns a future"
   [^Session session & query-params]
-  (comment
-    (cc/executeasync- session query-params q/select-query)))
+  (cc/async
+   (apply select session query-params)))

 (defn truncate
   "Truncates a table: permanently and irreversably removes all rows from the table,


fix word fit bug

fix word fit bug

--- src/cljs/infinitelives/pixi/pixelfont.cljs
+++ src/cljs/infinitelives/pixi/pixelfont.cljs
@@ -194,11 +194,17 @@
     (let [words (subs text 0 e)
           width (string-width font-key words)
           ]
-      (log "words" words width r n size
-           )
-      (if (and (< width size) r)
-        (recur (inc n) r)
-        n))))
+      (cond
+        (and (< width size) r)
+        (recur (inc n) r) ;; more words and more space
+
+        (< width size)
+        (inc n)           ;; no more words, fits in
+
+        :default
+        n                 ;; no more words, doesn't fit in
+        ))))
+


Made make-dl-expression to "unpack" all dl-expression first

i.e. if the given dl-sexp contains dl-expression objects, they will be
substituted by their syntax expressions.

Signed-off-by: Daniel Borchmann <25857343a15bf1edafebc2912e82ecf775c585c1@mailbox.tu-dresden.de>

--- src/conexp/contrib/dl/framework/syntax.clj
+++ src/conexp/contrib/dl/framework/syntax.clj
@@ -89,13 +89,19 @@
   [thing]
   (= (type thing) ::DL-expression))

+(defn- dl-sexp->term
+  "Ensures no dl-expression objects in the syntax expression given."
+  [expr]
+  (cond
+   (dl-expression? expr) (expression expr),
+   (sequential? expr)    (walk dl-sexp->term identity expr),
+   :else                 expr))
+
 (defn make-dl-expression
   "Takes a DL and a s-exp describing a concept description and returns
   a DL-expression."
   [language dl-sexp]
-  (cond
-   (dl-expression? dl-sexp) dl-sexp,
-   :else                    (DL-expression language (transform-expression language dl-sexp))))
+  (DL-expression language (dl-sexp->term dl-sexp)))

 ;;;


fixes typo in load-string* docstring

fixes typo in load-string* docstring

--- pigpen-core/src/main/clojure/pigpen/io.clj
+++ pigpen-core/src/main/clojure/pigpen/io.clj
@@ -41,7 +41,7 @@

   Examples:

-    (oad-string*
+    (load-string*
       \"input.txt\"
       (trap (fn [x] (subs x 42)))
       data)


Remove source map option from cljs build (#75)

As advised in https://github.com/adzerk-oss/boot-cljs/issues/136

--- resources/leiningen/new/tenzing/build.boot
+++ resources/leiningen/new/tenzing/build.boot
@@ -34,7 +34,7 @@
   identity)

 (deftask development []
-  (task-options! cljs {:optimizations :none :source-map true}
+  (task-options! cljs {:optimizations :none}
                  reload {:on-jsload '{{name}}.app/init}{{{development-task-opts}}})
   identity)


Extract hexadecimal generator

Extract hexadecimal generator

--- src/github_changelog/schema_generators.clj
+++ src/github_changelog/schema_generators.clj
@@ -4,7 +4,10 @@
             [schema.experimental.generators :as gen]
             [clojure.test.check.generators :as check-generators]))

+(def hexadecimal
+  (check-generators/elements "0123456789ABCDEF"))
+
 (def sha
-  ((gen/fmap join) (check-generators/vector (check-generators/elements "0123456789ABCDEF") 40)))
+  ((gen/fmap join) (check-generators/vector hexadecimal 40)))

 (def generators {schema/Sha sha})


Remove good? from manufacturer as it was just noise.

--- clj_record/test/model/manufacturer.clj
+++ clj_record/test/model/manufacturer.clj
@@ -5,12 +5,3 @@

 (cljrec/init-model
   (has-many products))
-
-(defn good?
-  ([manufacturer]
-    (and (:grade manufacturer) (>= (:grade manufacturer) 90)))
-  {:test (fn []
-    (are (good? {:grade _1})
-      90 90.0 91)
-    (are (not (good? {:grade _1}))
-      89 80 nil))})


Dont push notification if chat is not in cofx

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

--- src/status_im/notifications/local.cljs
+++ src/status_im/notifications/local.cljs
@@ -42,17 +42,18 @@
   [{:keys [title message icon user-info channel-id type]
     :as   notification
     :or   {channel-id "status-im-notifications"}}]
-  (pn-android/present-local-notification
-   (merge {:channelId channel-id
-           :title     title
-           :message   message
-           :showBadge false}
-          (when user-info
-            {:userInfo (bean/->js user-info)})
-          (when icon
-            {:largeIconUrl (:uri (react/resolve-asset-source icon))})
-          (when (= type "message")
-            notification))))
+  (when notification
+    (pn-android/present-local-notification
+     (merge {:channelId channel-id
+             :title     title
+             :message   message
+             :showBadge false}
+            (when user-info
+              {:userInfo (bean/->js user-info)})
+            (when icon
+              {:largeIconUrl (:uri (react/resolve-asset-source icon))})
+            (when (= type "message")
+              notification)))))

 (defn handle-notification-press [{{deep-link :deepLink} :userInfo
                                   interaction           :userInteraction}]
@@ -136,32 +137,33 @@
      {:keys [chat-type chat-id] :as chat} :chat
      {:keys [identicon]} :contact
      contact-id :contact-id}]
-   (let [contact-name @(re-frame/subscribe
-                        [:contacts/contact-name-by-identity contact-id])
-         group-chat?  (not= chat-type constants/one-to-one-chat-type)
-         title        (clojure.string/join
-                       " "
-                       (cond-> [contact-name]
-                         group-chat?
-                         (conj
-                          ;; TODO(rasom): to be translated
-                          "in")
-
-                         group-chat?
-                         (conj
-                          (str (when (contains? #{constants/public-chat-type
-                                                  constants/community-chat-type}
-                                                chat-type)
-                                 "#")
-                               (get chat :name)))))]
-     {:type             "message"
-      :chatType         (str chat-type)
-      :from             title
-      :chatId           chat-id
-      :alias            title
-      :identicon        (or identicon (identicon/identicon contact-id))
-      :whisperTimestamp (get message :whisperTimestamp)
-      :text             (reply/get-quoted-text-with-mentions (:parsedText message))})))
+   (when (and chat-type chat-id)
+     (let [contact-name @(re-frame/subscribe
+                          [:contacts/contact-name-by-identity contact-id])
+           group-chat?  (not= chat-type constants/one-to-one-chat-type)
+           title        (clojure.string/join
+                         " "
+                         (cond-> [contact-name]
+                           group-chat?
+                           (conj
+                            ;; TODO(rasom): to be translated
+                            "in")
+
+                           group-chat?
+                           (conj
+                            (str (when (contains? #{constants/public-chat-type
+                                                    constants/community-chat-type}
+                                                  chat-type)
+                                   "#")
+                                 (get chat :name)))))]
+       {:type             "message"
+        :chatType         (str chat-type)
+        :from             title
+        :chatId           chat-id
+        :alias            title
+        :identicon        (or identicon (identicon/identicon contact-id))
+        :whisperTimestamp (get message :whisperTimestamp)
+        :text             (reply/get-quoted-text-with-mentions (:parsedText message))}))))

 (defn create-notification
   ([notification]


Convert security group names into IDs

Convert security group names into IDs

--- src/exploud/asgard.clj
+++ src/exploud/asgard.clj
@@ -97,6 +97,9 @@
 (defn- image-list-url [region application-name]
   (str asgard-url "/" region "/image/list/" application-name ".json"))

+(defn- security-groups-list-url [region]
+  (str asgard-url "/" region "/security/list.json"))
+
 (defn application
   "Retrieves information about an application from Asgard"
   [region application-name]
@@ -124,6 +127,13 @@
   "Retrives the list of images associated with an application."
   [region application-name]
   (let [{:keys [body status]} (http/simple-get (image-list-url region application-name))]
+    (when (= status 200)
+      (json/parse-string body true))))
+
+(defn security-groups
+  "Retrieves the list of security groups in a given region."
+  [region]
+  (let [{:keys [body status]} (http/simple-get (security-groups-list-url region))]
     (when (= status 200)
       (json/parse-string body true))))

@@ -236,21 +246,24 @@
 (defn- is-security-group-name? [security-group]
   (re-find #"^sg-" security-group))

-(defn- get-security-group-id [security-group]
-  "hello")
-
-(defn- replace-security-group-names [params]
+(defn- get-security-group-id [security-group region]
+  (let [security-groups (:securityGroups (security-groups region))]
+    (if-let [found-group (first (filter (fn [sg] (= security-group (:groupName sg))) security-groups))]
+      (:groupId found-group)
+      (throw (Throwable. (str "Unknown security group with name " security-group))))))
+
+(defn- replace-security-group-names [region params]
   (if-let [security-group-names (get params "selectedSecurityGroups")]
     (map (fn [sg] (if (is-security-group-name? sg)
-                   (get-security-group-id sg)
+                   (get-security-group-id sg region)
                    sg))
          security-group-names)
     params))

-(defn- amend-params [params]
-  (comment (-> (replace-load-balancer-param params)
-               (replace-security-group-names params)))
-  params)
+(defn- amend-params [region params]
+  (replace-security-group-names
+   region
+   (replace-load-balancer-param params)))

 (defn- create-manual-deploy-params [params region application-name]
   (let [additional-params {"appName" application-name
@@ -264,7 +277,7 @@
                            "revision" ""
                            "stack" ""
                            "region" region}
-        required-params (amend-params (select-keys params required-keys))]
+        required-params (amend-params region (select-keys params required-keys))]
     (merge additional-params required-params)))

 (defn- application-params [application-name]
@@ -316,4 +329,5 @@
 ;(create-asgard-params (create-manual-deploy-params (merge (get (exploud.tyranitar/deployment-params "dev" "skeleton" "HEAD") "data") {"imageId" "woooooo" "selectedZones" ["eu-west-1a" "eu-west-1b"] "ticket" "something" "_action_save" ""}) "eu-west-1" "skeleton"))
 ;(auto-scaling-save-url "eu-west-1")
 ;(set/rename-keys {"selectedLoadBalancers" ["beef" "steak"]} {"selectedLoadBalancers" "selectedLoadBalancersForVpcIdvpc-e23232"})
-;(replace-security-group-names {"selectedSecurityGroups" ["woo" "sg-1234"]})
+;(replace-security-group-names "eu-west-1" {"selectedSecurityGroups" ["woo" "sg-1234"]})
+;(security-groups "eu-west-1")


apply CLJ-1472 fix to non-tail locking case

--- src/main/clojure/clojure/spec/gen/alpha.clj
+++ src/main/clojure/clojure/spec/gen/alpha.clj
@@ -14,11 +14,25 @@

 (defonce ^:private dynalock (Object.))

+(defmacro ^:private locking2
+  "Executes exprs in an implicit do, while holding the monitor of x.
+  Will release the monitor of x in all circumstances."
+  {:added "1.0"}
+  [x & body]
+  `(let [lockee# ~x]
+     (try
+       (let [locklocal# lockee#]
+         (monitor-enter locklocal#)
+         (try
+           ~@body
+           (finally
+            (monitor-exit locklocal#)))))))
+
 (defn- dynaload
   [s]
   (let [ns (namespace s)]
     (assert ns)
-    (locking dynalock
+    (locking2 dynalock
       (require (c/symbol ns)))
     (let [v (resolve s)]
       (if v


temporarily set slots to 4

temporarily set slots to 4

--- src/frontend/core.cljs
+++ src/frontend/core.cljs
@@ -3,8 +3,8 @@
 (defonce room-id (.getAttribute (. js/document (getElementById "roomid")) "data"))
 (defonce socket (js/io))
 (defonce current-sound-id "current-song")
-(defonce default-upload-slots 1)
-(defonce default-download-slots 1)
+(defonce default-upload-slots 4)
+(defonce default-download-slots 4)
 (defonce app-state (atom {:signed-in? false
                           :messages []
                           :message-received? false


test cljs

test cljs

--- src/gaugin/client.cljs
+++ src/gaugin/client.cljs
@@ -1,97 +1,54 @@
 (ns gauguin.client
-  (:require [hiccups.runtime :as hiccupsrt]
-            [clojure.browser.repl]
-            [cljs.core.async :refer [put! chan <! timeout]]
-            [strokes :refer [d3]])
-  (:require-macros [hiccups.core :as hiccups]
-                   [cljs.core.async.macros :refer [go]]))
-
-(.log js/console "HAIL TO THE LAMBDA!")
-
-
-
-;; fire up repl
-#_(do
-    (def repl-env (reset! cemerick.austin.repls/browser-repl-env
-                         (cemerick.austin/repl-env)))
-    (cemerick.austin.repls/cljs-repl repl-env))
+  (:require [strokes :refer [d3]]))

 (strokes/bootstrap)

-(def data [63 39 31 53 25 32 175 69 51])
+; 26 characters in a vec
+(def alphabet (vec "abcdefghijklmnopqrstuwvxyz"))

-(def margin {:top 50 :right 40 :bottom 50 :left 40})
-(def width (- 960 (margin :left) (margin :right)))
-(def height (- 500  (margin :top) (margin :bottom)))
+(def width 960)
+(def height 500)

-; x is a fn: data ↦ width
-(def x
-  (-> d3
-      .-scale
-      (.ordinal)
-      (.domain (vec (range (count data))))
-      (.rangeRoundBands [0 width] 0.2)))
+(def svg (-> d3 (.select "body") (.append "svg")
+      (.attr {:width width :height height})
+    (.append "g")
+      (.attr {:transform (str "translate(32," (/ height 2) ")")})))

-; y is a fn: index ↦ y
-(def y
-  (-> d3
-      .-scale
-      (.linear)
-      (.domain [(apply max data) 0])
-      (.range [height 0])))
+(defn update [data]
+  ; DATA JOIN
+  ; Join new data with old elements, if any.
+  (let [text (-> svg (.selectAll "text") (.data data))]
+    ; UPDATE
+    ; Update old elements as needed
+    (-> text (.attr {:class "update"}))

+    ; ENTER
+    ; Create new elments as needed
+    (-> text (.enter) (.append "text")
+      (.attr {:class "enter"
+              :x     #(* %2 32)
+              :dy    ".35em"}))

-(def svg2
-  (-> d3
-      (.select "body")
-      (.append "svg")
-      (.attr {:width  (+ width (margin :left) (margin :right))
-              :height (+ height (margin :top) (margin :bottom))})
-      (.append "g")
-      (.attr {:transform (str "translate(" (margin :left) "," (margin :top) ")")})))
+    ; ENTER + UPDATE
+    ; Appending to the enter selection expands the update selection to include
+    ; entering elements; so, operations on the update selection after appending to
+    ; the enter selection will apply to both entering and updating nodes.
+    (-> text (.text identity))

+    ; EXIT
+    ; Remove old elements as needed.
+    (-> text (.exit) (.remove))))

-; Data ↦ Element
-(def bar2
-  (-> svg2
-      (.selectAll "g.bar")
-      (.data data)
-      (.enter)
-      (.append "g")
-      (.attr {:class "bar"
-              :transform #(str "translate(" (x %1) "," (- height  (y (data %2))) ")" )})
-      (.style {:fill "steelblue"})))
+; The initial display - all letters
+(update alphabet)

-
-; Data Attributes ↦ Element Attributes
-(-> bar2
-    (.append "rect")
-    (.attr {:height  #(y %)
-            :width (.rangeBand x)}))
-
-
-; Data Attributes ↦ Element Attributes
-#_(-> bar2
-    (.append "text")
-    (.attr {:x  x
-            :y  (/ (.rangeBand y) 2)
-            :dx -6
-            :dy ".35em"
-            :text-anchor "end"})
-    (.style "fill" "white")
-    (.text identity))
-
-#_(-> d3
-    (.select "svg")
-    (.selectAll "g.bar")
-    (.style {:fill "steelblue"}))
-
-
-#_ (go
-  (while true
-    (<! (timeout 1000))
-    (draw-bar "green")
-    (<! (timeout 1000))
-    (draw-bar "red")
-    (<! (timeout 1000))
-    (draw-bar "blue")))
+; Grab a random sample of letters from the alphabet, in alphabetical order.
+(.setInterval js/window (fn []
+  (-> alphabet
+    shuffle
+    (subvec (rand-int 26))
+    sort
+    vec
+    update))
+  ; 2 seconds between swaps
+  2000)


STORM-132 sort supervisor by free slot in desending order in EvenScheduler to schedule more evenly between supervisor

--- storm-core/src/clj/backtype/storm/scheduler/EvenScheduler.clj
+++ storm-core/src/clj/backtype/storm/scheduler/EvenScheduler.clj
@@ -22,7 +22,12 @@
     :implements [backtype.storm.scheduler.IScheduler]))

 (defn sort-slots [all-slots]
-  (let [split-up (vals (group-by first all-slots))]
+  (let [split-up
+         (map second
+           (reverse
+             (sort
+               (for [[host ports] (group-by first all-slots)]
+                 [(count ports) ports]))))]
     (apply interleave-all split-up)
     ))


improved naming

improved naming

--- cljx/plongeur-clj/src/kierros/sente_server_driver.clj
+++ cljx/plongeur-clj/src/kierros/sente_server_driver.clj
@@ -26,10 +26,11 @@

 (defn make-sente-server-driver
   "Accepts an options map.
-  Returns a websocket server driver powered by Sente and http-kit."
+  Returns a websocket server driver powered by Sente and http-kit.
+  The driver accepts a channel of client bound push messages and returns a channel of client requests."
   [& [{sente-options    :sente
        http-kit-options :http-kit}]]
-  (fn [push-chan]
+  (fn [client-bound-chan]
     (let [{:keys [ch-recv
                   send-fn
                   connected-uids
@@ -42,11 +43,11 @@
                                (route/not-found  (page-not-found)))
           ring-handler (wrap-defaults sente-routes site-defaults)
           http-shutdown-fn    (h/run-server ring-handler http-kit-options)
-          client-request-chan (chan 10)
+          client-request-chan (chan)
           router-shutdown-fn  (s/start-chsk-router! ch-recv #(go (>! client-request-chan %)))]
       (go-loop []
-               (if-let [push->client (<! push-chan)]
-                 (do (send-fn push->client)
+               (if-let [client-bound-msg (<! client-bound-chan)]
+                 (do (send-fn client-bound-msg)
                      (recur))
                  (do (http-shutdown-fn)
                      (router-shutdown-fn)


Use `nil` as default value por db username and password.

--- backend/src/uxbox/config.clj
+++ backend/src/uxbox/config.clj
@@ -35,8 +35,8 @@
   []
   {:http-server-port (lookup-env env :uxbox-http-server-port 6060)
    :http-server-debug (lookup-env env :uxbox-http-server-debug true)
-   :database-username (lookup-env env :uxbox-database-username "")
-   :database-password (lookup-env env :uxbox-database-password "")
+   :database-username (lookup-env env :uxbox-database-username nil)
+   :database-password (lookup-env env :uxbox-database-password nil)
    :database-name (lookup-env env :uxbox-database-name "uxbox")
    :database-server (lookup-env env :uxbox-database-server "localhost")
    :database-port (lookup-env env :uxbox-database-port 5432)