Move lazy-clojuredocs dependencies across nrepl

closes #53

--- src/clj/reply/initialization.clj
+++ src/clj/reply/initialization.clj
@@ -71,18 +71,18 @@
         `(println "No usage examples for namespaces as a whole like" '~name
                   "\nTry a particular symbol in a namespace,"
                   "e.g. clojure.string/join")
-        `(reply.initialization/call-with-ns-and-name ~fn (var ~name))))))
+        `(reply.exports/call-with-ns-and-name ~fn (var ~name))))))

 (defmacro lazy-clojuredocs
   "Lazily checks if the clojuredocs client is available, and uses it to
   retrieve examples if it is."
   ([v]
-     `(when (deref reply.initialization/clojuredocs-available?)
-        (reply.initialization/handle-fns-etc
+     `(when (deref reply.exports/clojuredocs-available?)
+        (reply.exports/handle-fns-etc
          ~v (ns-resolve (symbol "cd-client.core")
                         (symbol "pr-examples-core")))))
   ([ns-str var-str]
-     `(when (deref reply.initialization/clojuredocs-available?)
+     `(when (deref reply.exports/clojuredocs-available?)
         ((ns-resolve (symbol "cd-client.core") (symbol "pr-examples-core"))
          ~ns-str ~var-str))))

@@ -113,6 +113,9 @@
     ~(export-definition 'reply.initialization/sourcery)
     (~'intern-with-meta '~'user '~'sourcery ~'#'sourcery)

+    ~(export-definition 'reply.initialization/clojuredocs-available?)
+    ~(export-definition 'reply.initialization/call-with-ns-and-name)
+    ~(export-definition 'reply.initialization/handle-fns-etc)
     ~(export-definition 'reply.initialization/lazy-clojuredocs)
     (~'intern-with-meta '~'user '~'clojuredocs ~'#'lazy-clojuredocs)
     (~'intern-with-meta '~'user '~'cdoc ~'#'lazy-clojuredocs)


Strip reply dependencies out of default init

This breaks exit/quit for a bit.

--- src/clj/reply/initialization.clj
+++ src/clj/reply/initialization.clj
@@ -1,5 +1,6 @@
 (ns reply.initialization
-  (:require [clojure.pprint]))
+  (:require [clojure.pprint]
+            [clojure.repl]))

 (defmacro repl-defn [sym & args]
   (let [no-meta-source (with-out-str (clojure.pprint/pprint `(defn ~sym ~@args)))
@@ -30,23 +31,36 @@
           (with-meta sym (meta value-var))
           @value-var))

