Correct svg formatting.

Correct svg formatting.

--- src/mash_commander/nix/character.cljs
+++ src/mash_commander/nix/character.cljs
@@ -60,40 +60,42 @@
     (render-state [_ state]
       (let [state (:state cursor)
             eye-height (condp = state
-                         :resting "2.1vh"
-                         :blinking ".3vh")]
+                         :resting "21"
+                         :blinking "3")]
         (dom/div nil
                  (dom/svg #js {:style #js {:width "30.0vh"
                                            :height "48.0vh"
-                                           :float "right"}}
-                          (dom/rect #js {:style #js {:x ".3.vh"
-                                                     :y "2.1vh"
-                                                     :width "27.0vh"
-                                                     :height "42.0vh"
-                                                     :rx "4.8vh"
-                                                     :ry "4.8vh"
-                                                     :stroke "black"
-                                                     :fill "white"
-                                                     :strokeWidth ".5vh"}})
-                          (dom/rect #js {:style #js {:x "2.7vh"
-                                                     :y "4.5vh"
-                                                     :width "22.0vh"
-                                                     :height "28.0vh"
-                                                     :rx "2.7vh"
-                                                     :ry "2.7vh"
-                                                     :stroke "black"
-                                                     :fill "#f4f9ff"
-                                                     :strokeWidth ".5vh"}})
-                          (dom/ellipse #js {:style #js {:cx "9.6vh"
-                                                        :cy "12.6vh"
-                                                        :rx ".8vh"
-                                                        :ry eye-height
-                                                        :fill "#0e3487"}})
-                          (dom/ellipse #js {:style #js {:cx "17.7vh"
-                                                        :cy "12.6vh"
-                                                        :rx ".8vh"
-                                                        :ry eye-height
-                                                        :fill "#0e3487"}}))
+                                           :float "right"
+                                           :padding "5vh"}
+                               :viewBox "0 0 300 480"}
+                          (dom/rect #js {:x "5"
+                                         :y "5"
+                                         :width "295"
+                                         :height "475"
+                                         :rx "48"
+                                         :ry "48"
+                                         :stroke "black"
+                                         :fill "white"
+                                         :strokeWidth "5"})
+                          (dom/rect #js {:x "30"
+                                         :y "30"
+                                         :width "245"
+                                         :height "345"
+                                         :rx "27"
+                                         :ry "27"
+                                         :stroke "black"
+                                         :fill "#f4f9ff"
+                                         :strokeWidth "5"})
+                          (dom/ellipse #js {:cx "105"
+                                            :cy "126"
+                                            :rx "8"
+                                            :ry eye-height
+                                            :fill "#0e3487"})
+                          (dom/ellipse #js {:cx "195"
+                                            :cy "126"
+                                            :rx "8"
+                                            :ry eye-height
+                                            :fill "#0e3487"}))
                  (om/build story-component (:page cursor)))))
     om/IDidMount
     (did-mount [_]


Revert "#59 remove println"

Revert "#59 remove println"

This reverts commit d1673780e44ae1b5d00b22fa334769836d64c905.

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

 (defn get-auth


Allow cgens to perform multichannel-expansion like ugens.

   USAGE: add {:expands? true} to any cgen parameter that
          should be expanded.

          (defcgen my-cgen [freq {:expands? true}] ...)

--- src/overtone/sc/machinery/defcgen.clj
+++ src/overtone/sc/machinery/defcgen.clj
@@ -86,18 +86,25 @@

 (defn- mk-cgen-fn
   "Make the function which gets executed when a cgen is called."
-  [param-names defaults body]
-  (let [arg-sym     (gensym 'arg-sym)
+  [params body]
+  (let [expand-flags (map #(:expands? %) params)
+        param-names (vec (map :name params))
+        defaults    (reduce (fn [s el] (assoc s (:name el) (:default el)))
+                            {}
+                            params)
+        arg-sym     (gensym 'arg-sym)
         sym-gensyms (syms->sym-gensym-pairs param-names)
         bindings    (reduce (fn [final param]
                               (conj final (get sym-gensyms (symbol (name param))) `(get (arg-mapper ~arg-sym ~param-names ~defaults) ~param)))
                             []
                             param-names)
         body        (walk/prewalk-replace sym-gensyms body )]
-    `(fn [& ~arg-sym]
-       (let [~@bindings]
-         (with-overloaded-ugens
-           ~body)))))
+    `(make-expanding
+      (fn [& ~arg-sym]
+        (let [~@bindings]
+          (with-overloaded-ugens
+            ~body)))
+      (quote ~expand-flags))))

 (defn generate-full-cgen-doc
   "Generate a full docstring from a the specified cgen information"
@@ -120,12 +127,8 @@
   params."
   ([c-name summary doc params body categories rate] (mk-cgen c-name summary doc params body categories rate #{rate}))
   ([c-name summary doc params body categories rate rates]
-     (let [param-names (vec (map :name params))
-           defaults    (reduce (fn [s el] (assoc s (:name el) (:default el)))
-                               {}
-                               params)
-           full-doc    (generate-full-cgen-doc c-name summary doc categories rate params rates)
-           cgen-fn     (mk-cgen-fn param-names defaults body)]
+     (let [full-doc    (generate-full-cgen-doc c-name summary doc categories rate params rates)
+           cgen-fn     (mk-cgen-fn params body)]
        `(callable-map {:params ~params
                        :summary ~summary
                        :doc ~doc


Pass file encoding options through to read-dataset* :csv

--- src/tabular/grafter/tabular/csv.clj
+++ src/tabular/grafter/tabular/csv.clj
@@ -8,7 +8,7 @@

 (defmethod tab/read-dataset* :csv
   [f opts]
-  (let [csv-seq (tab/mapply csv/read-csv (io/reader f) opts)]
+  (let [csv-seq (tab/mapply csv/read-csv (tab/mapply io/reader f opts) opts)]
     (if (nil? csv-seq)
       (throw (IOException. (str "There was an error loading the CSV file: " f)))
       (tab/make-dataset csv-seq))))


small refactoring

small refactoring

--- src/duratom/core.clj
+++ src/duratom/core.clj
@@ -24,7 +24,8 @@
   (write_out [_]
     (storage/commit storage-backend))
   (read_in [this]
-    (reset! this (storage/snapshot storage-backend)))
+    ;; reset the underlying atom directly to avoid writing exactly what was read in
+    (reset! underlying-atom (storage/snapshot storage-backend)))
   (destroy [_]
     (storage/cleanup storage-backend)
     (release true)) ;; the only place where this is called with an argument
@@ -105,10 +106,10 @@
   (let [raw-atom (atom nil)
         backend (make-backend (agent raw-atom))
         duratom (Duratom. backend raw-atom lock (ut/releaser))
-        storage-init (doto duratom read_in)]
-    (if (some? @storage-init) ;; found stuff
-      storage-init
-      (cond-> storage-init
+        storage-init (read_in duratom)]
+    (if (some? storage-init) ;; found stuff
+      duratom
+      (cond-> duratom
               (some? init) (doto (reset! init)))))) ;; empty storage means we start off with <initial-value>

 (defn- map->Duratom [m]


Implemented user-thread link uniqueness.

--- src/forumdb/core.clj
+++ src/forumdb/core.clj
@@ -4,7 +4,9 @@
            (java.text SimpleDateFormat)
            (java.io File)
            (model User ForumThread Post)
-           (org.joda.time DateTime))
+           (org.joda.time DateTime)
+           (org.hypergraphdb.atom HGRel HGRelType)
+           (org.hypergraphdb.query HGQueryCondition))
   (:require [clojure.string :as string]
             [clojure.xml :as xml]
             [clj-time.format :as f]
@@ -60,12 +62,13 @@
     (if (. (File. db-name) exists)
       (do
         (println "Database already exists")
-        (def database-exists)
+        (def database-exists 1)
         (println)
       )
       (do
         (println "Reading xml file...")
         (def parsed (xml/parse (string/join "/" [data-files-directory xml-filename])))
+        (def database-exists 0)
         (println "Xml file loaded")
         (println)
       )
@@ -76,7 +79,12 @@
     (println "Database opened")
     (println)

-    (if (not database-exists)
+    (def topType (. (. @database getTypeSystem) getTop))
+    (def userThreadRelType (HGQuery$hg/assertAtom @database (HGRelType. "user-thread" (into-array HGHandle [topType topType]))))
+    (def userPostRelType (HGQuery$hg/assertAtom @database (HGRelType. "user-post" (into-array HGHandle [topType topType]))))
+    (def threadPostRelType (HGQuery$hg/assertAtom @database (HGRelType. "thread-post" (into-array HGHandle [topType topType]))))
+
+    (if (= database-exists 0)
       (do
         (def saveTime (Long. 0))

@@ -132,9 +140,10 @@
               (def threadHandle (HGQuery$hg/assertAtom @database thread))
               (def postHandle (. @database add post))

-              (. @database add (HGPlainLink. (into-array HGHandle [threadHandle userHandle postHandle])))
-              ;(. @database add (HGPlainLink. (into-array HGHandle [userHandle postHandle])))
-              ;(. @database add (HGPlainLink. (into-array HGHandle [threadHandle postHandle])))
+              ;(. @database add (HGPlainLink. (into-array HGHandle [threadHandle userHandle postHandle])))
+              (HGQuery$hg/addUnique @database (HGRel. (into-array HGHandle [userHandle threadHandle])) userThreadRelType (HGQuery$hg/link (into-array HGHandle [threadHandle userHandle])))
+              (. @database add (HGRel. (into-array HGHandle [userHandle postHandle])) userPostRelType)
+              (. @database add (HGRel. (into-array HGHandle [threadHandle postHandle])) threadPostRelType)

               (def saveTime (+ saveTime (- (System/currentTimeMillis) saveStart)))
               )
@@ -165,6 +174,7 @@
         (def stop (System/currentTimeMillis))
         (println (string/join " " ["Data parsed and saved in" (String/valueOf (/ (- stop start) 1000.0)) "seconds"]))
         (println (string/join " " ["Saving took" (String/valueOf (/ saveTime 1000.0)) "seconds"]))
+        (println)
       )
       (do
         (println "Database already loaded, no need to parse")
@@ -174,7 +184,7 @@

     (println "liczba tematów utworzonych w 2013 roku")
     (let [operationStart (System/currentTimeMillis)]
-
+      ;(HGQuery$hg/findAll (HGQuery$hg/and (HGQuery$hg/type ForumThread) (HGQuery$hg/eq "")))
       (println (string/join " " ["Operation took" (String/valueOf (/ (- (System/currentTimeMillis) operationStart) 1000.0)) "seconds"]))
       )
     (println)
@@ -196,7 +206,8 @@
     (println "użytkownik wypowiadający się w największej liczbie tematów")
     (let [operationStart (System/currentTimeMillis)]
       (def userHandles (HGQuery$hg/findAll @database (HGQuery$hg/type User)))
-      (def uniqueThreadsCount (map (fn [user] (reduce (fn [count thread] (if (> (. (HGQuery$hg/findAll @database (HGQuery$hg/link (into-array HGHandle [user thread]))) size) 0) (+ count 1) count)) 0 (HGQuery$hg/findAll @database (HGQuery$hg/type ForumThread)))) userHandles))
+      (def uniqueThreadsCount (map (fn [userHandle] (. (HGQuery$hg/findAll @database (HGQuery$hg/and (into-array HGQueryCondition [(HGQuery$hg/incident userHandle) (HGQuery$hg/type userThreadRelType)]))) size)) userHandles))
+      ;(def uniqueThreadsCount (map (fn [user] (reduce (fn [count thread] (if (> (. (HGQuery$hg/findAll @database (HGQuery$hg/link (into-array HGHandle [user thread]))) size) 0) (+ count 1) count)) 0 (HGQuery$hg/findAll @database (HGQuery$hg/type ForumThread)))) userHandles))
       (def mostActiveUser (reduce (fn [x y] (if (> (last x) (last y)) x y)) (map vector userHandles uniqueThreadsCount)))
       (println (. (. @database get (first mostActiveUser)) getLogin) (last mostActiveUser))
       (println (string/join " " ["Operation took" (String/valueOf (/ (- (System/currentTimeMillis) operationStart) 1000.0)) "seconds"]))


got complement-char-class & tests working

--- src/hangman/core.clj
+++ src/hangman/core.clj
@@ -20,7 +20,7 @@
        (str/split-lines )
        (map str/trim ) ))

-(def ^:const all-letters (map char (range (int \a) (inc(int \z)) )))
+(def ^:const all-letters-set (set (map char (range (int \a) (inc(int \z)) ))) )

 (def tst-words [
   "is" "at" "by" "up"
@@ -170,7 +170,7 @@
   guess letter. "
   [keep-words used-chars]
   (let [
-        avail-chars   (set/difference (set all-letters) used-chars)
+        avail-chars   (set/difference all-letters-set used-chars)
         char-bits     (zipmap avail-chars (map #(calc-info-bits keep-words %) avail-chars) )
         best-char     (apply max-key char-bits avail-chars ) ]
     best-char ) )
@@ -192,14 +192,21 @@
   (vec
     (for [ letter target-vec ] (guesses-set letter)) ))

+(defn complement-char-class
+  "Generate the regex for the complement of a set of characters."
+  [not-chars]
+  (if (< 0 (count not-chars))
+    (str "[^" (str/join not-chars) "]" )
+    "." ))
+
 (defn clue-to-regex
   "Convert a clue string and set of guessed chars into a regex for filtering possible
   matching words."
   [clue-str guessed-chars]
-  (let [not-guessed-chars   (str "[^" (str/join guessed-chars) "]" )
+  (let [not-guessed-class   (complement-char-class guessed-chars)
         patt-str   (str/join
                      (for [clue-ch clue-str]
-                       (if (= clue-ch \-) not-guessed-chars clue-ch) ))
+                       (if (= clue-ch \-) not-guessed-class clue-ch) ))
     ] patt-str ))

 (defn do-tests []
@@ -219,42 +226,22 @@
   (assert (= (apply str (vec "abcd"))    "abcd" ))

   ; Test regex stuff
-  (let [words   ["abcd" "xbcd" "xxcd" "xxxd"]
-        letters [\a \b \c \d]
-        ]
-    (println "#1 --------------------")
-    (doseq [word words]
-      (println)
-      (print (str word ": ") )
-      (doseq [letter letters]
-        (if (re-find (re-pattern (str letter)) word) (print letter) (print \-)) ) )
-    (println)
-
-    (println "#2 --------------------")
-    (let [used    #{\b \s}
-          clue    "a---"
-          char-class    (str "[^" (str/join used) "]" )
-            _ (println "char-class" char-class)
-          patt-str      (str/join (flatten [ char-class "b" char-class char-class ] ))
-            _ (println "patt-str" patt-str)
-      ]
-      (println "patt-str" patt-str)
-      (doseq [word words]
-        (println word ":" (re-find (re-pattern patt-str) word )) ))
-
-    (println "#3 --------------------")
-    (let [used    #{\b \s}
-          clue    "-b--"
-          patt-str      (clue-to-regex clue used)
-      ]
-      (println "clue    " clue)
-      (println "used    " used)
-      (println "patt-str" patt-str)
-      (println "matches:")
-      (doseq [word words]
-        (println "  " word ":" (re-find (re-pattern patt-str) word )) )
-    )
-
+  (assert (= (complement-char-class #{})         "."      ))
+  (assert (= (complement-char-class #{\a \b})    "[^ab]"  ))
+  (let [words           ["abcd" "xbcd" "xxcd" "xxxd"]
+        letters         [\a \b \c \d]
+        guessed-chars   #{\b \s}
+        clue-str        "-b--"
+
+        not-char-class  (complement-char-class guessed-chars)
+        patt-str        (clue-to-regex clue-str guessed-chars)
+    ]
+    (assert (= not-char-class  "[^bs]"                 ))
+    (assert (= patt-str        "[^bs]b[^bs][^bs]"      ))
+    (assert      (re-find (re-pattern patt-str) "abcd" ))
+    (assert      (re-find (re-pattern patt-str) "xbcd" ))
+    (assert (not (re-find (re-pattern patt-str) "xxcd" )))
+    (assert (not (re-find (re-pattern patt-str) "xxxd" )))
     (println)
   )


Got looping over each word length

Got looping over each word length

--- src/hangman/core.clj
+++ src/hangman/core.clj
@@ -20,16 +20,15 @@
   (println "Hello, World!")
   (let [ words   (->> (slurp"resources/words.txt")
                       (str/split-lines )
-                      (map str/trim ) )
+                      (map str/trim ) )
          _       (show-info words "words")
-         len1    (find-words-len words 1 )
-         _       (show-info len1 "len1")
-         len2    (find-words-len words 2 )
-         _       (show-info len2 "len2")
-         len3    (find-words-len words 3 )
-         _       (show-info len3 "len3")
          max-len (apply max (map #(count %) words) )
          _  (println "max-len:" max-len)
+         _  (doall
+              (for [ curr-len (range 1 (inc max-len)) ]
+                (let [ curr-words (find-words-len words curr-len) ]
+                  (show-info curr-words
+                   (str "len=" curr-len) ) )))
        ]
   )
 )


Adding module-id to model

Adding module-id to model

--- src/helda/schema.clj
+++ src/helda/schema.clj
@@ -40,6 +40,7 @@
     :extends [s/Keyword]
     :fields {s/Keyword s/Str} ;{field description or type at least}
     :actions {s/Keyword Action}
+    :module-id s/Keyword
   })

 (s/defschema World {


run a repl

run a repl

--- src/lein_ui/core.clj
+++ src/lein_ui/core.clj
@@ -1,24 +1,26 @@
 (ns lein-ui.core
     (:require [clojure.java.io :as io]
+              [clojure.pprint :as pprint]
               [leiningen.core.project :as project]
+              [leiningen.repl :as repl]
               [org.httpkit.server :as server]
               [ring.middleware.reload :as reload]
               [compojure.handler :refer [site]]
               [compojure.core :refer [defroutes GET POST DELETE]]
-              [compojure.route :as route]))
+              [compojure.route :as route])
+      (:import (com.hypirion.io Pipe ClosingPipe)))

 ;;; Projects

 (defonce projects (atom {}))

-(defrecord Project [project state])
 (defn new-project [project-map]
-  (->Project project-map (atom {})))
+  (assoc project-map ::run-state (atom {})))

 (defn load-project! [root]
   (let [project (->>  (io/file root "project.clj")
                       (.getAbsolutePath)
-                      (project/read-raw))]
+                      (project/read))]
        (swap! projects (fn [ps p]
                          (when (ps (:name p))
                            (throw (ex-info (str "Project already loaded")
@@ -33,9 +35,69 @@
   (swap! projects dissoc name))

 (defn reload-project! [name]
-  (let [root (-> @projects name :root)]
+  (let [root (-> @projects (get name) :root)]
     (unload-project! name)
     (load-project! root)))
+
+(defn get-project* [name]
+  (if-let [project (@projects name)]
+    project
+    (throw (ex-info "Project doesn't exist" {:name name}))))
+
+;; adapated from leiningen.core.eval
+(defn- overridden-env
+  "Returns an overridden version of the current environment as an Array of
+  Strings of the form name=val, suitable for passing to Runtime#exec."
+  [env]
+  (->> env
+       (filter val)
+       (map #(str (name (key %)) "=" (val %)))
+       (into-array String)))
+
+;; adapated from leiningen.core.eval
+(defn sh
+  "A version of clojure.java.shell/sh that streams in/out/err."
+  [cmd & {:keys [dir]}]
+  (let [env (overridden-env (System/getenv))
+        proc (.exec (Runtime/getRuntime) (into-array cmd) env
+                    (io/file dir))]
+    (.addShutdownHook (Runtime/getRuntime)
+                      (Thread. (fn [] (.destroy proc))))
+    ;; TODO: wrap setup in try/finally and close streams
+    (let [out (io/reader (.getInputStream proc))
+          err (io/reader (.getErrorStream proc))
+          out-writer (java.io.StringWriter.)
+          err-writer (java.io.StringWriter.)
+          pump-out (doto (Pipe. out out-writer) .start)
+          pump-err (doto (Pipe. err err-writer) .start)]
+      {:process proc
+       :pump-out pump-out
+       :pump-err pump-err
+       :out-writer out-writer
+       :err-writer err-writer})))
+
+;;; Objective
+;; Launch a process & observe its output in a webui.
+
+;; Technique
+;;  - .exec, redirect out & err to StringWriters
+;;  - shove Process to another thread and waitFor it to end
+;;  - associate process, outSW, and errSW to project's ::run-state
+
+
+
+
+
+(defn start-repl! [name]
+  (let [project (get-project* name)]
+    (when (-> project ::run-state deref :repl)
+      (throw (ex-info "Project already running a repl!" {:name name})))
+
+    (let [env (overridden-env (System/getenv))
+          repl-process (sh ["lein"
+                            "repl"
+                            ":headless"] :dir ".")]
+      (swap! (::run-state project) assoc :repl repl-process))))

 ;;; Util
@@ -47,7 +109,7 @@

 (defn pprint-str [o]
   (let [w (java.io.StringWriter.)]
-    (pprint o w)
+    (pprint/pprint o w)
     (.toString w)))

@@ -66,9 +128,8 @@
                (project-short project))})

 (defn get-project [project-name]
-  (-> @projects
-      (get project-name)
-      :project))
+  (-> (get @projects project-name)
+      (dissoc ::run-state)))

 (defn add-project [project-root]
   (load-project! project-root))
@@ -88,7 +149,7 @@
   (POST "/api/projects" [root]
         (let [name (load-project! root)]
           {:status 201
-           :body (pprint-str (project-short (:project (@projects name))))}))
+           :body (pprint-str (project-short (get-project name)))}))
   (DELETE "/api/projects/:project-name" [project-name]
           (unload-project! project-name)
           {:status 204})
@@ -109,6 +170,3 @@
 (defn reset-server []
   (stop-server)
   (start-server))
-
-
-


check for string message

check for string message

Former-commit-id: 0187bc7bceec8be7468151b630797664a54913af

--- src/syng_im/handlers/suggestions.cljs
+++ src/syng_im/handlers/suggestions.cljs
@@ -58,8 +58,9 @@
 (defn load-commands []
   (http-get "chat-commands.js" execute-commands-js nil))

-(defn check-suggestion [db text]
-  (when-let [suggestion-text (re-matches #"^![^\s]+\s" text)]
+(defn check-suggestion [db message]
+  (when-let [suggestion-text (when (string? message)
+                               (re-matches #"^![^\s]+\s" message))]
     (let [suggestion-text' (s/trim suggestion-text)
           [suggestion] (filter #(= suggestion-text' (:text %))
                                (get-commands db))]


whitespace

whitespace

--- src/unspun/screens/number_needed.cljs
+++ src/unspun/screens/number_needed.cljs
@@ -326,8 +326,6 @@
                                      state)}))

-
-
 (rum/defc page < rum/reactive []
   (let [scenar ((rum/react stories) (rum/react story-index))
         palette (get-palette (rum/react palette-index))
@@ -363,9 +361,7 @@
     (letfn [(handle-scroll [event]
               (this-as this
                 (.log js/console (-> event (.-nativeEvent) (.-contentOffset) (.-y)))
-                ))
-            ]
-
+                ))]

       (view {:onLayout #(prn (screen-w-h))
              :style    {:flex            1
@@ -388,8 +384,7 @@
                                      (text-field :light-primary "bold" nn-group)
                                      (text-field :light-primary "normal" nn-group-to-anyway)
                                      (text-field :accent "bold" nn-anyway)
-                                     (text-field :light-primary "normal" nn-tail)
-                                     )))
+                                     (text-field :light-primary "normal" nn-tail))))

             (view {:style {:flex          0.7
                            :flexDirection "column"}}


Change ceiling test to be deterministic

Change ceiling test to be deterministic

--- test/clj/backtype/storm/util_test.clj
+++ test/clj/backtype/storm/util_test.clj
@@ -9,7 +9,7 @@
 (deftest test-new-curator-uses-exponential-backoff
   (let [expected_interval 2400
         expected_retries 10
-        expected_ceiling 5000
+        expected_ceiling (/ expected_interval 2)
         conf (merge (clojurify-structure (Utils/readDefaultConfig))
           {Config/STORM_ZOOKEEPER_RETRY_INTERVAL expected_interval
            Config/STORM_ZOOKEEPER_RETRY_TIMES expected_retries
@@ -23,11 +23,6 @@
     (is (= (.getBaseSleepTimeMs retry) expected_interval))
     (is (= (.getN retry) expected_retries))
     (is (= (.getMaxRetryInterval retry) expected_ceiling))
-    ; It would be very unlikely for this to fail three times.
-    (is (or
-          (= (.getSleepTimeMs retry 10 0) expected_ceiling)
-          (= (.getSleepTimeMs retry 10 0) expected_ceiling)
-          (= (.getSleepTimeMs retry 10 0) expected_ceiling)
-        ))
+    (is (= (.getSleepTimeMs retry 10 0) expected_ceiling))
   )
 )


rearranging code.  contract is now kontract and vv

--- src/fogus/me/trammel.clj
+++ src/fogus/me/trammel.clj
@@ -14,22 +14,27 @@
 (ns fogus.me.trammel
   (:use [clojure.test :as test]))

-(defn- build-contract [c]
-  (let [args (first c)]
-    (list
-     (into '[f] args)
-     (apply merge
-            (for [con (rest c)]
-              (cond (= (first con) 'requires)
-                    (assoc {} :pre (vec (rest con)))
-                    (= (first con) 'ensures)
-                    (assoc {} :post (vec (rest con)))
-                    :else (throw (Exception. (str "Unknown tag " (first con)))))))
-     (list* 'f args))))
+;; Experimentation
+
+(defn- build-contract [[[sig] expectations :as c]]
+  (list
+    (into '[f] sig)
+    (apply merge
+           (for [[[dir] & [cnstr]] (->> expectations
+                                        (partition-by #{:requires :ensures})
+                                        (partition 2))]
+             {(case dir
+                    :requires :pre
+                    :ensures  :post)
+              (vec cnstr)}))
+    (list* 'f sig)))
+

 (defn- collect-bodies [forms]
-  (for [form (partition 3 forms)]
-    (build-contract form)))
+  (for [body (->> (partition-by vector? forms)
+                  (partition 2))]
+    (build-contract body)))
+

 (defmacro contract [& forms]
   (let [name (if (symbol? (first forms))
@@ -39,80 +44,10 @@
                                (rest forms)
                                forms))]
     (list* 'fn name body)))
-;; USAGE
-
-(comment
-  (def doubler
-       (contract doubler
-         [x]
-         (requires
-          (pos? x))
-         (ensures
-          (= (* 2 x) %))))
-
-  (def times2 (partial doubler #(* 2 %)))
-  (times2 9)
-
-  (def times3 (partial doubler #(* 3 %)))
-  (times3 9)
-
-  (def doubler-contract
-       (contract doubler
-         [x]
-         (requires
-          (pos? x))
-         (ensures
-          (= (* 2 x) %))
-
-         [x y]
-         (requires
-          (pos? x)
-          (pos? y))
-         (ensures
-          (= (* 2 (+ x y)) %))))
-
-  ((partial doubler-contract #(* 2 (+ %1 %2))) 2 3)
-
-  ((partial doubler-contract #(+ %1 %1 %2 %2)) 2 3)
-
-  ((partial doubler-contract #(* 3 (+ %1 %2))) 2 3))
-
-;; Experimentation
-
-(defn- build-kontract [[[sig] expectations :as c]]
-  (list
-    (into '[f] sig)
-    (apply merge
-           (let [parts (->> expectations
-                            (partition-by #{:requires :ensures})
-                            (partition 2))]
-             (for [[[dir] & [cnstr]] parts]
-               {(case dir
-                      :requires :pre
-                      :ensures  :post)
-                (vec cnstr)})))
-    (list* 'f sig)))
-
-
-(defn- kollect-bodies [forms]
-  (let [bodies (->> (partition-by vector? forms)
-                    (partition 2))]
-    (for [body bodies]
-      (build-kontract (vec body)))))
-
-
-(defmacro kontract [& forms]
-  (let [name (if (symbol? (first forms))
-               (first forms)
-               nil)
-        body (kollect-bodies (if name
-                               (rest forms)
-                               forms))]
-    (list* 'fn name body)))

 (comment
   (def doubler-contract
-       (kontract doubler
+       (contract doubler
                  [x]
                  :requires
                  (pos? x)
@@ -148,3 +83,73 @@
   ((partial doubler-contract #(* 2 %)) 3)

   ((partial doubler-contract #(* 3 %)) 3))
+
+
+
+
+(defn- build-kontract [c]
+  (let [args (first c)]
+    (list
+     (into '[f] args)
+     (apply merge
+            (for [con (rest c)]
+              (cond (= (first con) 'requires)
+                    (assoc {} :pre (vec (rest con)))
+                    (= (first con) 'ensures)
+                    (assoc {} :post (vec (rest con)))
+                    :else (throw (Exception. (str "Unknown tag " (first con)))))))
+     (list* 'f args))))
+
+(defn- kollect-bodies [forms]
+  (for [form (partition 3 forms)]
+    (build-kontract form)))
+
+(defmacro kontract [& forms]
+  (let [name (if (symbol? (first forms))
+               (first forms)
+               nil)
+        body (kollect-bodies (if name
+                               (rest forms)
+                               forms))]
+    (list* 'fn name body)))
+
+;; USAGE
+
+(comment
+  (def doubler
+       (kontract doubler
+         [x]
+         (requires
+          (pos? x))
+         (ensures
+          (= (* 2 x) %))))
+
+  (def times2 (partial doubler #(* 2 %)))
+  (times2 9)
+
+  (def times3 (partial doubler #(* 3 %)))
+  (times3 9)
+
+  (def doubler-kontract
+       (kontract doubler
+         [x]
+         (requires
+          (pos? x))
+         (ensures
+          (= (* 2 x) %))
+
+         [x y]
+         (requires
+          (pos? x)
+          (pos? y))
+         (ensures
+          (= (* 2 (+ x y)) %))))
+
+  ((partial doubler-kontract #(* 2 (+ %1 %2))) 2 3)
+
+  ((partial doubler-kontract #(+ %1 %1 %2 %2)) 2 3)
+
+  ((partial doubler-kontract #(* 3 (+ %1 %2))) 2 3))
+
+(filter identity [1 nil 2 nil 3 nil 4])
+(doc remove)


Fix entity-for-data so it returns an entity def, not an attribute

--- src/main/workflo/macros/entity.clj
+++ src/main/workflo/macros/entity.clj
@@ -93,17 +93,18 @@
 (def memoized-entity-attrs
   (memoize entity-attrs))

-(defn- entity-with-attr [attr]
+(defn entity-for-attr [attr]
   (some (fn [[_ entity]]
-          (some #{attr} (memoized-entity-attrs entity)))
+          (when (some #{attr} (memoized-entity-attrs entity))
+            entity))
         (registered-entities)))

-(def memoized-entity-with-attr
-  (memoize entity-with-attr))
+(def memoized-entity-for-attr
+  (memoize entity-for-attr))

 (defn entity-for-data [data]
   (some (fn [[attr _]]
-          (memoized-entity-with-attr attr))
+          (memoized-entity-for-attr attr))
         data))

 ;;;; The defentity macro


update clojure dependencies to latest

update clojure dependencies to latest

--- resources/project.clj
+++ resources/project.clj
@@ -4,10 +4,10 @@
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
   :dependencies [[org.clojure/clojure "1.7.0"]
-                 [org.clojure/clojurescript "0.0-3308"]
-                 [org.omcljs/om "0.8.8"]
+                 [org.clojure/clojurescript "1.7.122"]
+                 [org.omcljs/om "0.9.0"]
                  [org.omcljs/ambly "0.6.0"]]
-:plugins [[lein-cljsbuild "1.0.6"]]
+:plugins [[lein-cljsbuild "1.1.0"]]
 :cljsbuild {:builds {:dev {:source-paths ["src"]
                            :compiler {:output-to "target/out/main.js"
                                       :output-dir "target/out"


CMR-7093: Replaced concept_id with provider_id and granule_ur in status table.

--- ingest-app/src/cmr/ingest/migrations/011_create_granule_bulk_update_tables.clj
+++ ingest-app/src/cmr/ingest/migrations/011_create_granule_bulk_update_tables.clj
@@ -25,12 +25,13 @@
   (h/sql
    (str "CREATE TABLE CMR_INGEST.bulk_update_gran_status ("
         "TASK_ID VARCHAR2(255) NOT NULL, "
-        "CONCEPT_ID VARCHAR2(255) NOT NULL, "
+        "PROVIDER_ID  VARCHAR2(10) NOT NULL, "
+        "GRANULE_UR VARCHAR2(250) NOT NULL, "
         "INSTRUCTION VARCHAR2(4000) NOT NULL, "
         "UPDATED_AT TIMESTAMP WITH TIME ZONE DEFAULT SYSTIMESTAMP NOT NULL, "
         "STATUS VARCHAR2(20), "
         "STATUS_MESSAGE VARCHAR2(2000), "
-        "CONSTRAINT bugs_pk PRIMARY KEY (TASK_ID,CONCEPT_ID), "
+        "CONSTRAINT bugs_pk PRIMARY KEY (TASK_ID, PROVIDER_ID, GRANULE_UR), "
         "CONSTRAINT bugs_fk FOREIGN KEY (TASK_ID) "
         "REFERENCES CMR_INGEST.granule_bulk_update_tasks(TASK_ID) "
         "ON DELETE CASCADE)"))


Add error logging to requests.

Add error logging to requests.

--- src/ontrail/core.clj
+++ src/ontrail/core.clj
@@ -31,14 +31,18 @@
       action
       (json-response {"error" "Authentication required"} 401))))

+(defn catch-exceptions [handler]
+  (fn [req]
+    (try
+      (handler req)
+      (catch Exception e
+        (.error logger (str "Exception in handler:\n%s" (strp/pst-str e)))))))
+
 (defn log-and-wrap-dir-index [handler]
   (fn [req]
     (.info request-logger (str "HTTP" (to-logline req)))
-    (try
-      (handler
-        (update-in req [:uri] #(if (= "/" %) "/index.html" %)))
-      (catch Exception e
-        (.error logger (str "Exception in handler:\n%s" (strp/pst-str e)))))))
+    (handler
+      (update-in req [:uri] #(if (= "/" %) "/index.html" %)))))

 (defroutes app-routes
   (GET "/rest/v1/summary/:user" [user] (json-response (get-overall-summary user)))
@@ -69,7 +73,8 @@

 (defn -main [& args]
   (rebuild-index) ;; builds in-memory index for fast searches
-  (start-http-server (-> app-routes
+  (start-http-server (-> catch-exceptions
+                         app-routes
                          handler/site
                          wrap-cookies
                          log-and-wrap-dir-index


test with ubuntu_large DB

test with ubuntu_large DB

--- src/pg_demo/core.clj
+++ src/pg_demo/core.clj
@@ -13,12 +13,21 @@
   (:import java.util.TimeZone)
   (:gen-class))

-(def ora-spec
-  { :classname    "oracle.jdbc.OracleDriver"  ; must be in classpath
-    :subprotocol  "oracle"
-    :subname      "thin:@//10.100.6.231:1521/pvram"
-    :user         "mart_user_bkp"
-    :password     "rxlogix" } )
+(def large-db true)
+
+(if large-db
+  (def ora-spec
+    { :classname    "oracle.jdbc.OracleDriver"  ; must be in classpath
+      :subprotocol  "oracle"
+      :subname      "thin:@//10.100.6.231:1521/pvram"
+      :user         "mart_user_bkp"
+      :password     "rxlogix" } )
+  (def ora-spec
+    { :classname    "oracle.jdbc.OracleDriver"  ; must be in classpath
+      :subprotocol  "oracle"
+      :subname      "thin:@//10.100.6.231:1521/pvram"
+      :user         "mart_user"
+      :password     "rxlogix" } ))

 (def pg-spec
   { :classname    "org.postgresql.Driver"
@@ -51,10 +60,11 @@
             (apply jdbc/insert! pg-conn tbl-name-str rows-chunk-new  )))))))

 (defn oracle-set-context [ora-conn]
-  (jdbc/execute! ora-conn
-    [ "begin
-         pkg_rls.set_context('admin', '1','ARGUS_MART', '#$!AgSeRvIcE@SaFeTy');
-       end; " ] ))
+  (when-not large-db
+    (jdbc/execute! ora-conn
+      [ "begin
+           pkg_rls.set_context('admin', '1','ARGUS_MART', '#$!AgSeRvIcE@SaFeTy');
+         end; " ] )))

 (defn oracle-init []
   (newline)


unlinking faq/n pages from faqs block titles


Add test for `with-handler`.

Add test for `with-handler`.

--- test/active/clojure/monad_test.cljc
+++ test/active/clojure/monad_test.cljc
@@ -169,6 +169,16 @@
                                             "what's your last name?" "Sperber"})
                                           (ex3)))))

+(deftest with-handler-state
+  (is (= [nil {::with-handler-state true}]
+         (run-free-reader-state-exception (null-monad-command-config nil nil)
+                                          (monadic
+                                           (with-handler
+                                             (fn [exn]
+                                               (put-state-component! ::with-handler-state true))
+                                             (monadic
+                                              (free-throw 'something))))))))
+
 (deftest test-and-finally
   (is (= [(make-exception-value "It's Mike") {::output ["Hello"]}]
          (run-free-reader-state-exception (run-ask-tell-config


CMR-2027: Add integration test

CMR-2027: Add integration test

--- system-int-test/test/cmr/system_int_test/search/collection_psa_search_test.clj
+++ system-int-test/test/cmr/system_int_test/search/collection_psa_search_test.clj
@@ -998,3 +998,48 @@
     ["[\"foo\"] is an invalid value for type [float]"
      "[\"1.42\"] is an invalid value for type [float]"]))

+(deftest dif-extended-metadata-test
+  (let [dif9-coll (d/ingest-concept-with-metadata-file
+                    "PROV1" :collection :dif
+                    "data/dif/sample_collection_with_extended_metadata.xml")
+        ;; TODO - add DIF10 sample
+        ; dif10-coll (d/ingest-concept-with-metadata-file
+        ;        "PROV1" :collection :dif10
+        ;        "data/dif10/sample_collection_with_extended_metadata.xml")
+        ]
+    (index/wait-until-indexed)
+
+    (testing "search for extended metadata fields"
+      (util/are2
+        [items search]
+        (let [condition {:attribute search}]
+          (d/refs-match? items (search/find-refs-with-json-query :collection {} condition)))
+
+        "By group"
+        [dif9-coll] {:group "gov.nasa.gsfc.gcmd"}
+
+        "By group - pattern"
+        [dif9-coll] {:group "*gcmd" :pattern true}
+
+        "By name - link_notification.contact"
+        [dif9-coll] {:name "link_notification.contact"}
+
+        "By name - metadata.extraction_date"
+        [dif9-coll] {:name "metadata.extraction_date"}
+
+        "By name - metadata.keyword_version"
+        [dif9-coll] {:name "metadata.keyword_version"}
+
+        "By name - pattern"
+        [dif9-coll] {:name "meta??ta*" :pattern true}
+
+         "By value - string"
+        [dif9-coll] {:name "metadata.extraction_date" :type "string" :value "2015-05-21 15:58:46"}
+
+        ;; TODO - Figure out why exact match is failing
+        ; "By value - float"
+        ; [dif9-coll] {:name "metadata.keyword_version" :value 8.1 :type "float"}
+
+        "By range - float"
+        [dif9-coll] {:name "metadata.keyword_version" :min_value 8.0 :type "float"}))))
+


fixed merge conflict

fixed merge conflict

--- test/forma/trends/analysis_test.clj
+++ test/forma/trends/analysis_test.clj
@@ -126,8 +126,6 @@
  series with a constructed, short-term break"
  (- (hansen-stat (shift-down-end ndvi))
     (hansen-stat ndvi)) => pos?)
-<<<<<<< HEAD
-=======

 (facts
  "test that the magnitude of the short-term drop of the
@@ -142,4 +140,3 @@
  ""
  (telescoping-short-trend 140 142 23 30 10 ndvi reli)
  => [-63.86454150922382 -63.80705626756505 -63.757505861590836])
->>>>>>> dan-work


removing unit test for api endpoint that no longer exists.

--- test/metabase/api/database_test.clj
+++ test/metabase/api/database_test.clj
@@ -20,28 +20,6 @@
                                                             :port   5432
                                                             :dbname "fakedb"
                                                             :user   "cam"}}))
-
-;; # FORM INPUT
-
-;; ## GET /api/database/form_input
-(expect
-    {:engines   (into {} (for [[driver info] @driver/available-drivers]
-                           {driver (-> info
-                                       (update :details-fields (partial map (fn [field]
-                                                                              (cond-> field
-                                                                                (:type field) (update :type name)))))
-                                       (update :features (partial map name)))}))
-     :timezones ["GMT"
-                 "UTC"
-                 "US/Alaska"
-                 "US/Arizona"
-                 "US/Central"
-                 "US/Eastern"
-                 "US/Hawaii"
-                 "US/Mountain"
-                 "US/Pacific"
-                 "America/Costa_Rica"]}
-    ((user->client :crowberto) :get 200 "database/form_input"))

 ;; # DB LIFECYCLE ENDPOINTS


fix bug in ordered-pair-destructure

fix bug in ordered-pair-destructure

--- src/setbang/core.clj
+++ src/setbang/core.clj
@@ -78,8 +78,10 @@
    (set?    x) (empty? x)
    :else       (empty? x)))

+(declare card)
 (defn choose-many [x n]
-  (let [s (if (number? x) (into #{} (range x)) x)]
+  (let [n (card n)
+        s (if (number? x) (into #{} (range x)) x)]
     (loop [remt s out #{} i 0]
       (if (or (>= i n) (is-empty-set remt))
         [(normalize remt) (normalize out)]
@@ -210,14 +212,19 @@
 (defn ordered-pair [x y]
   (normalize (hash-set (hash-set x) (hash-set x y))))

+(defn elt [x]
+  (cond (= x 0) 0
+        (= x 1) 0
+        :else (first x)))
+
 (defn ordered-pair-destructure [x]
-  (let [s (if (number? x) (into #{} (range x)) x)]
+  (let [s (as-set x)]
     (cond
      (empty? s) [0 0]
-     (= (count s) 1) [(first s) (first s)]
-     :else (let [[v w] (take 2 s)]
-             [(first (gen-intersect-2 v w))
-              (first (exclusive-or-2 v w))]))))
+     (= (count s) 1) [(elt (first s)) (elt (first s))]
+     :else (let [[v w] (map as-set (take 2 s))]
+             [(elt (gen-intersect-2 v w))
+              (elt (exclusive-or-2 v w))]))))

 (defn left-pad [size stack]
   (into [] (concat (repeat (- size (count stack)) 0) stack)))
@@ -257,8 +264,25 @@

 (declare run-code)

+;; This is important because we want to split conditional blocks only on
+;; top-level ,.  We don't want to split "(0(,),)" as: ["0(," "),)"]. That gives
+;; us two illegal code blocks.
+(defn split-if-legal [code]
+  (loop [i 0 cnt 0]
+    (if (>= i (count code))
+      [code ""] ; no split detected
+      (let [ch (.charAt code i)]
+        (case ch
+          \( (recur (inc i) (inc cnt))
+          \) (recur (inc i) (dec cnt))
+          \, (if (= cnt 0)
+               [(.substring code 0 i) (.substring code (inc i))]
+               (recur (inc i) cnt))
+          (recur (inc i) cnt))))))
+
 (defn conditionally-run-code [stack code]
-  (let [[then-code else-code] (clj-string/split code #",")
+  ;; this is wrong!!!
+  (let [[then-code else-code] (split-if-legal code)
         else-code (or else-code "")
         bool (is-empty-set (last stack))]
     (if bool


glsl shader and cleanup

glsl shader and cleanup

--- src/splash/core.cljs
+++ src/splash/core.cljs
@@ -68,6 +68,9 @@

 )

+;;
+;; font preloader channel
+;;
 (defonce render! (go
                    (<! (events/wait-time 1500))
                    (sprite/set-pos! dummy-text -100000 -10000)
@@ -78,8 +81,63 @@
                    (<! (events/next-frame))))

+;;
+;; experimental shaders
+;;
+
+#_ (deftype TestFilter [passes shaders dirty padding uniforms fragmentSrc]
+  PIXI/AbstractFilter)
+
+(defn make-test []
+  (let [f
+        (PIXI/AbstractFilter.
+         #js [
+              "
+precision mediump float;
+varying vec2 vTextureCoord;
+varying vec4 vColor;
+uniform sampler2D uSampler;
+uniform float time;
+
+float hash2(vec2 uv) {
+    return fract(sin(uv.x * 15.78 + uv.y * 35.14) * 43758.23);
+}
+
+void main( void ) {
+    vec4 col = texture2D(uSampler, vTextureCoord);
+
+    float r=col.r;
+    float g=col.g;
+    float b=col.b;
+
+    // magenta?
+    bool mag = ((r-b)<0.1) && r>0.1;
+
+    if(mag)
+    {
+         //gl_FragColor = vec4(vTextureCoord.x, vTextureCoord.y, 0.5, 1.0);
+         float c = hash2(gl_FragCoord.xy * time);
+         gl_FragColor = vec4(c,c,c,1.0) * r;
+    }
+    else
+    {
+        //gl_FragColor = vec4(hash2(gl_FragCoord.xy * time), time, 0.0, 0.3);
+        gl_FragColor = col; //vec4(0.0,0.0,0.0,0.0);
+    }
+}
+"]
+         #js {"time" #js {"type" "1f" "value" 0.0}})]
+    (go
+      (loop [frame 0]
+        (<! (events/next-frame))
+        (set! (.-uniforms.time.value f) (/ frame 1000))
+        (recur (inc frame))))
+    f))
+
+
 (defn main []
   (go
+    ;; load assets with loader bar
     (<! (resources/load-resources
          (-> canvas :layer :ui)
          [
@@ -96,20 +154,29 @@
          :fade-in 0.2
          :fade-out 0.5))

+    ;; wait for fonts to be ready
     (<! render!)

+    ;;
+    ;; bouncing name
+    ;;
     (sprite/set-alpha! test-text 0.0)
     (sprite/set-scale! test-text 6)
+    (set! (.-filters test-text) #js [(make-test)])
     (.addChild (-> canvas :layer :ui) test-text)
     (resources/fadein test-text :duration 5)
     (go (loop [n 0]
           (let [h (.-innerHeight js/window)
                 hh (/ h 2)
                 qh (/ h 4)]
-            (sprite/set-pos! test-text 0 (+ 200 (- (* 0.6 qh (Math/sin (* 0.04 n))) qh))))
+            (sprite/set-pos! test-text 0 (+ 200 (- (* 0.6 qh (Math/sin (* 0.04 n))) qh))
+                             ))
           (<! (events/next-frame))
           (recur (inc n))))

+    ;;
+    ;; scrolling message
+    ;;
     (sprite/set-scale! scroll-text 4)
     (.addChild (-> canvas :layer :ui) scroll-text)
     (go (loop [n -3200]
@@ -120,6 +187,9 @@
           (<! (events/next-frame))
           (recur (if (> n 3200) -3200 (inc n)))))

+    ;;
+    ;; parallax stars
+    ;;
     (let [scale [4 4]
           text (resources/get-texture :stars :nearest)
           stars (for [[x y] [[16 8] [8 8] [16 0] [8 0] [0 0] ;[24 0]
@@ -161,32 +231,9 @@
                        (inc c)
                        ))))

-        ;(macros/with-font )
-
         ;; wait forever
         (loop []
           (<! (events/next-frame))
-          (recur))
-
-        (<! (events/wait-time 15000))
-
-
-        ;(doseq [s sprs] (resources/fadeout s :duration 10))
-        (<! (events/wait-time 15000))))
-
-    (macros/with-sprite canvas :stars
-      [spr (sprite/make-sprite
-
-            (texture/sub-texture
-             (resources/get-texture :stars :nearest)
-             [0 0] [8 8])
-
-            :scale [4 4]
-            :alpha 0.0)]
-
-      (<! (resources/fadein spr :duration 0.5))
-      (<! (events/wait-time 2000))
-      (<! (resources/fadeout spr :duration 0.5)))))
-
+          (recur))))))

 (main)


fix #532

fix #532

--- src/status_im/components/status.cljs
+++ src/status_im/components/status.cljs
@@ -91,7 +91,7 @@
   [hash password callback]
   (log/debug :complete-transaction (boolean status) hash password)
   (when status
-    (call-module #(.completeTransaction status hash password callback))))
+    (call-module #(.completeTransaction status (str hash) password callback))))

 (defn discard-transaction
   [id]


handle :refer + :rename properly

handle :refer + :rename properly

need to clear out the :refer if its renamed

fixes #653

--- src/main/shadow/build/ns_form.clj
+++ src/main/shadow/build/ns_form.clj
@@ -312,44 +312,54 @@
       ;; merge cause there can be (:require ["react"]) and (:import ["react" Component])
       (update-in [:js-deps lib] merge opts)))

+(defn remove-entry [syms sym-to-remove]
+  (->> syms
+       (remove sym-to-remove)
+       (vec)))
+
 (defn process-symbol-require
   [ns-info lib {:keys [js as default refer refer-macros include-macros import rename only] :as opts-m}]

   ;; FIXME: remove this, just a sanity check since the first impl was incorrect
   (assert (not (contains? opts-m :imports)))

-  (-> ns-info
-      (add-dep lib)
-      (merge-require :requires lib lib)
-      (cond->
-        as
-        (merge-require :requires as lib)
-
-        default
-        (update :renames assoc default (symbol (str lib) "default"))
-
-        import
-        (-> (merge-require :imports import lib)
-            (merge-require :requires import lib))
-
-        (or include-macros (seq refer-macros))
-        (-> (merge-require :require-macros lib lib)
-            (cond->
-              as
-              (merge-require :require-macros as lib))))
-      (reduce->
-        (merge-require-fn :uses lib)
-        refer)
-      (reduce->
-        (merge-require-fn :use-macros lib)
-        refer-macros)
-      (reduce-kv->
-        (fn [ns-info rename-to rename-from]
-          (update ns-info :renames assoc rename-from (symbol (str lib) (str rename-to))))
-        rename)
-      (reduce->
-        (merge-require-fn :uses lib)
-        only)))
+  ;; :refer (f) :rename {f other-f} should clear out the :refer (f) since its no longer accessible
+  (let [rename-syms (set (keys rename))
+        refer (remove-entry refer rename-syms)
+        refer-macros (remove-entry refer-macros rename-syms)]
+
+    (-> ns-info
+        (add-dep lib)
+        (merge-require :requires lib lib)
+        (cond->
+          as
+          (merge-require :requires as lib)
+
+          default
+          (update :renames assoc default (symbol (str lib) "default"))
+
+          import
+          (-> (merge-require :imports import lib)
+              (merge-require :requires import lib))
+
+          (or include-macros (seq refer-macros))
+          (-> (merge-require :require-macros lib lib)
+              (cond->
+                as
+                (merge-require :require-macros as lib))))
+        (reduce->
+          (merge-require-fn :uses lib)
+          refer)
+        (reduce->
+          (merge-require-fn :use-macros lib)
+          refer-macros)
+        (reduce-kv->
+          (fn [ns-info var-to-rename rename-sym]
+            (update ns-info :renames assoc rename-sym (symbol (str lib) (str var-to-rename))))
+          rename)
+        (reduce->
+          (merge-require-fn :uses lib)
+          only))))

 (defn process-require [ns-info lib opts]
   (if (string? lib)


Remove clojure 1.5 and 1.6 proofiles from tests.

Because of test.check.

--- profiles.clj
+++ profiles.clj
@@ -1,14 +1,11 @@
 {:dev
- {:aliases {"test-all" ["with-profile" "dev,1.7:dev,1.6:dev,1.5:dev" "test"]}
+ {:aliases {"test-all" ["with-profile" "dev,1.7:dev" "test"]}
   :dependencies [[com.nimbusds/nimbus-jose-jwt "4.13.1"]]
-
   :codeina {:sources ["src"]
             :reader :clojure
             :target "doc/dist/latest/api"
             :src-uri "http://github.com/funcool/buddy-core/blob/master/"
             :src-uri-prefix "#L"}
-  :plugins [[funcool/codeina "0.3.0"]
+  :plugins [[funcool/codeina "0.4.0"]
             [lein-ancient "0.6.10"]]}
- :1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]}
- :1.5 {:dependencies [[org.clojure/clojure "1.5.1"]]}
  :1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]}}


Add test under clojure 1.8

Add test under clojure 1.8

--- profiles.clj
+++ profiles.clj
@@ -1,5 +1,6 @@
 {:dev
- {:dependencies [[org.clojure/tools.namespace "0.2.11"]
+ {:aliases {"test-all" ["with-profile" "dev,1.8:dev" "test"]}
+  :dependencies [[org.clojure/tools.namespace "0.2.11"]
                  [criterium "0.4.3"]]
   :source-paths ["dev"]
   :codeina {:sources ["src"]
@@ -9,6 +10,7 @@
             :src-uri-prefix "#L"}
   :plugins [[funcool/codeina "0.3.0"]
             [lein-ancient "0.6.7" :exclusions [org.clojure/tools.reader]]]}
+ :1.8 {:dependencies [[org.clojure/clojure "1.8.0-RC4"]]}
  :bench
  [:dev
   {:main ^:skip-aot benchmarks


Make sure test fails if 1.x not available

--- integration-tests/apps/xa-old-jdbc/immutant.clj
+++ integration-tests/apps/xa-old-jdbc/immutant.clj
@@ -1,7 +1,8 @@
 (ns xa.init
   (:require [immutant.xa :as xa]
             [immutant.web :as web]
-            [clojure.java.jdbc :as sql]))
+            [clojure.java.jdbc :as sql]
+            clojure.java.jdbc.internal)) ; ensure project dep wins

 (defonce ds (xa/datasource "foo" {:adapter "h2" :database "mem:foo"}))
 (def spec {:datasource ds})


CMR-332: Added day-night flag to UMM granule model.

--- test/cmr/umm/test/echo10/granule.clj
+++ test/cmr/umm/test/echo10/granule.clj
@@ -43,6 +43,7 @@
     </Collection>
     <DataGranule>
       <ProducerGranuleId>0000000.0000001.hdf</ProducerGranuleId>
+      <DayNightFlag>NIGHT</DayNightFlag>
     </DataGranule>
     <Orderable>true</Orderable>
     <Temporal>
@@ -131,7 +132,8 @@
                     :collection-ref (umm-g/map->CollectionRef
                                       {:entry-title "R1_SCANSAR_FRAME"})
                     :data-granule (umm-g/map->DataGranule
-                                    {:producer-gran-id "0000000.0000001.hdf"})
+                                    {:producer-gran-id "0000000.0000001.hdf"
+                                     :day-night "NIGHT"})
                     :project-refs ["Short Name-240" "Short Name-241"]
                     :cloud-cover 0.8
                     :temporal


Tests for function get-started-on-ms

Tests for function get-started-on-ms

--- test/emender_jenkins/config_test.clj
+++ test/emender_jenkins/config_test.clj
@@ -478,6 +478,23 @@
             (get-started-on-str {:configuration nil})               nil
             (get-started-on-str {:configuration nil})               nil)))

+(deftest test-get-started-on-ms-1
+    "Check the behaviour of function emender-jenkins.config/get-started-on-ms."
+    (testing "the behaviour of function emender-jenkins.config/get-started-on-ms."
+        (are [x y] (= x y)
+            (get-started-on-ms {:configuration {:started-ms nil}})   nil
+            (get-started-on-ms {:configuration {:started-ms false}}) false
+            (get-started-on-ms {:configuration {:started-ms true}})  true
+            (get-started-on-ms {:configuration {:started-ms 12345}}) 12345)))
+
+(deftest test-get-started-on-ms-2
+    "Check the behaviour of function emender-jenkins.config/get-started-on-ms."
+    (testing "the behaviour of function emender-jenkins.config/get-started-on-ms."
+        (are [x y] (= x y)
+            (get-started-on-ms {:configuration {:started-ms nil}}) nil
+            (get-started-on-ms {:configuration nil})               nil
+            (get-started-on-ms {:configuration nil})               nil)))
+
 (deftest test-override-options-by-cli-1
     "Check the behaviour of function emender-jenkins.config/override-options-by-cli."
     (testing "the behaviour of function emender-jenkins.config/override-options-by-cli."


added whitelist to auto-funcification

added whitelist to auto-funcification

--- src/trammel/core.clj
+++ src/trammel/core.clj
@@ -11,7 +11,8 @@
 ; agreeing to be bound by the terms of this license.  You must not
 ; remove this notice, or any other, from this software.
 (ns trammel.core
-  "The core contracts programming functions and macros for Trammel.")
+  "The core contracts programming functions and macros for Trammel."
+  (:use trammel.factors))

 ;; # base functions and macros

@@ -54,6 +55,7 @@
 (defmethod funcify* :default                [e args] (case (first e)
                                                        'or (list* 'or (funcify args (rest e)))
                                                        'in (concat (list* 'in args) (rest e))
+                                                       'whitelist (concat (list* 'whitelist args) (rest e))
                                                        e))

 (defn- funcify


Use prefered tuple structure in matrixify example.

--- examples/parkour/example/matrixify.clj
+++ examples/parkour/example/matrixify.clj
@@ -30,9 +30,9 @@
   (let [red (conf/get-long mr/*context* "mapred.task.partition" -1)]
     (tr/mapcat-state (fn [i odims-vals]
                        [(inc i) (if (identical? ::finished odims-vals)
-                                  [[:counts red i]]
+                                  [[:counts [red i]]]
                                   (map (fn [[odim val]]
-                                         [:data odim [[red i] val]])
+                                         [:data [odim [[red i] val]]])
                                        odims-vals))])
                      0 (r/mapcat identity [coll [::finished]]))))


Add cljs-devtools to todomvc

Add cljs-devtools to todomvc

--- examples/todomvc/src/todomvc/core.cljs
+++ examples/todomvc/src/todomvc/core.cljs
@@ -6,11 +6,15 @@
             [secretary.core :as secretary]
             [todomvc.handlers]
             [todomvc.subs]
-            [todomvc.views])
+            [todomvc.views]
+            [devtools.core :as devtools])
   (:import [goog History]
            [goog.history EventType]))

+;; debugging aids
+;; we love https://github.com/binaryage/cljs-devtools
+(devtools/install!)
 (enable-console-print!)

 ;; -- Routes and History ------------------------------------------------------


Change comment

Change comment

--- examples/todomvc/src/todomvc/core.cljs
+++ examples/todomvc/src/todomvc/core.cljs
@@ -12,9 +12,8 @@
            [goog.history EventType]))

-;; debugging aids
-;; we love https://github.com/binaryage/cljs-devtools
-(devtools/install!)
+;; -- Debugging aids ----------------------------------------------------------
+(devtools/install!)     ;; we love https://github.com/binaryage/cljs-devtools
 (enable-console-print!)

 ;; -- Routes and History ------------------------------------------------------


Fix expires (#264)

Fix expires (#264)

* Fix java.util.Date in :expires

as this delegates directly to joda time's .format, you need to have it
as a joda date-time first.

* Fix :else/duration in :expires in cookies

--- src/yada/cookies.clj
+++ src/yada/cookies.clj
@@ -50,9 +50,9 @@

                :expires
                (format "; %s=%s" (set-cookie-attrs k)
-                       (cond (inst? v) (tf/unparse (tf/formatters :rfc822) v)
+                       (cond (inst? v) (tf/unparse (tf/formatters :rfc822) (time/to-date-time v))
                              (string? v) v
-                             (instance? java.time.Duration) (tf/unparse (tf/formatters :rfc822) (time/from-date (java.util.Date/from (.plus (java.time.Instant/now) v))))
+                             (instance? java.time.Duration v) (tf/unparse (tf/formatters :rfc822) (time/from-date (java.util.Date/from (.plus (java.time.Instant/now) v))))
                              :else (str v)))

                (format "; %s=%s" (set-cookie-attrs k) v))))))


Multiple calls to a function are perfectly fine.

--- test/midje/semi_sweet_test.clj
+++ test/midje/semi_sweet_test.clj
@@ -57,7 +57,7 @@
 (def reportX) ;; so you can easily see real reports.
 (defmacro one-case
   ([description]
-   `(println "Pending:"  ~description))
+   `(println "PENDING:"  ~description))
   ([description expect-form & check-forms]
    (let [form-is-expect? (fn [form] (and (seq? form)
 					 (= (first form) 'expect)))]
@@ -128,5 +128,7 @@
      (is (last-type? :mock-incorrect-call-count))
      (is (only-one-result?)))

-  (one-case "multiple calls to a mocked function are perfectly fine")
+  (one-case "multiple calls to a mocked function are perfectly fine"
+     (expect (+ (mocked-function 12) (mocked-function 12)) => 2
+	     [ (fake (mocked-function 12) => 1) ]))
 )


Refactoring

Refactoring

--- jvm-runner/src/clojure/codewars/runner/java.clj
+++ jvm-runner/src/clojure/codewars/runner/java.clj
@@ -1,7 +1,7 @@
 (ns codewars.runner
   (:require [codewars.runner :refer [run]]
             [clojure.java.io :as io]
-            [codewars.util :as util])
+            [codewars.util :refer [write-code!]])
   (:import [codewars.java TempDir]
            [java.net URLClassLoader]
            [javax.tools ToolProvider]
@@ -32,14 +32,17 @@
     (.addListener runner (CwRunListener.))
     (.run runner (into-array [fixture-class]))))

+(defn- file-names [files]
+  (for [{:keys [:file-name]} files
+        :when (not (nil? file-name))]
+    file-name))
+
 (defmethod solution-only "java"
   [{:keys [:setup :solution]}]
   (let [dir (TempDir/create "java")
-        setup (when (not (empty? setup)) (util/write-code! "java" dir setup))
-        solution (util/write-code! "java" dir solution)
-        files (for [{:keys [:file-name]} [setup solution]
-                    :when (not (nil? file-name))]
-                file-name)]
+        setup (when (not (empty? setup)) (write-code! "java" dir setup))
+        solution (write-code! "java" dir solution)
+        files (file-names [setup solution])]
     (apply compile! files)
     (-> solution
         :class-name
@@ -50,11 +53,9 @@
 (defmethod full-project "java"
   [{:keys [:fixture :setup :solution]}]
   (let [dir (TempDir/create "java")
-        fixture (util/write-code! "java" dir fixture)
-        setup (when (not (empty? setup)) (util/write-code! "java" dir setup))
-        solution (util/write-code! "java" dir solution)
-        files (for [{:keys [:file-name]} [fixture setup solution]
-                    :when (not (nil? file-name))]
-                file-name)]
+        fixture (write-code! "java" dir fixture)
+        setup (when (not (empty? setup)) (write-code! "java" dir setup))
+        solution (write-code! "java" dir solution)
+        files (file-names [fixture setup solution])]
     (apply compile! files)
     (->> fixture :class-name (load-class dir) run-junit-tests)))


kill only active instances when deleting services in shell scheduler (#111)

--- waiter/src/waiter/shell_scheduler.clj
+++ waiter/src/waiter/shell_scheduler.clj
@@ -244,6 +244,11 @@
       (deliver completion-promise :failed)
       id->service)))

+(defn active?
+  "Returns true if the given instance is considered active"
+  [instance]
+  (not (:killed instance)))
+
 (defn- delete-service
   "Deletes the service corresponding to service-id and returns the updated id->service map"
   [id->service service-id port->reservation-atom port-grace-period-ms completion-promise]
@@ -252,7 +257,9 @@
       (do
         (log/info "deleting service" service-id)
         (let [{:keys [id->instance]} (get id->service service-id)]
-          (dorun (pc/map-vals #(kill-process! % port->reservation-atom port-grace-period-ms) id->instance)))
+          (doseq [[_ instance] id->instance]
+            (when (active? instance)
+              (kill-process! instance port->reservation-atom port-grace-period-ms))))
         (deliver completion-promise :deleted)
         (dissoc id->service service-id))
       (do
@@ -263,11 +270,6 @@
       (log/error e "error attempting to delete service" service-id)
       (deliver completion-promise :failed)
       id->service)))
-
-(defn active?
-  "Returns true if the given instance is considered active"
-  [instance]
-  (not (:killed instance)))

 (defn- healthy?
   "Returns true if the given instance is healthy (and active)"


CMR-5079: Change test name.

CMR-5079: Change test name.

--- system-int-test/test/cmr/system_int_test/ingest/granule_ingest_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/granule_ingest_test.clj
@@ -532,32 +532,31 @@
          (is (= 201 status))
          (is (= nil errors))))))

-(deftest old-delete-time-granule-ingest-test
-  (testing "DeleteTime validation"
-    (let [collection (d/ingest-umm-spec-collection
-                      "PROV1"
-                      (data-umm-c/collection 1 {}))]
-      (testing "DeleteTime in past results in validation error"
-        (let [granule (dg/granule-with-umm-spec-collection
-                       collection
-                       (:concept-id collection)
-                       {:granule-ur "gran1"
-                        :data-provider-timestamps {:delete-time "2000-01-01T00:00:00Z"}})
-              {:keys [status errors]} (d/ingest "PROV1"
-                                                granule
-                                                {:format :umm-json
-                                                 :allow-failure? true})]
-          (is (= 422 status))
-          (is (= ["DeleteTime 2000-01-01T00:00:00.000Z is before the current time."]
-                 errors))))
-      (testing "DeleteTime in future is successful"
-        (let [granule (dg/granule-with-umm-spec-collection
-                       collection
-                       (:concept-id collection)
-                       {:granule-ur "gran2"
-                        :data-provider-timestamps {:delete-time "2100-01-01T00:00:00Z"}})
-              response (d/ingest "PROV1" granule {:format :umm-json})]
-          (is (= 201 (:status response))))))))
+(deftest delete-time-granule-ingest-test
+  (let [collection (d/ingest-umm-spec-collection
+                    "PROV1"
+                    (data-umm-c/collection 1 {}))]
+    (testing "DeleteTime in past results in validation error"
+      (let [granule (dg/granule-with-umm-spec-collection
+                     collection
+                     (:concept-id collection)
+                     {:granule-ur "gran1"
+                      :data-provider-timestamps {:delete-time "2000-01-01T00:00:00Z"}})
+            {:keys [status errors]} (d/ingest "PROV1"
+                                              granule
+                                              {:format :umm-json
+                                               :allow-failure? true})]
+        (is (= 422 status))
+        (is (= ["DeleteTime 2000-01-01T00:00:00.000Z is before the current time."]
+               errors))))
+    (testing "DeleteTime in future is successful"
+      (let [granule (dg/granule-with-umm-spec-collection
+                     collection
+                     (:concept-id collection)
+                     {:granule-ur "gran2"
+                      :data-provider-timestamps {:delete-time "2100-01-01T00:00:00Z"}})
+            response (d/ingest "PROV1" granule {:format :umm-json})]
+        (is (= 201 (:status response)))))))

 (deftest ingest-umm-g-granule-test
   (let [collection (d/ingest-umm-spec-collection


Update synth-designs.clj to reflect latest synthdefs

--- etc/synthdefs/synth-designs.clj
+++ etc/synthdefs/synth-designs.clj
@@ -234,14 +234,14 @@
 (do

   (defsynth mono-player
-    [buf 0 rate 1 out-bus 0 loop 0]
+    [buf 0 rate 1 out-bus 0 amp 1 loop 0]
     (let [rate (* rate (buf-rate-scale buf ))]
-      (out out-bus (play-buf 1 buf rate :loop loop :action FREE))))
+      (out out-bus (* amp (play-buf 1 buf rate :loop loop :action FREE)))))

   (defsynth stereo-player
-    [buf 0 rate 1 out-bus 0 loop 0]
+    [buf 0 rate 1 out-bus 0 amp 1 loop 0]
     (let [rate (* rate (buf-rate-scale buf ))]
-      (out out-bus (play-buf 2 buf rate :loop loop :action FREE))))
+      (out out-bus (* amp (play-buf 2 buf rate :loop loop :action FREE)))))

   (defsynth mono-partial-playr
     "Plays a mono buffer from start pos to end pos (represented as


Removed redundant prefix declarations

Removed redundant prefix declarations

--- resources/rules/_0_pre_identifier_merge/_1_post_ice_rdf_load/step_c_other_ice_gen/step_cb_reactome_add_base_type_biopax_fields_1_as_ice/add_small_molecule_record_names_from_human_reactome_to_ice_step_b1.clj
+++ resources/rules/_0_pre_identifier_merge/_1_post_ice_rdf_load/step_c_other_ice_gen/step_cb_reactome_add_base_type_biopax_fields_1_as_ice/add_small_molecule_record_names_from_human_reactome_to_ice_step_b1.clj
@@ -15,8 +15,6 @@
 PREFIX bp3: <http://www.reactome.org/biopax/63/48887#>
 PREFIX kice: <http://ccp.ucdenver.edu/kabob/ice/>
 PREFIX kbio: <http://ccp.ucdenver.edu/kabob/bio/>
-PREFIX kice: <http://ccp.ucdenver.edu/kabob/ice/>
-PREFIX kbio: <http://ccp.ucdenver.edu/kabob/bio/>
 SELECT ?smmol_record ?name
 WHERE {
 ?smmol rdf:type bp:SmallMolecule .


Other minor fix.

Other minor fix.

--- src/apio/cli.clj
+++ src/apio/cli.clj
@@ -34,7 +34,6 @@
         wrapper (fn [c, m, d] (q/snd queue (task-generator d)))]
     wrapper))

-
 (defn -main
   [path & args]
   (core/with-config path


fix out of date check

fix out of date check

Signed-off-by: Chris Granger <5654cde260ae99bc4d30054171b8bcd902efd19a@gmail.com>

--- src/lt/objs/plugins.cljs
+++ src/lt/objs/plugins.cljs
@@ -289,10 +289,14 @@
          (select-keys deps unique)))
       seen)))

+
+(defn latest-version [plugin]
+  (get (:versions plugin) (keyword (:latest-version plugin))))
+
 (defn all-latest [plugins]
   (->> (dissoc plugins :__sha)
        (vals)
-       (map #(get (:versions %) (keyword (:latest-version %))))))
+       (map latest-version)))

 ;; (plugin->tar (:Rainbow (transitive-deps (:server-plugins @manager) ["Rainbow" "0.0.8"] {})))
 ;; (save-cache (build-cache))
@@ -531,7 +535,7 @@
                                     {:label "Cancel"}]})))

 (defui installed-plugin-ui [plugin]
-  (let [cached (-> @manager :server-plugins (get (:name plugin)) :latest-version)
+  (let [cached (-> @manager :server-plugins (get (keyword (:name plugin))) :latest-version)
         update? (when cached
                   (deploy/is-newer? (:version plugin) cached))]
     [:li {:class (if update?


Removed unused domain-schema requirement in domain.clj

--- main/src/dda/pallet/dda_backup_crate/domain.clj
+++ main/src/dda/pallet/dda_backup_crate/domain.clj
@@ -21,7 +21,6 @@
     [dda.config.commons.map-utils :as mu]
     [dda.config.commons.directory-model :as directory-model]
     [dda.pallet.commons.secret :as secret]
-    [dda.pallet.dda-backup-crate.domain.schema :as schema]
     [dda.pallet.dda-backup-crate.domain.backup-element-type :as element-type]
     [dda.pallet.dda-user-crate.domain :as user]
     [dda.pallet.dda-backup-crate.infra :as infra]


Splitted main into smaller functions.

Splitted main into smaller functions.

--- src/app/core.clj
+++ src/app/core.clj
@@ -29,6 +29,9 @@
 (load "linter")
 (load "cli")

+(def self-exclusive-modes-error
+  "Linter, interactive and query mode are self exclusive")
+
 (defn usageError [banner opts msg]
   (println (str "Incorrect usage: " msg))
   (when (:errors opts)
@@ -50,45 +53,59 @@
          (count)
          (< 1))))

-; TODO extract part of this method to cli
+
+;; The following methods have been extracted from the main function.
+;; These methods should probably be moved to a different namespace.
+
+(defn treat-possible-errors [opts banner]
+  (when (:errors opts)
+    (usageError banner opts ""))
+  (when (self-exclusive-modes? opts)
+    (usageError banner opts self-exclusive-modes-error)))
+
+(defn run-linter-mode [opts]
+  (when (not (:dir opts))
+    (info opts "Linter, no directory indicated. Using current directory")
+    (linter ".")
+    (System/exit 0))
+  (linter (:dir opts))
+  (System/exit 0))
+
+(defn run-interactive-mode []
+  (interactive {})
+  (System/exit 0))
+
+(defn show-help [banner]
+  (println "Printing help message, as asked")
+  (println banner)
+  (System/exit 0))
+
+(defn run-query-mode [opts banner]
+  (if
+    (and
+      (:dir opts)
+      (:query opts)
+      (name2operation (:query opts))
+      (nil? (:errors opts)))
+    (run opts)
+    ;; The following code block is very similar to the usageError function.
+    ;; Try to call that method to avoid repeating code.
+    (do
+      (println "Incorrect usage")
+      (when (:errors opts)
+        (doseq [e (:errors opts)]
+          (println " * " e)))
+      (println banner)
+      (System/exit 1))))
+
 (defn -main
-  "What I do"
   [& args]
   (let [optsMap (parse-opts args cliOpts)
         opts (:options optsMap)
         banner (:summary optsMap)]
-    (do
-      (when (:errors opts)
-        (usageError banner opts ""))
-      (when (self-exclusive-modes? opts)
-        (usageError banner opts "Linter, interactive and query mode are self exclusive"))
-      (when (:linter opts)
-        (when (not (:dir opts))
-          (info opts "Linter, no directory indicated. Using current directory")
-          (linter ".")
-          (System/exit 0))
-        (linter (:dir opts))
-        (System/exit 0))
-      (when (:interactive opts)
-        (do
-          (interactive {})
-          (System/exit 0)))
-      (when (:help opts)
-        (do
-          (println "Printing help message, as asked")
-          (println banner))
-        (System/exit 0))
-      (if
-        (and
-          (:dir opts)
-          (:query opts)
-          (name2operation (:query opts))
-          (nil? (:errors opts)))
-        (run opts)
-        (do
-          (println "Incorrect usage")
-          (when (:errors opts)
-            (doseq [e (:errors opts)]
-              (println " * " e)))
-          (println banner)
-          (System/exit 1))))))
+    (treat-possible-errors opts banner)
+    (cond
+      (:linter opts) (run-linter-mode opts)
+      (:interactive opts) (run-interactive-mode)
+      (:help opts) (show-help banner)
+      :else (run-query-mode opts banner))))


isolates the environment in which the metrics test run making them less susceptible to misbhaving tests elsewhere (#453)

--- waiter/test/waiter/metrics_test.clj
+++ waiter/test/waiter/metrics_test.clj
@@ -29,7 +29,7 @@
             [waiter.test-helpers :as test-helpers]
             [waiter.util.async-utils :as au]
             [waiter.util.utils :as utils])
-  (:import (com.codahale.metrics MetricFilter)
+  (:import (com.codahale.metrics MetricFilter MetricRegistry)
            (org.joda.time DateTime)))

 (deftest test-compress-strings
@@ -56,75 +56,70 @@
   (is (= '(.concat (.concat "a.b." c) ".d") (metric-name ["a" "b" 'c "d"])))
   (is (= '(.concat (.concat "a." b) ".c.d") (metric-name ["a" 'b "c" "d"]))))

+(def ^:private all-metrics-match-filter (reify MetricFilter (matches [_ _ _] true)))
+
+(defmacro with-isolated-registry
+  [& body]
+  `(with-redefs [mc/default-registry (MetricRegistry.)]
+     (.removeMatching mc/default-registry all-metrics-match-filter)
+     (do ~@body)
+     (.removeMatching mc/default-registry all-metrics-match-filter)))
+
 (deftest test-service-counter
-  (let [all-metrics-match-filter (reify MetricFilter (matches [_ _ _] true))]
-    (.removeMatching mc/default-registry all-metrics-match-filter)
+  (with-isolated-registry
     (service-counter "service-id" "foo")
     (service-counter "service-id" "foo" "bar")
     (service-counter "service-id" "fee" "fie")
     (is (every? #(str/starts-with? % "services.service-id.") (.getNames mc/default-registry)))
-    (is (= 3 (count (.getCounters mc/default-registry all-metrics-match-filter))))
-    (.removeMatching mc/default-registry all-metrics-match-filter)))
+    (is (= 3 (count (.getCounters mc/default-registry all-metrics-match-filter))))))

 (deftest test-service-histogram
-  (let [all-metrics-match-filter (reify MetricFilter (matches [_ _ _] true))]
-    (.removeMatching mc/default-registry all-metrics-match-filter)
+  (with-isolated-registry
     (service-histogram "service-id" "foo")
     (service-histogram "service-id" "foo" "bar")
     (service-histogram "service-id" "fee" "fie")
     (is (every? #(str/starts-with? % "services.service-id.") (.getNames mc/default-registry)))
-    (is (= 3 (count (.getHistograms mc/default-registry all-metrics-match-filter))))
-    (.removeMatching mc/default-registry all-metrics-match-filter)))
+    (is (= 3 (count (.getHistograms mc/default-registry all-metrics-match-filter))))))

 (deftest test-service-timer
-  (let [all-metrics-match-filter (reify MetricFilter (matches [_ _ _] true))]
-    (.removeMatching mc/default-registry all-metrics-match-filter)
+  (with-isolated-registry
     (service-timer "service-id" "foo")
     (service-timer "service-id" "foo" "bar")
     (service-timer "service-id" "fee" "fie")
     (is (every? #(str/starts-with? % "services.service-id.") (.getNames mc/default-registry)))
-    (is (= 3 (count (.getTimers mc/default-registry all-metrics-match-filter))))
-    (.removeMatching mc/default-registry all-metrics-match-filter)))
+    (is (= 3 (count (.getTimers mc/default-registry all-metrics-match-filter))))))

 (deftest test-service-meter
-  (let [all-metrics-match-filter (reify MetricFilter (matches [_ _ _] true))]
-    (.removeMatching mc/default-registry all-metrics-match-filter)
+  (with-isolated-registry
     (service-meter "service-id" "foo")
     (service-meter "service-id" "foo" "bar")
     (service-meter "service-id" "fee" "fie")
     (is (every? #(str/starts-with? % "services.service-id.") (.getNames mc/default-registry)))
-    (is (= 3 (count (.getMeters mc/default-registry all-metrics-match-filter))))
-    (.removeMatching mc/default-registry all-metrics-match-filter)))
+    (is (= 3 (count (.getMeters mc/default-registry all-metrics-match-filter))))))

 (deftest test-waiter-counter
-  (let [all-metrics-match-filter (reify MetricFilter (matches [_ _ _] true))]
-    (.removeMatching mc/default-registry all-metrics-match-filter)
+  (with-isolated-registry
     (waiter-counter "core" "foo")
     (waiter-counter "core" "foo" "bar")
     (waiter-counter "core" "fee" "fie")
     (is (every? #(str/starts-with? % "waiter.core.") (.getNames mc/default-registry)))
-    (is (= 3 (count (.getCounters mc/default-registry all-metrics-match-filter))))
-    (.removeMatching mc/default-registry all-metrics-match-filter)))
+    (is (= 3 (count (.getCounters mc/default-registry all-metrics-match-filter))))))

 (deftest test-waiter-meter
-  (let [all-metrics-match-filter (reify MetricFilter (matches [_ _ _] true))]
-    (.removeMatching mc/default-registry all-metrics-match-filter)
+  (with-isolated-registry
     (waiter-meter "core" "foo")
     (waiter-meter "core" "foo" "bar")
     (waiter-meter "core" "fee" "fie")
     (is (every? #(str/starts-with? % "waiter.core.") (.getNames mc/default-registry)))
-    (is (= 3 (count (.getMeters mc/default-registry all-metrics-match-filter))))
-    (.removeMatching mc/default-registry all-metrics-match-filter)))
+    (is (= 3 (count (.getMeters mc/default-registry all-metrics-match-filter))))))

 (deftest test-waiter-timer
-  (let [all-metrics-match-filter (reify MetricFilter (matches [_ _ _] true))]
-    (.removeMatching mc/default-registry all-metrics-match-filter)
+  (with-isolated-registry
     (waiter-timer "core" "foo")
     (waiter-timer "core" "foo" "bar")
     (waiter-timer "core" "fee" "fie")
     (is (every? #(str/starts-with? % "waiter.core.") (.getNames mc/default-registry)))
-    (is (= 3 (count (.getTimers mc/default-registry all-metrics-match-filter))))
-    (.removeMatching mc/default-registry all-metrics-match-filter)))
+    (is (= 3 (count (.getTimers mc/default-registry all-metrics-match-filter))))))

 (deftest test-update-counter
   (let [test-cases [{:name "nil-inputs", :input {:old nil, :new nil}, :expected 0}


using domina listen! wrapper to get domina events back instead of google events


clean up docstrings. we use the actual name of the lib, the user cannot supply this


Turn off code profiling

Turn off code profiling

--- src/text_justification/model.cljs
+++ src/text_justification/model.cljs
@@ -116,7 +116,7 @@
   {:pre [(> page-width 0)]}

   (clear-state)
-  (.profile js.console "text-justification")
+  ;; (.profile js.console "text-justification")
   (doseq [words-in-paragraph (prepare-text text separate-paragraphs page-width)]
     ; (println "PARAGRAPH:" words-in-paragraph)
     (let [words-lengths (mapv count words-in-paragraph)
@@ -132,6 +132,6 @@
               [next-word-start-idx (conj lines-atm words-in-this-line)] ))
           [0 []]
           justified-text))) ))
-  (.profileEnd js.console)
+  ;; (.profileEnd js.console)
   )


Moves tests around.

Moves tests around.

--- test/active/clojure/match_test.clj
+++ test/active/clojure/match_test.clj
@@ -208,6 +208,13 @@
    :else false))

 (t/deftest map-matcher-test
+  (t/testing "Very simple example without bindings."
+    ;; we thought that empty lets in the macro-expand would create problems
+    (t/is (= [] ((p/map-matcher [(:a)] []) {:a "a"}))))
+  (t/testing "Very simple examples with binding."
+    (t/is (= [] ((p/map-matcher [(:a :as a)] []) {:a "a"})))
+    (t/is (= ["a"] ((p/map-matcher [(:a :as a)] [a]) {:a "a"}))))
+
   (t/is (= ["x" "z"]
            (example-matcher one-data)))
   (t/is (= ["a" "c" {"Z" 42 "Y" 23 "X" 65 "W" {"foo" "bar"}} 42 23]
@@ -216,23 +223,6 @@
   ;; FIXME: What is the difference between this and the test before?
   (t/testing "map-matcher-regex-key-not-found"
     (t/is (= false (example-matcher three-data)))))
-
-;; FIXME: Clean up
-(t/deftest map-matcher-without-binding-test
-  (let [k "my-value"]
-    ((p/map-matcher [(:k 23)] (t/is (= "my-value" k))) {:k 23})))
-
-;; FIXME: Clean up
-(t/deftest my-little-no-bindings-test
-  (t/is (= ["a"]
-           ((p/map-matcher [(:a :as a)] [a])
-            {:a "a"})))
-  (t/is (= []
-           ((p/map-matcher [(:a :as a)] [])
-            {:a "a"})))
-  (t/is (= []
-           ((p/map-matcher [(:a)] [])
-            {:a "a"}))))

 (t/deftest map-matcher-optional-default-test
   (t/is (= ["a" "C" "C" 42]
@@ -332,6 +322,11 @@
 (p/defpattern constant-pattern [(X x)])
 (def p (p/parse-pattern '[(X x)]))

+;; FIXME: Clean up
+(t/deftest map-matcher-without-binding-test
+  (let [k "my-value"]
+    ((p/map-matcher [(:k 23)] (t/is (= "my-value" k))) {:k 23})))
+
 (t/deftest closes-over-outer-variables-test
   (t/testing "with compare-fn"
     (let [evt {"X" "x"}]


Adds test coverting ns->js

Adds test coverting ns->js


Split out binary-tree single-step function


Remove header from all emails and update the footer accordingly with the new design.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -219,27 +219,6 @@
 ;               [:p {:class "attribution"} attribution]]]]]
 ;       [:th {:class "small-1 large-1 last columns"}]]))

-(defn- transactional-header []
-  [:table {:class "row"}
-    [:tr
-      [:td {:class "small-1 large-2 columns"}]
-      [:td {:class "small-10 large-8 columns"}
-        (vspacer 15)
-        [:table {:class "row"}
-          [:tr
-            [:th {:class "small-2 large-2 columns"}
-              [:img {:width 13
-                     :height 24
-                     :src "https://open-company.s3.amazonaws.com/carrot_logo.png"
-                     :alt "Carrot logo"}]]
-            [:th {:class "small-10 large-10 columns"}
-              [:p {:class "text-right header-paragraph"}
-                "Find team alignment with "
-                [:a {:href "https://carrot.io"}
-                  "Carrot"]]]]]
-        (vspacer 15 "header-bottom")]
-      [:td {:class "small-1 large-2 columns"}]]])
-
 (defn- transactional-footer []
   [:table {:class "row footer-table"}
     [:tr
@@ -258,22 +237,9 @@
         (vspacer 15 "footer-table" "footer-table")
         [:table {:class "row footer-table"}
           [:tr
-            [:th {:class "small-6 large-6 columns"}
+            [:th {:class "small-12 large-12 columns"}
               [:p {:class "footer-paragraph bottom-footer"}
-                "Find team alignment with Carrot"]]
-            [:th {:class "small-6 large-6 columns"}
-              [:a {:class "footer-link" :href "https://blog.carrot.io"}
-                [:img {:alt "Blog"
-                       :src "https://open-company.s3.amazonaws.com/carrot_medium.png"
-                       :width 18
-                       :height 15}]]
-              "  "
-              [:a {:class "footer-link"
-                   :href "https://twitter.com/carrot_hq"}
-                [:img {:alt "Twitter"
-                       :src "https://open-company.s3.amazonaws.com/carrot_twitter.png"
-                       :width 19
-                       :height 16}]]]]]
+                "Sent with love from Carrot"]]]]
         (vspacer 15 "footer-table" "footer-table")]
       [:td {:class "small-1 large-2 columns"}]]])

@@ -470,7 +436,6 @@
       [:table {:class "body"}
         [:tr
           [:td
-            (transactional-header)
             [:table {:class "row"}
               [:tr
                 [:td {:class "small-1 large-2 columns"}]


casting dedup as separate operation

casting dedup as separate operation

--- src/ophion/aggregate.clj
+++ src/ophion/aggregate.clj
@@ -44,7 +44,7 @@
 (defn from-vertex
   ([label] (from-vertex label {}))
   ([label where]
-   [{:$group {:_id "$from" :to {:$first "$from"} :_history {:$addToSet "$_history"}}}
+   [;; {:$group {:_id "$from" :to {:$first "$from"} :_history {:$addToSet "$_history"}}}
     {:$lookup
      {:from label
       :localField "from"
@@ -59,7 +59,7 @@
 (defn to-vertex
   ([label] (to-vertex label {}))
   ([label where]
-   [{:$group {:_id "$to" :to {:$first "$to"} :_history {:$addToSet "$_history"}}}
+   [;; {:$group {:_id "$to" :to {:$first "$to"} :_history {:$addToSet "$_history"}}}
     {:$lookup
      {:from label
       :localField "to"
@@ -120,6 +120,18 @@
 (defn qount
   [label]
   [{:$count label}])
+
+(defn dedup
+  []
+  [{:$group {:_id "$gid" :dedup {:$first "$$ROOT"}}}
+   {:$replaceRoot {:newRoot "$dedup"}}])
+
+(defn dedup-on
+  [field]
+  (let [dollar (str "$" (name field))]
+    ;; {:$group {:_id dollar (keyword field) {:$first dollar} :_history {:$addToSet "$_history"}}}
+    [{:$group {:_id dollar :dedup {:$first "$$ROOT"}}}
+     {:$replaceRoot {:newRoot "$dedup"}}]))

 (defn offset
   [n]
@@ -205,6 +217,8 @@
    :from from
    :to to
    :root root
+   :dedup dedup
+   :dedupOn dedup-on
    :where where
    :match match
    :values values


Add additional reply parsing tests

Add additional reply parsing tests

--- test/test_carmine/main.clj
+++ test/test_carmine/main.clj
@@ -321,10 +321,12 @@
 (deftest test-reply-parsing
   (let [k (test-key "reply-parsing")]
     (wcar (car/set k [:a :A :b :B :c :C :d :D]))
-    (is (= ["PONG" {:a :A :b :B :c :C :d :D} "PONG" "PONG"]
+    (is (= ["PONG" {:a :A :b :B :c :C :d :D} "pong" "pong" "PONG"]
            (wcar (car/ping)
                  (car/with-parser #(apply hash-map %) (car/get k))
-                 (car/ping)
+                 (car/with-parser str/lower-case
+                   (car/ping)
+                   (car/ping))
                  (car/ping))))))

 (deftest test-transactions


32,33

--- src/sandbox/4clojure.clj
+++ src/sandbox/4clojure.clj
@@ -110,3 +110,9 @@

 ;;31 Pack a Sequence
 partition-by identity
+
+;;32 Duplicate a Sequence
+#(interleave % %)
+
+;;33 Replicate a Sequence
+(fn [col n] (reduce #(concat %1 (repeat n %2)) [] col))


Reorganize tests

Reorganize tests

--- test/caesium/crypto/sign_test.clj
+++ test/caesium/crypto/sign_test.clj
@@ -11,6 +11,13 @@
  s/secretkeybytes 64
  s/primitive "ed25519")

+(deftest generate-signing-keys-test
+  (let [kp1 (s/generate-signing-keys)
+        kp2 (s/generate-signing-keys)]
+    (is (not (u/array-eq (:public kp1) (:public kp2))))
+    (is (not (u/array-eq (:secret kp1) (:secret kp2)))))
+  (is (u/array-eq public (:public (s/generate-signing-keys secret)))))
+
 ;; Test values taken from Kalium's suite
 (def secret
   (u/unhexify "b18e1d0045995ec3d010c387ccfeb984d783af8fbb0f40fa7db126d889f6dadd"))
@@ -20,13 +27,6 @@
   (u/unhexify "916c7d1d268fc0e77c1bef238432573c39be577bbea0998936add2b50a653171ce18a542b0b7f96c1691a3be6031522894a8634183eda38798a0c5d5d79fbd01dd04a8646d71873b77b221998a81922d8105f892316369d5224c9983372d2313c6b1f4556ea26ba49d46e8b561e0fc76633ac9766e68e21fba7edca93c4c7460376d7f3ac22ff372c18f613f2ae2e856af40"))
 (def signature
   (u/unhexify "6bd710a368c1249923fc7a1610747403040f0cc30815a00f9ff548a896bbda0b4eb2ca19ebcf917f0f34200a9edbad3901b64ab09cc5ef7b9bcc3c40c0ff7509"))
-
-(deftest generate-signing-keys-test
-  (let [kp1 (s/generate-signing-keys)
-        kp2 (s/generate-signing-keys)]
-    (is (not (u/array-eq (:public kp1) (:public kp2))))
-    (is (not (u/array-eq (:secret kp1) (:secret kp2)))))
-  (is (u/array-eq public (:public (s/generate-signing-keys secret)))))

 (deftest sign-test
   (testing "Can sign a message"


lazy timelines

lazy timelines

--- core.clj
+++ core.clj
@@ -16,8 +16,10 @@
     hard.core
     hard.input))

+
 (defonce REGISTRY (atom {}))
 (defonce THIS (gensym 'this))
+(def panic false)

 (def -mono-obj (volatile! nil))
 (defn mono-obj []
@@ -33,8 +35,8 @@
         (MoveNext [this] (f))
         (get_Current [this])))))

-(def garbage (volatile! 0))
-(def garbage-active (volatile! false))
+(def garbage (volatile! 0))
+(def garbage-active (volatile! true))
 (defn take-out-trash! []
   (when (and @garbage-active (> (- Time/time @garbage) 0.7))
         (.Enqueue arcadia.repl/work-queue
@@ -96,20 +98,23 @@

 (defmacro deftag [tag methods]
   (let [sym (symbol (last (re-seq #"[^\.]+" (str tag))))
-        once (gensym (str tag))
+        once (gensym (str "_once_" sym))
         pair-sym (symbol (str "Pair-" sym))
         wm-f #(with-meta % {:tag tag :volatile-mutable true})
         pool-m (zipmap [:p :c :r] (map (comp symbol str) ["<>" "*" "!"] (repeat pair-sym)))
         entry (conj methods {:pair {:tag pair-sym :pool pool-m}})]
-    (swap! REGISTRY assoc tag entry)
+
     `(do
-        (deftype ^:once ~pair-sym [~(wm-f 'a) ~(wm-f 'b)])
+        (defonce ~once
+          (do
+           ~(do (swap! REGISTRY assoc tag entry) true)
+            (deftype ^:once ~pair-sym [~(wm-f 'a) ~(wm-f 'b)])))
         (def-pool 10000 ~pair-sym ~'a ~'b)
         (quote ~entry))))

-(deftype WaitCursor [
+(deftype ^:once WaitCursor [
   ^:volatile-mutable ^System.Single start
   ^:volatile-mutable ^boolean       initiated])

@@ -127,7 +132,7 @@

-(deftype TimeLineCursor [
+(deftype ^:once TimeLineCursor [
   ^:volatile-mutable ^System.Int64    i
   ^:volatile-mutable ^boolean         v
   ^:volatile-mutable ^System.Single overage])
@@ -137,6 +142,7 @@
 (def <over> (*TimeLineCursor 0 false 0.0))

 (defn timeline [fns]
+  (assert (vector? fns) "timeline requires a vector")
   (let [cnt (count fns)
         ^MonoBehaviour coro-root (mono-obj)
         ^TimeLineCursor cursor (*TimeLineCursor 0 false 0.0)]
@@ -153,6 +159,54 @@
         (get_Current [this] (.v cursor))))
     (fn [] false)))

+(defn lazy-timeline [fns]
+  (let [current (volatile! (first fns))
+        fns (volatile! (rest fns))
+        ^MonoBehaviour coro-root (mono-obj)
+        ^TimeLineCursor cursor (*TimeLineCursor 0 false 0.0)]
+    (.StartCoroutine coro-root
+      (reify IEnumerator
+        (MoveNext [this]
+          (when-not panic
+            (set! (.v cursor) (@current))
+            (if (.v cursor) true
+              (if (do (vreset! current (first @fns) )
+                      (vswap! fns rest) @current)
+                true
+                (!TimeLineCursor cursor)))))
+        (get_Current [this] (.v cursor))))
+    (fn [] (if @current true false))))
+
+(defn lazier-timeline [fns]
+  (let [fns (map #(%) fns)
+        current (volatile! (first fns))
+        fns (volatile! (rest fns))
+        ^MonoBehaviour coro-root (mono-obj)
+        ^TimeLineCursor cursor (*TimeLineCursor 0 false 0.0)]
+    (.StartCoroutine coro-root
+      (reify IEnumerator
+        (MoveNext [this]
+          (when-not panic
+            (try (set! (.v cursor) (@current))
+              (if (.v cursor) true
+                (if (do (vreset! current (first @fns))
+                        (vswap! fns rest) @current)
+                    true
+                  (!TimeLineCursor cursor)))
+              (catch Exception e false))))
+        (get_Current [this] (.v cursor))))
+    (fn [] (if @current true false))))
+
+
+
+
+(def seconds (volatile! 0))
+
+'(lazier-timeline
+  (cycle [
+    (fn [] (wait (rand 5)))
+    (fn [] (lazy-timeline (map #(fn [] (log %)) "dog")))]))
+

 (defn args->opts [m]
@@ -165,7 +219,7 @@

-(deftype TweenCursor [
+(deftype ^:once TweenCursor [
   ^:volatile-mutable ^boolean          initiated
   ^:volatile-mutable ^System.Single    start
   ^:volatile-mutable ^System.Single    duration
@@ -195,9 +249,8 @@
             (list (or (-> %2 :pair :pool :c) '*Pair) (:identity %2) %4))
           tags tagmaps pairsyms targets)]
    `(~'let [~THIS ~o
-            ~cursor (~'*TweenCursor false ~'Time/time ~(:duration opts) 0.0 0.0)
+            ~cursor (~'*TweenCursor false ~'(float Time/time) ~(:duration opts) (float 0.0) (float 0.0))
             ~@val-binds]
-      ;[~tags ~tagmaps]
       (~'fn []
         (~'when-not ~'(.initiated cursor)
         ~'(set! (.initiated cursor) true)
@@ -205,7 +258,7 @@
         ~@(map #(list 'set! (list '.a %1) %2) pairsyms getters))
         ~'(set! (.now cursor) (- Time/time (.start cursor)))
         ~'(set! (.ratio cursor)
-                (Mathf/InverseLerp 0.0 (.duration cursor) (.now cursor)))
+                (float (Mathf/InverseLerp 0.0 (.duration cursor) (.now cursor))))
       ~@(map
          #(list 'set! (:get (first %1))
             (list (:lerp %2)
@@ -217,9 +270,10 @@
           true
           (~'do
             ~@(map #(list (or (-> %1 :pair :pool :r) '!Pair-Object) %2) tagmaps pairsyms)
-            ~'(set! (.overage <over>) (- (.now cursor) (.duration cursor)))
+            ~'(set! (.overage <over>) (float (- (.now cursor) (.duration cursor))))
             ~'(!TweenCursor cursor)
-            false) )))))
+            ;~'(set! (.initiated cursor) false)
+            ))))))

 (deftag System.Object       {:lerp (fn [a b _] b)                     :identity (System.Object)})
 (deftag System.Single       {:lerp Mathf/Lerp                         :identity (float 0.0)})
@@ -276,59 +330,64 @@

 (defn pool-report []
-  (pprint/print-table   (mapv #(do {:pool %1 :stats (stats %2)})
+  (pprint/print-table   (mapv #(do {:pool %1 :stats (try (stats %2) (catch Exception e :error))})
     (into '[<>WaitCursor <>TimeLineCursor <>TweenCursor]
       (map (comp :p :pool :pair last) (filter (comp symbol? first) @REGISTRY)))
     (into [<>WaitCursor <>TimeLineCursor <>TweenCursor]
       (map (comp deref resolve :p :pool :pair last) (filter (comp symbol? first) @REGISTRY))))))

-(print (pool-report))
-
-
-
-
-
-
-
+(pool-report)

 (def run true)

 (defn hue [^UnityEngine.Material m ^UnityEngine.GameObject o]
-  (timeline [
-    ;(wait (+ (rand) 0.1))
-    (tween {:local
-      {:scale (Vector3. 2.0 2.0 2.0)
-       :position (v3+ (.position (.transform o))
-                      (Vector3. 0.0 2.0 0.0))}} o 1.0 {:in :pow5})
-    (tween {:material-color (UnityEngine.Color. (?f) (?f) (?f))} m (float 0.5) {:in :pow3})
-    (tween {:local
-      {:scale (Vector3. 1.0 1.0 1.0)
-       :position (v3+ (.position (.transform o))
-                      (Vector3. 0.0 0.0 0.0))}} o (float (rand 0.5)) :pow5)
-
-    #(do (hue m o) nil)]))
+  (lazier-timeline (cycle [
+    (fn [] (wait (+ (rand) 0.3)))
+    (fn [] (tween {:material-color (UnityEngine.Color. (?f) (?f) (?f))} m 0.5 {:in :pow3}))
+    (fn [] (tween
+      {:local {
+        :scale (Vector3. 2.0 2.0 2.0)
+        :position (v3+ (.position (.transform o))
+                       (Vector3. 0.0 2.0 0.0))}} o 1.0 {:in :pow5}))
+    ;(fn [] (wait (+ (rand) 0.1)))
+    (fn [] (tween {:material-color (UnityEngine.Color. 1 1 1)} m 0.5 {:in :pow3}))
+    (fn [] (tween
+     {:local {
+        :scale (Vector3. 1.0 1.0 1.0)
+        :position (v3+ (.position (.transform o))
+                      (Vector3. 0.0 0.0 0.0))}} o 0.5 :pow5))])))

 (defn start-demo [_]
   (clear-cloned!)
-  (dorun (for [x (range 40)
-               z (range 40)
+  (dorun (for [x (range 20)
+               z (range 20)
                :let [o (clone! :ball (V* (->v3 x 0 z) 2.0)) ]]
     (hue (.material (.GetComponent o UnityEngine.Renderer)) o))) )

-(start-demo nil)
-
-
-(timeline [
+
+(defn fast-demo [_]
+  (clear-cloned!)
+  (let [o-arr
+        (into-array System.Object
+          (for [x (range 20) z (range 20)
+            :let [o (clone! :ball (V* (->v3 x 0 z) 2.0)) ]] o))]
+    ) )
+
+(fast-demo nil)
+
+(lazy-timeline [
 (tween
   {:light {
-    :range (float (rand 50))
+    :range (float (+ 15 (rand 50)))
     :color (color (rand-vec 1.0 1.0 1.0))}}
-    (the lamp) 0.5 :pow4)])
-
-'(ppexpand     (tween {
+    (the lamp) 1.0 :pow4)])
+
+(start-demo nil)
+
+#_(ppexpand     (tween {
       :scale (Vector3. 2.0 2.0 2.0)
       :position (v3+ (.position (.transform (the lamp)))
                      (Vector3. 0.0 2.0 0.0))} (the lamp) 1.0 {:in :pow5}))


make test/axioms_coll.clj work

make test/axioms_coll.clj work

--- test/clojure/test/axioms_coll.clj
+++ test/clojure/test/axioms_coll.clj
@@ -103,9 +103,8 @@

 (deftest ^:coll empty-axiom3
   (testing "empty axiom 3: not-empty works on empty emaps"
-    (let [e1 (ds/entity-map [:A/B] {})
-          e2 (not-empty e1)]
-      (is (nil? e2))
-      (is (ds/emap? e2))
+    (let [e1 (ds/entity-map [:A/B] {})]
+      (is (nil? (not-empty e1)))
+      (is (ds/emap? e2)) ;; FIXME:  entity-map?
       )))


h1 on category pages too

h1 on category pages too

--- src-cljs/frontend/components/documentation.cljs
+++ src-cljs/frontend/components/documentation.cljs
@@ -135,13 +135,12 @@
     om/IRender
     (render [_]
       (html
-       [:div
-        [:h1 (:title doc)]
-        (om/build markdown (:markdown doc))]))))
+       (om/build markdown (:markdown doc))))))

 (defrender docs-subpage [doc owner opts]
   (html
    [:div
+    [:h1 (:title doc)]
     (if-not (empty? (:children doc))
       (om/build article-list (:children doc))
       (if (:markdown doc)


Fixes #105

Fixes #105

--- src/statuses/routing.clj
+++ src/statuses/routing.clj
@@ -77,7 +77,7 @@
         length (.length field-value)]
     (if (and (<= length max-length) (> length 0))
       (do (swap! db core/add-update (user request) field-value (parse-num reply-to nil))
-          (resp/redirect "/statuses"))
+          (resp/redirect "/statuses/updates"))
       (resp/redirect (str "/statuses/too-long/" length)))))

 (defn keyworded
@@ -99,7 +99,7 @@
   [id request]
   (if (= (user request) (:author (core/get-update @db (Integer/parseInt id))))
     (do (swap! db core/remove-update (Integer/parseInt id))
-      (resp/redirect "/statuses"))
+      (resp/redirect "/statuses/updates"))
     (resp/response (str "Delete failed as you are not " :author )))
   )