Remove lt.macros (again?)

Remove lt.macros (again?)

--- src/lt/macros.clj
+++ src/lt/macros.clj
@@ -1,98 +0,0 @@
-(ns lt.macros
-  (:require [clojure.walk :as walk]))
-
-(defn- namify [type keyword]
-  (symbol (str "__" type "__" (.replace (name keyword) "." "__DOT__"))))
-
-(defmacro behavior [name & {:keys [reaction] :as r}]
-  (if (and (seq? reaction) (= 'fn (first reaction)))
-    (let [[_ args & body] reaction]
-      `(do
-         (defn- ~(namify "BEH" name) ~args ~@body)
-         (lt.object/behavior* ~name ~@(apply concat (assoc r :reaction (namify "BEH" name))))))
-    `(lt.object/behavior* ~name ~@(apply concat r))))
-
-(defmacro defui [sym params hiccup & events]
-  `(defn ~sym ~params
-     (let [e# (crate.core/html ~hiccup)]
-       (doseq [[ev# func#] (partition 2 ~(vec events))]
-         (lt.util.dom/on e# ev# func#))
-       e#)))
-
-(defmacro timed [ev & body]
-  `(let [start# (lighttable.util.js/now)
-         res# (do ~@body)]
-     (lighttable.components.logger/log ~ev (- (lighttable.util.js/now) start#))
-     res#))
-
-(defn ->params [body]
-  (if (vector? (first body))
-    [(first body) (rest body)]
-    [[] body]))
-
-(defmacro on [name & body]
-  `(lighttable.command/on ~name (fn ~@body)))
-
-(defmacro in [ctx & body]
-  (let [[params body] (->params body)]
-    `(assoc ~ctx :in (fn ~params ~@body))))
-
-(defmacro out [ctx & body]
-  (let [[params body] (->params body)]
-    `(assoc ~ctx :out (fn ~params ~@body))))
-
-(defmacro defcontext [name & body]
-  `(let [ctx# {:name ~name}]
-     (lighttable.context/add-context!
-       (-> ctx#
-           ~@body))))
-
-(defmacro extract [elem kvs & body]
-  (let [defs (vec (apply concat (for [[k v] (partition 2 kvs)]
-                                  `[~k (lt.util.dom/$ ~v ~elem)])))]
-    `(let ~defs
-       ~@body)))
-
-(defmacro foreach [xs & body]
-  `(let [xs# ~(second xs)
-         len# (.-length xs#)]
-     (loop [left# 0]
-       (when (< left# len#)
-         (let [~(first xs) (aget xs# left)]
-           ~@body
-           (recur (inc left#)))))))
-
-(defmacro with-time [& body]
-  (let [start (gensym "start")
-        body (walk/postwalk-replace {'time (list '- '(.getTime (js/Date.)) start)} body)]
-  `(let [~start (.getTime (js/Date.))]
-     ~@body)))
-
-(defmacro background [func]
-  `(lt.objs.thread/thread*
-    (fn ~(gensym "tfun") []
-      (let [orig# (js/argsArray js/arguments)
-            msg# (.shift orig#)
-            args# (.map orig# cljs.reader/read-string)
-            ~'raise (fn [obj# k# v#]
-                     (js/_send obj# k# (pr-str v#) "clj"))]
-        (.unshift args# (.-obj msg#))
-        (.apply ~func nil args#)))))
-
-(comment
-
-  (worker (fn [v]
-            (do-something v))
-          :zomg (fn [r]
-                  ))
-
-  (defui cool [l]
-    [:li (bound l)]
-
-    :click (fn [e]
-             (this-as me
-                      ))
-    :hover (fn [e]
-             ))
-
-  )


Drop managedFields from k8s objects

Drop managedFields from k8s objects

The managedFields metadata is not useful to us, and it's very verbose.
https://github.com/kubernetes/kubernetes/issues/90066#issuecomment-626828512

--- waiter/src/waiter/scheduler/kubernetes.clj
+++ waiter/src/waiter/scheduler/kubernetes.clj
@@ -397,7 +397,9 @@
       (throw (ex-info "k8s watch connection failed"
                       {:watch-resource resource-name
                        :watch-response update-json}))
-      update-json)))
+      ;; Drop managedFields from response objects when present (much too verbose!)
+      ;; https://github.com/kubernetes/kubernetes/issues/90066#issuecomment-626828512
+      (utils/dissoc-in update-json [:object :metadata :managedFields]))))

 (defn api-request
   "Make an HTTP request to the Kubernetes API server using the configured authentication.


Changes to lambdas.

Changes to lambdas.

--- src/enoki_lang_clj/core.cljs
+++ src/enoki_lang_clj/core.cljs
@@ -125,18 +125,16 @@
 (defmethod nxt :LAMBDA [ast]

   (if (= 2 (count ast))
-    (format "(() => %s)" (nxt (nth ast 1)))
+    (format "() => %s" (nxt (nth ast 1)))
     (let [param-list (nxt (nth ast 1))
           fn-body (nxt (nth ast 2))]

       ;;curried
       (if (empty? param-list)
-        (format "(() => %s)" fn-body)
+        (format "() => %s)" fn-body)
         (str
-         "("
          (apply str (map #(format "(%s) => " %) param-list))
          fn-body
-         ")"
          )))))

 (defmethod nxt :PARAMLIST [ast]


Use sha1-hex instead of a format-string

Use sha1-hex instead of a format-string

--- web-app/src/cljs/potato/core.cljs
+++ web-app/src/cljs/potato/core.cljs
@@ -1099,7 +1099,7 @@

 (defn- make-draft-message [text-string html]
   (let [current-user (:current-user (deref potato.state/global))
-        hash (cljs.pprint/cl-format nil "~{~2,'0x~}" (cljs-hash.goog/sha1-bytes (str (:id current-user) "_" text-string)))]
+        hash (cljs-hash.goog/sha1-hex (str (:id current-user) "_" text-string))]
     {:id           (str draft-marker "draft:" (get-unique-id))
      :from         (:id current-user)
      :created_date (.format (.utc (js/moment)) "YYYY-MM-DDTHH:mm:ss.SSSZ")


Problem added - Intro to some

Problem added - Intro to some

--- src/foreclojure/data_set.clj
+++ src/foreclojure/data_set.clj
@@ -481,4 +481,13 @@
             :tests ["(contains? #{4 5 6} __)"
 		    "(contains? [1 1 1 1 1] __)"
 		    "(contains? {4 :a 2 :b} __)"
-                    "(not (contains? '(1 2 4) __))"]})))+                    "(not (contains? '(1 2 4) __))"]})
+
+       (insert! :problems
+           {:_id 48
+            :title "Intro to some"
+            :times-solved 0
+            :description "The some function takes a predicate function and a collection.  It returns the first item for which the predicate returns true."
+            :tags ["easy"]
+            :tests ["(= __ (some #{2 7 6} [5 6 7 8]))"
+		    "(= __ (some #(when (even? %) %) [5 6 7 8]))"]})))


Restricted functions added to user submission form

--- src/foreclojure/problems.clj
+++ src/foreclojure/problems.clj
@@ -293,6 +293,8 @@
     (text-field :title  (session/flash-get :title))
     (label :tags "Tags (space separated)")
     (text-field :tags  (session/flash-get :tags))
+    (label :restricted "Restricted Functions (space separated)")
+    (text-field :restricted  (session/flash-get :restricted))
     (label :description "Problem Description")
     (text-area {:id "problem-description"} :description  (session/flash-get :description))
     [:br]
@@ -304,7 +306,7 @@

 (defn create-problem
   "create a user submitted problem"
-  [title tags description code id author]
+  [title tags restricted description code id author]
   (let [user (session/session-get :user)]
     (if (can-submit? user)
       (let [prob-id (or id
@@ -320,6 +322,7 @@
                   :times-solved 0
                   :description description
                   :tags (s/split tags #"\s+")
+                  :restricted (s/split restricted #"\s+")
                   :tests (s/split-lines code)
                   :user (if (empty? author) user author)
                   :approved false})
@@ -327,11 +330,12 @@
       (flash-error "You are not authorized to submit a problem." "/problems"))))

 (defn edit-problem [id]
-  (let [{:keys [title user tags description tests]} (get-problem id)]
+  (let [{:keys [title user tags restricted description tests]} (get-problem id)]
     (doseq [[k v] {:prob-id id
                    :author user
                    :title title
                    :tags (s/join " " tags)
+                   :restricted (s/join " " restricted)
                    :description description
                    :tests (s/join "\n" tests)}]
       (session/flash-put! k v))
@@ -373,8 +377,8 @@
   (GET "/problems" [] (problem-page))
   (GET "/problem/:id" [id] (code-box id))
   (GET "/problems/submit" [] (problem-submission-page))
-  (POST "/problems/submit" [prob-id author title tags description code]
-    (create-problem title tags description code (when (not= "" prob-id) (Integer. prob-id)) author))
+  (POST "/problems/submit" [prob-id author title tags restricted description code]
+    (create-problem title tags restricted description code (when (not= "" prob-id) (Integer. prob-id)) author))
   (GET "/problems/unapproved" [] (unapproved-problems))
   (POST "/problem/edit" [id]
     (edit-problem (Integer. id)))


Formatting

Formatting

--- src/icecap/handlers/core.clj
+++ src/icecap/handlers/core.clj
@@ -18,8 +18,8 @@
   and then closes.
   "
   (fn [x] (cond (set? x) ::unordered-plans
-               (vector? x) ::ordered-plans
-               :else (:type x))))
+                (vector? x) ::ordered-plans
+                :else (:type x))))

 (defmethod execute ::unordered-plans
   [plans]


Rename variable to indicate true type (asset path is distinct from resource path)

--- src/io/aviso/twixt/utils.clj
+++ src/io/aviso/twixt/utils.clj
@@ -67,8 +67,8 @@
   "Creates a handler for the asset pipeline that delegates to the provided handler, but passes
   the obtained asset through a transformer function if it matches the expected content type."
   [handler content-type transformer]
-  (fn [resource-path]
-    (if-let [asset (handler resource-path)]
+  (fn [asset-path]
+    (if-let [asset (handler asset-path)]
       (if (= content-type (:content-type asset))
         (transformer asset)
         asset))))


change api ip to 0.0.0.0 instead of localhost. possible fix for windows

--- frontend/src/cruncher/config.cljs
+++ frontend/src/cruncher/config.cljs
@@ -1,6 +1,6 @@
 (ns cruncher.config)

-(def api {:host "http://localhost:5000/"
+(def api {:host "http://0.0.0.0:5000/"
           :init "api/init/"
           :base "api/"
           :login "api/login"


generators.clj: fixed the traverse function

--- clojure/org/gavrog/clojure/generators.clj
+++ clojure/org/gavrog/clojure/generators.clj
@@ -13,7 +13,7 @@
     (when gen
       (if (pred (current gen))
         (if-let [next (step gen)]
-          (lazy-seq (cons gen (traverse next)))
+          (lazy-seq (cons gen (traverse next pred)))
           (list gen))
         (recur (skip gen) pred)))))


simplify3d.clj: preliminary version of the cut-face function

--- clojure/org/gavrog/clojure/simplify3d.clj
+++ clojure/org/gavrog/clojure/simplify3d.clj
@@ -78,4 +78,20 @@
 (defn- cut-face [ds D E]
   (if (#{(walk ds D 1 0) (walk ds D 0 1)} E)
     ds
-    (let [tmp (append ds wedge)])))
+    (let [tmp (append ds wedge)
+          n (size ds)
+          [F G] (map (partial s ds 3) [D E])
+          [D* E* F* G*] (map (partial s ds 1) [D E F G])
+          [d e* d* e f g* f* g] (map (partial + n) (range 1 9))
+          ops* (assoc (ops tmp) 1 (conj ((ops tmp) 1)
+                                         [D d] [d D] [D* d*] [d* D*]
+                                         [E e] [e E] [E* e*] [e* E*]
+                                         [F f] [f F] [F* f*] [f* F*]
+                                         [G g] [g G] [G* g*] [g* G*]))
+          t (make-dsymbol 3 (size tmp) ops* {})
+          vs* (into {} (for [i (range 3)]
+                        [i (into {} (for [D (orbit-reps t [i (inc i)])
+                                          :let [v* 1]
+                                          E (orbit-elements t [i (inc i)] D)]
+                                      [E v*]))]))]
+      (make-dsymbol (dim t) (size t) ops* vs*))))


Print full, demunged name of function in nrepl eval

--- lein-light-nrepl/src/lighttable/nrepl/eval.clj
+++ lein-light-nrepl/src/lighttable/nrepl/eval.clj
@@ -4,6 +4,7 @@
             [clojure.test :as test]
             [lighttable.nrepl.core :as core]
             [lighttable.nrepl.exception :as exception]
+            clojure.main
             [clojure.tools.nrepl.transport :as transport]
             [clojure.tools.nrepl.middleware :refer [set-descriptor!]]
             [clojure.tools.nrepl.middleware.interruptible-eval :refer [interruptible-eval *msg*]]
@@ -61,7 +62,7 @@
 (defn clean-serialize [res & [opts]]
   (binding [*print-length* (or (:print-length opts) *print-length* 1000)]
     (cond
-     (fn? res) (.getSimpleName ^Class (type res))
+     (fn? res) (clojure.main/demunge (.getCanonicalName ^Class (type res)))
      (var? res) (if-not (:allow-var? opts)
                   res
                   (str res)


Use common font

Use common font

--- spectacles/src/spectacles/present_logo.clj
+++ spectacles/src/spectacles/present_logo.clj
@@ -22,7 +22,7 @@
   (q/image (:logo state) (- (/ (q/width) 2) 100) (- (/ (q/height) 2) 100))
   (q/stroke 255)
   (q/fill 255)
-  (q/text-font (q/create-font "monofur" 56))
+  (q/text-font (q/create-font "Roboto Thin" 56))
   (q/text (:message state)
           (- (/ (q/width) 2) (/ (q/text-width (:message state)) 2))
           (+ (/ (q/height) 2) 200))


Comment status

Comment status

--- src-cljs/frontend/components/pieces/topbar.cljs
+++ src-cljs/frontend/components/pieces/topbar.cljs
@@ -44,10 +44,10 @@
                               :aria-label "Teams"}
                   [:i.material-icons "group"] "Teams"]]]
             [:ul.nav-items.nav-items-left.collapsing-nav
-             [:li
-               [:a.has-icon {:href "/build-insights"
-                             :aria-label "System Status"}
-                 [:i.material-icons.status.operational "grain"] "System Status"]] ;; blur_on leak_add network_check
+             ; [:li
+             ;   [:a.has-icon {:href "/build-insights"
+             ;                 :aria-label "System Status"}
+             ;     [:i.material-icons.status.operational "grain"] "System Status"]] ;; blur_on leak_add network_check
              [:li.dropdown
               [:button.dropdown-toggle
                {:data-toggle "dropdown"


Fix \e[1J handling when cursor is over last column (fixes #47)

--- src/asciinema/vt/screen.cljc
+++ src/asciinema/vt/screen.cljc
@@ -459,11 +459,12 @@
                             (vec (concat top-lines [curr-line] bottom-lines))))))

 (defn clear-to-beginning-of-screen [{{:keys [x y]} :cursor :keys [width height char-attrs] :as screen}]
-  (update screen :lines (fn [lines]
-                          (let [top-lines (repeat y (blank-line width char-attrs))
-                                curr-line (clear-line-left (nth lines y) x char-attrs)
-                                bottom-lines (drop (inc y) lines)]
-                            (vec (concat top-lines [curr-line] bottom-lines))))))
+  (let [x (min x (dec width))]
+    (update screen :lines (fn [lines]
+                            (let [top-lines (repeat y (blank-line width char-attrs))
+                                  curr-line (clear-line-left (nth lines y) x char-attrs)
+                                  bottom-lines (drop (inc y) lines)]
+                              (vec (concat top-lines [curr-line] bottom-lines)))))))

 (defn erase-characters [{{:keys [x y]} :cursor :keys [width char-attrs] :as screen} n]
   (let [n (min n (- width x))]


Use debounce for persistence.

Use debounce for persistence.

--- frontend/uxbox/core.cljs
+++ frontend/uxbox/core.cljs
@@ -17,7 +17,7 @@
                              :projects-by-id])
         stream (->> (l/focus-atom lens st/state)
                     (rx/from-atom)
-                    (rx/sample 1000)
+                    (rx/debounce 1000)
                     (rx/tap #(println "[save]")))]
     (rx/on-value stream #(dl/persist-state %))))


Works... but reports things flipped over x/y axis

--- src/bejeweled_bot/solver.clj
+++ src/bejeweled_bot/solver.clj
@@ -1,29 +1,91 @@
 (ns bejeweled-bot.solver)
-(use 'bejeweled-bot.gems)
+
+(defn getFirst
+  [gem-array]
+  (first (drop-while #(= nil %) (solve gem-array))))

 (defn solve
   "puikula"
   [gem-array]
   (map-indexed
-  (fn [colIdx col]
-    (map-indexed
-      (fn [rowIdx item]
-        (check-matches colIdx rowIdx item))
-      col))
-  gem-array))
-
-(defn check-matches [x y gem-type]
-  ())
+    (fn [colIdx col]
+      (first
+        (drop-while
+          #(= nil %)
+          (map-indexed
+            (fn [rowIdx item]
+              (check-matches colIdx rowIdx item gem-array))
+            col))))
+    gem-array))

+(defn check-matches
+  "Check for matches from: 1. this left, 2. left to this, 3. this down, 4. down to this"
+  [x y gem-type gem-array]
+  (let
+    [right-x (+ x 1)
+     down-y (+ y 1)
+     right-gem-type (get-in gem-array [(+ x 1) y])
+     down-gem-type (get-in gem-array [x (+ y 1)])
+     right-swap (assoc-in
+                     (assoc-in gem-array [(+ x 1) y] gem-type)
+                     [x y] right-gem-type)
+     down-swap (assoc-in
+                     (assoc-in gem-array [x (+ y 1)] gem-type)
+                     [x y] down-gem-type)]
+    (cond
+      (would-match right-x y gem-type right-swap) {:x x :y y :dir "right" :debug 1 :gemtype gem-type}
+      (would-match x down-y gem-type down-swap) {:x x :y y :dir "down" :debug 2 :gemtype gem-type}
+      (would-match x y right-gem-type right-swap) {:x x :y y :dir "right" :debug 3 :gemtype right-gem-type}
+      (would-match x y down-gem-type down-swap) {:x x :y y :dir "down" :debug 4 :gemtype down-gem-type}
+      :else nil)))
+
+
+(def x 0)
+(def y 1)
+(def down-y (+ y 1))
+(def gem-type :opal)
+(def down-gem-type (get-in testArray [x (+ y 1)]))
+(def swapd (assoc-in (assoc-in testArray [x (+ y 1)] gem-type) [x y] down-gem-type))
+(def down-swap swapd)
+(def gem-array swapd)
+(would-match x down-y gem-type down-swap) {:x x :y y :dir "down" :debug 2 :gemtype gem-type}
+(defn would-match [x y gem-type gem-array]
+  (and (not (= gem-type nil))
+  (or
+    (=
+      (get-in gem-array [(+ x 1) y])
+      (get-in gem-array [(+ x 2) y])
+      gem-type)
+    (=
+      (get-in gem-array [(- x 1) y])
+      (get-in gem-array [(- x 2) y])
+      gem-type)
+    (=
+      (get-in gem-array [(- x 1) y])
+      (get-in gem-array [(+ x 1) y])
+      gem-type)
+    (=
+      (get-in gem-array [x (+ y 1)])
+      (get-in gem-array [x (+ y 2)])
+      gem-type)
+    (=
+      (get-in gem-array [x (- y 1)])
+      (get-in gem-array [x (- y 2)])
+      gem-type)
+    (=
+      (get-in gem-array [x (- y 1)])
+      (get-in gem-array [x (+ y 1)])
+      gem-type))))
+
 (def testArray
-  [[:ruby        :opal     :ruby       :diamond    :topaz    :amethyst   :sapphire :sapphire]
+  [[:ruby        :opal     :ruby       :ruby :topaz    :amethyst   :sapphire :sapphire]
    [:ruby        :diamond  :amethyst   :diamond    :opal     :smaragdine :sapphire :smaragdine]
-   [:topaz       :sapphire :smaragdine :topaz      :opal     :diamond    :amethyst :ruby]
+   [:topaz       :diamond  :smaragdine :topaz      :opal     :diamond    :amethyst :ruby]
    [:sapphire    :opal     :sapphire   :topaz      :sapphire :smaragdine :ruby     :ruby]
    [:amethyst    :opal     :diamond    :sapphire   :amethyst :ruby       :opal     :opal]
-   [:topaz       :opal     :amethyst   :smaragdine :amethyst :topaz      :sapphire :amethyst]
-   [:smaragdine  :opal     :opal       :opal       :sapphire :ruby       :amethyst :sapphire]
-   [:amethyst    :opal     :diamond    :amethyst   :diamond  :topaz      :opal     :opal]])
+   [:topaz       :amethyst :amethyst   :smaragdine :amethyst :topaz      :sapphire :amethyst]
+   [:smaragdine  :topaz    :opal       :opal       :sapphire :ruby       :amethyst :sapphire]
+   [:amethyst    :sapphire :diamond    :amethyst   :diamond  :topaz      :opal     :opal]])

-(solve testArray)
+(getFirst testArray)


change how websocket-send works to avoid error

When defining it as just `(partial apply chsk-send!)`, weird errors
were happening in re-frame's guts

--- src/braid/client/events.cljs
+++ src/braid/client/events.cljs
@@ -11,7 +11,7 @@
             [braid.client.dispatcher :refer [dispatch!]]
             [braid.client.quests.helpers :as quest-helpers]))

-(reg-fx :websocket-send (partial apply sync/chsk-send!))
+(reg-fx :websocket-send (fn [args] (apply sync/chsk-send! args)))

 (defn name->open-tag-id
   "Lookup tag by name in the open group"


Add more to the tutorial

Add more to the tutorial

--- worksheets/tutorial.clj
+++ worksheets/tutorial.clj
@@ -12,7 +12,8 @@
 ;; @@

 ;; @@
-(println schemas/Generation)
+(println "Individual" schemas/Individual)
+(println "Generation" schemas/Generation)
 ;; @@

 ;; @@
@@ -102,6 +103,10 @@
 (def fun-generations (search/config->generations fun-config))
 ;; @@

+;; **
+;;; ### Resaults
+;; **
+
 ;; @@
 (-> fun-generations first :individuals first)
 ;; @@
@@ -153,7 +158,29 @@
 ;; @@

 ;; @@
-(-> fun-generations last ->smallest-ind :genome)
+(def best-genome (-> fun-generations last ->smallest-ind :genome))
+
+best-genome
+;; @@
+
+;; **
+;;; ### Testing Model
+;; **
+
+;; @@
+(require '[clojure.repl :refer [source]])
+
+(source search/config->generations)
+;; @@
+
+;; @@
+(def fun-compute (:computed (search/compute-search fun-config)))
+(keys fun-compute)
+;; @@
+
+;; @@
+(def hopefully-times-four (partial (:test-fn fun-compute) best-genome))
+(hopefully-times-four -10)
 ;; @@

 ;; @@


changed deployment variables

changed deployment variables

--- src/cljs/bright_paper_werewolves/core.cljs
+++ src/cljs/bright_paper_werewolves/core.cljs
@@ -20,13 +20,13 @@
 ;; blog-server info, for now assume static
 ;; --------------------------
 ;; Testing
-(def server "localhost")
-(def port "3000")
+;; (def server "localhost")
+;; (def port "3000")

 ;; --------------------------
 ;; Production
-;; (def server "ecallen.com")
-;; (def port "4010")
+(def server "ecallen.com")
+(def port "4010")

 (def userid "ecallen")


working on datepicker.

working on datepicker.

--- src/clojure/com/davidykay/helloclojure/main.clj
+++ src/clojure/com/davidykay/helloclojure/main.clj
@@ -7,6 +7,23 @@
            (android.app Activity)
            (android.app DatePickerDialog DatePickerDialog$OnDateSetListener)
            (android.app DialogFragment)))
+
+(def listing (atom ""))
+
+(declare ^android.widget.LinearLayout mylayout)
+(declare update-ui)
+
+(defn set-elmt [elmt s]
+  (on-ui (config (elmt (.getTag mylayout)) :text s)))
+
+(defn get-elmt [elmt]
+  (str (.getText (elmt (.getTag mylayout)))))
+
+(defn add-event []
+  (swap! listing str
+     (apply format "%d - %s - %s\n" (map get-elmt [::date ::location ::name])))
+  (update-ui))
+

 (defn date-picker [activity]
   (proxy [DialogFragment DatePickerDialog$OnDateSetListener] []
@@ -18,7 +35,8 @@
         (DatePickerDialog. activity this year month day)))
      (onDateSet [view year month day]
        (set-elmt ::date
-         (format "%d%02d%02d" year (inc month) day)))))
+                 "YY MM DD"))))
+         ;(format "%02d%02d%02d" year (inc month) day)))))

 (defn show-picker [activity dp]
   (. dp show (. activity getFragmentManager) "datePicker"))
@@ -31,45 +49,27 @@
                 :id ::name}]
    [:edit-text {:hint "Event location",
                 :id ::location}]
-   [:linear-layout {:orientation :horizontal}
-    [:text-view {:hint "Event date",
-                 :id ::date}]
-    [:button {:text "...",
-              :on-click (fn [_] (show-picker activity
-                                             (date-picker activity)))}]]
+   [:button {:text "...",
+             :on-click (fn [_] (show-picker activity
+                                            (date-picker activity)))}]
    [:button {:text "+ Event",
              :on-click (fn [_](add-event))}]
    [:text-view {:text @listing,
                 :id ::listing}]])
-
-(declare ^android.widget.LinearLayout mylayout)
-
-(defn get-elmt [elmt]
-  (str (.getText (elmt (.getTag mylayout)))))
-
-(defn set-elmt [elmt s]
-  (on-ui (config (elmt (.getTag mylayout)) :text s)))
-
-
-(def listing (atom ""))

 (defn update-ui []
   (set-elmt ::listing @listing)
   (set-elmt ::location "")
   (set-elmt ::name ""))

-(defn add-event []
-  (swap! listing str
-     (apply format "%d - %s - %s\n" (map get-elmt [::date ::location ::name])))
-  (update-ui))
-

 (defactivity com.davidykay.helloclojure.MainActivity
   :key :main
+  ;:def a
   :on-create
   (fn [this bundle]
     (on-ui
-     (set-content-view! (*a)
+     (set-content-view! this
                         (main-layout this)))
     (on-ui
      (set-elmt ::listing @listing))))


more than one world, who knew?

more than one world, who knew?

--- clojure/src/main/clj/cucumber/runtime/clj.clj
+++ clojure/src/main/clj/cucumber/runtime/clj.clj
@@ -10,8 +10,7 @@
               :init init
               :state state))

-;; maybe this should be an atom
-(def world (promise))
+(def world (atom nil))

 (defn load-script [path]
   (try
@@ -23,7 +22,7 @@
   [[] (atom {:resource-loader resource-loader})])

 (defn- -buildWorld [cljb glue-paths a-world]
-  (deliver world a-world)
+  (reset! world a-world)
   (doseq [path glue-paths
           resource (.resources (:resource-loader @(.state cljb)) path ".clj")]
     ;; scripts are loaded with this namespace as the current namespace


Adds start-circle-instance

Adds start-circle-instance

--- src/circle/backend/nodes.clj
+++ src/circle/backend/nodes.clj
@@ -12,7 +12,8 @@
             [pallet.compute.node-list :as node-list]
             [clj-ssh.ssh :as ssh]
             [circle.backend.ec2 :as ec2]
-            [circle.backend.nodes.rails :as rails])
+            [circle.backend.nodes.rails :as rails]
+            [circle.backend.build.config])
   (:use [pallet.configure :only (defpallet)]
         [circle.util.core :only (apply-map)]))

@@ -95,6 +96,13 @@
                               {:instance-type "m1.small"
                                :ami (-> circle.backend.nodes.rails/rails-node :ami)})))

+(defn start-circle-instance []
+  (ec2/start-instances (merge (-> (circle.backend.build.config/read-yml-config ".")
+                                  :nodes
+                                  :www
+                                  (update-in [:public-key] slurp)
+                                  (update-in [:private-key] slurp))
+                              {:keypair-name "www"})))

 ;; TODO: vmfest could probably do this better
 (defn setup-vagrant []


fix docstring

fix docstring

--- src/clj/com/rpl/specter.cljc
+++ src/clj/com/rpl/specter.cljc
@@ -995,9 +995,9 @@
       )))

 (defnav
-  ^{:doc "Navigate to [index elem] pairs for each element in a sequence. Changing in index in transforms
+  ^{:doc "Navigate to [index elem] pairs for each element in a sequence. Changing index in transform
           has same effect as `index-nav`. Indices seen during transform take into account any shifting
-          resulting from prior sequence elements changing indices."}
+          from prior sequence elements changing indices."}
   INDEXED-VALS
   []
   (select* [this structure next-fn]


Beefed up the documentation in the conversion functions.

--- src/clj/forma/conversion.clj
+++ src/clj/forma/conversion.clj
@@ -2,9 +2,22 @@
   (:use (clj-time [core :only (date-time year month day)])
         (clojure.contrib [math :only (ceil)])))

-;; We have to pick some sort of reference starting point, and the
-;; first of january is as good as any!
-;; TODO -- flesh this out. Why the first?
+;; In developing the time period conversion functions, we noticed that
+;; as long as the time period remained consistent from dataset to
+;; dataset, the actual reference point, the zero-month, became
+;; irrelevant. We chose the year 2000 because the MODIS system
+;; recorded its earliest data in February of that year. MODIS indexing
+;; will begin at 1, while NOAA PREC/L rainfall data, for example, will
+;; begin at 0. For the purposes of our algorithm, we'll drop any
+;; indices that hang off the ends, when the datasets are joined. (The
+;; rain data's first month will be hacked off, as will later NDVI
+;; months, if they don't match up with some index of rain data.)
+;;
+;; We keep this reference point throughout calculations of 16 day time
+;; periods as well, as NASA's 16 day collection can be found at 16 day
+;; offsets through the year. The final 16 day set is never full,
+;; though its day count is either 13 or 14, depending on leap year status.
+
 (def ref-date (date-time 2000))

 (defn delta [f a b] (- (f b) (f a)))


update extension-from-content func

update extension-from-content func

--- src/clj/salava/core/util.clj
+++ src/clj/salava/core/util.clj
@@ -129,17 +129,15 @@
       (catch Object _
         (throw+ (str "Error copying file: " _))))))

-(defn extension-from-content [url]
-  (let [content (http/http-get url {:as :byte-array :max-redirects 5})
-        t (:body (client/get url))
-        extension (-> content mime-type-of extension-for-name)]
-  (if (and (= ".txt" extension) (re-find #"<svg" t)) ".svg" extension)))
+(defn extension-from-content [content]
+  (let [extension (-> content mime-type-of extension-for-name)]
+    (if (and (= ".txt" extension) (re-find #"<svg" (String. content))) ".svg" extension)))

 (defn save-file-from-http-url
   [ctx url]
   (let [content (http/http-get url {:as :byte-array :max-redirects 5})
-        extension (extension-from-content url)
+        extension (extension-from-content content)
         path (public-path-from-content content extension)]
     (save-file-data ctx content path)))


footer fix

footer fix

--- src/clj/yambox/templates.clj
+++ src/clj/yambox/templates.clj
@@ -31,15 +31,24 @@
   [& links]
   [:div.footer
    "&copy 2014 "
-   [:b "Sugar Glider"]
-   " team for "
-   [:a {:href   "https://tech.yandex.ru/events/meetings/october-2014/"
-        :target "_blank"}
-    "Yandex.Money Hackathon"]
-   (include-js "/metrika.js")
+   [:a {:href "https://twitter.com/si14"} "Dmitry Groshev"]
+   " and "
+   [:a {:href "https://twitter.com/alwxtwi"} "Alexander Pantyukhov"]
+   [:script {:type "text/javascript"}
+    "(function (d, w, c) { (w[c] = w[c] || []).push(function() { try
+    { w.yaCounter26594253 = new Ya.Metrika({id:26594253, clickmap:true,
+    trackLinks:true, accurateTrackBounce:true}); } catch(e) { } });
+    var n = d.getElementsByTagName(\"script\")[0], s = d.createElement(\"script\"),
+    f = function () { n.parentNode.insertBefore(s, n); };
+    s.type = \"text/javascript\"; s.async = true;
+    s.src = (d.location.protocol == \"https:\" ? \"https:\" : \"http:\")
+    + \"//mc.yandex.ru/metrika/watch.js\";
+    if (w.opera == \"[object Opera]\") {
+    d.addEventListener(\"DOMContentLoaded\", f, false);
+    } else { f(); } })(document, window, \"yandex_metrika_callbacks\");"]
    [:noscript
     [:div
-     [:img {:src   "http://mc.yandex.ru/watch/22414405"
+     [:img {:src   "http://mc.yandex.ru/watch/26594253"
             :style "position:absolute; left:-9999px;"}]]]])

 (defn- wrap-yandex-social


fix handling indel reads in mpileup

fix handling indel reads in mpileup

--- src/cljam/pileup/mpileup.clj
+++ src/cljam/pileup/mpileup.clj
@@ -15,20 +15,26 @@
     \~
     (nth (:qual aln) pos \~)))

-(defn- encode-seq* [seq*]
+(defn- append-seq**
+  [op target current]
+  (case op
+    \M (apply conj current (map str (:seq target)))
+    \I (if (seq current)
+         (update-in current [(dec (count current))]
+                    vector
+                    (str "+" (:n target) (apply str (:seq target))))
+         current)
+    \D (apply conj current (map str (:seq target)))
+    \N (apply conj current (map str (:seq target)))
+    current))
+
+(defn encode-seq* [seq*]
   (loop [[f & r] (filter #(nil? (#{\P} (:op %))) seq*)
          ret     []
          op      nil
          tmp     {:n 0, :op nil, :seq nil}]
     (if (nil? f)
-      (case op
-        \M (apply conj ret (map str (:seq tmp)))
-        \I (if (seq ret)
-             (update-in ret [(dec (count ret))] str "+" (:n tmp) (apply str (:seq tmp)))
-             ret)
-        \D (apply conj ret (map str (:seq tmp)))
-        \N (apply conj ret (map str (:seq tmp)))
-        ret)
+      (append-seq** op tmp ret)
       (if (nil? op)
         (recur r ret (:op f) f)
         (if (= (:op f) op)
@@ -36,14 +42,7 @@
                                    (update-in [:n] + (:n f))
                                    (assoc :op (:op f))
                                    (update-in [:seq] (partial apply conj) (:seq f))))
-          (let [new-ret (case op
-                          \M (apply conj ret (map str (:seq tmp)))
-                          \I (if (seq ret)
-                               (update-in ret [(dec (count ret))] str "+" (:n tmp) (apply str (:seq tmp)))
-                               ret)
-                          \D (apply conj ret (map str (:seq tmp)))
-                          \N (apply conj ret (map str (:seq tmp)))
-                          ret)]
+          (let [new-ret (append-seq** op tmp ret)]
             (recur r new-ret (:op f) f)))))))

 (defn- encode-seq
@@ -117,8 +116,12 @@
           plp1 (apply map (fn [& a]
                             {:rname rname
                              :count (reduce + (map :count a))
-                             :seq   (filterv (complement nil?) (map :seq a))
-                             :qual  (filterv (complement nil?) (map :qual a))}) cfas)]
+                             :seq   (->> (map :seq a)
+                                         (filterv identity)
+                                         (map #(cond
+                                                 (vector? %) (second %)
+                                                 :else %)))
+                             :qual  (filterv identity (map :qual a))}) cfas)]
       (map #(assoc %2 :pos %1 :ref (pickup-ref (:seq ref-line) %1))
            positions plp1))
     (let [plp1 (repeat (count positions) {:rname rname


Modals have a close button

Modals have a close button

--- src/cljs/db_quiz/modals.cljs
+++ src/cljs/db_quiz/modals.cljs
@@ -1,47 +1,58 @@
 (ns db-quiz.modals
-  (:require [db-quiz.util :refer [number-of-fields]]))
+  (:require [db-quiz.util :refer [number-of-fields]]
+            [reagent-modals.modals :refer [close-modal!]]))

 (def pos-number?
   (every-pred number? pos?))

+(defn modal
+  "Wraps modal body in a div with closing button."
+  [body]
+  [:div
+   [:button.close {:on-click close-modal!}
+    [:span "×"]]
+   body])
+
 (defn error-loading-data
   [sparql-endpoint]
-  [:div "Chyba při načítání dat ze SPARQL endpointu "
-        [:a {:href sparql-endpoint} sparql-endpoint]
-        ". Zkuste hru znovu načíst."])
+  (modal
+    [:div "Chyba při načítání dat ze SPARQL endpointu "
+     [:a {:href sparql-endpoint} sparql-endpoint]
+     ". Zkuste hru znovu načíst."]))

 (def game-info
-  [:div
-    [:h2 "Pravidla hry"]
-    [:p "Hra je založena na známé televizní soutěži "
-        [:a {:href "https://cs.wikipedia.org/wiki/AZ-kv%C3%ADz"} "AZ-kvíz"]
-        ". Cílem hry je obsadit pole souvisle spojující všechny tři strany hrací plochy. Hráč získá pole v případě, kdy správně zodpoví položenou otázku. Každá otázka obsahuje popis hádané věci a zkratku jejího názvu. Pokud je otázka pro zvolené pole zodpovězena nesprávně, pole je označeno jako neuhodnuté a jakýkoli hráč na tahu ho může získat bez nutnosti zodpovídání otázky. Na zodpovězení otázky má každý hráč 45 sekund. První hráč, který svými poli souvisle propojí všechny tři strany hrací plochy, se stává vítězem. Začíná náhodně vylosovaný hráč."]
-    [:h2 "Jak hra funguje?"]
-    [:p "V případě DB-quizu jsou herní otázky náhodně generovány na základě databáze. Ve hře je jako databáze použita sémantická podoba české Wikipedia zvaná "
-        [:a {:href "http://cs.dbpedia.org/"} "DBpedia"]
-        "."]
-    [:p "Hru dal dohromady "
-        [:a {:href "http://mynarz.net/#jindrich"} "Jindřich Mynarz"]
-        " s pomocí přátel. Zdrojový kód hry je k dispozici "
-        [:a {:href "https://github.com/jindrichmynarz/db-quiz"} "zde"] "."]
-    [:p [:a {:href "https://github.com/jindrichmynarz/db-quiz/issues"}
-         [:span.glyphicon.glyphicon-exclamation-sign.glyphicon-start]
-         "Nahlásit problém hry"]]])
+  (modal
+    [:div
+     [:h2 "Pravidla hry"]
+     [:p "Hra je založena na známé televizní soutěži "
+      [:a {:href "https://cs.wikipedia.org/wiki/AZ-kv%C3%ADz"} "AZ-kvíz"]
+      ". Cílem hry je obsadit pole souvisle spojující všechny 3 strany hrací plochy. Hráč získá pole v případě, kdy správně zodpoví položenou otázku. Každá otázka obsahuje popis hádané věci a zkratku jejího názvu. Pokud je otázka pro zvolené pole zodpovězena nesprávně, pole je označeno jako neuhodnuté a jakýkoli hráč na tahu ho může získat bez nutnosti zodpovídání otázky. Na zodpovězení otázky má každý hráč 45 sekund. První hráč, který svými poli souvisle propojí všechny 3 strany hrací plochy, se stává vítězem. Začíná náhodně vylosovaný hráč."]
+     [:h2 "Jak hra funguje?"]
+     [:p "V případě DB-quizu jsou herní otázky náhodně generovány na základě databáze. Ve hře je jako databáze použita sémantická podoba české Wikipedia zvaná "
+      [:a {:href "http://cs.dbpedia.org/"} "DBpedia"]
+      "."]
+     [:p "Hru dal dohromady "
+      [:a {:href "http://mynarz.net/#jindrich"} "Jindřich Mynarz"]
+      " s pomocí přátel. Zdrojový kód hry je k dispozici "
+      [:a {:href "https://github.com/jindrichmynarz/db-quiz"} "zde"] "."]
+     [:p [:a {:href "https://github.com/jindrichmynarz/db-quiz/issues"}
+          [:span.glyphicon.glyphicon-exclamation-sign.glyphicon-start]
+          "Nahlásit problém hry"]]]))

 (def google-spreadsheet-help
-  [:div
-   [:h2 "Jak má tabulka vypadat?"]
-   [:p "Tabulka musí mít 2 sloupce, záhlaví a alespoň tolik řádků, kolik je hracích políček. Název prvního sloupce je 'Label', druhý sloupec je pojmenován 'Description'. V prvním sloupci jsou názvy hádaných věcí, zatímco v druhém sloupci je otázka popisující hádanou věc."]
-   ; TODO: Provide a link to sample spreadsheet template.
-   [:h2 "Jak tabulku publikovat?"]
-   [:p "Zvolte 'File' \u2192 'Publish to the web...' \u2192 'Publish'."]])
+  (modal
+    [:div
+     [:h2 "Jak má tabulka vypadat?"]
+     [:p "Tabulka musí mít 2 sloupce, záhlaví a alespoň tolik řádků, kolik je hracích políček. Název prvního sloupce je 'Label', druhý sloupec je pojmenován 'Description'. V prvním sloupci jsou názvy hádaných věcí, zatímco v druhém sloupci je otázka popisující hádanou věc."]
+     [:h2 "Jak tabulku publikovat?"]
+     [:p "Zvolte 'File' \u2192 'Publish to the web...' \u2192 'Publish'."]]))

 (defn invalid-google-spreadsheet-url
   [url]
-  [:div "Neplatné URL Google Spreadsheetu: " url "."])
+  (modal [:div "Neplatné URL Google Spreadsheetu: " url "."]))

 (defn invalid-spreadsheet-rows
   [actual]
   {:pre [(pos-number? actual)]}
-  [:div "Nesprávný počet řádků v tabulce. Je třeba alespoň "
-        number-of-fields "řádků, ale tabulka má jen " actual " řádků."])
+  (modal [:div "Nesprávný počet řádků v tabulce. Je třeba alespoň "
+          number-of-fields "řádků, ale tabulka má jen " actual " řádků."]))


Client-side CSS rendering

Client-side CSS rendering

--- src/cljs/myproject/core.cljs
+++ src/cljs/myproject/core.cljs
@@ -8,6 +8,7 @@
    [reagent.core :as r]
    [posh.reagent :as p]
    [datascript.core :as d]
+   [garden.core :refer [css]]
    ;; -----
    [myproject.utils :as utils :refer [log*]]
    [myproject.client :as client]))
@@ -64,6 +65,16 @@
 ;; UI Components
 ;;

+(def common-style
+  (css [:h1 {:font-weight "bold"}]))
+
+(defonce style-node
+  (let [node (js/document.createElement "style")]
+    (js/document.head.appendChild node)
+    node))
+
+(aset style-node "innerHTML" style)
+
 (defn app []
   [:section.section>div.container
    [:h1.title
@@ -75,6 +86,10 @@
          "!")]
    [:p.subtitle "Let's go!"]])

+;;
+;; Init
+;;
+
 (r/render [app] (js/document.getElementById "app"))

 (client/start-router!)


Memoize math - space is cheaper than time.

--- src/cljs/primes/numbers.cljs
+++ src/cljs/primes/numbers.cljs
@@ -95,8 +95,13 @@
   (let [by-prime (group-results identity (factors n))]
     (sort > (map second by-prime))))

+(defn signature-and-value [n]
+  [(signature n) n])
+
+(def signature-and-value-m (memoize signature-and-value))
+
 (defn signatures [thru-n]
-  (map (juxt signature identity) (range 2 thru-n)))
+  (map signature-and-value-m (range 2 thru-n)))

 (defn sort-groups
   "Sort groups based on distance from origin in 'primes space'"


Fix broken `compile-when` macro.

Fix broken `compile-when` macro.

--- src/clojure/parkour/util.clj
+++ src/clojure/parkour/util.clj
@@ -80,7 +80,7 @@
 (defmacro compile-when
   "Evaluate `exp` and if it returns logical true and doesn't error, expand
 `body` forms."
-  [exp & body] `(compile-if (do ~@body) nil))
+  [exp & body] `(compile-if ~exp (do ~@body) nil))

 (defn run-id
   "A likely-unique user- and time-based string."


default values for update config set explicitly

--- src/clj/swarmpit/docker/mapper/inbound.clj
+++ src/clj/swarmpit/docker/mapper/inbound.clj
@@ -103,9 +103,9 @@
 (defn ->service-deployment
   [service]
   (let [update-config (get-in service [:Spec :UpdateConfig])]
-    {:parallelism   (:Parallelism update-config)
+    {:parallelism   (or (:Parallelism update-config) 1)
      :delay         (or (:Delay update-config) 0)
-     :failureAction (:FailureAction update-config)}))
+     :failureAction (or (:FailureAction update-config) "pause"}))

 (defn ->service-replicas-running
   [service-tasks]


Some minor additions and fixes for utils

This is one more set of changes extracted from my reporting pull
request.  It includes:

* A few new utility functions that are useful for pre-conditions
* Fix to the datetime? function; it was previously returning true
  for objects whose classes supported ICoerce, even if the actual
  instance was not a valid datetime (`to-date-time` returning `nil`).
* Provide an additional signature for mapvals function
* New `maptrans` function
* New `validate-map` function

--- src/com/puppetlabs/utils.clj
+++ src/com/puppetlabs/utils.clj
@@ -26,9 +26,41 @@
         [clojure.set :only (difference union)]
         [clojure.stacktrace :only (print-cause-trace)]
         [clj-time.core :only [now]]
-        [clj-time.coerce :only [ICoerce]]
+        [clj-time.coerce :only [ICoerce to-date-time]]
         [clj-time.format :only [formatters unparse]]
         [slingshot.slingshot :only (try+ throw+)]))
+
+;; ## Type checking
+
+(def string-or-nil? (some-fn string? nil?))
+
+(defn array?
+  "Returns true if `x` is an array"
+  [x]
+  (-?> x
+    (class)
+    (.isArray)))
+
+(defn datetime?
+  "Predicate returning whether or not the supplied object is
+  convertible to a Joda DateTime"
+  [x]
+  (and
+    (satisfies? ICoerce x)
+    (not (nil? (to-date-time x)))))
+
+;; TODO: no one besides us is ever going to use this, but I'm not sure where
+;; else to put it.  Seems goofy to create a "utils.internal" namespace?
+(defn keywords-fn-pair?
+  "Predicate that expects to be passed a two-element list; the first element
+  should be a list of keywords, and the second element should be a function.
+  This is the data structure required by some of our map utility functions, so
+  this is mostly used to validate input to those functions via preconditions."
+  [[ks fn]]
+  (and
+    (coll? ks)
+    (every? keyword? ks)
+    (fn? fn)))

 ;; ## I/O

@@ -102,10 +134,14 @@
        (constructor item))))

 (defn mapvals
-  "Return map `m`, with each value transformed by function `f`"
-  [f m]
-  (into {} (concat (for [[k v] m]
-                     [k (f v)]))))
+  "Return map `m`, with each value transformed by function `f`.
+
+  You may also provide an optional list of keys `ks`; if provided, only the
+  specified keys will be modified."
+  ([f m]
+    (mapvals f m (keys m)))
+  ([f m ks]
+    (reduce (fn [m k] (update-in m [k] f)) m ks)))

 (defn mapkeys
   "Return map `m`, with each key transformed by function `f`"
@@ -113,12 +149,46 @@
   (into {} (concat (for [[k v] m]
                      [(f k) v]))))

-(defn array?
-  "Returns true if `x` is an array"
-  [x]
-  (-?> x
-       (class)
-       (.isArray)))
+(defn maptrans
+  "Return map `m`, with values transformed according to the key-to-function
+  mappings specified in `keys-fns`.  `keys-fns` should be a map whose keys
+  are lists of keys from `m`, and whose values are functions to apply to those
+  keys.
+
+  Example: `(maptrans {[:a, :b] inc [:c] dec} {:a 1 :b 1 :c 1})` yields `{:a 2, :c 0, :b 2}`"
+  [keys-fns m]
+  {:pre [(map? keys-fns)
+         (every? keywords-fn-pair? keys-fns)
+         (map? m)]}
+  (let [ks (keys keys-fns)]
+    (reduce (fn [m k] (mapvals (keys-fns k) m k)) m ks)))
+
+(defn validate-map
+  "A utility function for validating the contents of a map.  Throws
+  `IllegalArgumentException` if the contents of the map are not valid.
+
+  Requires three arguments:
+
+  * `desc`: A description of the object/map that you are validating; this will
+    be used to create a descriptive error message in the event that the map is
+    not valid.
+  * `m`: The map to validate.
+  * `key-defs`: The definitions of the keys should exist in the map, and how they
+    should be validated.  This argument should be a list of triples.  Each triple
+    should consist of:
+      * the key to validate
+      * a predicate function to apply to the value of that key in the map to test
+        its validity, and
+      * a string describing the expected type of the value, used to create an
+        more useful error message explaining why the validation failed if it does."
+  [desc m key-defs]
+  (doseq [[required-key validate-fn type-desc] key-defs]
+    (when-not (contains? m required-key)
+      (throw (IllegalArgumentException. (format "%s is missing required key %s" desc required-key))))
+    (when-not (validate-fn (required-key m))
+      (throw (IllegalArgumentException.
+                (format "%s data is invalid for key %s; expected type '%s', got '%s'"
+                  desc required-key type-desc (required-key m)))))))

 (defn keyset
   "Retuns the set of keys from the supplied map"
@@ -135,12 +205,6 @@
   (set (vals m)))

 ;; ## Date and Time
-
-(defn datetime?
-  "Predicate returning whether or not the supplied object is
-  convertible to a Joda DateTime"
-  [x]
-  (satisfies? ICoerce x))

 (defn timestamp
   "Returns a timestamp string for the given `time`, or the current time if none


return latest data after insert

return latest data after insert

--- src/rrms/core.clj
+++ src/rrms/core.clj
@@ -93,15 +93,16 @@
                en "employeename" d "date"
                lc "location" br "barcode" }
               body]
-          (rr/content-type
-           (rr/response
+          (do
             (db/insert-documents {:documentname dn
                                   :title title
                                   :employeename en
                                   :date (c/to-sql-time (f/parse d))
                                   :location lc
-                                  :barcode br}))
-           content-type)))
+                                  :barcode br})
+            (rr/content-type
+             (rr/response (db/get-all-documents))
+             content-type))))

   (POST "/documents/update"
         {body :body}


Minor refactoring in parallel fetcher

Minor refactoring in parallel fetcher

--- src/cyanite_fetcher/core.clj
+++ src/cyanite_fetcher/core.clj
@@ -96,15 +96,15 @@
   "Fetch data in parallel fashion."
   (let [futures
         (doall (map #(future
-                       (let [data (alia/execute
-                                   session fetch!
-                                   {:values [% tenant (int rollup)
-                                             (int period)
-                                             from to]
-                                    :fetch-size Integer/MAX_VALUE})]
-                         (->> (doall data)
-                              (map detect-aggregate)
-                              (seq))))
+                       (->> (alia/execute
+                             session fetch!
+                             {:values [% tenant (int rollup)
+                                       (int period)
+                                       from to]
+                              :fetch-size Integer/MAX_VALUE})
+                            (map detect-aggregate)
+                            (doall)
+                            (seq)))
                     paths))]
     (map deref futures)))


:sparkles: Add more builtin colors

:sparkles: Add more builtin colors


Add an API for accessing total-solved-count

--- src/foreclojure/problems.clj
+++ src/foreclojure/problems.clj
@@ -579,6 +579,7 @@

 (defroutes problems-routes
   (GET "/problems" [] (problem-list-page))
+  (GET "/problems/solved" [] (:total @solved-stats))
   (GET "/problem/:id" [id]
     (if-let [id-int (as-int id)]
       (problem-page id-int)


Link to user profiles in solution list

Link to user profiles in solution list

--- src/foreclojure/problems.clj
+++ src/foreclojure/problems.clj
@@ -340,7 +340,9 @@

 (defn solution-block [username code]
   [:div.follower-solution
-   [:div.solution-username (str username "'s solution:")]
+   [:div.solution-username
+    (link-to (str "/user/" username) username)
+    "'s solution:"]
    [:pre.solution-code
     (escape-html code)]])


test.check interferes with data-test

test.check interferes with data-test

--- test/src/dda/pallet/dda_serverspec_crate/infra/fact/iproute_test.clj
+++ test/src/dda/pallet/dda_serverspec_crate/infra/fact/iproute_test.clj
@@ -46,10 +46,11 @@
    [[fact script] gen-fact-and-script]
    (= fact (sut/parse-iproute-response script))))

-(deftest test-parse
-  (testing
-    "test parsing iproute output"
-    (is (:result (tc/quick-check 10 prop-ipv4-parsing)))))
+; TODO: test.check interferes here with data-test
+; (deftest test-parse
+;   (testing
+;     "test parsing iproute output"
+;     (is (:result (tc/quick-check 10 prop-ipv4-parsing)))))

 (defdatatest should-parse [input expected]
   (is (= expected


another test

another test

--- src/main/cawala/api/read.clj
+++ src/main/cawala/api/read.clj
@@ -6,7 +6,7 @@
                      :person/relation :friend}
                  2  {:db/id 2 :person/name "Sally" :person/age 22
                      :person/relation :friend}
-                 3  {:db/id 3 :person/name "Allie" :person/age 75
+                 3  {:db/id 3 :person/name "Allie" :person/age 74
                      :person/relation :enemy}
                  4  {:db/id 4 :person/name "Zoe" :person/age 32
                      :person/relation :friend}


add missing munge when getting interned vars from ns object

--- src/main/cljs/cljs/core.cljs
+++ src/main/cljs/cljs/core.cljs
@@ -9842,7 +9842,7 @@
     (Var. (get @mappings sym)
       (symbol (str name) (str sym)) nil))
   (findInternedVar [_ sym]
-    (Var. (goog.object/get obj (str sym))
+    (Var. (goog.object/get obj (munge (str sym)))
       (symbol (str name) (str sym)) nil))
   (getMappings [_]
     @mappings)


fix worker using wrong fs-watch namespace

--- src/main/shadow/cljs/devtools/server/worker.clj
+++ src/main/shadow/cljs/devtools/server/worker.clj
@@ -10,7 +10,7 @@
             [shadow.cljs.devtools.server.web.common :as common]
             [shadow.build.classpath :as cp]
             [shadow.build.npm :as npm]
-            [shadow.cljs.devtools.server.fs-watch-hawk :as fs-watch]
+            [shadow.cljs.devtools.server.fs-watch :as fs-watch]
             [shadow.build.babel :as babel])
   (:import (java.util UUID)))


use fipp instead of cljs.pprint

use fipp instead of cljs.pprint

including both is overkill

--- src/main/shadow/cljs/ui/components/inspect.cljs
+++ src/main/shadow/cljs/ui/components/inspect.cljs
@@ -7,7 +7,7 @@
     [shadow.cljs.model :as m]
     [shadow.cljs.ui.components.common :as common]
     [shadow.experiments.grove.keyboard :as keyboard]
-    [cljs.pprint :refer (pprint)]))
+    [fipp.edn :refer (pprint)]))

 (refer-lazy shadow.cljs.ui.components.code-editor/codemirror)


now fiddling with Ruby

now fiddling with Ruby


lift anon method into named helper

lift anon method into named helper

--- src/midje/parsing/2_to_lexical_maps/expects.clj
+++ src/midje/parsing/2_to_lexical_maps/expects.clj
@@ -14,30 +14,29 @@
             [such.sequences :as seq]))

+;; TODO: Maybe this wants to be a multimethod, but I'm not sure whether the
+;; resemblance between data-fakes and regular fakes isn't too coincidental.
+(defn- expand-fake [fake]
+ (cond (first-named? fake "fake")
+       (parse-fakes/to-lexical-map-form fake)
+
+       (first-named? fake "data-fake")
+       (parse-data-fakes/to-lexical-map-form fake)
+
+       (first-named? fake "not-called")
+       (macroexpand fake)
+
+       :else
+       (do (prn "Now here's a peculiar thing to find inside a check: " fake)
+           fake)))
+
 (defn expansion [call-form arrow expected-result fakes overrides]
   (branch-on arrow
     recognize/common-check-arrow?
     (let [check (lexical-maps/checkable call-form arrow expected-result overrides)
-          expanded-fakes (map (fn [fake]
-                                 ;; TODO: Maybe this wants to be a multimethod,
-                                 ;; but I'm not sure whether the resemblance between
-                                 ;; data-fakes and regular fakes isn't too coincidental.
-                                 (cond (first-named? fake "fake")
-                                       (parse-fakes/to-lexical-map-form fake)
+          expanded-fakes (map expand-fake fakes)]
+      `(midje.checking.checkables/check-one ~check ~(vec expanded-fakes)))

-                                       (first-named? fake "data-fake")
-                                       (parse-data-fakes/to-lexical-map-form fake)
-
-                                       (first-named? fake "not-called")
-                                       (macroexpand fake)
-
-                                       :else
-                                       (do
-                                         (prn "Now here's a peculiar thing to find inside a check: " fake)
-                                         fake)))
-                               fakes)]
-      `(midje.checking.checkables/check-one ~check ~(vec expanded-fakes)))
-
     recognize/macroexpansion-check-arrow?
     (let [expanded-macro `(macroexpand-1 '~call-form)
           escaped-expected-result `(quote ~expected-result)]
@@ -50,7 +49,7 @@

     recognize/parse-exception-arrow?
     (throw (java.lang.ClassNotFoundException. "A test asked for an exception"))
-
+
     :else
     (throw (Error. (str "Program error: Unknown arrow form " arrow)))))

@@ -66,7 +65,7 @@
 (defn to-lexical-map-form [full-form]
   (apply expansion (valid-pieces full-form)))

-(defmacro expect
+(defmacro expect
   {:arglists '([call-form arrow expected-result & fakes+overrides])}
   [& _]
   (to-lexical-map-form &form))


test request sooner for prerenderer

test request sooner for prerenderer

--- src/name_bazaar/ui/core.cljs
+++ src/name_bazaar/ui/core.cljs
@@ -49,12 +49,12 @@
                                           :events [:district0x/smart-contracts-loaded :district0x/my-addresses-loaded]
                                           :dispatch-n [[:district0x/watch-my-eth-balances]
                                                        [:try-resolving-address]
-                                                       [:active-page-changed]]}]}
+                                                       [:active-page-changed]
+                                                       [:offerings.total-count/load]]}]}
                     :forward-events {:register :active-page-changed
                                      :events #{:district0x/set-active-page}
                                      :dispatch-to [:active-page-changed]}
                     :dispatch-n [[:setup-update-now-interval]
                                  [:district0x/load-conversion-rates [:USD]]
-                                 [:district0x.config/load]
-                                 [:offerings.total-count/load]]}}])
+                                 [:district0x.config/load]]}}])
   (mount-root))


Show only tweets with links.

Show only tweets with links.

--- src/orbitingnews/twitter.clj
+++ src/orbitingnews/twitter.clj
@@ -29,10 +29,17 @@
       (.setOAuthAccessToken access-token))
     twitter))

+(defn fetch-link [status]
+  (.getExpandedURL status))
+
+(defn handle-status [status]
+  (let [urls (map fetch-link (vec (.getURLEntities status)))]
+    (when-not (empty? urls) (prn urls))))
+
 (defn status-listener []
   "Implementation of twitter4j's StatusListener interface"
   (proxy [StatusListener] []
-    (onStatus [^twitter4j.Status status] (println (.getText status)))
+    (onStatus [^twitter4j.Status status] (handle-status status))
     (onException [^java.lang.Exception e] (.printStackTrace e))
     (onDeletionNotice [^twitter4j.StatusDeletionNotice statusDeletionNotice] ())
     (onScrubGeo [userId upToStatusId] ())
@@ -41,7 +48,7 @@
 (defn user-listener []
   "Implementation of twitter4j's StatusListener interface"
   (proxy [UserStreamListener] []
-    (onStatus [^twitter4j.Status status] (println (.getText status)))
+    (onStatus [^twitter4j.Status status] (handle-status status))
     (onException [^java.lang.Exception e] (.printStackTrace e))
     (onDeletionNotice [^twitter4j.StatusDeletionNotice statusDeletionNotice] ())
     (onScrubGeo [userId upToStatusId] ())
@@ -69,7 +76,7 @@

 (defn do-filter-stream []
   ; We want tweets with the word tweet in them
-  (let [filter-query (FilterQuery. 0 (long-array []) (into-array String ["#ChristianChavezNoRaulGil"]))
+  (let [filter-query (FilterQuery. 0 (long-array []) (into-array String ["#MissBrasil"]))
         stream (oauth-stream-authorized-twitter)]
     (.addListener stream (status-listener))
     (.filter stream filter-query)))


Add helper fn which returns a simple map representing the next modified controller.

--- src/overtone/studio/midi.clj
+++ src/overtone/studio/midi.clj
@@ -121,3 +121,17 @@
   (remove-handler (:off-key player))
   (reset! (:status player) :stopped)
   player)
+
+
+(defn midi-capture-next-control-input
+  "Returns a simple map representing next modified controller. Useful
+  for detecting controller information."
+  []
+  (let [p (promise)]
+    (oneshot-event [:midi :control-change]
+                   (fn [msg]
+                     (let [{controller :data1 val :data2} msg
+                           device-name                    (get-in msg [:device :name])]
+                       (deliver p {:device device-name, :controller controller :value val})))
+                   ::print-next-control-input)
+    @p))


Fix spec example

Fix spec example

--- examples/ring-spec-swagger/src/example/server.clj
+++ examples/ring-spec-swagger/src/example/server.clj
@@ -13,7 +13,7 @@
             ; [reitit.ring.middleware.dev :as dev]
             ; [reitit.ring.spec :as spec]
             ; [spec-tools.spell :as spell]
-            [spec-tools.data-spec :as ds]
+            [spec-tools.core :as st]
             [ring.adapter.jetty :as jetty]
             [muuntaja.core :as m]
             [clojure.spec.alpha :as s]
@@ -28,7 +28,7 @@

 ;; Use data-specs to provide extra JSON-Schema properties:
 ;; https://github.com/metosin/spec-tools/blob/master/docs/04_json_schema.md#annotated-specs
-(s/def ::x (ds/spec {:spec int?
+(s/def ::x (st/spec {:spec int?
                      :name "X parameter"
                      :description "Description for X parameter"
                      :json-schema/default 42}))


Introduce (game :point-x) and (game :point-y) to preserve backwards compatibility

--- src/play_clj/core_basics.clj
+++ src/play_clj/core_basics.clj
@@ -94,15 +94,17 @@
   "Provides quick access to often-used functions.

     (game :width)"
-  [k]
+  [k & [arg]]
   (case k
     :width (graphics! :get-width)
     :height (graphics! :get-height)
     :fps (graphics! :get-frames-per-second)
     :fullscreen? (graphics! :is-fullscreen)
     :touched? (input! :is-touched)
-    :x (input! :get-x)
-    :y (- (graphics! :get-height) (input! :get-y))
+    :x (input! :get-x) ; deprecated, use :point-x instead
+    :y (input! :get-y) ; deprecated, use :point-y instead (it is flipped)
+    :point-x (input! :get-x (or arg 0))
+    :point-y (- (graphics! :get-height) (input! :get-y (or arg 0)))
     (u/throw-key-not-found k)))

 (defmacro key-code


test request sooner for prerenderer

test request sooner for prerenderer

--- src/name_bazaar/ui/core.cljs
+++ src/name_bazaar/ui/core.cljs
@@ -46,11 +46,10 @@
                    :effects
                    {:async-flow {:first-dispatch [:district0x/load-smart-contracts {:version constants/contracts-version}]
                                  :rules [{:when :seen?
-                                          :events [:district0x/smart-contracts-loaded :district0x/my-addresses-loaded]
+                                          :events [:district0x/smart-contracts-loaded]
                                           :dispatch-n [[:district0x/watch-my-eth-balances]
                                                        [:try-resolving-address]
-                                                       [:active-page-changed]
-                                                       [:offerings.total-count/load]]}]}
+                                                       [:active-page-changed]]}]}
                     :forward-events {:register :active-page-changed
                                      :events #{:district0x/set-active-page}
                                      :dispatch-to [:active-page-changed]}


Don't throw away perfectly good information.

--- src-cljs/frontend/controllers/navigation.cljs
+++ src-cljs/frontend/controllers/navigation.cljs
@@ -247,8 +247,7 @@
              :navigation-data (assoc args :show-aside-menu? false))
       state-utils/clear-page-state
       (assoc-in state/crumbs-path [{:type :build-insights}
-                                   {:type :insights-repositories}])
-      (assoc-in state/projects-path nil)))
+                                   {:type :insights-repositories}])))

 (defmethod post-navigated-to! :build-insights
   [history-imp navigation-point _ previous-state current-state]
@@ -269,8 +268,7 @@
                                     :username org}
                                    {:type :project
                                     :username org
-                                    :project repo}])
-      (assoc-in state/projects-path nil)))
+                                    :project repo}])))

 (defmethod post-navigated-to! :project-insights
   [history-imp navigation-point _ previous-state current-state]


Comment dump exception

Comment dump exception

--- src/obb_rules_api/routes.clj
+++ src/obb_rules_api/routes.clj
@@ -41,7 +41,7 @@
     (try
       (handler req)
       (catch Exception e
-        (clojure.stacktrace/print-stack-trace e 10)
+        #_(clojure.stacktrace/print-stack-trace e 10)
         (reply/exception e)))))

 (defn setup-cors


look ma, I can add numbers

look ma, I can add numbers

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

--- src/aurora/editor/ui.cljs
+++ src/aurora/editor/ui.cljs
@@ -18,6 +18,28 @@

 (defn update-path [path neue]
   (update-in path [(-> path count dec)] merge neue))
+
+(defn update-sub-path [path neue]
+  (let [path (if-not (map? path)
+               (last path)
+               path)
+        neue (if (coll? neue)
+               neue
+               [neue])]
+    (assoc path :sub-path (concat (:sub-path path []) neue))))
+
+(extend-type function
+  Fn
+  IMeta
+  (-meta [this] (.-meta this)))
+
+(alter-meta! + assoc :desc "Add " :name "cljs.core._PLUS_")
+(alter-meta! - assoc :desc "Subtract " :name "cljs.core._")
+(alter-meta! * assoc :desc "Multiply " :name "cljs.core._STAR_")
+(alter-meta! / assoc :desc "Divide " :name "cljs.core._SLASH_")
+
+(alter-meta! number? assoc :desc "Is a number? " :name "cljs.core.number_QMARK_")
+

 ;;*********************************************************
 ;; Declares
@@ -134,7 +156,7 @@
                                                  :left (.-clientX e)
                                                  :items [{:label "remove"
                                                           :action (fn []
-                                                                    (println "remove!"))}]}))}
+                                                                    (remove-step! (current :page) step))}]}))}
     (clickable-ref step path)]
    (sub-step step path)
    ))
@@ -144,7 +166,11 @@
       [:p {:className "desc"}
        (ref->name (:ref step))
        (each [input (:args step)]
-             (item-ui input))]))
+             (item-ui input (update-sub-path path [:args index])))]
+   [:div {:className "result"}
+      (item-ui (path->result path))
+      ]
+   ))

 (defmethod item-ui :ref/id [step]
   (dom [:span {:className "ref"}
@@ -319,11 +345,21 @@
                (subs refs 0 5)]])
    ])

+(defdom call-inserter [page]
+  [:ul
+   (each [ref [(ref-js "cljs.core._PLUS_")]]
+         [:li [:button {:onClick (fn []
+                                   (add-step! (current :page) (call ref [1 2])))}
+               (ref->name ref)]])
+   [:li "foo"]
+   ])
+
 (defdom new-step-helper []
   [:div
    [:p "Let's create some data to get started!"]
    (constant-inserter)
    (ref-inserter (current :page))
+   (call-inserter (current :page))
    ])

 (defdom step-canvas [step path]
@@ -523,7 +559,8 @@
                                                     ))}]
                            [:span {:className "value"
                                    :onClick (fn []
-                                              (add-input! path true)
+                                              (when path
+                                                (add-input! path true))
                                               )}
                             (str x)])))
              "keyword" (fn [x]
@@ -540,7 +577,8 @@
                                                     ))}]
                            [:span {:className "value"
                                    :onClick (fn []
-                                              (add-input! path true)
+                                              (when path
+                                                (add-input! path true))
                                               )}
                             (str x)])
                           ))
@@ -609,10 +647,21 @@
                        :data data}
                       opts)))

+(defn call
+  ([ref args] (call ref args {}))
+  ([ref args opts] (merge {:type :call
+                           :ref ref
+                           :args args}
+                      opts)))
+
 (defn ref-id [id]
   {:type :ref/id
    :id id})

+(defn ref-js [js]
+  {:type :ref/js
+   :js js})
+
 ;;*********************************************************
 ;; Aurora state (mutation!)
 ;;*********************************************************
@@ -627,7 +676,9 @@
   (swap! aurora-state update-in [:cache :inputs] dissoc id))

 (defn update-index! [thing path & args]
-  (if-not thing
+  (if (or (not thing)
+          (and (map? thing)
+               (not (:id thing))))
     (throw (js/Error. "Trying to update index with nil"))
     (apply swap! aurora-state update-in
            (concat [:index (if (map? thing)
@@ -762,8 +813,10 @@

 (defn re-run [notebook page args]
   (when (and notebook page)
-    (reset! run-stack #js {:calls #js [(nth (run-index (:index @aurora-state) notebook page args) 2)]})
-    (queue-render)))
+    (let [run (run-index (:index @aurora-state) notebook page args)]
+      (println "RESULT: " (first run))
+      (reset! run-stack #js {:calls #js [(nth run 2)]})
+      (queue-render))))

 (defn find-id [thing id]
   (first (filter #(= (aget % "id") id) (aget thing "calls"))))
@@ -824,5 +877,3 @@
 ;;*********************************************************

 (repopulate)
-
-


Reflection warnings.

Reflection warnings.

--- src/onyx/messaging/aeron.clj
+++ src/onyx/messaging/aeron.clj
@@ -196,15 +196,15 @@
         (let [t (System/currentTimeMillis)
               snapshot @publications
               to-remove (map first
-                             (filter (fn [[k v]] (>= (- t @(:last-used v)) idle))
+                             (filter (fn [[k v]] (>= (- ^long t ^long @(:last-used v)) idle))
                                      snapshot))]
           (doseq [k to-remove]
             (let [pub (:publication (snapshot k))
                   conn (@connections k)]
               (swap! publications dissoc k)
               (swap! connections dissoc k)
-              (.close pub)
-              (.close conn))))
+              (.close ^Publication pub)
+              (.close ^Aeron conn))))
         (catch InterruptedException e
           (throw e))
         (catch Throwable e
@@ -266,7 +266,7 @@
     (doseq [conn (vals @connections)]
       (.close ^Aeron conn))
     (when media-driver (.close ^MediaDriver media-driver))
-    (when media-driver-context (.deleteAeronDirectory media-driver-context))
+    (when media-driver-context (.deleteAeronDirectory ^MediaDriver$Context media-driver-context))
     (assoc component
            :pub-gc-thread nil
            :media-driver nil :publications nil :virtual-peers nil


Remove logging statements

Remove logging statements

--- src/onyx/messaging/aeron.clj
+++ src/onyx/messaging/aeron.clj
@@ -364,11 +364,8 @@
       (let [{:keys [subscription src-peer-id]} next-subscription
             result-state (atom [])
             take-n 2
-            _ (info "GW Before " @global-watermarks)
             gw-val (swap! global-watermarks take-ticket task-id src-peer-id id take-n)
-            _ (info "GW after " @global-watermarks)
             ticket (get-in gw-val [task-id src-peer-id :ticket])
-            _ (info "Ticket: " ticket)
             fh (controlled-fragment-data-handler (partial handle-message result-state message-counter task-id src-peer-id ticket))]
         (if (= [-1 -1] ticket)
           []


Allow notes to use B as flat in addition to b. Also pull out midi note regexp matcher so it can be used externally.

--- src/overtone/music/pitch.clj
+++ src/overtone/music/pitch.clj
@@ -5,7 +5,8 @@
      :author "Jeff Rose, Sam Aaron & Marius Kempe"}
   overtone.music.pitch
   (:use [overtone.util old-contrib]
-        [overtone.algo chance]))
+        [overtone.algo chance])
+  (:require [clojure.string :as string]))

 ;; Notes in a typical scale are related by small, prime number ratios. Of all
 ;; possible 7 note scales, the major scale has the highest number of consonant
@@ -91,6 +92,10 @@
 (def REVERSE-NOTES
   (into {} (map (fn [[k v]] [v k]) NOTES)))

+(def MIDI-NOTE-RE-STR "([a-gA-G][#bB]?)([-0-9]+)" )
+(def MIDI-NOTE-RE (re-pattern MIDI-NOTE-RE-STR))
+(def ONLY-MIDI-NOTE-RE (re-pattern (str "\\A" MIDI-NOTE-RE-STR "\\Z")))
+

 (defn note
   "Resolves note to MIDI number format. Resolves upper and lower-case keywords
@@ -115,8 +120,7 @@
                     (throw (IllegalArgumentException.
                             (str "Unable to resolve note: " n ". Value is out of range. Lowest value is 0"))))
    (keyword? n) (note (name n))
-   (string? n) (let [midi-note-re #"\A([a-gA-G][#b]?)([-0-9]+\Z)"
-                        separated (re-find midi-note-re n)
+   (string? n) (let [separated (re-find ONLY-MIDI-NOTE-RE n)
                         _ (when (nil? separated)
                             (throw (IllegalArgumentException.
                                     (str "Unable to resolve note: " n ". Does not appear to be in MIDI format i.e. C#4"))))
@@ -126,7 +130,7 @@
                         _ (when (< octave -1)
                             (throw (IllegalArgumentException.
                                     (str "Unable to resolve note: " n ". Octave is out of range. Lowest octave value is -1"))))
-                        interval (NOTES (keyword pitch-class))
+                        interval (NOTES (keyword (string/lower-case pitch-class)))

                         _ (when (nil? interval)
                             (throw (IllegalArgumentException.


Use => rather than ->

Use => rather than ->

--- src/overtunes/songs/canone_alla_quarta.clj
+++ src/overtunes/songs/canone_alla_quarta.clj
@@ -2,6 +2,8 @@
   (:use
     [overtone.live :only [at now]]
     [overtone.inst.sampled-piano :only [sampled-piano] :rename {sampled-piano piano#}]))
+
+(defn => [val & fs] (reduce #(apply %2 [%1]) val fs))

 (defn update-all [m [& ks] f]
     (if ks
@@ -82,15 +84,14 @@

 (defn play# []
   (let [from-now #(translate % 0 (now))
-        beat (from-now (bpm 90))
-        with-beat (update :time (partial connect beat))
-        in-key (update :pitch (partial connect g-major))
+        with-beat (update :time (partial connect (from-now (bpm 90))))
+        in #(update :pitch (partial connect %))
         with-bass-accidentals (update :pitch (partial sharps [8]))
         with-leader-accidentals (connect (update :pitch (partial sharps [22 32])) (update :pitch (partial flats [37])))
         after-a-half (after 1/2)]
-    (-> bass in-key with-bass-accidentals with-beat melody#)
-    (-> leader after-a-half canone-alla-quarta in-key with-beat melody#)
-    (-> leader after-a-half in-key with-leader-accidentals with-beat melody#)
+    (=> bass (in g-major) with-bass-accidentals with-beat melody#)
+    (=> leader (after 1/2) canone-alla-quarta (in g-major) with-beat melody#)
+    (=> leader (after 1/2) (in g-major) with-leader-accidentals with-beat melody#)
     ))

 (play#)


Improve configuration option for pre-loading projections

--- src/photon/default_projs.clj
+++ src/photon/default_projs.clj
@@ -14,144 +14,11 @@
      {(:stream-name n)
       {:total-events 1}})))

-(def all-events
-  (sfn/fn [p n]
-    (let [hash-amount 5000
-          ignored ["/favicon.ico" "/fonts/" "/learn.json"
-                   "/images/learn.json" "/apple-touch-icon.png"
-                   "/browserconfig.xml"
-                   "/views-react//remarkable-react.jsx"
-                   "/apple-touch-icon-precomposed.png"]
-          payload (:payload n)
-          user-agent (:user-agent (:headers payload))
-          starts-with (fn [^String s ^String b] (.startsWith s b))
-          user (mod (hash (:session_id payload)) hash-amount)]
-      (if (and (not (nil? user)) (= "get-html" (:commandName payload))
-               (not (nil? user-agent))
-               (not (starts-with user-agent "Apache")))
-        (let [matrix (:matrix p)
-              origin (get (:user-last p) user)
-              destination (:url payload)
-              index-of (fn [^String s ^String b] (.indexOf s b))
-              ignore (map #(= 0 (index-of destination %)) ignored)
-              ignore (reduce #(or %1 %2) false ignore)]
-          (if ignore
-            p
-            (let [new-matrix
-                  (if (nil? origin)
-                    matrix
-                    (let [by-origin (get matrix origin {})
-                          new-d (merge-with + by-origin {destination 1})]
-                      (assoc matrix origin new-d)))
-                  new-keys (into [] (conj (into #{} (:keys p))
-                                          destination))]
-              {:matrix new-matrix
-               :keys new-keys
-               :user-last (assoc (:user-last p) user destination)})))
-        p))))
-
-(def login-failed
-  (sfn/fn [p n]
-    (let [payload (:payload n)
-          session-id (:session_id payload)]
-      (if (nil? session-id)
-        p
-        (if (= (:commandName payload) "login-failed")
-          (into []
-                (conj (into #{} p)
-                      (clojure.string/lower-case
-                       (:username (:payload payload)))))
-          p)))))
-
-(def registered-vs-logged
-  (sfn/fn [p n]
-    (let [aggregation-unit 3600000
-          data (:payload n)
-          event-name (:commandName data)
-          entity-id (:entityId data)
-          url (:url data)
-          payload (:payload data)
-          username (:username payload)
-          server-timestamp (:server-timestamp n)]
-      (if (and (not (nil? payload)) (not (nil? server-timestamp))
-               (not (nil? username)) (= event-name "login-success"))
-        (let [interval (int (/ server-timestamp aggregation-unit))]
-          (update-in p [interval] #(merge-with + % {username 1})))
-        p))))
-
-(def session-duration
-  (sfn/fn [p n]
-    (let [data (:payload n)
-          session-id (:session_id data)
-          server-timestamp (:server-timestamp n)]
-      (if (nil? session-id)
-        p
-        (if (contains? (:sessions p) session-id)
-          (assoc-in p [:sessions session-id :end] server-timestamp)
-          (assoc-in p [:sessions session-id :start] server-timestamp))))))
-
-(def browser-count
-  (sfn/fn [p n]
-    (let [hash-amount 100
-          payload (:payload n)
-          session-id (:session_id payload)
-          user-agent (:user-agent (:headers payload))
-          index-of (fn [^String s ^String b] (.indexOf s b))
-          user (:username (:payload payload))]
-      (if (or (nil? session-id) (nil? user-agent)
-              (= 0 (index-of user-agent "curl"))
-              (= 0 (index-of user-agent "Apache-HttpClient"))
-              (= 0 (index-of user-agent "node-superagent")))
-        p
-        (assoc-in p [:agents user-agent session-id :user] user)))))
-
 (def default-projections
   [{:projection-name "__streams__"
     :stream-name "__all__"
     :language :clojure
     :reduction (pr-str stream-fn)
-    :initial-value {}}
-   #_{:projection-name "__streams2__"
-    :stream-name "__all__"
-    :language :clojure
-    :reduction (pr-str stream-fn)
-    :initial-value {}}
-   #_{:projection-name "__streams3__"
-    :stream-name "__all__"
-    :language :clojure
-    :reduction (pr-str stream-fn)
-    :initial-value {}}
-   #_{:projection-name "__streams4__"
-    :stream-name "__all__"
-    :language :clojure
-    :reduction (pr-str stream-fn)
-    :initial-value {}}
-   {:projection-name "login-failed"
-    :stream-name "cambio"
-    :language :clojure
-    :reduction (pr-str login-failed)
-    :initial-value []}
-   {:projection-name "all-events"
-    :stream-name "cambio"
-    :language :clojure
-    :reduction (pr-str all-events)
-    :initial-value {:user-last {}
-                    :keys []
-                    :matrix {}}}
-   {:projection-name "browser-count"
-    :stream-name "cambio"
-    :language :clojure
-    :reduction (pr-str browser-count)
-    :initial-value {:agents {}}}
-   {:projection-name "registered-vs-logged"
-    :stream-name "cambio"
-    :language :clojure
-    :reduction (pr-str registered-vs-logged)
-    :initial-value {}}
-   {:projection-name "session-duration"
-    :stream-name "cambio"
-    :language :clojure
-    :reduction (pr-str session-duration)
     :initial-value {}}])

 (defn init-projection! [proj-file]
@@ -168,11 +35,14 @@
   (let [path (:projections.path conf/config)
         all-files (file-seq (io/file path))
         proj-files (filter #(ends-with (absolute-path %)
-                                       ".projection")
+                                       ".edn")
                            all-files)
         projs (map #(read-string (slurp %)) proj-files)
+        projs (map #(if (list? (:reduction %))
+                      (update-in % [:reduction] pr-str)
+                      %)
+                   projs)
         combined (vals (merge (projs->keyed default-projections)
                               (projs->keyed projs)))]
     (dorun (map #(streams/register-query! stm %) combined))))

-


Dropped environ for aero

Dropped environ for aero

--- src/leiningen/new/onyx_app/project.clj
+++ src/leiningen/new/onyx_app/project.clj
@@ -5,14 +5,13 @@
             :url "http://www.eclipse.org/legal/epl-v10.html"}
   :dependencies [[org.clojure/clojure "1.7.0"]
                  [org.onyxplatform/onyx "{{onyx-version}}"]
-                 [environ "1.0.1"]
-                 ; Docker Opts
                  [org.onyxplatform/onyx-sql "{{onyx-version}}.{{onyx-sql-minor}}"]
                  [mysql/mysql-connector-java "5.1.18"]
                  [org.onyxplatform/onyx-kafka "{{onyx-version}}.{{onyx-kafka-minor}}"]
                  {{#metrics?}}[org.onyxplatform/onyx-metrics "{{onyx-version}}.{{onyx-metrics-minor}}"]{{/metrics?}}
                  [org.onyxplatform/onyx-seq "{{onyx-version}}.{{onyx-seq-minor}}"]
-                 [cheshire "5.5.0"]]
+                 [cheshire "5.5.0"]
+                 [aero "0.1.3"]]
   :profiles {:uberjar {:aot [{{app-name}}.launcher.aeron-media-driver
                              {{app-name}}.launcher.launch-prod-peers]}
              :dev {:dependencies [[org.clojure/tools.namespace "0.2.11"]]


drop editable table into 3 more views

drop editable table into 3 more views

--- pedestal-app/app/src/semtag_web/rendering.cljs
+++ pedestal-app/app/src/semtag_web/rendering.cljs
@@ -161,11 +161,11 @@
     (when (re-find #"\.\.\.$" (dom/text elem))
       (dom/set-text! elem (dom/attr elem "title")))))

-(defn enable-editable-table [input-queue]
-  (dom/set-attr! (css/sel "td.editable") "contentEditable" true)
-  (dom/set-attr! (css/sel "td.editable a") "contentEditable" false)
-
-  (doseq [elem (.querySelectorAll js/document "td.editable")]
+(defn enable-editable-table [dom-id input-queue]
+  (dom/set-attr! (css/sel (str domid " td.editable ")) "contentEditable" true)
+  (dom/set-attr! (css/sel (str domid " td.editable a")) "contentEditable" false)
+
+  (doseq [elem (.querySelectorAll js/document (str domid " td.editable"))]
     ;; didn't use events/send-on because it was overriding default keypress behavior
     (.addEventListener elem
                        "keypress"
@@ -253,7 +253,7 @@
         (search-results-html things tags))
       (add-search-stats tags things)
       (enable-toggle-stats-button input-queue)
-      (enable-editable-table input-queue)
+      (enable-editable-table "#search_table" input-queue)
       (enable-clickable-links-on "#search_table td:not([data-field=url])" input-queue))))

 ;; we'd like to destroy/hide these but that requires changing render-search-results
@@ -278,6 +278,7 @@
                                          {:title "Percent of things for a type that have a name"}
                                          {:title "Percent of things for a type that have a url"}]))

+  (enable-editable-table "#type_stats_table" input-queue)
   (enable-clickable-links-on "#type_stats_table" input-queue))

 (defn render-tag-stats-results [_ [_ _ _ new-value] input-queue]
@@ -302,6 +303,8 @@
                      :row-partial p/all-row
                      :caption (str "Total: " (count new-value))
                      :fields [:type :name :url :tags :created-at]))
+
+  (enable-editable-table "#all_table" input-queue)
   (enable-clickable-links-on "#all_table td:not([data-field=url])" input-queue))

 (defn- enable-delete-thing
@@ -323,6 +326,7 @@
                         :caption (if (re-find #"\d+$" thing-id) "" (p/link-tagged thing-id))
                         :row-partial p/thing-row
                         :fields [:attribute :value]))
+    (enable-editable-table "#thing_show_table" input-queue)
     (enable-clickable-links-on "#thing_show_table td:not([data-field=url])" input-queue)
     (enable-clickable-links-on "#thing_show_table caption" input-queue)
     (enable-delete-thing input-queue num-id)))


test for helloworld

test for helloworld

--- test/flatgui/samples/forms/hellowindow_test.clj
+++ test/flatgui/samples/forms/hellowindow_test.clj
@@ -10,6 +10,8 @@
   (:require [flatgui.samples.forms.helloworld :as hw]
             [flatgui.test :as fgt]
             [clojure.test :as test]))
+
+(fgt/enable-traces-for-failed-tests)

 (test/deftest scenario
   (let [container (fgt/create-container #'flatgui.samples.forms.helloworld/root-panel)]


Fix conversion of JS variables from CLJ

Fix conversion of JS variables from CLJ

--- src/uruk/core.clj
+++ src/uruk/core.clj
@@ -196,11 +196,11 @@
              :xcc-type ValueType/ELEMENT}

    :js-array {:ml->clj java-json->clj-json
-              :clj->xdm #(ValueFactory/newJSArray (json/write-str %))
+              :clj->xdm #(json/write-str %)
               :xml-name "json:array"
               :xcc-type ValueType/JS_ARRAY}
    :js-object {:ml->clj java-json->clj-json
-               :clj->xdm #(ValueFactory/newJSObject (json/write-str %))
+               :clj->xdm #(json/write-str %)
                :xml-name "json:object"
                :xcc-type ValueType/JS_OBJECT}


Fixed failing build. Removed machine-head deps.

--- ingestion-api/src/ingestion_api/mqtt/core.clj
+++ ingestion-api/src/ingestion_api/mqtt/core.clj
@@ -4,7 +4,6 @@
         [compojure.core :only [defroutes GET POST DELETE ANY context]]
         [clojure.string :only [split trim lower-case]]
         org.httpkit.server)
-  (:use [clojurewerkz.machine-head.conversion :as conv])
   (:require [ingestion-api.mqtt.handler :as handler])
   (:require [ingestion-api.mqtt.tcp :as tcp])
   (:import [org.httpkit.server AsyncChannel])


Capitalize continuous

Capitalize continuous

--- frontend/components/language_landing.cljs
+++ frontend/components/language_landing.cljs
@@ -59,7 +59,7 @@
                          :title "Intelligent Test Running"
                          :icon (utils/cdn-path "/img/outer/languages/file-icon.svg")}
                         {:feature "CircleCI makes setting up Continuous Delivery for your Python application simple and easy. We offer first-class support for deployment to platforms like with Heroku, Elastic Beanstalk, and Google App Engine as well as using tools like Fabric, Ansible, Salt, and others."
-                         :title "Easy continuous Delivery"
+                         :title "Easy Continuous Delivery"
                          :icon (utils/cdn-path "/img/outer/languages/book-icon.svg")}]
              :docs-link "/docs/language-python"
              :testimonials [{:text "The speed is really impressive, the rspec suite alone takes 6 minutes to run on my Macbook Air, but only 2 minutes on Circle."


Include PID in hostname option

Include PID in hostname option

--- src/riemann/jvm_profiler.clj
+++ src/riemann/jvm_profiler.clj
@@ -1,7 +1,8 @@
 (ns riemann.jvm-profiler
   (:require [riemann.jvm-profiler.stack :as stack]
             [riemann.client.http :as client])
-  (:import (java.lang StackTraceElement)))
+  (:import (java.lang StackTraceElement)
+           (java.lang.management ManagementFactory)))

 (def http-client client/client)
 (def localhost client/localhost)
@@ -49,7 +50,8 @@
   :port       Riemann HTTP port.
   :prefix     Service prefix for distinguishing this telemetry from other apps
               (default \"\")
-  :localhost  Override the hostname (default: nil; calls (localhost))
+  :localhost  Override the event hostname (default: nil; calls (localhost))
+  :localhost-pid?  If truthy, use pid@host as the event hostname.
   :dt         How often to send telemetry events to Riemann, in seconds
               (default 5)
   :load       Target fraction of one core's CPU time to use for profiling
@@ -63,7 +65,9 @@
                  dt
                  (partial report client
                           dt
-                          (:localhost opts)
+                          (if (:localhost-pid? opts)
+                            (.. ManagementFactory getRuntimeMXBean getName)
+                            (:localhost opts))
                           (or (:prefix opts) "")))))

 (defn stop!


Remove REPL code from the compiler.

Remove REPL code from the compiler.

--- src/clj/cljs/compiler.clj
+++ src/clj/cljs/compiler.clj
@@ -9,7 +9,7 @@
 (set! *warn-on-reflection* true)

 (ns cljs.compiler
-  (:refer-clojure :exclude [munge load-file loaded-libs macroexpand-1])
+  (:refer-clojure :exclude [munge macroexpand-1])
   (:require [clojure.java.io :as io]
             [clojure.string :as string]))

@@ -34,7 +34,6 @@
                             cljs.user {:name cljs.user}}))

 (def ^:dynamic *cljs-ns* 'cljs.user)
-(def ^:dynamic *cljs-verbose* false)
 (def ^:dynamic *cljs-warn-on-undeclared* false)

 (defn munge [s]
@@ -48,20 +47,6 @@
     (if (symbol? s)
       (symbol ms)
       ms)))
-
-;;todo - move to core.cljs, using js
-(def ^String bootjs "
-//goog.provide should do this for us
-//cljs = {}
-//cljs.lang = {}
-//cljs.user = {}
-//goog.provide('cljs.core');
-//goog.provide('cljs.user');
-//cljs.lang.truth_ = function(x){return x != null && x !== false;}
-//cljs.lang.fnOf_ = function(f){return (f instanceof Function?f:f.cljs$core$Fn$invoke);}
-//cljs.lang.original_goog_require = goog.require;
-goog.require = function(rule){Packages.clojure.lang.RT[\"var\"](\"cljs.compiler\",\"goog-require\").invoke(goog.global.cljs_javascript_engine, rule);}
-")

 (defn confirm-var-exists [env prefix suffix]
   (when true ;;*cljs-warn-on-undeclared*
@@ -958,54 +943,6 @@
         (set? form) (analyze-set env form name)
         :else {:op :constant :env env :form form}))))

-(defn eval1
-  [repl-env env form]
-  (try
-    (let [ast (analyze env form)
-          js (emits ast)
-          jse ^javax.script.ScriptEngine (:jse repl-env)]
-      (try
-        (when *cljs-verbose*
-            (print js))
-        (let [filename (.get jse javax.script.ScriptEngine/FILENAME)
-              linenum (or (:line (meta form)) Integer/MIN_VALUE)
-              ctx (sun.org.mozilla.javascript.internal.Context/enter)]
-          (try
-            (.evaluateString ctx (:global repl-env) js filename linenum nil)
-          (finally
-            (sun.org.mozilla.javascript.internal.Context/exit))))
-        (catch Throwable ex
-          ;;we eat ns errors because we know goog.provide() will throw when reloaded
-          ;;TODO - file bug with google, this is bs error
-          ;;this is what you get when you try to 'teach new developers' via errors (goog/base.js 104)
-          (when-not (and (seq? form) (= 'ns (first form)))
-            (prn "Error evaluating:" form :as js)
-            (.printStackTrace ex)
-            #_(println (str ex))))))
-    (catch Throwable ex
-      (.printStackTrace ex)
-      (println (str ex)))))
-
-(defn load-stream [repl-env stream]
-  (with-open [r (io/reader stream)]
-    (let [env {:ns (@namespaces *cljs-ns*) :context :statement :locals {}}
-          pbr (clojure.lang.LineNumberingPushbackReader. r)
-          eof (Object.)]
-      (loop [r (read pbr false eof false)]
-        (let [env (assoc env :ns (@namespaces *cljs-ns*))]
-          (when-not (identical? eof r)
-            (eval1 repl-env env r)
-            (recur (read pbr false eof false))))))))
-
-(defn load-file
-  [repl-env f]
-  (binding [*cljs-ns* 'cljs.user]
-    (let [res (if (= \/ (first f)) f (io/resource f))]
-      (assert res (str "Can't find " f " in classpath"))
-      (.put ^javax.script.ScriptEngine (:jse repl-env)
-            javax.script.ScriptEngine/FILENAME f)
-      (load-stream repl-env res))))
-
 (defn analyze-file
   [f]
   (binding [*cljs-ns* 'cljs.user]
@@ -1020,79 +957,6 @@
               (when-not (identical? eof r)
                 (analyze env r)
                 (recur (read pbr false eof false))))))))))
-
-(def loaded-libs (atom #{}))
-
-(defn goog-require [repl-env rule]
-  (when-not (contains? @loaded-libs rule)
-    (let [jse ^javax.script.ScriptEngine (:jse repl-env)
-          path (string/replace (munge rule) \. java.io.File/separatorChar)
-          cljs-path (str path ".cljs")
-          js-path (str "goog/" (.eval jse (str "goog.dependencies_.nameToPath['" rule "']")))]
-      (if-let [res (io/resource cljs-path)]
-        (binding [*cljs-ns* 'cljs.user]
-          (load-stream repl-env res))
-        (if-let [res (io/resource js-path)]
-          (.eval jse (io/reader res))
-          (throw (Exception. (str "Cannot find " cljs-path " or " js-path " in classpath")))))
-      (swap! loaded-libs conj rule))))
-
-(defn repl-env
-  "Returns a fresh JS environment, suitable for passing to repl.
-  Hang on to return for use across repl calls."
-  []
-  (let [jse (-> (javax.script.ScriptEngineManager.) (.getEngineByName "JavaScript"))
-        base (io/resource "goog/base.js")
-        deps (io/resource "goog/deps.js")
-        new-repl-env {:jse jse :global (.eval jse "this")}]
-    (assert base "Can't find goog/base.js in classpath")
-    (assert deps "Can't find goog/deps.js in classpath")
-    (.put jse javax.script.ScriptEngine/FILENAME "goog/base.js")
-    (.put jse "cljs_javascript_engine" new-repl-env)
-    (with-open [r (io/reader base)]
-      (.eval jse r))
-    (.eval jse bootjs)
-    ;; Load deps.js line-by-line to avoid 64K method limit
-    (doseq [^String line (line-seq (io/reader deps))]
-      (.eval jse line))
-    new-repl-env))
-
-(defn repl
-  "Note - repl will reload core.cljs every time, even if supplied old repl-env"
-  [repl-env & {:keys [verbose warn-on-undeclared]}]
-  (prn "Type: " :cljs/quit " to quit")
-  (binding [*cljs-ns* 'cljs.user
-            *cljs-verbose* verbose
-            *cljs-warn-on-undeclared* warn-on-undeclared]
-    (let [env {:context :statement :locals {}}]
-      (load-file repl-env "cljs/core.cljs")
-      (eval1 repl-env (assoc env :ns (@namespaces *cljs-ns*))
-             '(ns cljs.user))
-      (.put ^javax.script.ScriptEngine (:jse repl-env)
-            javax.script.ScriptEngine/FILENAME "<cljs repl>")
-      (loop []
-        (print (str "ClojureScript:" *cljs-ns* "> "))
-        (flush)
-        (let [form (read)]
-          (cond
-           (= form :cljs/quit) :quit
-
-           (and (seq? form) (= (first form) 'in-ns))
-           (do (set! *cljs-ns* (second (second form))) (newline) (recur))
-
-           (and (seq? form) ('#{load-file clojure.core/load-file} (first form)))
-           (do (load-file repl-env (second form)) (newline) (recur))
-
-           :else
-           (let [ret (eval1 repl-env
-                            (assoc env :ns (@namespaces *cljs-ns*))
-                            ;;form
-                            (list 'cljs.core.prn form)
-                            ;(list 'goog.global.print form)
-                            )]
-             ;(newline) (flush)
-             ;;(prn (if (nil? ret) nil ret))
-             (recur))))))))

 (defn forms-seq
   "Seq of forms in a Clojure or ClojureScript file."


always recompile if a source map is requested

--- src/clj/cljs/compiler.clj
+++ src/clj/cljs/compiler.clj
@@ -867,7 +867,7 @@
      (let [src-file (io/file src)
            dest-file (io/file dest)]
        (if (.exists src-file)
-         (if (requires-compilation? src-file dest-file)
+         (if (or (requires-compilation? src-file dest-file) (:source-map opts))
            (do (mkdirs dest-file)
                (compile-file* src-file dest-file opts))
            (parse-ns src-file dest-file opts))


Ensure that only variadic *methods* follow the variadic path. Refs #11

--- src/clj/cljs/compiler.clj
+++ src/clj/cljs/compiler.clj
@@ -295,34 +295,6 @@
     (when-not (= :expr (:context env)) (print ";\n"))
     (when export
       (println (str "goog.exportSymbol('" export "', " name ");")))))
-
-(defn emit-fn-method
-  [{:keys [gthis name variadic params statements ret env recurs max-fixed-arity]}]
-  (emit-wrap env
-             (print (str "(function " name "(" (comma-sep params) "){\n"))
-             (when gthis
-               (println (str "var " gthis " = this;")))
-             (when recurs (print "while(true){\n"))
-             (emit-block :return statements ret)
-             (when recurs (print "break;\n}\n"))
-             (print "})")))
-
-(defn emit-variadic-fn-method
-  [{:keys [gthis name variadic params statements ret env recurs max-fixed-arity]}]
-  (emit-wrap env
-             (print (str "(function " name "(" (comma-sep
-                                                (if variadic
-                                                  (concat (butlast params) ['var_args])
-                                                  params)) "){\n"))
-             (when gthis
-               (println (str "var " gthis " = this;")))
-             (when variadic
-               (println (str "var " (last params) " = cljs.core.array_seq(Array.prototype.slice.call(arguments, " (dec (count params)) "),0);"))
-               #_(println (str (last params) " = Array.prototype.slice.call(arguments, " (dec (count params)) ");")))
-             (when recurs (print "while(true){\n"))
-             (emit-block :return statements ret)
-             (when recurs (print "break;\n}\n"))
-             (print "})")))

 (defn emit-apply-to
   [{:keys [name params env]}]
@@ -345,6 +317,34 @@
     (println (str "return " name ".call(" (string/join ", " (cons "null" params)) ");"))
     (print "})")))

+(defn emit-fn-method
+  [{:keys [gthis name variadic params statements ret env recurs max-fixed-arity]}]
+  (emit-wrap env
+             (print (str "(function " name "(" (comma-sep params) "){\n"))
+             (when gthis
+               (println (str "var " gthis " = this;")))
+             (when recurs (print "while(true){\n"))
+             (emit-block :return statements ret)
+             (when recurs (print "break;\n}\n"))
+             (print "})")))
+
+(defn emit-variadic-fn-method
+  [{:keys [gthis name variadic params statements ret env recurs max-fixed-arity]}]
+  (emit-wrap env
+             (print (str "(function " name "(" (comma-sep
+                                                (if variadic
+                                                  (concat (butlast params) ['var_args])
+                                                  params)) "){\n"))
+             (when gthis
+               (println (str "var " gthis " = this;")))
+             (when variadic
+               (println (str "var " (last params) " = cljs.core.array_seq(Array.prototype.slice.call(arguments, " (dec (count params)) "),0);"))
+               #_(println (str (last params) " = Array.prototype.slice.call(arguments, " (dec (count params)) ");")))
+             (when recurs (print "while(true){\n"))
+             (emit-block :return statements ret)
+             (when recurs (print "break;\n}\n"))
+             (print "})")))
+
 (defmethod emit :fn
   [{:keys [name env methods max-fixed-arity variadic]}]
   ;;fn statements get erased, serve no purpose and can pollute scope if named
@@ -362,7 +362,7 @@
         (println "(function() {")
         (println (str "var " name " = null;"))
         (doseq [[n meth] ms]
-          (println (str "var " n " = " (with-out-str (if variadic
+          (println (str "var " n " = " (with-out-str (if (:variadic meth)
                                                        (emit-variadic-fn-method meth)
                                                        (emit-fn-method meth))) ";")))
         (println (str name " = function(" (comma-sep (if variadic