+(defn export-definition [s]
+  (read-string (clojure.repl/source-fn s)))
+
 (defn default-init-code []
-  '(do
+  `(do
     (println "Welcome to REPL-y!")
     (println "Clojure" (clojure-version))
-    (use '[clojure.repl :only (source apropos dir pst doc find-doc)])
-    (use '[clojure.java.javadoc :only (javadoc)])
-    (use '[clojure.pprint :only (pp pprint)])
+    (use '[clojure.repl :only ~'[source apropos dir pst doc find-doc]])
+    (use '[clojure.java.javadoc :only ~'[javadoc]])
+    (use '[clojure.pprint :only ~'[pp pprint]])
+
+    ~(export-definition 'reply.initialization/help)
+
+    (ns reply.exports)
+    ~(export-definition 'reply.initialization/intern-with-meta)
+
+    (binding [*err* (java.io.StringWriter.)]
+      ~(export-definition 'reply.initialization/repl-defn)
+      (~'intern-with-meta '~'user '~'defn #'repl-defn))
+
+    ~(export-definition 'reply.initialization/sourcery)
+    (~'intern-with-meta '~'user '~'sourcery #'sourcery)
+
+    (in-ns '~'user)
+
+    ; assumes cd-client is on the execution classpath by now
     (require '[cd-client.core])
-    (def exit reply.main/exit)
-    (def quit reply.main/exit)
-    (def help reply.initialization/help)
+    (~'reply.exports/intern-with-meta '~'user '~'clojuredocs #'cd-client.core/pr-examples)

     (help)
-    (reply.initialization/intern-with-meta 'user 'clojuredocs #'cd-client.core/pr-examples)
-    (binding [*err* (java.io.StringWriter.)]
-      (reply.initialization/intern-with-meta 'user 'defn #'reply.initialization/repl-defn))
-    (reply.initialization/intern-with-meta 'user 'sourcery #'reply.initialization/sourcery)
     nil))

 (defn eval-in-user-ns [code]


Implement check for a string with kibit.

--- src/clj/sally/checkers/kibit.clj
+++ src/clj/sally/checkers/kibit.clj
@@ -1,5 +1,6 @@
 (ns sally.checkers.kibit
   (:require [kibit.check :as kc]
+            [clojure.edn :as edn]
             [sally.checkers.meta :refer [add-sally-metadata]])
   (:import [java.io File Reader]
            [clojure.lang PersistentList]))
@@ -15,7 +16,10 @@
   (check [f] (kc/check-file f))

   PersistentList
-  (check [expr] (kc/check-expr expr)))
+  (check [expr] (kc/check-expr expr))
+
+  String
+  (check [s] (check (edn/read-string s))))

 (add-sally-metadata check
                     :name "kibit"


Add listen utility

Add listen utility

--- src/cljs/hacker_agent/utils.cljs
+++ src/cljs/hacker_agent/utils.cljs
@@ -1,4 +1,7 @@
-(ns hacker-agent.utils)
+(ns hacker-agent.utils
+  (:require [goog.dom :as dom]
+            [goog.events :as events]
+            [cljs.core.async :as async :refer [put! chan <!]]))

 (defn dissoc-in [data path]
   (let [prefix (butlast path)
@@ -22,3 +25,9 @@
                 (conj sub k)))
             m)
     []))
+
+(defn listen [el type]
+  (let [out (chan)]
+    (events/listen el type
+      (fn [e] (put! out e)))
+    out))


added tests for om snippet and template implementations

--- test/kioo/om_test.cljs
+++ test/kioo/om_test.cljs
@@ -1,13 +1,14 @@
 (ns kioo.om-test
   (:require [cemerick.cljs.test :as t]
             [kioo.om :refer [content set-attr append prepend
-                               remove-attr before after do->
-                               set-style remove-style add-class
-                               remove-class wrap unwrap set-class
-                               html html-content]]
+                             remove-attr before after do->
+                             set-style remove-style add-class
+                             remove-class wrap unwrap set-class
+                             html html-content]]
             [kioo.test :refer [render-dom]]
             [goog.dom :as gdom])
-  (:require-macros [kioo.om :refer [component]]
+  (:require-macros [kioo.om :refer [component snippet template
+                                    defsnippet deftemplate]]
                    [cemerick.cljs.test :refer [are is deftest testing]]))

 ;; all text get surrounded by spans in om
@@ -125,3 +126,45 @@
                           {[:div] (html-content "
t1
t2")})]
       (is (= "

t1
t2
"
              (render-dom comp))))))
+
+
+
+
+(defsnippet snip1 "wrap-test.html" [:span] [] {})
+(deftemplate tmp1 "simple-div.html" [] {})
+(defsnippet snip2 "wrap-test.html" [:span] [val]
+  {[:span] (content val)})
+(deftemplate tmp2 "simple-div.html" [val]
+  {[:div] (content val)})
+
+(deftest snippet_template_test
+  (testing "basic setup for snippet"
+    (let [comp (snippet "wrap-test.html" [:span] [] {})]
+      (is (= "testing"
+             (render-dom (comp))))))
+  (testing "basic setup for template"
+    (let [comp (template "simple-div.html" [] {})]
+      (is (= "
test
"
+             (render-dom (comp))))))
+  (testing "simple tranform for snippet"
+    (let [comp (snippet "wrap-test.html" [:span] [val]
+                        {[:span] (content val)})]
+      (is (= "test"
+             (render-dom (comp "test"))))))
+  (testing "simple transform for template"
+    (let [comp (template "simple-div.html" [val]
+                         {[:div] (content val)})]
+      (is (= "
success
"
+             (render-dom (comp "success"))))))
+  (testing "basic setup for defsnippet"
+    (is (= "testing"
+           (render-dom (snip1)))))
+  (testing "basic setup for deftemplate"
+    (is (= "
test
"
+           (render-dom (tmp1)))))
+  (testing "simple transform for defsnippet"
+    (is (= "test"
+           (render-dom (snip2 "test")))))
+  (testing "simple transform for deftemplate"
+    (is (= "
success
"
+           (render-dom (tmp2 "success"))))))


Somehow, clojure is loosing meta-data keys over time...

--- src/conexp/util/multimethods.clj
+++ src/conexp/util/multimethods.clj
@@ -217,20 +217,18 @@
     `(do
        (defonce ~name :was-undefined-yet)
        (when (= ~name :was-undefined-yet)
-         (defmulti dispatcher# (fn [ & x# ] nil))
-         (defmethod dispatcher# nil [ & x# ] :declared-but-never-inherited)
-         (defmulti ~name dispatcher#)
-         (defmethod ~name :declared-but-never-inherited [ & x# ]
-           (illegal-argument (str ~name-str
-                               " is a declared as a dispatched multimethod,"
-                               " but has never been inherited.")))
-         (defmethod ~name nil [& args#]
-           (illegal-argument (str ~name-str
-                               " called, but there is no method declared for type "
-                               (when-not (empty? args#) (type (first args#))) "!"  )))
-         (.setMeta (var ~name) (conj (meta (var ~name))
-                                 {:dispatcher dispatcher#}))
-         (ns-unmap *ns* (quote dispatcher#))))))
+         (let [dispatcher# (ref (fn [ & x# ] :declared-but-never-inherited)) ]
+           (defmulti ~name (fn [& x#] (apply (deref dispatcher#) x#)))
+           (defmethod ~name :declared-but-never-inherited [ & x# ]
+             (illegal-argument (str ~name-str
+                                 " is a declared as a dispatched multimethod,"
+                                 " but has never been inherited.")))
+           (defmethod ~name nil [& args#]
+             (illegal-argument (str ~name-str
+                                 " called, but there is no method declared for type "
+                                 (when-not (empty? args#) (type (first args#))) "!"  )))
+           (.setMeta (var ~name) (conj (meta (var ~name))
+                                   {:dispatcher dispatcher#})))))))

 (defmacro inherit-multimethod-local
   "Creates a new multimethod that dispatches by type hierarchy
@@ -243,8 +241,8 @@
             old-doc-strings# (if (nil? old-doc-strings-val#) {} old-doc-strings-val#)
             old-types# (if (nil? old-meta#) (list) (:type-list old-meta#))]
        (declare-multimethod-local ~name)
-       (def dispatcher# (:dispatcher (meta (var ~name))))
-       (let [ doc-strings# (conj old-doc-strings#
+       (let [ dispatcher# (:dispatcher (meta (var ~name)))
+              doc-strings# (conj old-doc-strings#
                              {~type-name (str ~type-name "\n=====\n" ~doc-str)})
               is-new-type# (not (some #{~type-name} old-types#))
               types#  (if is-new-type#
@@ -257,14 +255,20 @@
                            (map doc-strings# types#))) ]
          (print "Dispatched by" dispatcher#)
          (when is-new-type#
-           (defmethod dispatcher# nil [x# & args#] (test-list-types-object types# x#))
+           (dosync
+             (ref-set dispatcher# (fn [x# & args#] (test-list-types-object types# x#))))
            (defmethod ~name ~type-name [& args#]
              (illegal-argument (str ~name-str
                                  " called, but there is a method declared but"
                                  " not defined for type "
                                  (when-not (empty? args#) (type (first args#))) "!"  ))))
+         (print "\ndisp: " dispatcher#)
+         (print "\nmeta: " (meta (var ~name)))
          (.setMeta (var ~name) (merge (meta (var ~name))
                                  {:doc new-doc#
                                  :doc-strings doc-strings#
                                  :type-list types#
-                                 :dispatcher dispatcher#}))))))
+                                 :dispatcher dispatcher#}))
+         (print "\nnew-meta: " (meta (var ~name)))
+         (print "\ndisp: " dispatcher#)
+         (print "\nmeta-d:" (:dispatcher (meta (var ~name))))))))


First pass at converting club

First pass at converting club

--- raw_data/convert_players.clj
+++ raw_data/convert_players.clj
@@ -1,6 +1,10 @@
 (use '[clojure.string :only (split-lines split join capitalize)])

 ; Conversions
+(def position { "GK" "Goalkeeper", "DF" "Defender", "MF" "Midfielder", "FW" "Forward" })
+
+(def number read-string)
+
 (defn nameify [s]
   (let [words (split s #" ")
         word-names (map capitalize words)]
@@ -10,9 +14,10 @@
   (let [[day month year] (split s #"/")]
     (format "%s-%s-%s" year month day)))

-(def position { "GK" "Goalkeeper", "DF" "Defender", "MF" "Midfielder", "FW" "Forward" })
-
-(def number read-string)
+(defn club [s]
+  (let [[_ club country_code] (re-find #"(\w+) \((\w+)\)" s)
+        country country_code]
+    { :name club, :country country }))

 ; Player conversion
 (defn convert-player [country data]
@@ -24,7 +29,7 @@
       :shirt_number shirt
       :date_of_birth (iso-date (data 2))
       :position (position (data 3))
-      :club (data 4)
+      :club (club (data 4))
       :height (number (data 5))
     }))


set literals can not be duplicate, use the set

function to build out of a seq instead.

--- test/onyx/peer/flow_exception_retry_test.clj
+++ test/onyx/peer/flow_exception_retry_test.clj
@@ -29,7 +29,7 @@
 (defn check-within-one [results]
   (let [upper (apply max (vals results))
         lower (apply min (vals results))]
-    (every? #{upper lower} (vals results))))
+    (every? (set [upper lower]) (vals results))))

 (t/deftest exception-retry
   (let [id (java.util.UUID/randomUUID)


Use get-context instead of get-default-context for foldl and foldr.

This avoids the execution of useless code.

--- src/cats/core.cljc
+++ src/cats/core.cljc
@@ -510,11 +510,11 @@
 (defn foldr
   "Perform a right-associative fold on the data structure."
   [f z xs]
-  (let [ctx (get-current-context xs)]
-    (p/foldr ctx f z xs)))
+  (-> (p/get-context xs)
+      (p/foldr f z xs)))

 (defn foldl
   "Perform a right-associative fold on the data structure."
   [f z xs]
-  (let [ctx (get-current-context xs)]
-    (p/foldl ctx f z xs)))
+  (-> (p/get-context xs)
+      (p/foldl f z xs)))


Renamed w-actx to world.

Renamed w-actx to world.

--- src/cbfg/core.cljs
+++ src/cbfg/core.cljs
@@ -287,20 +287,20 @@
         (set-el-innerHTML "vis-svg"
                           (apply str (flatten (vis-svg-actxs @vis @vis-positions nil))))
         (recur (inc num-events))))
-    (ago w-actx w
-         (reset! root-actx w-actx)
-         (let [in (achan-buf w-actx 100)
-               out (achan-buf w-actx 0)]
-           (ago-loop main-in w-actx [num-ins 0]
+    (ago world w
+         (reset! root-actx world)
+         (let [in (achan-buf world 100)
+               out (achan-buf world 0)]
+           (ago-loop main-in world [num-ins 0]
                      (let [cmd (<! cmds)
                            cmd-handler ((get cmd-handlers (:op cmd)) cmd)]
                        (aput main-in in cmd-handler)
                        (recur (inc num-ins))))
-           (ago-loop main-out w-actx [num-outs 0]
+           (ago-loop main-out world [num-outs 0]
                      (let [result (atake main-out out)]
                        (set-el-innerHTML "output" result)
                        (recur (inc num-outs))))
-           (make-fenced-pump w-actx in out @max-inflight)))))
+           (make-fenced-pump world in out @max-inflight)))))

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


added test for disconnect without being signed in

--- test/server/rooms-test.cljs
+++ test/server/rooms-test.cljs
@@ -75,3 +75,7 @@
                   (fn [reply]
                     (is (= nil reply))
                     (done)))))))))))
+
+; just tests to make sure it doesn't crash/error
+(deftest disconnect-with-not-signed-in-user
+  (rooms/disconnect "foo" nil))


Fixing the collection temporal test.

Fixing the collection temporal test.

--- test/cmr/system_int_test/search/collection_temporal_search_test.clj
+++ test/cmr/system_int_test/search/collection_temporal_search_test.clj
@@ -58,9 +58,9 @@
   (testing "search by temporal_start."
     (let [references (search/find-collection-refs
                        {"temporal[]" "2010-12-12T12:00:00Z,"})]
-      (is (= 8 (count references)))
+      (is (= 7 (count references)))
       (some #{"Dataset2" "Dataset3" "Dataset4" "Dataset5"
-              "Dataset6" "Dataset7" "Dataset8" "Dataset10"}
+              "Dataset6" "Dataset7" "Dataset8"}
             (map #(:dataset-id %) references))))
   (testing "search by temporal_end."
     (let [references (search/find-collection-refs


Remove merge stuff

Remove merge stuff

--- src/discuss/components/clipboard.cljs
+++ src/discuss/components/clipboard.cljs
@@ -18,20 +18,12 @@

 (defn add-item!
   "Store current selection in clipboard."
-<<<<<<< Updated upstream:src/discuss/clipboard.cljs
-  []
-  (let [selections (get-stored-selections)
-        current (lib/get-selection)
-        with-current (distinct (merge selections {:title current}))]
-    (lib/update-state-item! :clipboard :selections (fn [_] with-current))))
-=======
   ([current]
    (let [selections (get-stored-selections)
          current current
          with-current (distinct (merge selections {:title current}))]
      (lib/update-state-item! :clipboard :selections (fn [_] with-current))))
   ([] (add-item! (lib/get-selection))))
->>>>>>> Stashed changes:src/discuss/components/clipboard.cljs

 ;;;; Drag n Drop stuff


Tiny simplification / efficiency improvement

--- src/io/aviso/rook/dispatcher.clj
+++ src/io/aviso/rook/dispatcher.clj
@@ -68,8 +68,9 @@
   handler)

 (defn- make-header-arg-resolver [sym]
-  (fn [request]
-    (-> request :headers (get (name sym)))))
+  (let [header-name (name sym)]
+    (fn [request]
+      (-> request :headers (get header-name)))))

 (defn- make-param-arg-resolver [sym]
   (let [kw (keyword sym)]


use into instead of reduce conj

use into instead of reduce conj

--- src/kixi/hecuba/api/profiles.clj
+++ src/kixi/hecuba/api/profiles.clj
@@ -711,7 +711,7 @@
     (case request-method
       :post (let [decoded-body  (decode-body request)
                   body     (if (= "text/csv" (:content-type request))
-                             (let [body-map (reduce conj {} decoded-body)]
+                             (let [body-map (into {} decoded-body)]
                                (parse-by-schema body-map profile-schema))
                              decoded-body)]
               ;; We need to assert a few things


[#2861] Use java.time.Instant instad of long

--- backend/src/akvo/lumen/lib/transformation/engine.clj
+++ backend/src/akvo/lumen/lib/transformation/engine.clj
@@ -6,7 +6,8 @@
             [clojure.set :as set]
             [clojure.string :as str]
             [clojure.tools.logging :as log]
-            [clojure.walk :as w]))
+            [clojure.walk :as w])
+  (:import [java.time Instant]))

 (defmulti columns-used
   (fn [applied-transformation columns]
@@ -162,7 +163,7 @@
                                     :transformations (w/keywordize-keys
                                                       (conj (vec (:transformations dataset-version))
                                                             (assoc transformation
-                                                                   "created" (System/currentTimeMillis)
+                                                                   "created" (Instant/ofEpochMilli (System/currentTimeMillis))
                                                                    "changedColumns" (diff-columns previous-columns
                                                                                columns))))
                                     :columns (w/keywordize-keys columns)}]


Prettify output for single and multiple alternatives

--- src/fp_contest_solution_tree/core.clj
+++ src/fp_contest_solution_tree/core.clj
@@ -6,9 +6,9 @@

 (def undefined "—")

-(def beetles-names ["Ауата сетуньская" "Десятилиньята лепая" "Семипунктата Коха" "Популий грыжомельский" "Гортикола филопетьевая"])
+(def subject-names ["Ауата сетуньская" "Десятилиньята лепая" "Семипунктата Коха" "Популий грыжомельский" "Гортикола филопетьевая"])

-(def beetles-matrix  [["Наличие бомбурий",         ["Да",      "Да",        "Нет",       "Да",    "Нет"]],
+(def subject-matrix  [["Наличие бомбурий",         ["Да",      "Да",        "Нет",       "Да",    "Нет"]],
                       ["Количество клептиконов",   ["1",       "1",         "0",         "3",     "5"]],
                       ["Цвет велория",             ["Красный", "Оранжевый", "Оранжевый", "—",     "Синий"]],
                       ["Наличие пумпеля",          ["Нет",     "Да",        "Да",        "—",     "—"]],
@@ -58,6 +58,12 @@
         (recur (next current-answers) (inc index) (assoc indexed-answers index ans))))
     ))

+(declare ask-question)
+
+(defn repeat-question [answers]
+  (println "Please, choose right option from answers. Try one more time")
+  (ask-question answers))
+
 (defn ask-question [answers]
   (let [feature (first (first answers))]
     (println "What is the value of feature: " feature "?")
@@ -71,10 +77,9 @@
           (let [answer-number (Integer/parseInt user-choise)]
             (if-let [answer (indexed-answers answer-number)]
               answer
-              (throw (IllegalStateException. (str "Subject don't corresponds any of options for feature: " feature)))))
-          (catch NumberFormatException e
-            (do (println "Please, choose right option from answers. Try one more time")
-                (ask-question answers))))
+              (repeat-question answers)
+              #_(throw (IllegalStateException. (str "Subject don't corresponds any of options for feature: " feature)))))
+          (catch NumberFormatException e (repeat-question answers)))
         ))))

 (defn answers [tree]
@@ -85,32 +90,34 @@
 (defn get-subtree [tree option]
   (first (filter #(= (:answer %) option) tree)))

-;; (get-subtree (solve-tree beetles-matrix) "Да")
+;; (get-subtree (solve-tree subject-matrix) "Да")

 (defn find-out [tree]
   (let [chosen-option (ask-question (answers tree))
         chosen-subtree (get-subtree tree chosen-option)]
     (if-let [children (:children chosen-subtree)]
       (find-out children)
-      (map #(get beetles-names %) (:alternatives chosen-subtree)))))
+      (map #(get subject-names %) (:alternatives chosen-subtree)))))

-;; (find-out (solve-tree beetles-matrix))
+;; (find-out (solve-tree subject-matrix))

 (defn -main
   [& args]
-  (println "Here is a solve tree for beetles matrix:")
-  (let [tree (solve-tree beetles-matrix)]
+  (println "Here is a solve tree for subject matrix:")
+  (let [tree (solve-tree subject-matrix)]
     (time (pprint tree))
-    (pprint beetles-matrix)
-    (println "Now let's define what is the beetle in front of you by answering questions")
+    (pprint subject-matrix)
+    (println "Now let's define what is the subject in front of you by answering questions")
     (let [alternatives (find-out tree)]
-      (println "You got following alternatives" alternatives))))
+      (if (= (count alternatives) 1)
+        (println "Your subject is: " (first alternatives))
+        (println "Feature matrix is not unique, so got following alternatives: " alternatives)))))

 (comment
   (-main)
   (print-table [:value1 :value2] [{:value1 1 :value2 2}{:value1 3 :value2 4}])
-  (time (pprint (solve-tree beetles-matrix)))
+  (time (pprint (solve-tree subject-matrix)))
   (solve-tree [["f1" ["yes" "yes" "no" "no"]] ["f2" ["1" "2" "2" "—"]]] nil)

   (def f1 ["f1" ["1" "1" "2"]])


Use double* to generate longitude and latitude

--- src/rp/util/string_spec.clj
+++ src/rp/util/string_spec.clj
@@ -33,8 +33,8 @@
 (s/def ::bounding-box (s/spec (s/conformer (truthy->conform-pred util-string/parse-bounding-box)
                                            str)
                               :gen (fn []
-                                     (g/bind (s/gen (s/tuple (s/and double? util-number/longitude?)
-                                                             (s/and double? util-number/latitude?)
-                                                             (s/and double? util-number/longitude?)
-                                                             (s/and double? util-number/latitude?)))
+                                     (g/bind (g/tuple (g/double* {:min -180 :max 180})
+                                                      (g/double* {:min -90 :max 90})
+                                                      (g/double* {:min -180 :max 180})
+                                                      (g/double* {:min -90 :max 90}))
                                              #(g/return (apply str (interpose "," %)))))))


Update to ClojureScript 0.0-2665. Also update simple-brepl and Weasel to compatible versions.

--- ClojureScript/project.clj
+++ ClojureScript/project.clj
@@ -1,12 +1,12 @@
 (defproject shrimp "0.1.0-SNAPSHOT"
             :description "Demo project for Goby."
             :dependencies [[org.clojure/clojure "1.6.0"]
-                           [org.clojure/clojurescript "0.0-2511"]
+                           [org.clojure/clojurescript "0.0-2665"]
                            [org.clojure/core.async "0.1.346.0-17112a-alpha"]
                            [goby "0.1.0"]
-                           [weasel "0.4.2"]]
+                           [weasel "0.5.0"]]
             :plugins [[lein-cljsbuild "1.0.3"]
-                      [jarohen/simple-brepl "0.1.2"]]
+                      [jarohen/simple-brepl "0.2.1"]]
             :source-paths ["src"]
             :brepl {:ip "127.0.0.1"}
             :cljsbuild {:builds {:dev


Better report MIDI connection errors.

Better report MIDI connection errors.

--- src/afterglow/midi.clj
+++ src/afterglow/midi.clj
@@ -379,9 +379,12 @@
   (when (or (empty? @midi-inputs) (not mac?) (not (mmj-installed?)))
     (doseq [input (filter @midi-port-filter (midi/midi-sources))]
       (when-not (get @midi-inputs (@midi-device-key input))
-        (let [connected (connect-midi-in input)]
-          (doseq [handler @new-device-handlers]
-            (handler connected))))))
+        (try
+          (let [connected (connect-midi-in input)]
+            (doseq [handler @new-device-handlers]
+              (handler connected)))
+          (catch Throwable t
+            (timbre/error t "Unable to connect MIDI input" input))))))
   (vals @midi-inputs))

 (defn open-outputs-if-needed!
@@ -395,9 +398,12 @@
   (when (or (empty? @midi-outputs) (not mac?) (not (mmj-installed?)))
     (doseq [output (filter @midi-port-filter (midi/midi-sinks))]
       (when-not (get @midi-outputs (@midi-device-key output))
-        (let [connected (connect-midi-out output)]
-          (doseq [handler @new-device-handlers]
-            (handler connected))))))
+        (try
+          (let [connected (connect-midi-out output)]
+               (doseq [handler @new-device-handlers]
+                 (handler connected)))
+          (catch Throwable t
+            (timbre/error t "Unable to connect MIDI output" output))))))
   (vals @midi-outputs))

 (defn- lost-midi-in


Kill function if asked to end a second time.

--- src/afterglow/show.clj
+++ src/afterglow/show.clj
@@ -130,7 +130,11 @@
     :refresh-interval refresh-interval
     :universes (set universes)
     :next-id (atom 0)
-    :active-functions (atom {})
+    :active-functions (atom {:functions []
+                             :indices {}
+                             :keys []
+                             :priorities []
+                             :ending #{}})
     :variables (atom {})
     :fixtures (atom {})
     :task (atom nil)}))
@@ -273,7 +277,8 @@
     {:functions (vec-remove (:functions fns) index)
      :indices (remove-key (:indices fns) key index)
      :keys (vec-remove (:keys fns) index)
-     :priorities (vec-remove (:priorities fns) index)}
+     :priorities (vec-remove (:priorities fns) index)
+     :ending (disj (:ending fns) key)}
     fns))

 (defn- find-insertion-index
@@ -311,7 +316,8 @@
     {:functions (vec-insert (:functions base) index f)
      :indices (insert-key (:indices base) key index)
      :keys (vec-insert (:keys base) index key)
-     :priorities (vec-insert (:priorities base) index priority)}))
+     :priorities (vec-insert (:priorities base) index priority)
+     :ending (:ending base)}))

 (defn add-function!
   "Add an effect function or cue to the active set which are affecting
@@ -346,10 +352,13 @@
   ([show key]
    (end-function! show key false))
   ([show key force]
-   (let [effect (find-function show key)]
-     (when (and effect
-                (or force (fx-util/end effect show (metro-snapshot (:metronome show)))))
-       (swap! (:active-functions show) #(remove-function-internal % (keyword key)))))))
+   (let [effect (find-function show key)
+         key (keyword key)]
+     (if (and effect
+              (or force ((:ending @(:active-functions show)) key)
+                  (fx-util/end effect show (metro-snapshot (:metronome show)))))
+       (swap! (:active-functions show) #(remove-function-internal % key))
+       (swap! (:active-functions show) #(update-in % [:ending] conj key))))))

 (defn clear-functions!
   "Remove all effect functions from the active set, leading to a blackout state in all controlled
@@ -358,7 +367,8 @@
   (reset! (:active-functions show) {:functions [],
                                     :indices {},
                                     :keys [],
-                                    :priorities []}))
+                                    :priorities []
+                                    :ending #{}}))

 (defn- address-map-internal
   "Helper function which returns a map whose keys are all addresses in use in a given universe


Adding allInterfaces, renaming getEnums -> allEnums

--- src/app/javaparser.clj
+++ src/app/javaparser.clj
@@ -214,7 +214,10 @@
 (defn allClasses [cu]
   (filter isClass? (allTypes cu)))

-(defn getEnums [cu]
+(defn allInterfaces [cu]
+  (filter isInterface? (.getTypes cu)))
+
+(defn allEnums [cu]
   (filter isEnum? (.getTypes cu)))

 (defn allClassesForCus [cus]


Explosions

Explosions


Less namespace pollution.

Less namespace pollution.

--- src/cbfg/world/t2.cljs
+++ src/cbfg/world/t2.cljs
@@ -12,15 +12,12 @@
    "count" cbfg.world.base/example-count
    "close-lane" cbfg.world.base/close-lane})

-(defn cmd-handler [c] (assoc c :rq #((get req-handlers (:op c)) % c)))
-
-(defn make-t2-cmd-handlers []
-  (into {} (map (fn [k] [k cmd-handler]) (keys req-handlers))))
-
 (defn world-vis-init [el-prefix init-event-delay]
-  (cbfg.world.t1/world-vis-init-t "cbfg.world.t2"
-                                  (make-t2-cmd-handlers) el-prefix
-                                  cbfg.world.t1/ev-msg init-event-delay))
+  (let [cmd-handler (fn [c] (assoc c :rq #((get req-handlers (:op c)) % c)))
+        cmd-handlers (into {} (map (fn [k] [k cmd-handler]) (keys req-handlers)))]
+    (cbfg.world.t1/world-vis-init-t "cbfg.world.t2"
+                                    cmd-handlers el-prefix
+                                    cbfg.world.t1/ev-msg init-event-delay)))

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


multiplying

multiplying

--- src/celestial/jobs.clj
+++ src/celestial/jobs.clj
@@ -39,7 +39,7 @@
 (defn save-status
    "marks jobs as succesful"
    [spec status]
-  (let [status-exp (* 1000 60 (or (get* :celestial :job :status-expiry) (24 60)))]
+  (let [status-exp (* 1000 60 (or (get* :celestial :job :status-expiry) (* 24 60)))]
     (es/put (merge spec {:status status :end (System/currentTimeMillis)}) status-exp)
     {:status status}))


Raise the log level to info

Raise the log level to info

--- src/circle/logging.clj
+++ src/circle/logging.clj
@@ -27,7 +27,7 @@
       (.removeAllAppenders)
       (.addAppender rolling-log-appender)
       (.addAppender (ConsoleAppender. layout))))
-  (. (Logger/getRootLogger) (setLevel Level/DEBUG))
+  (. (Logger/getRootLogger) (setLevel Level/INFO))
   (set-level "jclouds.wire" Level/OFF)
   (set-level "jclouds.headers" Level/OFF)
   (set-level "jclouds.signature" Level/OFF))


exclude filter

exclude filter

--- src/clj/flambo/api.clj
+++ src/clj/flambo/api.clj
@@ -1,5 +1,5 @@
 (ns flambo.api
-  (:refer-clojure :exclude [map reduce first count take distinct])
+  (:refer-clojure :exclude [map reduce first count take distinct filter])
   (:require [serializable.fn :as sfn]
             [clojure.tools.logging :as log]
             [flambo.function :refer [flat-map-function


Increase ch size.

Increase ch size.

--- test/onyx/peer/kw_grouping_test.clj
+++ test/onyx/peer/kw_grouping_test.clj
@@ -20,9 +20,9 @@

 (def output (atom []))

-(def in-chan (chan 1000))
+(def in-chan (chan 1000000))

-(def out-chan (chan (sliding-buffer 1000)))
+(def out-chan (chan (sliding-buffer 1000000)))

 (defmethod l-ext/inject-lifecycle-resources :in
   [_ _] {:core.async/chan in-chan})


cluster using maximum cpus

cluster using maximum cpus


new syntax b/c i love the warnings so much


kern grammar completed

kern grammar completed

--- src/logic/kern.clj
+++ src/logic/kern.clj
@@ -1,57 +1,132 @@
 (ns logic.kern
-  (:use [blancas.kern core expr]
-        [blancas.kern.lexer java-style]))
+  (:require
+    [clojure.repl :refer :all]
+    [blancas.kern [core :refer :all] [expr :refer :all]]
+    [blancas.kern.lexer :as lex]))

-#_(
-  minimal sudoku pseudocode grammar
-
-  or     := and "|" and
-  and    := unexp "&" unexp
-  unexp  := "!"? exp
-
-  exp    := atom | "(" or ")"
-
-  atom   := "c" digit*
-)
+; custom lexer
+(def special-chars (one-of* "_{}\\."))

-(declare or-parser)
+(def mpa-style
+  (assoc lex/java-style
+    :identifier-start (<|> letter special-chars)
+    :identifier-letter (<|> letter special-chars digit)
+    :reserved-names ["and" "nand" "or" "nor" "impl" "nimpl" "if" "nif" "iff" "xor"
+                     "false" "False" "0" "true" "True" "1"]))

-(def special-chars (one-of* "_{}\\."))
-(def ident-parser (<+>
-                    (<|>
-                      letter
-                      special-chars)
-                    (many (<|>
-                            letter
-                            special-chars
-                            digit))))
+(def- rec (lex/make-parsers mpa-style))

-(def ident (<$> symbol ident-parser))
+(def trim (:trim rec))
+(def lexeme (:lexeme rec))
+(def sym (:sym rec))
+(def new-line (:new-line rec))
+(def one-of (:one-of rec))
+(def none-of (:none-of rec))
+(def token (:token rec))
+(def word (:word rec))
+(def identifier (:identifier rec))
+(def field (:field rec))
+(def char-lit (:char-lit rec))
+(def string-lit (:string-lit rec))
+(def dec-lit (:dec-lit rec))
+(def oct-lit (:oct-lit rec))
+(def hex-lit (:hex-lit rec))
+(def float-lit (:float-lit rec))
+(def bool-lit (:bool-lit rec))
+(def nil-lit (:nil-lit rec))
+(def parens (:parens rec))
+(def braces (:braces rec))
+(def angles (:angles rec))
+(def brackets (:brackets rec))
+(def semi (:semi rec))
+(def comma (:comma rec))
+(def colon (:colon rec))
+(def dot (:dot rec))
+(def semi-sep (:semi-sep rec))
+(def semi-sep1 (:semi-sep1 rec))
+(def comma-sep (:comma-sep rec))
+(def comma-sep1 (:comma-sep1 rec))
+
+; the actual parser
+(def ident
+  (bind [id identifier]
+    (return (symbol id))))
+
+(def true-parser
+  (>>
+    (token "true" "True" "1")
+    (return true)))
+
+(def false-parser
+  (>>
+    (token "false" "False" "0")
+    (return false)))
+
+(declare start-parser)

 (def exp (<|>
-           ident
-           (<< (>> (one-of* "(") or-parser) (one-of* ")"))
-           (<< (>> (one-of* "[") or-parser) (one-of* "]"))))
+           (parens (fwd start-parser))
+           (brackets (fwd start-parser))
+           true-parser
+           false-parser
+           ident))

 (def not-sym (>>
                (token "!" "not")
                (return #(list 'not %))))
+(def unexp (prefix1 exp not-sym))

-(def unexp (prefix1 exp not-sym))
+(def nand-sym (>>
+                (token "!&" "nand")
+                (return #(list 'nand %1 %2))))
+(def nand-parser (chainl1 unexp nand-sym))

 (def and-sym (>>
                (token "&" "and")
                (return #(list 'and %1 %2))))
-(def and-parser (chainl1 unexp and-sym))
+(def and-parser (chainl1 nand-parser and-sym))
+
+(def nor-sym (>>
+               (token "!|" "nor")
+               (return #(list 'nor %1 %2))))
+(def nor-parser (chainl1 and-parser nor-sym))

 (def or-sym (>>
               (token "|" "or")
               (return #(list 'or %1 %2))))
-(def or-parser (chainl1 and-parser or-sym))
+(def or-parser (chainl1 nor-parser or-sym))

+(def if-sym (>>
+              (token "<-" "if")
+              (return #(list 'cimpl %1 %2))))
+(def if-parser (chainr1 or-parser if-sym))
+
+(def nif-sym (>>
+               (token "!<-" "nif")
+               (return #(list 'ncimpl %1 %2))))
+(def nif-parser (chainr1 if-parser nif-sym))
+
+(def impl-sym (>>
+                (token "->" "impl")
+                (return #(list 'impl %1 %2))))
+(def impl-parser (chainr1 nif-parser impl-sym))
+
+(def nimpl-sym (>>
+                 (token "!->" "nimpl")
+                 (return #(list 'nimpl %1 %2))))
+(def nimpl-parser (chainr1 impl-parser nimpl-sym))
+
+(def equiv-sym (>>
+                 (token "<->" "iff")
+                 (return #(list 'equiv %1 %2))))
+(def equiv-parser (chainl1 nimpl-parser equiv-sym))
+
+(def xor-sym (>>
+               (token "^" "xor")
+               (return #(list 'xor %1 %2))))
+(def xor-parser (chainl1 equiv-parser xor-sym))
+
+(def start-parser xor-parser)

 ; examples
-(run or-parser "a & b | c")
-;(run or-parser "(((((c1)))))")
-
-;(time (parse-data or-parser rules))
+(parse-data start-parser "a xor !(c !<- (false !-> b))")


adding suspend/resume for #5

adding suspend/resume for #5

docs and tests will follow

--- src/mount/core.clj
+++ src/mount/core.clj
@@ -22,42 +22,70 @@
   (toString [this]
     (str "'" state "' is not started (to start all the states call mount/start)")))

-;;TODO validate stop and the fact that start and stop are fns
-(defn- validate [{:keys [start stop]}]
+;;TODO validate the whole lifecycle
+(defn- validate [{:keys [start stop suspend resume] :as lifecycle}]
   (when-not start
     (throw (IllegalArgumentException. "can't start a stateful thing without a start function. (i.e. missing :start fn)")))
-  {:start start :stop stop})
+  (when (and suspend (not resume))
+    (throw (IllegalArgumentException. "suspendable state should have a resume function (i.e. missing :resume fn)"))))

 (defmacro defstate [state & body]
-  (let [[state [c cf d df]] (macro/name-with-attributes state body)
-        {:keys [start stop]} (validate {c cf d df})]
+  (let [[state params] (macro/name-with-attributes state body)
+        {:keys [start stop suspend resume] :as lifecycle} (apply hash-map params)]
+    (validate lifecycle)
     (let [s-meta (-> {:mount-state mount-state
                       :order (make-state-seq state)
                       :start `(fn [] (~@start))
                       :started? false}
-                     (cond-> df (assoc :stop `(fn [] (~@stop)))))]
+                     (cond-> stop (assoc :stop `(fn [] (~@stop))))
+                     (cond-> suspend (assoc :suspend `(fn [] (~@suspend))))
+                     (cond-> resume (assoc :resume `(fn [] (~@resume)))))]
       `(defonce ~(with-meta state (merge (meta state) s-meta))
          (NotStartedState. ~(str state))))))

-(defn- up [var {:keys [ns name start started?]}]
+(defn- up [var {:keys [ns name start started? resume suspended?]}]
   (when-not started?
-    (info ">> starting.. " name)
-    (let [s (try (start)
-                 (catch Throwable t
+    (let [s (try (if suspended?
+                   (do (info ">> resuming.. " name)
+                       (resume))
+                   (do (info ">> starting.. " name)
+                       (start)))
+                 (catch Throwable t
                    (throw (RuntimeException. (str "could not start [" name "] due to") t))))]
       (intern ns (symbol name) s)
-      (alter-meta! var assoc :started? true))))
+      (alter-meta! var assoc :started? true :suspended? false))))

-(defn- down [var {:keys [ns name stop started?]}]
-  (when started?
+(defn- down [var {:keys [ns name stop started? suspended?]}]
+  (when (or started? suspended?)
     (info "<< stopping.. " name)
     (when stop
       (try
         (stop)
-        (catch Throwable t
+        (catch Throwable t
           (throw (RuntimeException. (str "could not stop [" name "] due to") t)))))
     (intern ns (symbol name) (NotStartedState. name)) ;; (!) if a state does not have :stop when _should_ this might leak
-    (alter-meta! var assoc :started? false)))
+    (alter-meta! var assoc :started? false :suspended? false)))
+
+(defn- sigstop [var {:keys [ns name started? suspend resume]}]
+  (when (and started? resume)        ;; can't have suspend without resume, but the reverse is possible
+    (info ">> suspending.. " name)
+    (when suspend                    ;; don't suspend if there is only resume function (just mark it :suspended?)
+      (let [s (try (suspend)
+                   (catch Throwable t
+                     (throw (RuntimeException. (str "could not suspend [" name "] due to") t))))]
+        (intern ns (symbol name) s)))
+    (alter-meta! var assoc :started? false :suspended? true)))
+
+(defn- sigcont [var {:keys [ns name start started? resume suspended?]}]
+  (when (instance? NotStartedState var)
+    (throw (RuntimeException. (str "could not resume [" name "] since it is stoppped (i.e. not suspended)"))))
+  (when suspended?
+    (info ">> resuming.. " name)
+    (let [s (try (resume)
+                 (catch Throwable t
+                   (throw (RuntimeException. (str "could not resume [" name "] due to") t))))]
+      (intern ns (symbol name) s)
+      (alter-meta! var assoc :started? true :suspended? false))))

 ;;TODO args might need more thinking
 (defn args [] @-args)
@@ -72,7 +100,6 @@
        (map second)
        (filter mount-state?)))

-
 ;;TODO ns based for now. need to be _state_ based
 (defn- add-deps [{:keys [ns] :as state} all]
   (let [refers (ns-refers ns)
@@ -83,7 +110,7 @@
 (defn states-with-deps []
   (let [all (find-all-states)]
     (->> (map (comp #(add-deps % all)
-                    #(select-keys % [:name :order :ns])
+                    #(select-keys % [:name :order :ns :started? :suspended?])
                     meta)
               all)
          (sort-by :order))))
@@ -127,6 +154,14 @@
     (doall (map rollback! states)) ;; restore to origin from "start-with"
     :stopped))

+(defn stop-except [& states]
+  (let [all (set (find-all-states))
+        states (remove (set states) all)]
+    (doall (map unsub states))     ;; unmark substitutions marked by "start-with"
+    (bring states down >)
+    (doall (map rollback! states)) ;; restore to origin from "start-with"
+    :stopped))
+
 (defn start-with-args [xs & states]
   (reset! -args xs)
   (if (first states)
@@ -146,3 +181,13 @@
           without (remove (set states) app)]
       (apply start without))
     (start)))
+
+(defn suspend [& states]
+  (let [states (or (seq states) (find-all-states))]
+    (bring states sigstop <)
+    :suspended))
+
+(defn resume [& states]
+  (let [states (or (seq states) (find-all-states))]
+    (bring states sigcont <)
+    :resumed))


Comments.

Comments.

--- src/ombs/dbold.clj
+++ src/ombs/dbold.clj
@@ -93,13 +93,15 @@
 (declare subtract-feesed-parts)
 (defn get-events []
   "Return list of events, and it actual count of event"
-  ;First of all, we select events from it table and join for each rest(actual)
-  ;parts Then we update each event elent: substract from each count of parts,
-  ;that hang in fees some events haven't parts, and after join it's have nil
-  ;parts. So we need fix before substract
+  ; Then we update each event elent: substract from each event count of parts,
+  ; that hang in fees.
+  ; Some events haven't parts, and after join it's have nil parts. So we need
+  ; fix before substract.
   (map
     #(update % :parts
              (comp (partial subtract-feesed-parts (:id %)) f/nil-fix))
+    ; First of all, we select events from it table and join for each
+    ; rest(actual) parts.
     (sql/select events
                 (sql/fields :id :name :date :price :author :status)
                 (sql/with goods (sql/fields [:rest :parts])))))


Fix empty index page. Resources should be below all routes. Except not-found, ofcourse.

--- src/ombs/route.clj
+++ src/ombs/route.clj
@@ -18,15 +18,13 @@
     [noir.response :refer [redirect]]

     ; request handlers. Prepare data, and call views.
-    [ombs.handler.handle :refer [index user]]
+    [ombs.handler.handle :refer [index user pay]]
     [ombs.handler.addevent :refer [addevent-page addevent]]
     [ombs.handler.auth :refer [login logout register reg-page]]
     ))

 (defroutes main-routes
-  (resources "/") ; search all resources in dir 'resources' in root of project
   (GET  "/" [params] index)
-

   (POST "/login" request login)
   (POST "/logout" request logout)
@@ -46,6 +44,8 @@

   ;(POST "/participate" [_] user) ;request common/participate) ; TODO: not fixed, after realize participation on addition

+  (resources "/") ;Should be after pages. Search all css, js, etc. in dir 'resources' in root of project
+
   (not-found "Page not found") ) ; should be last, it overlap all below routes.

 (def engine


Add assoc-levels

Add assoc-levels

--- src/useful/map.clj
+++ src/useful/map.clj
@@ -118,6 +118,13 @@
   [m ks v]
   (update-in! m ks (constantly v)))

+(defn assoc-levels
+  "Like assoc-in, but an empty keyseq replaces whole map."
+  [m ks v]
+  (if-let [[k & ks] (seq ks)]
+    (assoc m k (assoc-levels (get m k) ks v))
+    v))
+
 (defn map-to
   "Returns a map from each item in coll to f applied to that item."
   [f coll]


more assertions

more assertions

--- test/latte/core_test.clj
+++ test/latte/core_test.clj
@@ -17,7 +17,19 @@

 (deftest simple-definition
   (testing "disjunction"
-    (is (defenv/definition? disjunction))))
+    (is (defenv/definition? disjunction))
+    (is (= (:name disjunction) 'disjunction))
+    (is (= (:params disjunction) '[[A ✳] [B ✳]]))
+    (is (= (:arity disjunction) 2))
+    (is (= (:parsed-term disjunction) '(Π [C ✳] (Π [⇧ (Π [⇧ A] C)] (Π [⇧ (Π [⇧ B] C)] C)))))
+    (is (= (:type disjunction) '✳))
+    (is (= (:opts disjunction ){}))
+    ;; metadata
+    (is (= (:name (meta #'disjunction)) 'disjunction))
+    (is (string? (:doc (meta #'disjunction))))
+    (is (= (:arglists (meta #'disjunction)) '([[A :type] [B :type]])))
+    ))
+

 ;;{
 ;; Testing theorems
@@ -38,6 +50,7 @@
       (is (= (:type impl-refl) '(Π [⇧ A] A)))
       (is (nil? (:proof impl-refl)))
       ;; metadata
+      (is (= (:name (meta #'impl-refl)) 'impl-refl))
       (is (string? (:doc (meta #'impl-refl))))
       (is (= (:arglists (meta #'impl-refl)) '[[[A :type]]]))
       (is (not (:private (meta #'impl-refl))))))
@@ -75,9 +88,17 @@

 (deftest simple-axiom
   (testing "a dummy axiom"
-    (is (defenv/axiom? dummy-ax))))
+    (is (defenv/axiom? dummy-ax))
+    (is (= (:name dummy-ax) 'dummy-ax))
+    (is (= (:params dummy-ax) '[[A ✳]]))
+    (is (= (:arity dummy-ax) 1))
+    (is (= (:type dummy-ax) (list #'latte.core-test/disjunction 'A 'A)))
+    ;; metadata
+    (is (= (:name (meta #'dummy-ax)) 'dummy-ax))
+    (is (string? (:doc (meta #'dummy-ax))))
+    (is (= (:arglists (meta #'dummy-ax)) '[[[A :type]]]))
+    (is (not (:private (meta #'dummy-ax))))))

-


Input retries should be logged in trace.

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -310,7 +310,7 @@
            (let [tail (last (get-in @(:onyx.core/state event) [:timeout-pool]))]
              (doseq [m tail]
                (when (p-ext/pending? event m)
-                 (taoensso.timbre/info (format "Input retry message %s" m))
+                 (taoensso.timbre/trace (format "Input retry message %s" m))
                  (p-ext/retry-message event m)))
              (swap! (:onyx.core/state event) update-in [:timeout-pool] rsc/expire-bucket)
              (recur))))))))


Use arg-or-default.

Use arg-or-default.

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -608,7 +608,7 @@
                            :onyx.core/task-map task-map
                            :onyx.core/serialized-task task
                            :onyx.core/params (resolve-calling-params task-map opts)
-                           :onyx.core/drained-back-off (or (:onyx.peer/drained-back-off opts) 400)
+                           :onyx.core/drained-back-off (arg-or-default :onyx.peer/drained-back-off opts)
                            :onyx.core/log log
                            :onyx.core/messenger-buffer messenger-buffer
                            :onyx.core/messenger messenger


we only have to check the previous cursor line, not everything in between

--- src/parinfer/editor_support.cljs
+++ src/parinfer/editor_support.cljs
@@ -79,9 +79,8 @@
            :end-line (inc (.. change -to -line))
            :num-new-lines (alength (.-text change))}

-          (let [[start end] (sort [(:cursor-line prev-state)
-                                   (:cursor-line overrides)])
-                end (inc end)]
+          (let [start (:cursor-line prev-state)
+                end (inc start)]
             {:start-line start
              :end-line end
              :num-new-lines (- end start)}))


Add local users map as a db

Add local users map as a db

--- src/todo_repl_webapp/handler.clj
+++ src/todo_repl_webapp/handler.clj
@@ -9,6 +9,13 @@
                              [credentials :as credentials])
             [todo-repl.core :as todo]
             [todo-repl-webapp.views :as views]))
+
+(def users {"root" {:username "root"
+                   :password (credentials/hash-bcrypt "admin-pass")
+                   :roles #{::admin}}
+            "foo" {:username "foo"
+                    :password (credentials/hash-bcrypt "foo-pass")
+                    :roles #{::user}}})

 (def ^:dynamic *tasks-ref* (ref []))
 (defn tasks [] (deref *tasks-ref*))


get-wishlist-with-wishes

get-wishlist-with-wishes

--- src/wishlistd/models/queries.clj
+++ src/wishlistd/models/queries.clj
@@ -59,6 +59,12 @@
       ["select * from wish where wishlist=?" id]
       (into [] results))))

+(defn get-wishes-for-wishlist-no-date [{:keys [id]}]
+  (sql/with-connection db
+    (sql/with-query-results results
+      ["select * from wish where wishlist=?" id]
+      (into [] (map #(dissoc % :created_at) results)))))
+
 (defn insert-wish [wish {:keys [id]}]
   (sql/with-connection db
     (sql/insert-records :wish (assoc wish :wishlist id))))
@@ -82,4 +88,8 @@

 (defn create-wishlist-with-wishes []
   (let [wishlist (insert-wishlist {:title "Default"})]
-    (assoc wishlist :wishes [])))+    (assoc wishlist :wishes [])))
+
+(defn get-wishlist-with-wishes [{:keys [code]}]
+  (when-let [wishlist (get-wishlist {:code code})]
+    (assoc wishlist :wishes (get-wishes-for-wishlist-no-date wishlist))))


Fix default handler for control-event to return the current state

--- src/omchaya/controllers/controls.cljs
+++ src/omchaya/controllers/controls.cljs
@@ -6,7 +6,7 @@

 (defmethod control-event :default
   [target message args state]
-  (print "No control event for" (pr-str message)))
+  state)

 (defmethod control-event :current-user-mentioned
   [target message [activity url] state]


#59 remove println

#59 remove println

--- src/org/zalando/stups/friboo/auth.clj
+++ src/org/zalando/stups/friboo/auth.clj
@@ -23,7 +23,6 @@
                          :throw-exceptions false
                          :body             {:policy  policy
                                             :payload {:team team}}})]
-    (println auth-response)
     (= 200 (:status auth-response))))

 (defn get-auth


added read-big-query-table to api

added read-big-query-table to api

--- src/datasplash/api.clj
+++ src/datasplash/api.clj
@@ -23,6 +23,7 @@
 (def read-edn-file dt/read-edn-file)
 (def write-text-file dt/write-text-file)
 (def write-edn-file dt/write-edn-file)
+(def read-big-query-table dt/read-big-query-table)
 (def cogroup dt/cogroup)
 (def cogroup-by dt/cogroup-by)
 (def join-by dt/join-by)


turn off new wallet design

turn off new wallet design

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

--- src/status_im/ui/screens/screens.cljs
+++ src/status_im/ui/screens/screens.cljs
@@ -121,8 +121,8 @@
             [status-im.ui.screens.wallet.recipient.views :as recipient]
             [status-im.ui.screens.wallet.send.views :as wallet.send]
             [quo2.screens.main :as quo2.preview]
-            [status-im.utils.config :as config]
-            [quo2.foundations.colors :as quo2.colors]))
+            [status-im.utils.config :as config]))
+            ;[quo2.foundations.colors :as quo2.colors]))

 (def components
   [{:name      :chat-toolbar
@@ -358,10 +358,11 @@
            {:name      :wallet
             :insets    {:top false}
             :on-focus  [:wallet/tab-opened]
-            :options   {:statusBar {:backgroundColor quo2.colors/neutral-5}}
-            :component wallet.accounts/accounts-overview}
+            ;;TODO wallet redesign
+            ;;:options   {:statusBar {:backgroundColor quo2.colors/neutral-5}}
+            :component wallet.accounts/accounts-overview-old}
            {:name      :wallet-account
-            ;;TODO dynamic title
+            ;;TODO dynamic titleaccounts-overview
             :options   {:topBar {:visible false}}
             :component wallet.account/account}
            {:name      :add-new-account


Setup advanced compilation on dist.

Setup advanced compilation on dist.

--- scripts/dist.clj
+++ scripts/dist.clj
@@ -14,7 +14,7 @@
     :warnings {:ns-var-clash false}
     :output-to "resources/public/js/main.js"
     :output-dir "resources/public/js"
-    :optimizations :simple
+    :optimizations :advanced
     :language-in  :ecmascript5
     :language-out :ecmascript5
     :verbose true})


Clean up.

Clean up.

--- test/lambdajam/jobs/test_1_2.clj
+++ test/lambdajam/jobs/test_1_2.clj
@@ -35,11 +35,7 @@
 ;;
 ;; `lein test lambdajam.jobs.test-1-2`

-
 (def input (mapv (fn [n] {:n n}) (range 10)))
-
-
-(mapv (fn [n] (* 5 (+ 40 (* n n n)))) (range 10))

 (def expected-output
   [{:n 50}


Added test checking assumption only one more destination in taxonomy than destinations - extra location is the notional 'World' location that is the parent of the locations in the taxonomy file

--- test/lonelyplanet/model_test.clj
+++ test/lonelyplanet/model_test.clj
@@ -45,4 +45,17 @@
                              :content
                              (map (comp #(Integer. ^String %) :atlas_id :attrs)))]
     (testing "Assumption of continually-increasing :atlas_id codes in destinations.xml"
-      (is (= (apply < destination-ids) true)))))+      (is (= (apply < destination-ids) true)))))
+
+(deftest destination-count
+  (let [taxonomy-count (-> (gen-reader "resources/test" "taxonomy.xml")
+                           gen-parser
+                           z/xml-zip
+                           leaves
+                           count)
+        destinations-count (-> (gen-reader "resources/test" "destinations.xml")
+                               gen-parser
+                               :content
+                               count)]
+    (testing "One extra destination in taxonomy vs destinations as it includes notional 'World' entry"
+      (is (= 1 (- taxonomy-count destinations-count))))))


Potoo create form

Potoo create form


check supplied key-value has same length as key


truth table is now handled as relation (except the printing)


adding non empty validation on node and removing status import from core


print an error when server gets a command it can't handle

--- src/subrosa/commands.clj
+++ src/subrosa/commands.clj
@@ -11,10 +11,12 @@
   (let [[cmd args] (seq (.split message " " 2))]
     (if (hooked? cmd)
       (run-hook cmd channel (or args ""))
-      (when (authenticated? channel)
-        (raise {:type :client-error
-                :code 421
-                :msg (format "%s :Unknown command" cmd)})))))
+      (do
+        (println "Received unhandled command:" message)
+        (when (authenticated? channel)
+          (raise {:type :client-error
+                  :code 421
+                  :msg (format "%s :Unknown command" cmd)}))))))

 (defn fix-args
   [require-auth? fn-tail]


Add more legends

Add more legends

--- src-cljs/frontend/components/account.cljs
+++ src-cljs/frontend/components/account.cljs
@@ -37,7 +37,7 @@
                                    (get-in app state/user-organizations-path))]
         (html
          [:div#settings-plans
-          [:legend "Org Settings"]
+          [:legend "Org Plan Settings"]
           [:div.plans-item
            [:h3 "Set up a plan for one of your Organizations:"]
            [:p "You can set up plans for any organization that you admin."]
@@ -74,6 +74,7 @@
             project-page? (:project-page? opts)]
         (html
          [:div#settings-heroku.settings
+          [:legend "Heroku Settings"]
           [:div.heroku-item
            [:p
             "Add your " [:a {:href "https://dashboard.heroku.com/account"} "Heroku API Key"]
@@ -242,6 +243,7 @@
     (render [_]
       (html
        [:div
+        [:legend "Beta Program"]
         (card/titled {:title "Beta Program"}
                      (html
                       [:div


CMR-6161 trying to force test fixtures to reset

--- system-int-test/test/cmr/system_int_test/search/autocomplete_collection_facet_search_test.clj
+++ system-int-test/test/cmr/system_int_test/search/autocomplete_collection_facet_search_test.clj
@@ -23,8 +23,9 @@
     (esd/delete conn "1_autocomplete" "suggestion" (:_id baz))
     (index/wait-until-indexed)))

-(use-fixtures :each (ingest/reset-fixture {"provguid1" "PROV1" "provguid2" "PROV2"}))
-(use-fixtures :each autocomplete-fixture)
+(use-fixtures :each (join-fixtures
+                     [(ingest/reset-fixture)
+                      autocomplete-fixture]))

 (deftest autocomplete-suggest-test
   (testing "returned result form test"


resume uploads

resume uploads

--- src/frontend/core.cljs
+++ src/frontend/core.cljs
@@ -193,6 +193,7 @@
                                            {client-id (merge upload-info
                                                              {:paused? false})}))))
 (defn pause-upload [client-id]
+  (println "Pausing upload" client-id)
   (let [upload-info ((:uploads @app-state) client-id)
         blob-stream (:blob-stream upload-info)
         stream      (:stream upload-info)]
@@ -423,10 +424,14 @@
     (let [old-upload-slots (:upload-slots @app-state)]
       (swap! app-state assoc :upload-slots new-upload-slots)
       (if (> new-upload-slots old-upload-slots)
-        (let [next-file (last (:upload-queue @app-state))]
-          (swap! app-state assoc :upload-queue (pop (:upload-queue @app-state)))
-          (upload-file next-file)
-        )))))
+        (let [paused-uploads (filter #(:paused? (val %)) (into [] (:uploads @app-state)))]
+          (if (empty? paused-uploads)
+            (let [next-file (last (:upload-queue @app-state))]
+              (swap! app-state assoc :upload-queue (pop (:upload-queue @app-state)))
+              (upload-file next-file))
+            (resume-upload (key (last paused-uploads)))))
+        (let [most-recent-upload-id (last (keys (:uploads @app-state)))]
+          (pause-upload most-recent-upload-id))))))

 (.onready js/soundManager
   (fn []


avoid multiple Date headers

avoid multiple Date headers

--- src/frontend/proxy.clj
+++ src/frontend/proxy.clj
@@ -37,6 +37,8 @@
                     ;; httpkit will decode the body, so hide the
                     ;; fact that the backend was gzipped.
                     (dissoc "content-encoding")
+                    ;; avoid setting two Dates!  httpkit here will insert another Date
+                    (dissoc "Date")
                     ;; The production server insists on secure cookies, but
                     ;; the development proxy does not support SSL.
                     strip-secure)]


for expression instead of map

for expression instead of map

--- test/midje/test_util.clj
+++ test/midje/test_util.clj
@@ -3,14 +3,12 @@
 (ns midje.test-util
   (:use [clojure.test])
   (:use midje.checkers)
-  (:use [clojure.set :only [subset?]])
-)
+  (:use [clojure.set :only [subset?]]))

 (defmacro testable-privates [namespace & symbols]
-  (let [make-form (fn [symbol] `(def ~symbol (intern '~namespace '~symbol)))
-        forms (map make-form symbols)]
-  `(do ~@forms))
-)
+  (let [forms (for [sym symbols]
+                `(def ~sym (intern '~namespace '~sym)))]
+  `(do ~@forms)))

 (def reported (atom []))


order queued builds in ascending order

order queued builds in ascending order

--- src-cljs/frontend/api.cljs
+++ src-cljs/frontend/api.cljs
@@ -56,7 +56,8 @@
     {:admin true
      :query-params {:status (case tab
                               :running-builds "running"
-                              :queued-builds "scheduled,queued")}}
+                              :queued-builds "scheduled,queued")
+                    :order "asc"}}
     api-ch))

 (defn get-projects-builds [build-ids api-ch]


enabling puppet integration testing

enabling puppet integration testing

--- test/celestial/integration/puppet.clj
+++ test/celestial/integration/puppet.clj
@@ -1,16 +1,21 @@
 (ns celestial.integration.puppet
   "Requires both proxmox redis and a celetial instance to reply to puppet ext queries"
+  (:require
+    [celestial.persistency :as p])
   (:use
     clojure.test
     [celestial.api :only (app)]
     [ring.adapter.jetty :only (run-jetty)]
     [celestial.tasks :only (reload puppetize)]
     [celestial.common :only (config)]
-    [celestial.fixtures :only (spec local-prox type)]
+    [celestial.fixtures :only (spec local-prox redis-type)]
     [celestial.puppet-standalone :only (copy-module)]))

-#_(deftest ^:puppet redis-provision
+(deftest ^:puppet redis-provision
   (with-redefs [config local-prox]
     (reload spec)
-    (puppetize (:provision baseline))))
+    (p/new-type "red1" redis-type)
+    (p/register-host "red1" "redis" spec)
+    (run-jetty app {:port 8080 :join? false})
+    (puppetize redis-type spec)))


added example to use for later tests

added example to use for later tests

--- test/forma/classify/logistic_test.clj
+++ test/forma/classify/logistic_test.clj
@@ -111,3 +111,13 @@
          (logistic-prob ?beta ?feat-update :> ?prob)
          (> ?prob 0.5))))

+;; Will write tests soon when I understand how to NOT set off an
+;; infinite import loop...
+
+;; forma.classify.logistic-test> (show-group-probabilities 100)
+
+;; RESULTS
+;; -----------------------
+;; eco1	0.9999999999765928
+;; eco1	0.9999999999963644
+;; -----------------------


draft cascalog implementation of classifier

--- test/forma/classify/logistic_test.clj
+++ test/forma/classify/logistic_test.clj
@@ -2,7 +2,9 @@
   (:use [forma.classify.logistic] :reload)
   (:use [midje sweet cascalog]
         [clojure-csv.core]
-        [cascalog.api])
+        [cascalog.api]
+        [clojure.test]
+        [midje.cascalog])
   (:import [org.jblas FloatMatrix])
   (:require [incanter.core :as i]
             [forma.testing :as t]))
@@ -79,24 +81,36 @@
   string, the label, and the feature vector"
   [n]
   (let [ecoid (eco-generator n)
-        obs (map conj ecoid (map vector y) (map vec X)) ]
+        obs (map conj ecoid (map vector y) (map vec X))]
     (vec (take n obs))))

-(defbufferop get-probabilities
+(defbufferop logistic-beta-wrap
+  "returns a vector of coefficients that is accepted within the
+  framework of cascalog."
   [tuples]
   (let [y (vec (flatten (map first tuples)))
         X (vec (map second tuples))]
-    (estimated-probabilities y X X)))
+    [[(vec (logistic-beta-vector y X 1e-8 1e-6 250))]]))

-(defn show-logistic-results
-  "display the probability and ecoregion for each pixel in std out,
-  based on grouping by ecoregion and `n` observations total"
+(defn show-beta-vector
+  "generate a separate coefficient vector for each ecoregion, and
+  apply the appropriate coefficient vector to each pixel.  Note that
+  `?feat-training` is the feature set over the training period,
+  whereas `?feat-update` is the feature set through the updated
+  interval.  Here, for this example, the two feature sets are
+  identical, which means that the probability output is defined as the
+  probability of deforestation *during* the training period. This
+  seems a little round-about, but this workflow will reduce redundant
+  calculation as we estimate probabilities for more than one time
+  period (or any other time period than the training period)"
   [n]
-  (let [src (create-sample-tap n)]
+  (let [src (create-sample-tap n)
+        beta-gen (<- [?eco ?beta]
+                     (src ?eco ?y ?feat-training)
+                     (logistic-beta-wrap ?y ?feat-training :> ?beta))]
     (?<- (stdout)
          [?eco ?prob]
-         (src ?eco ?y ?X)
-         (get-probabilities ?y ?X :> ?prob))))
-
-
-
+         (src ?eco ?y ?feat-update)
+         (= ?eco "eco1")
+         (beta-gen ?eco ?beta)
+         (logistic-prob ?beta ?feat-update :> ?prob))))


edited NACA Design

edited NACA Design

--- src/hydrofoil/core.clj
+++ src/hydrofoil/core.clj
@@ -9,7 +9,10 @@
   [max-camber position-camber thickness]
   (hash-map :corrected-max-camber (/ max-camber 100)
             :corrected-position-camber (/ position-camber 10)
-            :corrected-thickness (/ thickness 100)))
+            :corrected-thickness (/ thickness 100)
+            :max-camber max-camber
+            :positon-camber position-camber
+            :thickness thickness))

 (defn generate-random-design


test fixes

test fixes

--- test/metabase/api/meta/field_test.clj
+++ test/metabase/api/meta/field_test.clj
@@ -5,6 +5,7 @@
                              [field-values :refer [FieldValues]]
                              [table :refer [Table]])
             [metabase.test-data :refer :all]
+            metabase.test-setup
             [metabase.test.util :refer [match-$ expect-eval-actual-first]]))

@@ -84,13 +85,14 @@

 ;; ## GET /api/meta/field/:id/values
 ;; Should return something useful for a field that has special_type :category
-(expect (match-$ (field->field-values :venues :price)
-          {:field_id (field->id :venues :price)
-           :human_readable_values {}
-           :values [1 2 3 4]
-           :updated_at $
-           :created_at $
-           :id $})
+(expect-eval-actual-first
+    (match-$ (field->field-values :venues :price)
+      {:field_id (field->id :venues :price)
+       :human_readable_values {}
+       :values [1 2 3 4]
+       :updated_at $
+       :created_at $
+       :id $})
   (do (upd FieldValues (:id (field->field-values :venues :price)) :human_readable_values nil)       ; clear out existing human_readable_values in case they're set
       ((user->client :rasta) :get 200 (format "meta/field/%d/values" (field->id :venues :price)))))

@@ -102,20 +104,10 @@

 ;; ## POST /api/meta/field/:id/value_map_update
-(expect
-    [;; (1)
-     {:status "success"}
-     ;; (2)
-     (match-$ (sel :one FieldValues :field_id (field->id :venues :price))
-       {:field_id (field->id :venues :price)
-        :human_readable_values {}
-        :values [1 2 3 4]
-        :updated_at $
-        :created_at $
-        :id $})
-     ;; (3)
-     {:status "success"}
-     ;; (4)
+
+;; Check that we can set values
+(expect-eval-actual-first
+    [{:status "success"}
      (match-$ (sel :one FieldValues :field_id (field->id :venues :price))
        {:field_id (field->id :venues :price)
         :human_readable_values {:1 "$"
@@ -126,20 +118,34 @@
         :updated_at $
         :created_at $
         :id $})]
-  [;; (1) Check that we can unset values
-   (do (upd FieldValues (:id (field->field-values :venues :price)) :human_readable_values {:1 "$"      ; make sure they're set
+  [((user->client :rasta) :post 200 (format "meta/field/%d/value_map_update" (field->id :venues :price)) {:values_map {:1 "$"
+                                                                                :2 "$$"
+                                                                                :3 "$$$"
+                                                                                :4 "$$$$"}})
+   ((user->client :rasta) :get 200 (format "meta/field/%d/values" (field->id :venues :price)))])
+
+;; Check that we can unset values
+(expect-eval-actual-first
+    [{:status "success"}
+     (match-$ (sel :one FieldValues :field_id (field->id :venues :price))
+       {:field_id (field->id :venues :price)
+        :human_readable_values {}
+        :values [1 2 3 4]
+        :updated_at $
+        :created_at $
+        :id $})]
+  [(do (upd FieldValues (:id (field->field-values :venues :price)) :human_readable_values {:1 "$"      ; make sure they're set
                                                                                :2 "$$"
                                                                                :3 "$$$"
                                                                                :4 "$$$$"})
        ((user->client :rasta) :post 200 (format "meta/field/%d/value_map_update" (field->id :venues :price))
         {:values_map {}}))
-   ;; (2) Check the unset values
-   ((user->client :rasta) :get 200 (format "meta/field/%d/values" (field->id :venues :price)))
-   ;; (3) Check that we can set values
-   ((user->client :rasta) :post 200 (format "meta/field/%d/value_map_update" (field->id :venues :price))
-    {:values_map {:1 "$"
-                  :2 "$$"
-                  :3 "$$$"
-                  :4 "$$$$"}})
-   ;; (4) Check the set values
    ((user->client :rasta) :get 200 (format "meta/field/%d/values" (field->id :venues :price)))])
+
+;; Check that we get an error if we call value_map_update on something that isn't a category
+(expect "You can only update the mapped values of a Field whose 'special_type' is 'category'."
+  ((user->client :rasta) :post 400 (format "meta/field/%d/value_map_update" (field->id :venues :id))
+   {:values_map {:1 "$"
+                 :2 "$$"
+                 :3 "$$$"
+                 :4 "$$$$"}}))


Pass another test.

Pass another test.

[ci skip]

--- test/onyx/peer/bulk_function_test.clj
+++ test/onyx/peer/bulk_function_test.clj
@@ -5,49 +5,7 @@
             [onyx.test-helper :refer [load-config]]
             [onyx.api]))

-(def id (java.util.UUID/randomUUID))
-
-(def config (load-config))
-
-(def env-config (assoc (:env-config config) :onyx/id id))
-
-(def peer-config (assoc (:peer-config config) :onyx/id id))
-
-(def env (onyx.api/start-env env-config))
-
-(def peer-group (onyx.api/start-peer-group peer-config))
-
 (def n-messages 100)
-
-(def batch-size 5)
-
-(defn my-inc [segments]
-  :ignored)
-
-(def catalog
-  [{:onyx/name :in
-    :onyx/plugin :onyx.plugin.core-async/input
-    :onyx/type :input
-    :onyx/medium :core.async
-    :onyx/batch-size batch-size
-    :onyx/max-peers 1
-    :onyx/doc "Reads segments from a core.async channel"}
-
-   {:onyx/name :inc
-    :onyx/fn :onyx.peer.bulk-function-test/my-inc
-    :onyx/type :function
-    :onyx/bulk? true
-    :onyx/batch-size batch-size}
-
-   {:onyx/name :out
-    :onyx/plugin :onyx.plugin.core-async/output
-    :onyx/type :output
-    :onyx/medium :core.async
-    :onyx/batch-size batch-size
-    :onyx/max-peers 1
-    :onyx/doc "Writes segments to a core.async channel"}])
-
-(def workflow [[:in :inc] [:inc :out]])

 (def in-chan (chan (inc n-messages)))

@@ -65,39 +23,72 @@
 (def out-calls
   {:lifecycle/before-task-start inject-out-ch})

-(def lifecycles
-  [{:lifecycle/task :in
-    :lifecycle/calls :onyx.peer.bulk-function-test/in-calls}
-   {:lifecycle/task :in
-    :lifecycle/calls :onyx.plugin.core-async/reader-calls}
-   {:lifecycle/task :out
-    :lifecycle/calls :onyx.peer.bulk-function-test/out-calls}
-   {:lifecycle/task :out
-    :lifecycle/calls :onyx.plugin.core-async/writer-calls}])
+(defn my-inc [segments]
+  :ignored)

-(doseq [n (range n-messages)]
-  (>!! in-chan {:n n}))
+(deftest bulk-functions
+  (let [id (java.util.UUID/randomUUID)
+        config (load-config)
+        env-config (assoc (:env-config config) :onyx/id id)
+        peer-config (assoc (:peer-config config) :onyx/id id)
+        env (onyx.api/start-env env-config)
+        peer-group (onyx.api/start-peer-group peer-config)
+        batch-size 5
+        catalog
+        [{:onyx/name :in
+          :onyx/plugin :onyx.plugin.core-async/input
+          :onyx/type :input
+          :onyx/medium :core.async
+          :onyx/batch-size batch-size
+          :onyx/max-peers 1
+          :onyx/doc "Reads segments from a core.async channel"}

-(>!! in-chan :done)
+         {:onyx/name :inc
+          :onyx/fn :onyx.peer.bulk-function-test/my-inc
+          :onyx/type :function
+          :onyx/bulk? true
+          :onyx/batch-size batch-size}

-(def v-peers (onyx.api/start-peers 3 peer-group))
+         {:onyx/name :out
+          :onyx/plugin :onyx.plugin.core-async/output
+          :onyx/type :output
+          :onyx/medium :core.async
+          :onyx/batch-size batch-size
+          :onyx/max-peers 1
+          :onyx/doc "Writes segments to a core.async channel"}]

-(onyx.api/submit-job
- peer-config
- {:catalog catalog
-  :workflow workflow
-  :lifecycles lifecycles
-  :task-scheduler :onyx.task-scheduler/balanced})
+        workflow [[:in :inc] [:inc :out]]

-(def results (take-segments! out-chan))
+        lifecycles
+        [{:lifecycle/task :in
+          :lifecycle/calls :onyx.peer.bulk-function-test/in-calls}
+         {:lifecycle/task :in
+          :lifecycle/calls :onyx.plugin.core-async/reader-calls}
+         {:lifecycle/task :out
+          :lifecycle/calls :onyx.peer.bulk-function-test/out-calls}
+         {:lifecycle/task :out
+          :lifecycle/calls :onyx.plugin.core-async/writer-calls}]

-(let [expected (set (map (fn [x] {:n x}) (range n-messages)))]
-  (fact (set (butlast results)) => expected)
-  (fact (last results) => :done))
+        v-peers (onyx.api/start-peers 3 peer-group)]

-(doseq [v-peer v-peers]
-  (onyx.api/shutdown-peer v-peer))
+    (doseq [n (range n-messages)]
+      (>!! in-chan {:n n}))
+    (>!! in-chan :done)
+    (onyx.api/submit-job
+     peer-config
+     {:catalog catalog
+      :workflow workflow
+      :lifecycles lifecycles
+      :task-scheduler :onyx.task-scheduler/balanced})

-(onyx.api/shutdown-peer-group peer-group)
+    (let [results (take-segments! out-chan)
+          expected (set (map (fn [x] {:n x}) (range n-messages)))]
+      (is (= expected (set (butlast results))))
+      (is (= :done (last results)))

-(onyx.api/shutdown-env env)
+      (doseq [v-peer v-peers]
+        (onyx.api/shutdown-peer v-peer))
+
+      (onyx.api/shutdown-peer-group peer-group)
+
+      (onyx.api/shutdown-env env))))


(maint) correct namespace declarations

(maint) correct namespace declarations

Caught by eastwood

--- test/puppetlabs/cthun/client_test.clj
+++ test/puppetlabs/cthun/client_test.clj
@@ -1,7 +1,7 @@
 (ns puppetlabs.cthun.client-test
-  (require [clojure.test :refer :all]
-           [puppetlabs.cthun.client :refer :all]
-           [puppetlabs.cthun.message :as message]))
+  (:require [clojure.test :refer :all]
+            [puppetlabs.cthun.client :refer :all]
+            [puppetlabs.cthun.message :as message]))

 (deftest session-association-message-test
   (let [message (session-association-message {:identity "cth://lolcathost/agent"})]


minor prettyfication

minor prettyfication

--- src/java_time/data.clj
+++ src/java_time/data.clj
@@ -24,11 +24,13 @@

   YearMonth
   (datafy [ym]
-    {:year (-> (d/datafy (.getMonth ym))
-               (assoc-in [:month :length] (.lengthOfMonth ym)) ;; correct the length here
-               (merge {:length (.lengthOfYear ym)              ;; 365 or 366 depending on `.isLeapYear()`
-                       :leap?  (.isLeapYear ym)
-                       :value  (.getYear ym)}))})
+    (let [month (-> (d/datafy (.getMonth ym))
+                    ;; correct the length here
+                    (assoc-in [:month :length] (.lengthOfMonth ym)))]
+      {:year (merge month
+                    {:length (.lengthOfYear ym) ;; 365 or 366 depending on `.isLeapYear()`
+                     :leap?  (.isLeapYear ym)
+                     :value  (.getYear ym)})}))

   LocalTime
   (datafy [lt]
@@ -55,7 +57,7 @@
     (let [lt (.toLocalTime ldt)
           d  (.toLocalDate ldt)]
       (-> (merge-with merge (d/datafy lt) (d/datafy d))
-          (assoc-in [:year :day] (.getDayOfYear  ldt))
+          (assoc-in [:year :day]        (.getDayOfYear  ldt))
           (assoc-in [:year :month :day] (.getDayOfMonth ldt)))))

   OffsetDateTime


did a lot of renaming in lseq-node and removed some dead code, trying to make it make more sense if you have to read it, added some docstrings

--- src/lseq_tree/lseq_node.cljc
+++ src/lseq_tree/lseq_node.cljc
@@ -17,31 +17,37 @@

 (defrecord Node [triple element sub-counter children])

+(defn node
+  [[triple & xs] element]
+  (if (= (count xs) 0)
+    (Node. triple element 0 [])
+    (Node. triple nil 1 [(node xs element)])))
+
 (declare add del fetch index-of indexes)

 (defn merge-child
-  [children target]
-  (->> (cons target children)
-       (sorted :triple)
-       (into [])))
+  "takes children and merges a limb into it..."
+  [children limb]
+  (->> children (cons limb) (sorted :triple) (into [])))

 (defn triple-in
-  [{:keys [children] :as node}
-   triple]
+  "finds the triple in a node and returns it's index"
+  [{:keys [children] :as node} triple]
   (find-in (map :triple children) triple))

 (defn add
+  "adds a node with one child at each level(a limb) to the children of a node"
   [{:keys [children triple] :as node}
    {-children :children -element :element -triple :triple
-    :as target}]
+    :as limb}]
   (let [node* (update-in node [:sub-counter] inc)
         index (triple-in node* -triple)
         length (count children)]
     ;does the path exist
     (if (or (< index 0)
             (= length 0))
-      (assoc node* :children (merge-child children target))
-      ;does the target have children
+      (assoc node* :children (merge-child children limb))
+      ;does the limb have children
       (if (= (count -children) 0)
         ; is their something at the index
         (if (get-in children [index :element])
@@ -54,8 +60,10 @@
   this)

 (defn left-to-right
-  [position tree]
-  (loop [pos position, branch (-> tree node-zip z/down), acc 0]
+  "a strategy that returns the sum of the branches to the left of a position
+  in a node"
+  [position node]
+  (loop [pos position, branch (-> node node-zip z/down), acc 0]
     (let [{:keys [sub-counter element]} (z/node branch)
           acc* (if element (inc acc) acc)]
       (if (= pos 0)
@@ -64,59 +72,43 @@
                (z/right branch)
                (+ sub-counter acc*))))))

-(defn right-to-left
-  [position {:keys [children] :as tree}]
-  (loop [pos 0
-         branch (-> tree node-zip z/down z/rightmost)
-         acc 0]
-    (let [{:keys [sub-counter element]} (z/node branch)]
-      (if (= (+ pos (inc position)) (count children))
-        (- (:sub-counter tree) acc)
-        (recur (inc position)
-               (z/left branch)
-               (+ sub-counter (if element (inc acc) acc)))))))
-
-(defn strat
-  [position acc sub-count]
-  (if (< (- position acc) (/ sub-count 2))
-    left-to-right right-to-left))
-
 (defn index-of
-  [this node]
-  (if-let [full-path (indexes this node)]
-      (loop [path full-path,
-             tree this,
-             acc (if (:element tree) 1 0)]
-        (let [head (first path), tail (next path)
-              {:keys [sub-counter children]} tree]
+  "returns the zero-based index of a limb in a node"
+  [node limb]
+  (if-let [paths (indexes node limb)]
+      (loop [paths paths,
+             node node,
+             acc (if (:element node) 1 0)]
+        (let [head (first paths), tail (next paths)
+              {:keys [children]} node]
           (if head
             (recur tail
                    (nth children head)
-                   (+ acc
-                      ;((strat head acc sub-counter)head tree)
-                      (left-to-right head tree)))
-            (dec acc))))
+                   (+ acc (left-to-right head node)))
+            (dec acc)))) ;zero-based index
       nil))

 (defn indexes
-  [this node]
-  (loop [xs [], tree this, path node]
-    (let [{:keys [children]} tree
-          index (find-in (map :triple children) (:triple path))]
-      ;does the tree contain the path
+  "returns a vector of numbers for each level that the index of a limb is
+  located at in a node"
+  [node limb]
+  (loop [path [], node node, limb limb]
+    (let [{:keys [children]} node
+          index (find-in (map :triple children) (:triple limb))]
+      ;does the node contain the limb
       (if (or (< index 0)
               (and (= index 0) (= (count children) 0)))
         nil
-        ;does the path have more children
-        (if (or (= (count (:children path)) 0)
+        ;does the limb have more children
+        (if (or (= (count (:children limb)) 0)
                 (= (count children) 0))
-          (conj xs index)
-          (recur (conj xs index)
-                 (get-in tree [:children index])
-                 (get-in path [:children 0])))))))
+          (conj path index)
+          (recur (conj path index)
+                 (get-in node [:children index])
+                 (get-in limb [:children 0])))))))

 (defn crawl-to
-  "returns a zipper at the nth element"
+  "returns a zipper with it's location where the index in a node"
   [node index]
   (loop [zip (node-zip node)
          to-go index]
@@ -127,11 +119,11 @@
           nil
           (recur (z/next zip) (if elem (dec to-go) to-go)))))))

-(defn fetch
-  "this function goes to a node in a zipper then crawls up making
-  a replica of the nodes it sees"
-  [this index]
-  (loop [zip (crawl-to this index)
+(defn crawl-out
+  "this crawls up making from child node in a zipper making a replica of the
+  nodes it sees"
+  [child]
+  (loop [zip child
          build nil]
     (let [{:keys [triple element]} (z/node zip)
           child (if build
@@ -141,8 +133,10 @@
         (recur (z/up zip) child)
         build))))

-(defn node
-  [[triple & xs] element]
-  (if (= (count xs) 0)
-    (Node. triple element 0 [])
-    (Node. triple nil 1 [(node xs element)])))
+(defn fetch [node index]
+  "takes a node and an index and returns a recreation of the node at that index
+  as a limb"
+  (-> node
+      (crawl-to index)
+      (crawl-out)))
+


Add UnsupportedOperationException when throwing

--- src/clj/http/async/client/headers.clj
+++ src/clj/http/async/client/headers.clj
@@ -45,10 +45,10 @@
        ([k default] (if (.containsKey hds k)
                       (v hds k)
                       default)))
-      (cons [m] (throw "Headers are read only."))
+      (cons [m] (throw (UnsupportedOperationException. "Headers are read only.")))
       (count [] (.size hds))
-      (assoc [k v] (throw "Headers are read only."))
-      (without [k] (throw "Headers are read only"))
+      (assoc [k v] (throw (UnsupportedOperationException. "Headers are read only.")))
+      (without [k] (throw (UnsupportedOperationException. "Headers are read only")))
       (seq [] ((fn thisfn [plseq]
                   (lazy-seq
                    (when-let [pseq (seq plseq)]


coerce item id to the correct type

coerce item id to the correct type

--- src/clj_money/models/transactions.clj
+++ src/clj_money/models/transactions.clj
@@ -139,7 +139,7 @@
       (empty? (:id item))) (dissoc :id)
     (and
       (string? (:id item))
-      (not (empty? (:id item)))) (update-in [:id] #(Integer. %))))
+      (not (empty? (:id item)))) (update-in [:id] #(UUID/fromString %))))

 (def ^:private coercion-rules
   [(coercion/rule :uuid [:id])


clarify note for future refactor

clarify note for future refactor

--- src/clj_money/models/transactions.clj
+++ src/clj_money/models/transactions.clj
@@ -865,8 +865,8 @@
            s
            {:account-id account-id
             :transaction-date [:between nil date]}
-           {:sort [[:t.transaction-date :desc] [:i.index :desc]]}) ; TODO: add :limit 1 option
-         (remove #(= date (:transaction-date %))) ; TODO: revert this after reworking logic to deduce partition date range
+           {:sort [[:t.transaction-date :desc] [:i.index :desc]]})
+         (remove #(= date (:transaction-date %))) ; TODO: revert this and add limit 1 after reworking logic to deduce partition date range
          first)))

 (defn- find-last-item-on-or-before


Add missing :refer-clojure on shmac ns.

Add missing :refer-clojure on shmac ns.

--- src/buddy/core/mac/shmac.clj
+++ src/buddy/core/mac/shmac.clj
@@ -14,6 +14,7 @@

 (ns buddy.core.mac.shmac
   "Salted variant of Hash-based Message Authentication Codes (HMACs)"
+  (:refer-clojure :exclude [hash])
   (:require [buddy.core.codecs :refer :all]
             [buddy.core.bytes :as bytes]
             [buddy.core.mac.hmac :as hmac]


Use boot-sass 0.1.0

Use boot-sass 0.1.0

--- build.boot
+++ build.boot
@@ -7,7 +7,7 @@
                   [adzerk/boot-cljs-repl  "0.1.10-SNAPSHOT" :scope "test"]
                   [adzerk/boot-reload     "0.3.3-SNAPSHOT" :scope "test"]
                   [deraen/boot-less       "0.4.1"      :scope "test"]
-                  [deraen/boot-sass       "0.1.0-SNAPSHOT" :scope "test"]
+                  [deraen/boot-sass       "0.1.0"      :scope "test"]
                   [deraen/boot-ctn        "0.1.0"      :scope "test"]

                   ; Backend


Add dry-run to deploy-s3

Add dry-run to deploy-s3

--- build.boot
+++ build.boot
@@ -257,10 +257,10 @@
                                     org.mozilla/rhino})))

 (deftask deploy-s3
-  []
+  [y dry-run bool "Report as usual but don't actually do anything"]
   (let [bucket (get (env/env) "AWS_BUCKET")]
     (boot.util/info "Deploying on bucket %s...\n" bucket)
-    (sync-bucket #_:dry-run #_true
+    (sync-bucket :dry-run dry-run
                  :prune true
                  :bucket bucket
                  :access-key (get (env/env) "AWS_ACCESS_KEY")


add reader extensions hack to boot build, just in case

--- build.boot
+++ build.boot
@@ -70,6 +70,7 @@

 (deftask build []
   (comp
+   (data-readers)
    (cljs :optimizations :advanced)
    (aot :namespace '#{relembra.core})
    (pom :project 'relembra


Fixed repl

Fixed repl

--- build.boot
+++ build.boot
@@ -67,9 +67,9 @@
   (set-env! :source-paths #{"src/clj" "src/cljs"})
   (comp (serve :dir "resources/public")
         (watch)
-        (reload :on-jsload 'cljs-repl-web.core/main)
         (cljs-repl)
-        (cljs :compiler-options compiler-options)))
+        (cljs :compiler-options compiler-options)
+        (reload :on-jsload 'cljs-repl-web.core/main)))

 (ns-unmap 'boot.user 'test)


Update deps

Update deps

--- build.boot
+++ build.boot
@@ -5,11 +5,11 @@

                     [adzerk/boot-test            "1.2.0"     :scope "test"]
                     [pandeiro/boot-http          "0.7.6"     :scope "test"]
-                    [adzerk/boot-reload          "0.5.0"     :scope "test"]
+                    [adzerk/boot-reload          "0.5.1"     :scope "test"]
                     [adzerk/boot-cljs            "1.7.228-2" :scope "test"]
                     [adzerk/boot-cljs-repl       "0.3.3"     :scope "test"]
                     [crisptrutski/boot-cljs-test "0.3.0"     :scope "test"]
-                    [boot-codox                  "0.10.2"    :scope "test"]
+                    [boot-codox                  "0.10.3"    :scope "test"]

                     [me.raynes/conch             "0.8.0"     :scope "test"]
                     [com.cemerick/piggieback     "0.2.1"     :scope "test"]
@@ -209,7 +209,7 @@
       :name         "moxaj/mikron"
       :metadata     {:doc/format :markdown}
       :output-path  "../docs"
-      :namespaces   [#"^mikron\.(?!codegen)"]
+      ;:namespaces   [#"^mikron\.(?!codegen)"]
       :exclude-vars #"^((map)?->\p{Upper}|[?!].*\*)"
       :themes       [:default
                      [:klipse


CMR-5397: Change eval command.

CMR-5397: Change eval command.

--- collection-renderer-lib/src/cmr/collection_renderer/services/collection_renderer.clj
+++ collection-renderer-lib/src/cmr/collection_renderer/services/collection_renderer.clj
@@ -41,8 +41,9 @@
   []
   (future
     (let [jruby (.. (ScriptEngineManager.)
-                    (getEngineByName "jruby"))]
-      (.eval jruby "load 'collection_preview/bootstrap.rb'")
+                    (getEngineByName "jruby"))
+          cmd (format "load '%s'" (.getFile bootstrap-rb))]
+      (.eval jruby cmd)
       (info "JRuby runtime ready for collection renderer.")
       jruby)))


Fix version

Fix version

--- src/obb_rules/game.clj
+++ src/obb_rules/game.clj
@@ -3,7 +3,7 @@
             [obb-rules.result :as result]
             [obb-rules.board :as board]))

-(def version (System/getProperty "obb-rules-api.version"))
+(def version (System/getProperty "obb-rules.version"))

 (defn state?
   "Checks if the game is in a given state"


controller part

controller part

--- src/ca_recipe/tnywb/core.clj
+++ src/ca_recipe/tnywb/core.clj
@@ -27,3 +27,10 @@

 (def request {:path "/greeting" :body "Mike,Joe,John,Steve"})

+(defn make-greeting [name]
+  (let [greetings ["Hello" "Greetings" "Salutations" "Hola"]
+        greeting-court (count greetings)]
+    (str (greetings (rand-int greeting-court)) ", " name)))
+
+(defn handle-greeting [http-request]
+  {:greetings (map make-greeting (str/split (:body http-request) #","))})


title

title

--- src/ontrail/mutate.clj
+++ src/ontrail/mutate.clj
@@ -119,6 +119,6 @@
   (.debug logger (str (:user params) " creating comment " params))
   (mc/update-by-id EXERCISE
                    (ObjectId. (:id params))
-                   {"$push" {:comments {:tile (:title params) :date (time/now) :user (:user params) :body (:body params)}}})
+                   {"$push" {:comments {:title (:title params) :date (time/now) :user (:user params) :body (:body params)}}})
    (.debug logger (str (:user params) " creating comment " params))
   (get-ex (:id params)))


added several tests for :atom, corrected :unquote definition by using a negative lookahead


Now using parsley's incremental buffer feature ! ! !

--- src/paredit/parser.clj
+++ src/paredit/parser.clj
@@ -4,7 +4,7 @@
   (:use paredit.regex-utils)
 	(:require [clojure.zip :as zip])
   (:require [clojure.contrib.zip-filter :as zf])
-  (:use net.cgrand.parsley)
+  (:require [net.cgrand.parsley :as p])
   (:require [net.cgrand.parsley.lrplus :as lr+])
   (:require [net.cgrand.regex :as r]))

@@ -77,9 +77,9 @@
     open-unquote open-anon-arg open-keyword open-discard whitespace open-comment
     open-char})
 (def sexp
-  (parser {:root-tag :root
+  (p/parser {:root-tag :root
            :main :expr*
-           :space (unspaced gspaces :*)}
+           :space (p/unspaced gspaces :*)}
     :expr- #{
              :list
              :vector
@@ -111,8 +111,8 @@
                 [open-map :expr* #{")" "]" eof}]
                 [open-fn :expr* #{"]" "}" eof}]
                 [open-set :expr* #{")" "]" eof}]
-                (unspaced open-string #"(?:\\.|[^\\\"])++(?!\")" :? eof)
-                (unspaced open-regex #"(?:\\.|[^\\\"])++(?!\")" :? eof)
+                (p/unspaced open-string #"(?:\\.|[^\\\"])++(?!\")" :? eof)
+                (p/unspaced open-regex #"(?:\\.|[^\\\"])++(?!\")" :? eof)
                 [open-quote #{"]" "}" ")" eof}]
                 [open-meta :expr :? #{"]" "}" ")" eof}]
                 [open-deprecated-meta :expr :? #{"]" "}" ")" eof}]
@@ -122,7 +122,7 @@
                 [open-discard #{"]" "}" ")" eof}]
                 [open-unquote-splicing #{"]" "}" ")" eof}]
                 [open-unquote #{"]" "}" ")" eof}]
-                (unspaced open-char eof)
+                (p/unspaced open-char eof)
                 }
     :vector [open-vector :expr* "]"]
     :map [open-map :expr* "}"]
@@ -136,26 +136,35 @@
     :deprecated-meta [open-deprecated-meta :expr :expr]
     :unquote-splicing [open-unquote-splicing :expr]
     :unquote [open-unquote :expr]
-    :string (unspaced open-string #"(?:\\.|[^\\\"])++(?=\")" :? \")
-    :regex  (unspaced open-regex #"(?:\\.|[^\\\"])++(?=\")" :? \")
+    :string (p/unspaced open-string #"(?:\\.|[^\\\"])++(?=\")" :? \")
+    :regex  (p/unspaced open-regex #"(?:\\.|[^\\\"])++(?=\")" :? \")
     :symbol
       #"(?:[\-\+](?![0-9])[^\^\(\[\#\{\\\"\~\%\:\,\s\;\'\@\`\)\]\}]*)|(?:[^\^\(\[\#\{\\\"\~\%\:\,\s\;\'\@\`\)\]\}\-\+;0-9][^\^\(\[\#\{\\\"\~\%\:\,\s\;\'\@\`\)\]\}]*|#(?![\{\(\'\^\"\_\!])[^\^\(\[\#\{\\\"\~\%\:\,\s\;\'\@\`\)\]\}]*)#?"
-    :keyword (unspaced open-keyword #"[^\(\[\{\'\^\@\`\~\"\\\,\s\;\)\]\}]*"); factorize with symbol
+    :keyword (p/unspaced open-keyword #"[^\(\[\{\'\^\@\`\~\"\\\,\s\;\)\]\}]*"); factorize with symbol
     :int #"(?:[-+]?(?:0(?!\.)|[1-9][0-9]*+(?!\.)|0[xX][0-9A-Fa-f]+(?!\.)|0[0-7]+(?!\.)|[1-9][0-9]?[rR][0-9A-Za-z]+(?!\.)|0[0-9]+(?!\.))(?!/))"
     :ratio #"[-+]?[0-9]+/[0-9]*"
     :float #"[-+]?[0-9]+\.[0-9]*+(?:[eE][-+]?+[0-9]+)?+M?"
-    :anon-arg (unspaced open-anon-arg #"(?:[0-9|\&])?+")
-    :char (unspaced open-char #"(?:newline|space|tab|backspace|formfeed|return|u[0-9|a-f|A-F]{4}|o[0-3]?+[0-7]{1,2}|.)")
+    :anon-arg (p/unspaced open-anon-arg #"(?:[0-9|\&])?+")
+    :char (p/unspaced open-char #"(?:newline|space|tab|backspace|formfeed|return|u[0-9|a-f|A-F]{4}|o[0-3]?+[0-7]{1,2}|.)")
     :whitespace whitespace
-    :comment (unspaced open-comment #"[^\n]*")
+    :comment (p/unspaced open-comment #"[^\n]*")
     :discard [open-discard :expr]
     ))

+(defn edit-buffer [buffer offset len text]
+  (let [text (or text "")]
+    (if (= [0 -1] [offset len])
+      (p/edit (p/incremental-buffer sexp) 0 0 text)
+      (p/edit (or buffer (p/incremental-buffer sexp)) offset len text))))
+
+(defn buffer-parse-tree [buffer]
+  (p/parse-tree buffer))
+
 (defn parse
   ([^String text]
-    (sexp text))
+    (p/parse-tree (edit-buffer nil 0 -1 text)))
   ([^String text offset]
-    (sexp text)))
+    (throw (RuntimeException. "deprecated arity")) #_(sexp text)))

 (defn parse-tree
   [state]
@@ -165,29 +174,30 @@
 (require '[net.cgrand.parsley.lrplus :as l])
 (require '[net.cgrand.parsley.fold :as f])
 (require '[paredit.loc-utils :as lu])
-(defn dser-ser-inc
-  "Demonstration of parsley's incremental features"
-  [d]
-  (println "----------------------------------------")
-  (let [steps (do (println "steps computing") (time (first (reduce (fn [[steps l] r]
-                               (let [step (sexp l r)]
-                                 [(conj steps step) step]))
-                             [[] l/zero]
-                             (concat d [nil])))))
-        stitch (do (println "reducing steps") (time (reduce f/stitch steps)))]
-    (f/make-node :root (nth stitch 2)))))
-
-(comment
-  ;; {:v {:count}, :l, :r}
-(defprotocol BST
-  (bst-node ([this]) ([this l r v])))
-
-(defrecord Leaf [v]
-  BST
-  (bst-node [this] this))
-(defn node-val [l r]
-  {:count (+ (-> l bst-node :v :count) (-> r bst-node :v :count))})
-(defrecord Node [l r v]
-  BST
-  (bst-node ([this] this)
-            ([this l r] (Node. l r (node-val l r))))))+(let [c (slurp "C:\\Users\\Laurent\\Downloads\\1.3.0-alpha6\\src\\clj\\clojure\\core.clj")]
+
+  (println "Executing full parser:")
+  (dotimes [_ 10] (time (sexp c)))
+
+  (println "Executing parser incrementally:")
+  (dotimes [_ 10] (time (-> sexp p/incremental-buffer (p/edit 0 0 c) parse-tree)  ))
+  (println "Test edit incremental")
+
+  (dotimes [_ 10]
+    (let [b (let [_ (println "initial incremental buffer")
+                  b (time (-> sexp p/incremental-buffer (p/edit 0 0 c)))
+                  _ (println "initial parse-tree")
+                  _ (time (p/parse-tree b))]
+              b)
+          b (let [_ (println "edit in the top comment")
+                  b (time (-> b (p/edit 1 0 "coucou")))
+                  _ (println "parse-tree after edit in the top comment")
+                  _ (time (p/parse-tree b))]
+              b)
+          b (let [_ (println "add '(\\n' before the top comment")
+                  b (time (-> b (p/edit 0 0 "(\n")))
+                  _ (println "parse-tree after add '(\\n' before the top comment")
+                  _ (time (p/parse-tree b))]
+              b)]
+      b))
+  (= c (lu/node-text (-> sexp p/incremental-buffer (p/edit 0 0 c) p/parse-tree)) (lu/node-text (sexp c)))))


Import module$React in tempalte

Import module$React in tempalte

--- src/pump/template.cljs
+++ src/pump/template.cljs
@@ -1,6 +1,7 @@
 (ns pump.template
   (:require-macros [pump.macros :refer [dash-to-camel-str]])
-  (:require [clojure.string :as string]))
+  (:require [clojure.string :as string]
+            [module$React :as React]))

 (declare elem-factory)

@@ -33,7 +34,7 @@
     [:custom tag nil]
     (let [[tag id class] (next (re-matches re-tag (name tag)))]
       [:vanilla
-       (aget (.-DOM js/React) tag)
+       (aget React/DOM tag)
        {:id (or id nil)
         :className (if class (string/replace class #"\." " "))}])))


Get rid of reaction-key

Get rid of reaction-key

--- src/reagent/ratom.cljs
+++ src/reagent/ratom.cljs
@@ -74,15 +74,6 @@
                (if (identical? (aget x i) (aget y i))
                  (recur (inc i))
                  false))))))
-
-(def ^:private reaction-counter 0)
-
-(defn- reaction-key [r]
-  (if-some [k (.-reaction-id r)]
-    k
-    (->> reaction-counter inc
-         (set! reaction-counter)
-         (set! (.-reaction-id r)))))

 (defn- check-watches [old new]
   (when debug
@@ -208,7 +199,7 @@

 (declare make-reaction)

-(def ^{:private true :const true} cache-key "reaction-cache")
+(def ^{:private true :const true} cache-key "reagReactionCache")

 (defn- cached-reaction [f o k obj destroy]
   (let [m (aget o cache-key)
@@ -508,7 +499,7 @@
   (-pr-writer [a w opts] (pr-atom a w opts (str "Reaction " (hash a) ":")))

   IHash
-  (-hash [this] (reaction-key this)))
+  (-hash [this] (goog/getUid this)))

 (defn make-reaction [f & {:keys [auto-run on-set on-dispose derefed no-cache
@@ -524,17 +515,16 @@
         reaction (Reaction. f nil dirty nil nil
                             runner on-set on-dispose nocache)]
     (when-not (nil? capture)
+      (when (dev?)
+        ;; TODO: Add test
+        (set! (.-ratomGeneration reaction)
+              (.-ratomGeneration capture)))
       (when-some [c (aget capture cache-key)]
+        (aset capture cache-key nil)
         (aset reaction cache-key c)))
-    ;; TODO: get rid of reaction-id
-    (when-some [rid (some-> capture .-reaction-id)]
-      (set! (.-reaction-id reaction) rid))
     (when-not (nil? derefed)
       (warn "using derefed is deprecated"))
     (when-not (nil? derefs)
-      (when (dev?)
-        (set! (.-ratomGeneration reaction)
-              (.-ratomGeneration derefs)))
       (._update-watching reaction derefs))
     reaction))