CLJS-641: js* overflow for large inputs

CLJS-641: js* overflow for large inputs

sequence construction not wrapped in a lazy-seq, would result in a stack
overflow for large inputs

--- src/clj/cljs/analyzer.clj
+++ src/clj/cljs/analyzer.clj
@@ -937,7 +937,10 @@
                        (list s)
                        (let [end (.indexOf s "}" idx)
                              inner (:name (resolve-existing-var env (symbol (subs s (+ 2 idx) end))))]
-                         (cons (subs s 0 idx) (cons inner (interp (subs s (inc end)))))))))]
+                         (lazy-seq
+                           (cons (subs s 0 idx)
+                             (cons inner
+                               (interp (subs s (inc end))))))))))]
       {:env env :op :js :form form :code (apply str (interp jsform))
        :tag (-> form meta :tag) :js-op (-> form meta :js-op)})))


description of namespace name

description of namespace name

--- src/clj/forma/hoptree.clj
+++ src/clj/forma/hoptree.clj
@@ -24,6 +24,12 @@
 ;; Note that if the global index of the pixel under consideration
 ;; falls outside of the specified window, then the conversion will
 ;; throw an error.
+
+;; The API operates on three levels: tile, global, window. The
+;; three-leaved hoptree is a deciduous tree that is native to North
+;; America; it's bark is smooth but gets rough with age.
+
+;; http://en.wikipedia.org/wiki/Ptelea_trifoliata

 ;; TODO: remove redundancy from multimethods


quick fix to `append`

quick fix to `append`

--- src/cljc/tupelo/core.cljc
+++ src/cljc/tupelo/core.cljc
@@ -909,7 +909,8 @@
     (throw (ex-info  "append: Sequential collection required, found=" {:listy listy})))
   (when (empty? elems)
     (throw (ex-info "Nothing to append! elems=" {:elems elems})))
-  (vec (concat listy elems)))
+  ; (vec (concat listy elems))  ; #TODO ***WARNING*** never use `concat`!!! 1000x slower!
+  (into (vec listy) elems))   ; #todo measure & write blog re TPX/TigerGraph data

 (s/defn prepend :- tsk/List
   "Given a sequential object (vector or list), add one or more elements to the beginning"


Move function for great pedantry

Move function for great pedantry

--- src/cljs/fatlip/core.cljs
+++ src/cljs/fatlip/core.cljs
@@ -278,23 +278,6 @@
                                       (assoc pos s-2 (+ (get pos seg-1) 1))
                                       (into ord [s-1 node-1])))))))]
     (assoc next-layer :minus-qs minus-qs)))
-
-
-(defn map-aboves-belows
-  "Maps things in a layer (nodes and edges) to the things that are directly
-  above or below"
-  [graph layer]
-  (let [layer-id (:id layer)]
-    (loop [grph graph
-           o (-> layer :flat first)
-           os (-> layer :flat rest)]
-      (if (empty? os)
-        grph
-        (let [next-o (first os)
-              g (-> grph
-                    (assoc-in [:belows layer-id o] next-o)
-                    (assoc-in [:aboves layer-id next-o] o))]
-          (recur g next-o (rest os)))))))

 (defn add-qs
@@ -565,6 +548,23 @@
     :belows (:aboves graph)))

+(defn map-aboves-belows
+  "Maps things in a layer (nodes and edges) to the things that are directly
+  above or below"
+  [graph layer]
+  (let [layer-id (:id layer)]
+    (loop [grph graph
+           o (-> layer :flat first)
+           os (-> layer :flat rest)]
+      (if (empty? os)
+        grph
+        (let [next-o (first os)
+              g (-> grph
+                    (assoc-in [:belows layer-id o] next-o)
+                    (assoc-in [:aboves layer-id next-o] o))]
+          (recur g next-o (rest os)))))))
+
+
 (defn order-graph-once
   "Performs one layer-by-layer sweep of the graph using ESK's algorithm"
   [sparse-graph]


Clean up date selection on client side.

Clean up date selection on client side.

--- src/cljs/medusa/core.cljs
+++ src/cljs/medusa/core.cljs
@@ -13,11 +13,11 @@
                    [cljs.core.match.macros :refer [match]]))

 (ws-repl/connect "ws://localhost:9001" :verbose true)
-
 (enable-console-print!)

-(let [date-formatter (timef/formatter "yyyy-MM-dd")
-      end-date (time/today-at 12 00)
+(def date-formatter (timef/formatter "yyyy-MM-dd"))
+
+(let [end-date (time/today-at 12 00)
       start-date (time/minus end-date (time/months 1))
       end-date (timef/unparse date-formatter end-date)
       start-date (timef/unparse date-formatter start-date)]
@@ -55,6 +55,10 @@
             name->metric (zipmap (map :name metrics) metrics)
             element (om/get-node owner "metrics-selector")
             jq-element (js/$ element)]
+
+        ; needed to clean current selection
+        (.select2 jq-element #js {:placeholder ""
+                                  :allowClear true})
         (.off jq-element)
         (.on jq-element "change" (fn [e]
                                    (let [selected-metric (get name->metric (.-val e))]
@@ -62,6 +66,7 @@
                                        (>! event-channel [:metric-selected selected-metric])))))))
     om/IRenderState
     (render-state [_ {:keys [event-channel]}]
+      (println "selecting")
       (html
        [:div.form-group
         [:label {:for "metrics-selector"} "Metric:"]
@@ -75,10 +80,17 @@
   (reify
     om/IDidMount
     (did-mount [_]
-      (let [start-element (js/$ (om/get-node owner "start-date"))
+      (let [event-channel (om/get-state owner :event-channel)
+            start-element (js/$ (om/get-node owner "start-date"))
             end-element (js/$ (om/get-node owner "end-date"))
             start-datepicker (.datepicker start-element #js {:format "yyyy-mm-dd"})
-            end-datepicker (.datepicker end-element #js {:format "yyyy-mm-dd"})]
+            end-datepicker (.datepicker end-element #js {:format "yyyy-mm-dd"})
+            format-date #(timef/unparse date-formatter (time/plus (time/date-time (.-date %))
+                                                                  (time/days 1)))]
+        (.on start-datepicker "changeDate" (fn [e]
+                                             (go (>! event-channel [:from-selected (format-date e)]))))
+        (.on end-datepicker "changeDate" (fn [e]
+                                           (go (>! event-channel [:to-selected (format-date e)]))))
         start-datepicker))

     om/IRenderState
@@ -221,21 +233,39 @@
               (condp = topic
                 :detector-selected
                 (do
-                  (om/update! state [:selected-detector] message)
-                  (om/update! state [:error :message] "")
-                  (om/update! state [:selected-metric] nil)
-                  (om/update! state [:alerts] nil))
+                  (println "detector-selected")
+                  (om/transact! state (fn [state]
+                                        (let [state (assoc state
+                                                      :selected-detector message
+                                                      :selected-metric nil
+                                                      :alerts nil)
+                                              state (assoc-in state [:error :message] "")]
+                                          state))))

                 :metric-selected
                 (let [detector (:selected-detector @state)]
-                  (om/update! state [:selected-metric] message)
-                  (om/update! state [:error :message] "")))
-                                        ;retrieve resources
+                  (om/transact! state (fn [state]
+                                        (let [state (assoc state :selected-metric message)
+                                              state (assoc-in state [:error :message] "")]
+                                          state))))
+
+                :from-selected
+                (do
+                  (om/update! state [:selected-date-range 0] message))
+
+                :to-selected
+                (do
+                  (om/update! state [:selected-date-range 1] message)))
+
+              ;retrieve resources
               (let [selected-detector (:selected-detector @state)
                     selected-metric (:selected-metric @state)
                     selected-start-date (get-in @state [:selected-date-range 0])
                     selected-end-date (get-in @state [:selected-date-range 1])]
                 (match [selected-detector selected-metric]
+                       [nil nil]
+                       ()
+
                        [_ nil]
                        (do
                          (update-resource state :metrics


Add function for detecting empty body on html page.

--- src/cljs/quil/sketch.cljs
+++ src/cljs/quil/sketch.cljs
@@ -75,19 +75,20 @@

 (def sketch-init-list (atom (list )))

-
 (defn ^:export add-js-event [event fun]
   (if (.-addEventListener js/window)
       (.addEventListener js/window event fun false)
       (if (.-attachEvent js/window)
           (.attachEvent js/window (str "on" event) fun))))

+(defn ^:export check-empty-body []
+  (let [child (.-childNodes (.-body js/document))]
+    (= 1 (.-length child))))

 (defn init-sketches []
   (doseq [sk @sketch-init-list]
     (sk)))

-
 (defn add-sketch-to-init-list [sk]
   (swap! sketch-init-list conj sk))


some more positioning experiments

some more positioning experiments

--- src/cljs/signet/core.cljs
+++ src/cljs/signet/core.cljs
@@ -64,12 +64,11 @@
                 (append "svg")
                 (attr {:width width
                        :height height}))
-        tooltip (.. d3
-                    (select "body")
-                    (append "div")
-                    (style {:position "absolute"
-                            :z-index 10
-                            :visibility "hidden"
+        tooltip (.. svg
+                    (append "text")
+                    (style {:visibility "hidden"
+                            :position "absolute"
+                            :text-anchor "middle"
                             :color "black"}))]
     (do
       (.. svg
@@ -95,9 +94,9 @@
                                 "steelblue"))
                  :r circle-size})
           (on "click" (fn [d] (do (.. tooltip
-                                     (style {:top (str (- (get y-positions d) 15) "px")
-                                             :left (str  (+ (get x-positions d) 50)  "px")
-                                             :visibility "visible"})
+                                     (style {:visibility "visible"})
+                                     (attr {:y (- (get y-positions d) 15)
+                                            :x (get x-positions d)})
                                      (text d)))))))))


s/handle-/read-/

s/handle-/read-/

--- src/clojurecraft/core.clj
+++ src/clojurecraft/core.clj
@@ -7,8 +7,9 @@
 ; Packet Type Maps -----------------------------------------------------------------
 (def packet-ids {
      :keepalive 0x00
-     :login 0x01
-     :handshake 0x02
+     :login 0x01
+     :handshake 0x02
+     :chat 0x03
 })
 (def packet-types (apply assoc {} (mapcat reverse packet-ids)))

@@ -56,6 +57,9 @@

 ; Writing Packets ------------------------------------------------------------------
+(defn write-packet-keepalive [conn _]
+      (writ-byte conn (:handshake packet-ids)))
+
 (defn write-packet-handshake [conn {username :username}]
       (writ-byte conn (:handshake packet-ids))

@@ -76,7 +80,7 @@

 (defn write-packet [conn packet-type payload]
       (cond
-        (= packet-type :keepalive) nil
+        (= packet-type :keepalive) (write-packet-handshake conn payload)
         (= packet-type :handshake) (write-packet-handshake conn payload)
         (= packet-type :login) (write-packet-login conn payload)
         )
@@ -103,16 +107,16 @@

 ; Handling Packets -----------------------------------------------------------------
-(defn handle-packet-keepalive [conn]
+(defn read-packet-keepalive [conn]
       (println "OMG got a keepalive")
       nil)

-(defn handle-packet-handshake [conn]
+(defn read-packet-handshake [conn]
       (println "OMG got a handshake")
       (-> {}
           (assoc :hash (red-string16 conn))))

-(defn handle-packet-login [conn]
+(defn read-packet-login [conn]
       (println "OMG got a login")
       (-> {}
           (assoc :eid (red-int conn))
@@ -120,15 +124,15 @@
           (assoc :seed (red-long conn))
           (assoc :dimension (red-byte conn))))

-(defn handle-packet [conn packet-id]
+(defn read-packet [conn packet-id]
       (let [packet-id (int packet-id)
             packet-type (packet-types packet-id)]
         (println "\n----->")
         (println
           (cond
-            (= packet-type :keepalive) (handle-packet-keepalive conn)
-            (= packet-type :handshake) (handle-packet-handshake conn)
-            (= packet-type :login) (handle-packet-login conn)
+            (= packet-type :keepalive) (read-packet-keepalive conn)
+            (= packet-type :handshake) (read-packet-handshake conn)
+            (= packet-type :login) (read-packet-login conn)
             :else (str "UNKNOWN PACKET TYPE: " packet-id)
             ))
         (println "\n\n\n")))
@@ -141,23 +145,21 @@

     ; Get handshake
     (let [packet-id (red-byte conn)]
-      (handle-packet conn packet-id))
+      (read-packet conn packet-id))

     ; Send login
     (write-packet conn :login {:version 13 :username "timmy"})

     ; Get login
     (let [packet-id (red-byte conn)]
-      (handle-packet conn packet-id))
-
-   )
+      (read-packet conn packet-id)))

 (defn conn-handler [conn]
       (println "connecting")
       (login conn)
       (while (nil? (:exit @conn))
         (let [packet-id (.readByte (:in @conn))]
-          (handle-packet conn packet-id)
+          (read-packet conn packet-id)
           ))
       (println "done"))


fixed future bug

fixed future bug

--- src/co/nclk/flax/node.clj
+++ src/co/nclk/flax/node.clj
@@ -219,7 +219,7 @@
       (assoc (if (= "local" (full-node-name self node))
                (invoke-local checkpoint)
                (let [node (get-node self node)]
-                 (if (= "local" (-> @(:data node) :name))
+                 (if (nil? (:data node))
                    (invoke-local checkpoint)
                    (invoke-remote checkpoint node))))
              :started (.getTime ts)


Code cleanup.

Code cleanup.

--- src/gorilla_repl/core.clj
+++ src/gorilla_repl/core.clj
@@ -66,11 +66,9 @@
     (when-let [ns (:ns (:params req))]
       (res/response {:completions (complete/completions stub (symbol ns))}))))

+
 ;; API endpoint for getting the list of worksheets in the project
-(defn gorilla-files
-  [req]
-  (let [paths (files/gorilla-filepaths-in-current-directory)]
-      (res/response {:files paths})))
+(defn gorilla-files [req] (res/response {:files (files/gorilla-filepaths-in-current-directory)}))

 ;; the combined routes - we serve up everything in the "public" directory of resources under "/".
@@ -89,7 +87,7 @@
   ;; start the app - first start the nREPL server, and then the http server.
   (let [version (or (:version conf) "develop")
         _ (println "Gorilla-REPL:" version)
-        _ (version/check-for-update version)
+        _ (version/check-for-update version)  ;; runs asynchronously
         nrepl-requested-port (or (:nrepl-port conf) 0) ;; auto-select port if none requested
         nrepl (nrepl-server/start-server :port nrepl-requested-port
                                          :handler (nrepl-server/default-handler #'render-mw/render-values))


Better ajax handling wip.

Better ajax handling wip.

Programmes, projects, properties.

--- src-cljs/kixi/hecuba/tabs/programmes.cljs
+++ src-cljs/kixi/hecuba/tabs/programmes.cljs
@@ -36,26 +36,15 @@
 (defn ajax [in data path {:keys [template selection-key content-type]} & [chart]]
   (go-loop []
     (let [nav-event (<! in)
-          active-components (-> nav-event :args :ids keys set)
-          components [:programmes :projects :properties :devices :sensors :measurements] ; FIXME
-          to-clear (remove #(active-components %) components)
           [new-selected uri] (uri-for-selection-change (:selected @data)
                                                        selection-key
                                                        template
                                                        nav-event)]

-
       (om/update! data :active-components (-> nav-event :args :ids))

-      (doseq [a active-components]
-        (om/update! data (vector a :active) true))
-
-      (doseq [c to-clear]
-        (om/update! data (vector c :active) false)
-        (om/update! data (vector c :data) [])
-        (om/update! data (vector c :selected) nil))
-
       (when uri
+        (println "Fetching: " uri)
         (GET uri
              (-> {:handler  (fn [x]
                               (when (= selection-key :sensors)
@@ -170,11 +159,27 @@

 (defn programmes-div [tables owner]
   (reify
+    om/IDidUpdate
+    (did-update [_ prev-props prev-state]
+      (let [{:keys [programmes active-components]} tables]
+
+        (if (empty? (:data programmes))
+          (GET (str "/4/programmes/")
+               {:handler  (fn [x]
+                            (println "Fetching programmes.")
+                            (om/update! programmes :data x)
+                            (om/update! programmes :selected nil))
+                ;; TODO: Add Error Handler
+                :headers {"Accept" "application/edn"}
+                :response-format :text})
+          (println "Not fetching programmes!"))
+
+        ;; handle selection on programmes table (this should be nil if called)
+        (om/update! programmes :selected (:programmes active-components))))
     om/IRender
     (render [_]
       (let [programmes (-> tables :programmes)]
         (html
-         ;; hide div if we've already chosen something
          [:div {:id "programmes-div"}
           [:h1 "Programmes"]
           (om/build programmes-table programmes)])))))
@@ -211,9 +216,32 @@
   (reify
     om/IDidUpdate
     (did-update [_ prev-props prev-state]
-      (let [{:keys [programmes projects active-components]} tables]
-        ;;(println "Active Components: " active-components)
-        ))
+      (let [{:keys [programmes projects active-components]} tables
+            new-programme-id (:programmes active-components)]
+
+        ;; handle selection in programme table
+        (when-not new-programme-id
+          (om/update! projects :data [])
+          (om/update! projects :selected nil))
+
+        ;; get the data if we have a new id
+        (if (and new-programme-id
+                   (not (= (:programme-id projects) new-programme-id)))
+          (GET (str "/4/programmes/" new-programme-id "/projects/")
+               {:handler  (fn [x]
+                            (println "Fetching projects for programme: " new-programme-id)
+                            (om/update! projects :data x)
+                            (om/update! projects :selected nil))
+                ;; TODO: Add Error Handler
+                :headers {"Accept" "application/edn"}
+                :response-format :text})
+          (println "Not fetching projects!"))
+
+        ;; update our current id with the new one
+        (om/update! projects :programme-id new-programme-id)
+
+        ;; handle selection in projects table
+        (om/update! projects :selected (:projects active-components))))
     om/IRender
     (render [_]
       (let [{:keys [programmes projects active-components]} tables
@@ -241,21 +269,50 @@
         (html
          [:table {:className "table table-hover"}
           [:thead
-           [:tr [:th "Address"] [:th "Country"]]]
+           [:tr [:th "Address"] [:th "Region"] [:th "Country"]]]
           [:tbody
-           (for [row (sort-by :name (:data properties))]
-             (let [{:keys [id addressStreetTwo country]} row]
+           (for [row (sort-by :address-street-two (:data properties))]
+             (let [{:keys [id address-street-two address-country address-region]} row]
                [:tr {:onClick (fn [_ _]
                                 (om/update! properties :selected id)
                                 (history/update-token-ids! history :properties id)
                                 (fixed-scroll-to-element "devices-div"))
                      :className (if (= id (:selected properties)) "success")
                      :id (str table-id "-selected")}
-                [:td addressStreetTwo]
-                [:td country]]))]])))))
+                [:td address-street-two]
+                [:td address-region]
+                [:td address-country]]))]])))))

 (defn properties-div [tables owner]
   (reify
+    om/IDidUpdate
+    (did-update [_ prev-props prev-state]
+      (let [{:keys [projects properties active-components]} tables
+            new-project-id (:projects active-components)]
+
+        (println "Active Components: " active-components)
+
+        ;; handle selection in projects table
+        (when-not new-project-id
+          (println "Cleaering projects data.")
+          (om/update! properties :data [])
+          (om/update! properties :selected nil))
+
+        (if (and new-project-id
+                 (not (= (:project-id properties) new-project-id)))
+          (GET (str "/4/projects/" new-project-id "/properties/")
+               {:handler  (fn [x]
+                            (println "Fetching properties for project: " new-project-id)
+                            (om/update! properties :data x)
+                            (om/update! properties :selected nil))
+                ;; TODO: Add Error Handler
+                :headers {"Accept" "application/edn"}
+                :response-format :text})
+          (println "Not fetching properties!"))
+        (om/update! properties :project-id new-project-id)
+
+        ;; handle selection on properties table
+        (om/update! properties :selected (:properties active-components))))
     om/IRender
     (render [_]
       (let [{:keys [programmes projects properties active-components]} tables
@@ -386,15 +443,15 @@
               m           (mult (history/set-chan! history (chan)))
               tap-history #(tap m (chan))]

-          (ajax (tap-history) tables [:programmes] {:template      "/4/programmes/"
-                                                    :content-type  "application/edn"
-                                                    :selection-key :programmes})
-          (ajax (tap-history) tables [:projects] {:template      "/4/programmes/:programmes/projects/"
-                                                  :content-type  "application/edn"
-                                                  :selection-key :projects})
-          (ajax (tap-history) tables [:properties] {:template      "/4/projects/:projects/properties/"
-                                                    :content-type "application/json"
-                                                    :selection-key :properties})
+          ;; (ajax (tap-history) tables [:programmes] {:template      "/4/programmes/"
+          ;;                                           :content-type  "application/edn"
+          ;;                                           :selection-key :programmes})
+          ;; (ajax (tap-history) tables [:projects] {:template      "/4/programmes/:programmes/projects/"
+          ;;                                         :content-type  "application/edn"
+          ;;                                         :selection-key :projects})
+          ;; (ajax (tap-history) tables [:properties] {:template      "/4/projects/:projects/properties/"
+          ;;                                           :content-type "application/json"
+          ;;                                           :selection-key :properties})
           (ajax (tap-history) tables [:devices] {:template      "/4/entities/:properties/devices/"
                                                  :content-type  "application/json"
                                                  :selection-key :devices})


Remove word boundary regex it's borked

Remove word boundary regex it's borked

--- src/clj/freestuffly/gumtree/result_parser.clj
+++ src/clj/freestuffly/gumtree/result_parser.clj
@@ -9,7 +9,7 @@

 (defn- interesting-keywords [] (:keywords config))

-(defn- interesting-keywords-regex [] (re-pattern (str "(?i)" (string/join "\\b|" (interesting-keywords)))))
+(defn- interesting-keywords-regex [] (re-pattern (str "(?i)" (string/join "|" (interesting-keywords)))))

 (defn- interesting-finds
   [results]


Always include sym into env

Always include sym into env

--- src/com/wsscode/pathom/connect/run_graph.cljc
+++ src/com/wsscode/pathom/connect/run_graph.cljc
@@ -276,7 +276,7 @@
 (defn resolver-input-paths
   [out
    {::keys                           [available-data run-next]
-    :com.wsscode.pathom.connect/keys [attribute index-resolvers]
+    :com.wsscode.pathom.connect/keys [index-resolvers]
     :as                              env}
    inputs resolvers]
   (let [missing (into #{} (remove #(contains? available-data %)) inputs)]
@@ -285,15 +285,16 @@
       ; resolvers loop
       (reduce
         (fn [out resolver]
-          (if (and (contains? (::index-syms out) resolver)
-                   (not (get-in index-resolvers [resolver :com.wsscode.pathom.connect/dynamic-resolver?])))
-            (extend-node-run-next out (assoc env pc-sym resolver pc-attr attribute))
-            (let [node (create-sym-node (assoc env pc-sym resolver pc-attr attribute))]
-              (-> out
-                  (include-node node)
-                  (cond-> run-next
-                          (assoc-in [::nodes run-next ::after-node] (::node-id node)))
-                  (compute-root-or env node)))))
+          (let [env (assoc env pc-sym resolver)]
+            (if (and (contains? (::index-syms out) resolver)
+                     (not (get-in index-resolvers [resolver :com.wsscode.pathom.connect/dynamic-resolver?])))
+              (extend-node-run-next out env)
+              (let [node (create-sym-node env)]
+                (-> out
+                    (include-node node)
+                    (cond-> run-next
+                            (assoc-in [::nodes run-next ::after-node] (::node-id node)))
+                    (compute-root-or env node))))))
         <>
         resolvers)


Add test for s/and

Add test for s/and

--- test/spectrace/trace_test.clj
+++ test/spectrace/trace_test.clj
@@ -18,6 +18,11 @@
     :a
     [[{:spec `integer? :path [] :val :a :in []
        :spec-name ::x}]]
+
+    (s/and integer? even?)
+    3
+    [[{:spec `(s/and integer? even?) :path [] :val 3 :in []}
+      {:spec `even? :path [] :val 3 :in []}]]

     (s/or :int integer? :str string?)
     :a


Adapt test page for use with p5js

Adapt test page for use with p5js

--- test/cljs/quil/snippet.cljs
+++ test/cljs/quil/snippet.cljs
@@ -25,7 +25,7 @@
             :size (:size opts default-size)
             :renderer (:renderer opts :p2d)
             :host (or (:host opts)
-                       (get default-host (:renderer opts :p2d)))
+                      (get default-host (:renderer opts :p2d)))
             :setup (:setup snippet)

             :draw (fn []
@@ -33,8 +33,7 @@
                       ((:body snippet))
                       (catch js/Error e
                         (swap! failed inc)
-                        (throw e))
-                      (finally (q/exit)))))))})
+                        (throw e)))))))})

 (def test-functions (mapv snippet-to-test-function as/all-snippets))

@@ -60,6 +59,10 @@
   (reset! failed 0)
   (reset! total 0))

+(defn remove-canvases []
+   (doseq [c (d/sel [:canvas])]
+     (d/remove! c)))
+
 (defn run-single-test []
   (if (< @test-indx (count test-functions))
     (let [sketch (nth test-functions @test-indx)]
@@ -67,6 +70,7 @@
       (swap! total inc)

       (try
+        (remove-canvases)
         ((:fn sketch))

         (catch js/Error e
@@ -90,6 +94,7 @@
 (defn run-selected-test [event]
   (let [select (.-target event)
         option (aget select (.-selectedIndex select))]
+    (remove-canvases)
     ((:fn (.-testData option)))))

 (defn init-test-selection [input]


додано визначення

додано визначення

--- src/uawa/core.clj
+++ src/uawa/core.clj
@@ -2,6 +2,7 @@
 ;; (use 'uawa.core)

 ;; макроси
+(defmacro визначення "див. def" [символ документація значення] `(def ~символ ~документація ~значення))
 (defmacro постійна "див. defonce" [назва значення] `(let [v# (def ~назва)](when-not (.hasRoot v#) (def ~назва ~значення))))

 (defmacro функція "див. defn" [назви & описи] (list* `defn (with-meta назви (assoc (meta назви) :private false)) описи))
@@ -11,26 +12,6 @@
 (defmacro для "див. for" [set-expr body-expr] `(for ~set-expr body-expr))

 (defmacro запис "див. defrecord" [name fields & opt] `(defrecord ~name ~fields ~@opt))
-
-;; умови
-
-(постійна істина true)
-
-(постійна фальш false)
-
-(функція ні? "not" [x] (not x))
-
-(функція та? "and" ([x y] (and x y)) ([x y & більше] (reduce та? (та? x y) більше)))
-
-(функція кожен? "див. every?" ([умова колекція] (every? умова колекція)))
-
-(функція або? "or" ([x y] (or x y)) ([x y & більше] (reduce або? (або? x y) більше)))
-
-;; системні
-
-(функція вихід ([] (вихід 0)) ([статус] (System/exit статус)))
-
-(defn використай [& args] (use args))

 ;; колекції
@@ -53,12 +34,29 @@
 (функція зменш "див. reduce" [функція колекція] (reduce функція колекція))
 (функція зменш "див. reduce" [функція значення колекція] (reduce функція значення колекція))

+
+;; умови
+
+(постійна істина true)
+
+(постійна фальш false)
+
+(функція ні? "not" [x] (not x))
+
+(функція та? "and" ([x y] (and x y)) ([x y & більше] (зменш та? (та? x y) більше)))
+
+(функція кожен? "див. every?" ([умова колекція] (every? умова колекція)))
+
+(функція або? "or" ([x y] (or x y)) ([x y & більше] (зменш або? (або? x y) більше)))
+
+;; системні
+
+(функція вихід ([] (вихід 0)) ([статус] (System/exit статус)))
+
+(defn використай [& args] (use args))
+
+
 ;; різні
-
-(функція текст "(див. str)" [] (str))
-(функція текст "(див. str)" [x] (str x))
-(функція текст "(див. str)" [x y] (str x y))
-(функція текст "(див. str)" [x y & більше] (зменш текст (текст x y) більше))

 (функція дай-випадкове "див. rand-int" [максимальне] (rand-int максимальне))


indenting

indenting

--- src/vc/vijava.clj
+++ src/vc/vijava.clj
@@ -156,21 +156,21 @@
     (-> hostname find-vm bean :summary bean :runtime bean :powerState power-to-s )))

 (defn guest-info
-   "Guest info map"
-   [hostname]
-    (with-service
-      (-> (find-vm hostname) (.getGuest) bean)))
+  "Guest info map"
+  [hostname]
+  (with-service
+    (-> (find-vm hostname) (.getGuest) bean)))

 (defn tools-installed?
-   "checks if vmware tools are installed on the host"
-   [hostname]
-   (not (nil? (:toolsVersion (guest-info hostname)))))
+  "checks if vmware tools are installed on the host"
+  [hostname]
+  (not (nil? (:toolsVersion (guest-info hostname)))))

 (defn guest-status
-   "Get guest os status (requires vmware tools to be installed)"
-   [hostname]
+  "Get guest os status (requires vmware tools to be installed)"
+  [hostname]
   {:pre [(tools-installed? hostname)]}
-    (some-> (guest-info hostname) :guestState keyword))
+  (some-> (guest-info hostname) :guestState keyword))

 (defn power-on
   "Power on VM"


Add new events to schema

Add new events to schema

--- src-cljs/frontend/analytics/core.cljs
+++ src-cljs/frontend/analytics/core.cljs
@@ -28,11 +28,15 @@
   #{:account-settings-clicked
     :add-more-containers-clicked
     :add-project-clicked
+    :aside-project-settings-clicked
     :authorize-vcs-clicked
     :beta-accept-terms-clicked
     :beta-join-clicked
     :beta-leave-clicked
     :branch-clicked
+    :build-head-parallelism-clicked
+    :build-page-project-settings-clicked
+    :build-page-tab-clicked
     :build-insights-upsell-clicked
     :build-insights-upsell-impression
     :build-link-clicked
@@ -40,6 +44,8 @@
     :build-timing-upsell-impression
     :cancel-plan-clicked
     :change-image-clicked
+    :container-filter-changed
+    :container-selected
     :dismiss-trial-offer-banner-clicked
     :insights-bar-clicked
     :invite-teammates-clicked
@@ -55,7 +61,7 @@
     :pr-link-clicked
     :project-branch-changed
     :project-clicked
-    :project-settings-clicked
+    :project-enabled
     :revision-link-clicked
     :select-plan-clicked
     :set-up-junit-clicked


Syntax error

Syntax error

--- datasets/src/cortex_datasets/mmap.clj
+++ datasets/src/cortex_datasets/mmap.clj
@@ -58,7 +58,7 @@
    (let [r-file (MMapBuffer. (File. fname) map-mode byte-order)]
      (resource/track r-file)
      (.memory r-file)))
-  (^Memory [String fname]
+  (^Memory [^String fname]
    (mem-map-file fname FileChannel$MapMode/READ_ONLY ByteOrder/BIG_ENDIAN)))


Add TODOs

Add TODOs

--- src/yada/body.clj
+++ src/yada/body.clj
@@ -68,8 +68,6 @@
   (content-length [s]
     nil)

-
-
   MapBody
   (to-body [mb representation]
     (to-body (:map mb) representation))
@@ -230,6 +228,7 @@
    :error error})

 ;; TODO: Check semantics, is this right? Shouldn't we be encoding to json here?
+;; TODO: Move to yada.json
 (defmethod render-error "application/json"
   [status error representation {:keys [id options]}]
   {:status status
@@ -238,6 +237,7 @@
    :error error})

 ;; TODO: Check semantics, is this right? Shouldn't we be encoding to transit+json here?
+;; TODO: Move to yada.transit
 (defmethod render-error "application/transit+json"
   [status error representation {:keys [id options]}]
   {:status status


Better spyctx

Better spyctx

--- src/yada/core.clj
+++ src/yada/core.clj
@@ -96,9 +96,11 @@
 (defmacro exit-when-not [expr status]
   `(exit-when (not* ~expr) ~status))

-(defn spyctx [ctx]
-  (debugf "Context is %s" ctx)
-  ctx)
+(defn spyctx [label & [korks]]
+  (fn [ctx]
+    (debugf "SPYCTX %s: Context is %s" label
+            (if korks (get-in ctx (if (sequential? korks) korks [korks])) ctx))
+    ctx))

 (defrecord NoAuthorizationSpecified []
   p/Resource


added another element to rdd2 to differentiate from result

--- test/sparkling/api_test.clj
+++ test/sparkling/api_test.clj
@@ -407,7 +407,7 @@
                     (testing
                         "intersection returns the common elements of two vectors"
                       (let [rdd1 (s/parallelize c [1 2 3 4 5])
-                            rdd2 (s/parallelize c [1 3 5])]
+                            rdd2 (s/parallelize c [1 3 5 7])]
                         (is (equals-ignore-order? (-> (s/intersection rdd1 rdd2)
                                                       s/collect
                                                       vec)


removes unnecessary bindings

removes unnecessary bindings

--- storm-core/src/clj/backtype/storm/ui/core.clj
+++ storm-core/src/clj/backtype/storm/ui/core.clj
@@ -1108,12 +1108,8 @@
   (GET "/api/v1/topology/:id/profiling/start/:host-port/:timeout"
        [:as {:keys [servlet-request]} id host-port timeout & m]
        (thrift/with-configured-nimbus-connection nimbus
-         (let [user (.getUserName http-creds-handler servlet-request)
-               topology-conf (from-json
-                              (.getTopologyConf ^Nimbus$Client nimbus id))]
-           (assert-authorized-user "setWorkerProfiler" (topology-config id))
-           (assert-authorized-profiler-action "start"))
-
+         (assert-authorized-user "setWorkerProfiler" (topology-config id))
+         (assert-authorized-profiler-action "start")
          (let [[host, port] (split host-port #":")
                nodeinfo (NodeInfo. host (set [(Long. port)]))
                timestamp (+ (System/currentTimeMillis) (* 60000 (Long. timeout)))
@@ -1133,11 +1129,8 @@
   (GET "/api/v1/topology/:id/profiling/stop/:host-port"
        [:as {:keys [servlet-request]} id host-port & m]
        (thrift/with-configured-nimbus-connection nimbus
-         (let [user (.getUserName http-creds-handler servlet-request)
-               topology-conf (from-json
-                              (.getTopologyConf ^Nimbus$Client nimbus id))]
-           (assert-authorized-user "setWorkerProfiler" (topology-config id))
-           (assert-authorized-profiler-action "stop"))
+         (assert-authorized-user "setWorkerProfiler" (topology-config id))
+         (assert-authorized-profiler-action "stop")
          (let [[host, port] (split host-port #":")
                nodeinfo (NodeInfo. host (set [(Long. port)]))
                timestamp 0
@@ -1152,11 +1145,8 @@
   (GET "/api/v1/topology/:id/profiling/dumpprofile/:host-port"
        [:as {:keys [servlet-request]} id host-port & m]
        (thrift/with-configured-nimbus-connection nimbus
-         (let [user (.getUserName http-creds-handler servlet-request)
-               topology-conf (from-json
-                              (.getTopologyConf ^Nimbus$Client nimbus id))]
-           (assert-authorized-user "setWorkerProfiler" (topology-config id))
-           (assert-authorized-profiler-action "dumpprofile"))
+         (assert-authorized-user "setWorkerProfiler" (topology-config id))
+         (assert-authorized-profiler-action "dumpprofile")
          (let [[host, port] (split host-port #":")
                nodeinfo (NodeInfo. host (set [(Long. port)]))
                timestamp (System/currentTimeMillis)
@@ -1171,11 +1161,8 @@
   (GET "/api/v1/topology/:id/profiling/dumpjstack/:host-port"
        [:as {:keys [servlet-request]} id host-port & m]
        (thrift/with-configured-nimbus-connection nimbus
-         (let [user (.getUserName http-creds-handler servlet-request)
-               topology-conf (from-json
-                              (.getTopologyConf ^Nimbus$Client nimbus id))]
-           (assert-authorized-user "setWorkerProfiler" (topology-config id))
-           (assert-authorized-profiler-action "dumpjstack"))
+         (assert-authorized-user "setWorkerProfiler" (topology-config id))
+         (assert-authorized-profiler-action "dumpjstack")
          (let [[host, port] (split host-port #":")
                nodeinfo (NodeInfo. host (set [(Long. port)]))
                timestamp (System/currentTimeMillis)
@@ -1190,11 +1177,8 @@
   (GET "/api/v1/topology/:id/profiling/restartworker/:host-port"
        [:as {:keys [servlet-request]} id host-port & m]
        (thrift/with-configured-nimbus-connection nimbus
-         (let [user (.getUserName http-creds-handler servlet-request)
-               topology-conf (from-json
-                              (.getTopologyConf ^Nimbus$Client nimbus id))]
-           (assert-authorized-user "setWorkerProfiler" (topology-config id))
-           (assert-authorized-profiler-action "restartworker"))
+         (assert-authorized-user "setWorkerProfiler" (topology-config id))
+         (assert-authorized-profiler-action "restartworker")
          (let [[host, port] (split host-port #":")
                nodeinfo (NodeInfo. host (set [(Long. port)]))
                timestamp (System/currentTimeMillis)
@@ -1209,11 +1193,8 @@
   (GET "/api/v1/topology/:id/profiling/dumpheap/:host-port"
        [:as {:keys [servlet-request]} id host-port & m]
        (thrift/with-configured-nimbus-connection nimbus
-         (let [user (.getUserName http-creds-handler servlet-request)
-               topology-conf (from-json
-                              (.getTopologyConf ^Nimbus$Client nimbus id))]
-           (assert-authorized-user "setWorkerProfiler" (topology-config id))
-           (assert-authorized-profiler-action "dumpheap"))
+         (assert-authorized-user "setWorkerProfiler" (topology-config id))
+         (assert-authorized-profiler-action "dumpheap")
          (let [[host, port] (split host-port #":")
                nodeinfo (NodeInfo. host (set [(Long. port)]))
                timestamp (System/currentTimeMillis)


Restore handling of non-unique sync names.

Just in case someone has a MIDI config with multiple devices with the
same name.

--- src/afterglow/web/routes/show_control.clj
+++ src/afterglow/web/routes/show_control.clj
@@ -284,8 +284,8 @@
   "Builds a list of sync sources of a particular type for constructing
   the user interface."
   [known kind name-fn selected]
-  (loop [sorted (into (sorted-map-by (fn [key1 key2] (compare (name-for-sync-sorting key1)
-                                                              (name-for-sync-sorting key2))))
+  (loop [sorted (into (sorted-map-by (fn [key1 key2] (compare [(name-for-sync-sorting key1) key1]
+                                                              [(name-for-sync-sorting key2) key2])))
                       known)
            result []]
     (if-not (seq sorted)


good so far

good so far

--- src/epicea/typed/core.clj
+++ src/epicea/typed/core.clj
@@ -5,13 +5,6 @@
             [epicea.utils.access :as access] :reload-all))

 (spec/def ::unspecified nil?)
-
-(spec/def ::bool boolean?)
-(spec/def ::float float?)
-(spec/def ::double double?)
-(spec/def ::long #(instance? java.lang.Long %))
-(spec/def ::int #(or (instance? java.lang.Integer %)
-                     (int? %)))

 (spec/def ::dynamic (partial = :dynamic))

@@ -32,54 +25,43 @@

 (spec/def ::record-field (spec/cat
                           :key ::key
-                          :value ::sized-type))
+                          :value-type ::type))

 (spec/def ::record (spec/cat
                     :type (partial = :record)
                     :fields (spec/* ::record-field)))

-(spec/def ::union (spec/cat
-                   :type (partial = :union)
-                   :alts (spec/* ::sized-type)))
-
 (spec/def ::vec (spec/cat
                  :type (partial = :vec)
-                 :type ::sized-type
+                 :value-type ::type
                  :count ::count))

-(spec/def ::vecdata (spec/cat
-                     :type (partial = :vecdata)
-                     :data (spec/* ::sized-type)))
+(spec/def ::vec-literal (spec/cat
+                         :type (partial = :vecdata)
+                         :data (spec/* ::type)))

-;; Compile time tagging
-(spec/def ::tagged (spec/cat
-                    :type (partial = :tag)
-                    :tag (constantly true)
-                    :data ::sized-type))
+(spec/def ::pointer (spec/cat
+                     :type (partial = :pointer)
+                     :value-type ::type))

-(spec/def ::primitive (spec/or :double ::double
-                               :float ::float
-                               :long ::long
-                               :int ::int
-                               :bool ::bool
-                               :number ::number))
+(spec/def ::constant (spec/cat
+                      :type (partial = :constant)
+                      :value (constantly true)))

-(spec/def ::sized-type (spec/or :primitive ::primitive
-                                :record ::record
-                                :union ::union
-                                :unspecified ::unspecified ;; <-- a primitive building block
-                                :tagged ::tagged
-                                :vec ::vec
-                                :vecdata ::vecdata))
+(spec/def ::type (spec/or :double ::double
+                          :float ::float
+                          :long ::long
+                          :int ::int
+                          :bool ::bool
+                          :number ::number
+                          :record ::record
+                          :vec ::vec
+                          :vec ::vec-literal
+                          :pointer ::pointer
+                          :unspecified ::unspecified ;; <-- a primitive building block
+                          :constant ::constant
+                          :dynamic ::dynamic))

-(spec/def ::array (spec/cat
-                   :type (partial = :array)
-                   :header (spec/? ::sized-type)
-                   :data ::sized-type))
-
-(spec/def ::type (spec/or :sized-type ::sized-type
-                          :array ::array
-                          :dynamic ::dynamic))

 (defn export-primitive [x]
   [:export x])
@@ -93,15 +75,12 @@
 ;; How to specify one:
 ;; (value [:record :a :number :b double] [3 [4 9]])

+
 (assert (spec/valid? ::number :number))
-(assert (spec/valid? ::union [:union :number :number]))
 (assert (spec/valid? ::record [:record
                                :a :number
                                :b [:vec nil 3]]))
-(assert (spec/valid? ::tagged [:tag 119 [:vec :number 3]]))
-(assert (spec/valid? ::array [:array [:record :a nil :b nil]]))
-(assert (spec/valid? ::array [:array [:record :a nil :b nil] nil]))
-(assert (spec/valid? ::vecdata [:vecdata 3 4 5]))
+

 (def pair-settings {:default-parent [nil nil]})

@@ -112,6 +91,7 @@
 (def get-pair-value (access/getter pair-value))

 ;;;;;; Type properties
+;; When it is stored
 (declare compute-size)

 (defn size-op [f]
@@ -121,29 +101,6 @@
 (def size-add +)
 (def size-mul *)
 (def size-max max)
-
-
-;;;; Compute the size of a ::sized-type
-(defmultiple compute-size get-pair-tag
-  (:default [x] 1)
-  (:vec [x] (let [value (get-pair-value x)]
-              (size-mul (:count value) (compute-size (:type value)))))
-  (:tagged [x] (compute-size (:data (get-pair-value x))))
-  (:union [x] (reduce size-max (map compute-size (-> x get-pair-value :alts))))
-  (:record [x] (reduce size-add (map (comp compute-size :value)
-                                    (-> x get-pair-value :fields))))
-  (:unspecified [x] nil)
-  (:vecdata [x] (reduce size-add (map compute-size (-> x get-pair-value :data)))))
-
-
-(assert (= 1 (compute-size (spec/conform ::sized-type [:tag 119 :number]))))
-(assert (= 1 (compute-size (spec/conform ::sized-type 3))))
-(assert (= 3 (compute-size (spec/conform ::sized-type [:vec :number 3]))))
-(assert (= 2 (compute-size (spec/conform ::sized-type [:union :number [:vec :number 2]]))))
-(assert (= 2 (compute-size (spec/conform ::sized-type [:record :a :number :b :number]))))
-(assert (= 3 (compute-size (spec/conform
-                            ::sized-type
-                            [:record :a :number :b :number :c :number]))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Grammar
 (spec/def ::arg-name symbol?)


Minor refactor

Minor refactor

--- src/cljs/gtfve/components/maps_panel.cljs
+++ src/cljs/gtfve/components/maps_panel.cljs
@@ -95,11 +95,12 @@
       (let [opts (om/get-state owner :opts)
             node (om/get-node owner "gmap")
             google-map (Maps.Map. node (clj->js opts))
+            data (.-data google-map)
             bounds-changed-ch (-> (maps/listen google-map "bounds_changed")
                                   (utils/debounce 100))
             center-changed-ch (-> (maps/listen google-map "center_changed")
                                   (utils/debounce 100))
-            data-click-ch (maps/data-listen (.-data google-map)
+            data-click-ch (maps/data-listen data
                                             "click"
                                             (om/get-state owner :data-click-ch))
             kill-ch (om/get-state owner :kill-ch)]


fix ui

fix ui

--- src/cljs/salava/badge/ui/endorsement.cljs
+++ src/cljs/salava/badge/ui/endorsement.cljs
@@ -482,13 +482,13 @@
                             [:a {:href "#" :on-click #(do
                                                         (.preventDefault %)
                                                         (mo/open-modal [:badge :userendorsement] (atom {:endorsement endorsement :state state}) {:hidden (fn [] (init-user-endorsements state))} ))}
-                              [:div.media
-                             [:div.col-md-12 [:small [:i (date-from-unix-time (* 1000 mtime) "days")]]]
-                             #_[:div.row
-                                [:div.labels
-                                 [:span.label.label-success (if endorser_id (t :badge/Endorsedyou) (t :badge/Youendorsed))]
-                                 (if (= "pending" status) [:span.label.label-info (t :social/Pending)])]
-                                ]
+                             [:div.media
+                              [:div.col-md-12 [:small [:i (date-from-unix-time (* 1000 mtime) "days")]]]
+                              #_[:div.row
+                                 [:div.labels
+                                  [:span.label.label-success (if endorser_id (t :badge/Endorsedyou) (t :badge/Youendorsed))]
+                                  (if (= "pending" status) [:span.label.label-info (t :social/Pending)])]
+                                 ]

                               [:div.media-left.media-top.list-item-body
                                [:img.main-img.media-object {:src (str "/" image_file)}]
@@ -500,10 +500,10 @@
                                  [:img.media-object.small-img {:src (profile-picture profile_picture)}]]
                                 [:div.media-body
                                  [:p endorser]
-                                  [:div.labels
-                                   [:span.label.label-success (if endorser_id (t :badge/Endorsedyou) (t :badge/Youendorsed))]
-                                   (if (= "pending" status) [:span.label.label-info (t :social/Pending)])]]
-                                 ]]
+                                 [:div.labels
+                                  [:span.label.label-success (if endorser_id (t :badge/Endorsedyou) (t :badge/Youendorsed))]
+                                  (if (= "pending" status) [:span.label.label-info (t :social/Pending)])]]
+                                ]]
                               ]

                              #_[:div.media


more subtle button

more subtle button

--- src/cljs/swarmpit/component/page_404.cljs
+++ src/cljs/swarmpit/component/page_404.cljs
@@ -39,11 +39,11 @@
                    (if (some? params)
                      (comp/button
                        {:onClick #(.back js/window.history)
-                        :color   "primary"
+                        :color   "outlined"
                         :variant "contained"}
                        "Go back")
                      (comp/button
                        {:href    (routes/path-for-frontend :index)
-                        :color   "primary"
+                        :color   "outlined"
                         :variant "contained"}
                        "go home"))])))]]]]))))


Don't println at the module level

Don't println at the module level

--- src/eulalie/platform.cljs
+++ src/eulalie/platform.cljs
@@ -13,8 +13,7 @@
 (def https (nodejs/require "https"))
 (def crc   (try
              (nodejs/require "crc")
-             (catch js/Error e
-               (println "Unable to load 'crc' module - proceeding anyway")
+             (catch js/Error _
                nil)))

 (defn req->node [{{:keys [query host port path]} :endpoint :keys [headers method] :as req}]


Now that bugs are fixed in jclouds, don't create a new pallet group for each deploy

--- src/circle/backend/project/circle.clj
+++ src/circle/backend/project/circle.clj
@@ -22,26 +22,25 @@
                          :group circle/circle-group))

 (def circle-deploy
-  (extend-group-with-revision
-   (build :project-name "Circle"
-          :build-num 2
-          :type :deploy
-          :vcs-type :git
-          :vcs-url "git@github.com:arohner/CircleCI.git"
-          :vcs-revision "5c4c9b4104032b9b443cefe5d178c3a5fd46ce91"
-          :aws-credentials circle.aws-credentials/AWS-access-credentials
-          :r53-zone-id "ZBVDNEPFXWZR2"
-          :num-nodes 1
-          :lb-name "www"
-          :group circle/circle-group
-          :actions [(start-nodes)
-                    (checkout)
-                    (bash [(lein deps)])
-                    (bash [(export "CIRCLE_ENV=production")
-                           (export "SWANK=true")
-                           (lein daemon start ":web")])
-                    (bash [(sudo "/etc/init.d/nginx" :start)])
-                    (tag-revision)
-                    (lb/add-instances)
-                    (lb/wait-for-healthy)
-                    (lb/shutdown-remove-old-revisions)])))+  (build :project-name "Circle"
+         :build-num 2
+         :type :deploy
+         :vcs-type :git
+         :vcs-url "git@github.com:arohner/CircleCI.git"
+         :vcs-revision "a7108a0481b64c0be7387b5082494b344104b926"
+         :aws-credentials circle.aws-credentials/AWS-access-credentials
+         :r53-zone-id "ZBVDNEPFXWZR2"
+         :num-nodes 1
+         :lb-name "www"
+         :group circle/circle-group
+         :actions [(start-nodes)
+                   (checkout)
+                   (bash [(lein deps)])
+                   (bash [(export "CIRCLE_ENV=production")
+                          (export "SWANK=true")
+                          (lein daemon start ":web")])
+                   (bash [(sudo "/etc/init.d/nginx" :start)])
+                   (tag-revision)
+                   (lb/add-instances)
+                   (lb/wait-for-healthy)
+                   (lb/shutdown-remove-old-revisions)]))


Some minor tweaks for TITANIC

Some minor tweaks for TITANIC

and the bottleneck is probaly somewhere in titanic-closure.

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

--- src/conexp/contrib/algorithms/titanic.clj
+++ src/conexp/contrib/algorithms/titanic.clj
@@ -47,17 +47,17 @@
   "
   [X base-set keys candidates]
   (let [X-weight (set-weight X),
-        keys     (map #(vector % (set-weight %)) keys)]
+        keys     (take-while #(not= (set-weight %) X-weight) keys)]
     (loop [Y        (apply union X (map #(closure (disj X %)) X)),
            elements (difference base-set Y)]
       (if-not (empty? elements)
         (let [m    (first elements),
-              add? (if-let [s (set-weight (conj X m))]
-                     (= s X-weight)
-                     (not (first (for [[K weight] keys,
-                                       :while (not= weight X-weight)
+              X+m  (conj X m),
+              add? (if (contains? candidates X+m)
+                     (= (set-weight X+m) X-weight)
+                     (not (first (for [K keys,
                                        :when (and (contains? K m)
-                                                  (subset? (disj K m) X))]
+                                                  (subset? K X+m))]
                                    K))))]
           (recur (if add? (conj Y m) Y)
                  (rest elements)))


cjl - Debugging info

cjl - Debugging info

--- src/icfp2015/gameplay.clj
+++ src/icfp2015/gameplay.clj
@@ -1,9 +1,16 @@
 (ns icfp2015.gameplay
-  (:require [icfp2015.board :refer [make-board transition-board valid-position?]]))
+  (:require [icfp2015.board :refer [board->str make-board transition-board valid-position?]]))
+
+(def DEBUG false)

 (defn handle-unit
   [ai initial-board unit]
   (let [f (fn [[board commands]]
+            (if DEBUG
+              (do
+                (println (board->str board))
+                (println)
+                (Thread/sleep 100)))
             (let [new-command (ai board)
                   new-board (transition-board board new-command)]
               [new-board (conj commands new-command)]))
@@ -25,6 +32,10 @@
   (loop [board (make-board width height filled)
          commands '() ; TODO: use vector
          remaining-units units]
+    (if DEBUG
+      (do
+        (println (board->str board))
+        (println)))
     (if (empty? remaining-units)
       commands
       (let [current-unit (first remaining-units)


Fix variable names

Fix variable names

--- src/karmanaut/crawler.clj
+++ src/karmanaut/crawler.clj
@@ -19,10 +19,9 @@
   {:_id (:username user-map)})

 (defn create-sample-document [user-map]
-  (let [mn (utils/midnight (utils/utcnow))
-        secs (utils/hours-since-midnight (utils/utcnow))
-        stats {(str "link_karma." secs) (:link-karma user-map),
-               (str "comment_karma." secs) (:comment-karma user-map)}]
+  (let [hours (utils/hours-since-midnight (utils/utcnow))
+        stats {(str "link_karma." hours) (:link-karma user-map),
+               (str "comment_karma." hours) (:comment-karma user-map)}]
     {"$set" stats}))

 (defn create-query-document [user-map]


damn it, haskell is looking really nice right now

--- src/mediakeys/hotkeys.clj
+++ src/mediakeys/hotkeys.clj
@@ -13,13 +13,12 @@

 (def not-nil? (comp not nil?))

-(defn allowed? [change] true)
-    ; (println change)
-    ; (let [key-val (first change)
-    ;       [action hotkey] key-val]
-    ;     (if hotkey
-    ;         (-> hotkey make-keystroke not-nil?)
-    ;         false)))
+(defn allowed? [change]
+    (let [key-val (first change)
+          [action hotkey] key-val]
+        (if hotkey
+            (-> hotkey make-keystroke not-nil?)
+            false)))

 (defcurried flatmap< [f channel]
     (let [return (chan)]
@@ -55,12 +54,11 @@

 (defn keypress-channel! [key-change]
-    (let [old-keys (new-keys!)]
-            (let [keys (new-keys! key-change)
-                  provider (new-provider!)
-                  channel (register-keys provider keys)]
-                        (save-keys! keys)
-                        channel)))
+   (let [keys (new-keys! key-change)
+         provider (new-provider!)
+         channel (register-keys provider keys)]
+            (save-keys! keys)
+            channel))

 (defcurried seed-channel! [seed channel]
     (put! channel seed)
@@ -68,5 +66,5 @@

 (defn keypress-events! [key-changes]
     (let [result (flatmap< keypress-channel! key-changes)]
-        (seed-channel! "{}" key-changes)
+        (seed-channel! { } key-changes)
         result))


when repositioning cards, actually check that the dashcard query came back with a value before updating.

--- src/metabase/api/dash.clj
+++ src/metabase/api/dash.clj
@@ -91,8 +91,9 @@
   (write-check Dashboard id)
   (doseq [{dashcard-id :id :keys [sizeX sizeY row col]} cards]
     ;; we lookup the dashcard purely to ensure the card is part of the given dashboard
-    (let [_ (sel :one [DashboardCard :id] :id dashcard-id :dashboard_id id)]
-      (upd DashboardCard dashcard-id :sizeX sizeX :sizeY sizeY :row row :col col)))
+    (let [dashcard (sel :one [DashboardCard :id] :id dashcard-id :dashboard_id id)]
+      (when dashcard
+        (upd DashboardCard dashcard-id :sizeX sizeX :sizeY sizeY :row row :col col))))
   (push-revision :entity Dashboard, :object (Dashboard id))
   {:status :ok})


put sprite removal in finally block so its always triggered

--- src/clj/infinitelives/pixi/macros.clj
+++ src/clj/infinitelives/pixi/macros.clj
@@ -20,9 +20,9 @@
   (if (pos? (count bindings))
     (let [symb (first bindings) val (second bindings)]
       `(let [~symb ~val]
-         (.addChild (get-layer ~canvas ~layer) ~symb)
-         (with-sprite ~canvas ~layer ~(subvec bindings 2) ~@body)
-         (.removeChild (get-layer ~canvas ~layer) ~symb)))
+         (try (.addChild (get-layer ~canvas ~layer) ~symb)
+              (with-sprite ~canvas ~layer ~(subvec bindings 2) ~@body)
+              (finally (.removeChild (get-layer ~canvas ~layer) ~symb)))))
     `(do ~@body)))

 (defmacro with-layered-sprite [bindings & body]
@@ -36,13 +36,13 @@
           val (nth bindings 2)]
       `(let [~symb ~val
              canvas# (infinitelives.pixi.canvas/get)]
-         (.addChild
-          (get-layer canvas# ~layer)
-          ~symb)
-         (with-layered-sprite ~(subvec bindings 3) ~@body)
-         (.removeChild
-          (get-layer canvas# ~layer)
-          ~symb)))
+         (try (.addChild
+               (get-layer canvas# ~layer)
+               ~symb)
+              (with-layered-sprite ~(subvec bindings 3) ~@body)
+              (finally (.removeChild
+                        (get-layer canvas# ~layer)
+                        ~symb)))))
     `(do ~@body)))

 (defmacro with-sprite-set [canvas layer bindings & body]
@@ -53,11 +53,12 @@
   (if (pos? (count bindings))
     (let [symb (first bindings) val (second bindings)]
       `(let [~symb ~val]
-         (doseq [sprite# ~symb]
-           (.addChild (get-layer ~canvas ~layer) sprite#))
-         (with-sprite-set ~canvas ~layer ~(subvec bindings 2) ~@body)
-         (doseq [sprite# ~symb]
-           (.removeChild (get-layer ~canvas ~layer) sprite#))))
+         (try
+           (doseq [sprite# ~symb]
+             (.addChild (get-layer ~canvas ~layer) sprite#))
+           (with-sprite-set ~canvas ~layer ~(subvec bindings 2) ~@body)
+           (finally (doseq [sprite# ~symb]
+                      (.removeChild (get-layer ~canvas ~layer) sprite#))))))
     `(do ~@body)))

 (defmacro while-let


use naming

use naming

--- src/cljc/commos/delta/compscribe.cljc
+++ src/cljc/commos/delta/compscribe.cljc
@@ -418,7 +418,7 @@
   "Caches on endpoints.  Sends the current sum to a new subscriber,
   continues with deltas."
   [service]
-  (cached-service service sum-and-delta sum-then-deltas))
+  (cached-service service sum-and-delta first-then-second))

 (defn compscriber
   [service]


gcd.clj problem updates: changed training case generators to make them harder to guess; slight mods to genetic operators; recorded some successful programs as comments

--- src/clojush/problems/software/gcd.clj
+++ src/clojush/problems/software/gcd.clj
@@ -1,6 +1,6 @@
 ;; gcd.clj
 ;; Bill Tozier, bill@vagueinnovation.com
-;; updated February 4, 2020
+;; updated February 24, 2020
 ;;
 ;; This is code for finding algorithms which return the greatest common
 ;;   divisor (GCD) of a pair of integer arguments. See the Wikipedia
@@ -55,14 +55,15 @@

 (def gcd-training-cases
-  "Produces a random sample of 100 training cases: some cases where the integer arguments are identical, some pairs of moderate integers (~10000) with nontrivial GCD values, some pairs of large integers (~10^8) with nontrivial GCD values, and some pairs of coprime integers with GCD=1"
+  "Produces a random sample of training cases: some cases where the integer arguments are identical, some pairs of moderate integers (~10000) with nontrivial GCD values, some pairs of large integers (~10^8) with nontrivial GCD values, some Very Large pairs, and some pairs of coprime integers with GCD=1"
   (into []
     (concat
       (repeatedly 5 #(identical-case (product-of-n-d-sided-dice 20 7)))
-      (repeatedly 30 #(nontrivial-gcd-training-case 7 7))
-      (repeatedly 50 #(nontrivial-gcd-training-case 20 7))
-      (repeatedly 15
-        #(gcd-coprime-case (product-of-n-d-sided-dice 7 7)))
+      (repeatedly 40 #(nontrivial-gcd-training-case 7 7))
+      (repeatedly 30 #(nontrivial-gcd-training-case 20 7))
+      (repeatedly 20 #(nontrivial-gcd-training-case 20 11))
+      (repeatedly 5
+        #(gcd-coprime-case (product-of-n-d-sided-dice 20 7)))
         )))

@@ -83,7 +84,7 @@
         errors (mapv (fn [behavior a-case]
                        (if (int? behavior)
                         (abs-err behavior (last a-case))
-                        1000000000000))
+                        1e15))
                      behaviors
                      cases)]
     (assoc individual
@@ -91,12 +92,19 @@
       :errors errors)))

+(defn gcd-initial-report
+  [argmap]
+  (println "Training cases:")
+  (doseq [[i case] (map vector (range) gcd-training-cases)]
+    (println (format "Train Case: %3d | Input/Output: %s" i (str case))))
+  (println ";;******************************"))
+
+

 ; Atom generators
 (def gcd-atom-generators
   "Collection of items which will be used to construct random programs: Some integer constants, boolean constants, the input and various standard Push instructions. The relative proportions are stupid and simply the result of poking and prodding with insufficient evidence; feel free to change them."
   (concat
-    (repeat 10 'integer_mod)
     (repeat 10 'in1)
     (repeat 10 'in2)
     (list
@@ -128,26 +136,168 @@
 (def argmap
   "I literally have no idea what many of these things do. However, with the current settings, the first run I attempted did solve the problem to my satisfaction. YMMV."
   {:error-function (fn [individual]
-                      (gcd-error-function
-                        individual
-                        gcd-training-cases
-                        ))
-   :atom-generators gcd-atom-generators
-   :max-points 2000
-   :max-genome-size-in-initial-program 500
-   :evalpush-limit 2000
-   :population-size 400
-   :max-generations 5000
-   :parent-selection :lexicase
-   :genetic-operator-probabilities {:uniform-addition-and-deletion 0.5
-                                    :alternation 0.5}
-   :uniform-addition-and-deletion-rate [0.001 0.01 0.1]
-   :alternation-rate [0.001 0.01 0.1]
-   :alignment-deviation [0 1 10 100]
-   :report-simplifications 0
-   :final-report-simplifications 5000
-   })
-
-;; An evolved solution (simplified):
-;;
-;; (in2 in1 integer_mod in1 in1 integer_dup_items integer_mod integer_mod 53 integer_dup_items in1 integer_mod in2 integer_mod integer_mod 2 integer_dup_items integer_mod integer_swap 2 integer_dup_items integer_dec integer_dec integer_mod integer_swap 2 integer_dup_items 2 integer_dup_items integer_mod integer_mod 2 integer_dup_items integer_mod 2 integer_dup_items integer_mod integer_swap 2 integer_dup_items integer_dec integer_dec integer_mod integer_mod 2 integer_dup_items integer_mod 2 integer_dup_items integer_mod integer_swap 2 integer_dup_items integer_dec integer_dec integer_mod integer_mod 2 integer_dup_items integer_mod 2 integer_dup_items integer_mod 2 integer_dup_items integer_mod exec_dup_times ())
+                        (gcd-error-function
+                          individual
+                          gcd-training-cases
+                          ))
+     :atom-generators gcd-atom-generators
+     :max-points 1000
+     :max-genome-size-in-initial-program 500
+     :evalpush-limit 1000
+     :population-size 400
+     :max-generations 5000
+     :parent-selection :lexicase
+     :genetic-operator-probabilities {:uniform-addition-and-deletion 0.5
+                                      :alternation 0.5}
+     :uniform-addition-and-deletion-rate [0.001 0.01 0.1]
+     :alternation-rate [0.001 0.01 0.1]
+     :alignment-deviation [0 1 10 100]
+     :report-simplifications 0
+     :final-report-simplifications 5000
+     :problem-specific-initial-report gcd-initial-report
+
+     })
+
+;; Evolved solutions (not all simplified):
+
+;; (in2 in1 integer_mod in1 in1 integer_dup_items integer_mod integer_mod 53
+;; integer_dup_items in1 integer_mod in2 integer_mod integer_mod 2
+;; integer_dup_items integer_mod integer_swap 2 integer_dup_items integer_dec
+;; integer_dec integer_mod integer_swap 2 integer_dup_items 2 integer_dup_items
+;; integer_mod integer_mod 2 integer_dup_items integer_mod 2 integer_dup_items
+;; integer_mod integer_swap 2 integer_dup_items integer_dec integer_dec
+;; integer_mod integer_mod 2 integer_dup_items integer_mod 2 integer_dup_items
+;; integer_mod integer_swap 2 integer_dup_items integer_dec integer_dec
+;; integer_mod integer_mod 2 integer_dup_items integer_mod 2 integer_dup_items
+;; integer_mod 2 integer_dup_items integer_mod exec_dup_times ())
+
+;; program: (in1 in2 integer_sub in2 integer_sub in2 in1 in2 integer_mod
+;; integer_mod in1 in2 in2 in1 in2 integer_mod integer_mod integer_mod
+;; integer_mod integer_mod integer_mod exec_eq in1 boolean_and in1 in2
+;; integer_yankdup integer_sub integer_mod integer_lte in1 integer_mod
+;; integer_mod in1 integer_mod in2 in1 in2 in2 boolean_dup_items integer_mod
+;; integer_mod exec_eq code_yankdup in2 in2 integer_swap integer_dup_items
+;; integer_mod integer_mod integer_sub in2 integer_mod integer_lte in1
+;; integer_mod in2 in1 in2 integer_mod integer_mod integer_mod integer_lte in1
+;; in2 integer_yankdup exec_swap integer_sub integer_mod integer_mod in2 in1 in2
+;; integer_mod in1 boolean_dup_items integer_mod in2 integer_dup_items
+;; integer_mod integer_mod integer_mod integer_sub in1 in2 integer_dup_items
+;; integer_mod integer_mod integer_sub integer_lte in2 integer_mod integer_mod
+;; integer_lte in2 in2 integer_dup_items integer_mod integer_mod integer_sub in2
+;; integer_mod integer_lte in1 in2 integer_mod integer_mod in2 in1 in2 in1
+;; boolean_dup_items integer_mod integer_mod in2 integer_dup_items integer_mod
+;; integer_mod in2 integer_dup_items integer_mod integer_mod 7 integer_dup_items
+;; exec_dup_times integer_mod)
+
+;; program: (in1 in2 in1 exec_dup_items exec_dup (exec_dup (integer_mod
+;; exec_empty exec_dup (integer_min exec_if integer_mod integer_sub integer_gte
+;; in2 in1 in2 integer_yankdup))))
+
+;; Successful program: (integer_lt code_subst in1 true in1 in1 boolean_rot
+;; code_position code_swap code_quote (code_noop integer_inc) exec_eq
+;; integer_yankdup integer_pop code_subst in2 in2 in1 boolean_rot exec_dup
+;; (exec_do*while (boolean_or code_quote (code_do* integer_yankdup)) boolean_xor
+;; boolean_rot) exec_when (code_subst in1 code_stackdepth code_flush integer_min
+;; in1 exec_eq in1 integer_yankdup) code_flush code_flush code_subst in2
+;; code_null in1 in2 in1 1000000000 code_length code_length exec_dup_times
+;; (boolean_yank integer_stackdepth integer_dup_items exec_dup_times
+;; (integer_dup_items integer_stackdepth integer_dup_items exec_dup_times
+;; (integer_dup_items integer_mod integer_empty integer_rot))))
+
+;; Successful program: (exec_swap (exec_dup (3 integer_dup_items) integer_add)
+;; (code_do*count exec_when (code_frominteger exec_swap (boolean_or exec_if
+;; (code_extract exec_dup_times (in2 exec_k (boolean_invert_first_then_and
+;; boolean_shove in1 in1 in2) () integer_pop) 1000000) (integer_dup_items) 1000
+;; exec_swap () (code_fromboolean in1 in1 in2 integer_eq exec_while (in2
+;; integer_dup_items boolean_xor exec_flush in1 integer_gt in2)) in2
+;; integer_empty exec_dup_items exec_swap (integer_pop boolean_and boolean_yank
+;; integer_yankdup integer_inc exec_k (exec_dup_items integer_mod) ()) ()) ())))
+
+;; Successful program: (in1 boolean_rot in1 in2 in2 boolean_rot code_atom
+;; exec_dup_items integer_sub code_subst in1 in2 code_position integer_dup_items
+;; integer_mod integer_mod code_position code_atom code_atom boolean_empty
+;; code_extract integer_sub boolean_invert_first_then_and
+;; boolean_invert_first_then_and integer_eq in2 in1 in2 in1 code_length in1
+;; integer_lt integer_sub code_dup_items integer_mod integer_mod integer_mod
+;; boolean_rot integer_sub integer_lt code_pop code_extract integer_sub
+;; code_extract integer_sub integer_eq in2 in1 in2 in1 code_length in1
+;; code_dup_items integer_mod integer_mod in1 in2 integer_mod integer_mod in1
+;; in2 integer_mod integer_mod code_noop code_subst in1 in2 boolean_rot
+;; exec_dup_items integer_sub integer_lt in1 integer_mod integer_mod boolean_dup
+;; integer_mod in2 integer_mod boolean_dup in2 in1 integer_dup_items integer_mod
+;; integer_mod code_do code_position integer_sub integer_lt code_position
+;; boolean_eq integer_mod code_dup_times exec_noop in2 integer_mod exec_noop
+;; integer_mod code_eq)
+
+;; Successful program: (in1 boolean_invert_first_then_and integer_mod
+;; code_append exec_when (in2) in1 integer_yankdup code_do*times in2 integer_mod
+;; code_append in2 in1 code_do*times in2 code_dup_times in1 integer_empty
+;; integer_mod code_list boolean_empty integer_mod in1 exec_dup () in2
+;; integer_mod exec_dup_items integer_mod code_yank integer_mod code_list
+;; integer_mod integer_mod integer_yank integer_mod integer_yank in2 code_atom
+;; boolean_invert_first_then_and integer_mod boolean_invert_first_then_and in1
+;; in1 integer_mult code_subst code_do*range boolean_empty integer_mod code_list
+;; in1 integer_mod integer_mod integer_yank in2 boolean_invert_first_then_and
+;; code_atom integer_mod in1 in1 integer_mult code_subst in2 1000000 exec_eq
+;; code_flush code_flush 19 integer_mod code_atom boolean_yank in1 exec_while
+;; (exec_empty) integer_mod integer_swap integer_yankdup integer_mod integer_mod
+;; integer_max integer_mod code_yank in2 integer_mod in2 integer_mod integer_max
+;; integer_mod in2 boolean_dup integer_mod code_subst code_yank in2 integer_mod
+;; boolean_invert_first_then_and integer_max code_map code_if in2 in1 in2
+;; integer_mod integer_mod code_list in1 integer_yankdup integer_mod integer_mod
+;; integer_mod integer_max code_null in1 code_yank code_nth code_list
+;; integer_mod integer_max in1 code_map code_append in2 in1 integer_mod
+;; integer_mod code_list in1 integer_yankdup integer_mod integer_mod
+;; boolean_invert_first_then_and integer_yank integer_max in1 code_insert
+;; code_map code_append code_if code_if in2 in1 integer_mod integer_mod
+;; code_list in1 integer_yankdup integer_mod integer_mod integer_mod integer_mod
+;; boolean_invert_first_then_and integer_yank integer_max in1 code_map
+;; code_append code_if code_append code_if code_if in2 in1 integer_mod
+;; integer_mod code_list in1 integer_yankdup integer_mod integer_mod integer_mod
+;; integer_mod code_noop integer_max code_yank integer_mod integer_max in1
+;; code_yank code_map code_append code_if in2 in1 code_if in2 code_yank
+;; integer_mod integer_max in1 code_yank boolean_rot integer_yankdup integer_mod
+;; integer_mod integer_mod integer_max integer_mod in2 integer_mod integer_max
+;; integer_max code_yank in2 in2 integer_mod code_nthcdr in2 integer_max in1
+;; code_map code_append in2 in1 integer_mod integer_mod code_list
+;; integer_yankdup integer_mod integer_mod integer_mod code_rot in1 code_map
+;; code_append in2 in1 integer_mod integer_mod code_list in1 integer_yankdup
+;; integer_mod integer_mod integer_mod integer_mod integer_max in1 code_yank
+;; code_list integer_mod integer_max)
+
+;; SUCCESS at generation 540
+;; Successful program: (in1 in2 code_append integer_mod integer_mod in2 in2
+;; code_do* boolean_dup integer_yankdup in1 integer_min integer_mod integer_mod
+;; integer_max integer_empty in1 in1 code_cons code_insert integer_dup_items
+;; integer_yankdup code_swap boolean_dup integer_min integer_mod integer_sub
+;; integer_mod integer_mod integer_eq in2 in2 in2 integer_yankdup false
+;; code_null integer_min integer_mod integer_sub code_member integer_mod in2 in2
+;; in2 boolean_dup integer_yankdup false code_null boolean_dup integer_min
+;; integer_mod integer_mod integer_max integer_add in1 in1 in2 boolean_swap
+;; integer_yankdup 11 integer_max integer_mod exec_pop (integer_mod) integer_max
+;; code_size integer_mod code_position integer_gte integer_max code_shove
+;; exec_if () (integer_min integer_gte) integer_mod code_do*range integer_mod
+;; integer_max integer_empty in1 in1 in1 code_cons integer_yankdup boolean_dup
+;; integer_min integer_mod code_extract integer_sub integer_mod integer_add in2
+;; exec_dup_items in2 exec_if () (integer_min integer_swap) integer_mod code_nth
+;; integer_mod integer_mod integer_max integer_add in1 boolean_pop in1 in1
+;; code_cons integer_yankdup boolean_invert_second_then_and boolean_dup
+;; integer_min integer_mod integer_sub integer_mod integer_mod integer_mod in2
+;; in2 in2 boolean_or boolean_dup integer_yankdup integer_min integer_mod
+;; integer_max integer_add in1 in1 integer_min integer_mod 1000000000
+;; boolean_rot boolean_not integer_mod integer_max in1 integer_dup_items in2 in2
+;; in2 in1 7 in2 integer_mod integer_mod integer_add in2 in2 boolean_shove
+;; boolean_dup integer_min integer_gt exec_shove (boolean_xor integer_mod)
+;; integer_max integer_empty in1 in1 in1 code_cons code_rot integer_yankdup
+;; integer_min integer_mod integer_sub integer_mod integer_mod in2 in2
+;; integer_mod integer_sub integer_mod integer_mod in2 in2 boolean_swap
+;; code_atom in1 in1 code_cons boolean_dup boolean_or integer_min integer_mod
+;; integer_sub integer_mod integer_mod integer_add in2 in2 code_if boolean_swap
+;; code_atom integer_yankdup in1 code_cons boolean_dup boolean_or integer_min
+;; integer_mod integer_sub integer_mod integer_add in2 in2 in1 code_cons
+;; integer_yankdup code_append boolean_dup integer_min integer_mod integer_sub
+;; integer_mod integer_mod code_dup_times in2 in2 in2 integer_yankdup
+;; boolean_dup boolean_xor integer_min integer_mod code_length integer_mod
+;; integer_add boolean_eq in1 in1 in1 integer_yankdup boolean_dup integer_min
+;; integer_mod integer_sub integer_mod integer_dup_times integer_max in1
+;; code_quote (exec_y (exec_empty 1000 11 7)))


minor formatting.

minor formatting.

--- src-cljs/tranjlator/master_view.cljs
+++ src-cljs/tranjlator/master_view.cljs
@@ -20,14 +20,17 @@
     om/IRender
     (render [this]
       (apply dom/ul nil
-             (map (fn [item] (dom/li nil item)) app)))))
+             (map (fn [item] (dom/li nil item)) (sort app))))))
+
+(defn format-chat [{:keys [user-name content]}]
+  (str user-name ": " content ))

 (defn chat-view [app owner]
   (reify
     om/IRender
     (render [this]
       (apply dom/ul nil
-             (map (fn [item] (dom/li nil (:content item))) app)))))
+             (map (fn [item] (dom/li nil (format-chat item))) app)))))

 (defn master-view [app owner]
   (reify


Try to extract siblings and couple correctly

--- src/clj/algorithms_clj/ancestors.clj
+++ src/clj/algorithms_clj/ancestors.clj
@@ -18,12 +18,20 @@
   (pldb/db
     [male 'John]
     [male 'Herb]
+    [male 'Mike]
     [female 'Alice]
     [female 'Jessy]
+    [female 'Nicola]
     [parent 'John 'Alice]
+    [parent 'John 'Mike]
+    [parent 'John 'Nicola]
     [parent 'Jessy 'Alice]
+    [parent 'Jessy 'Mike]
     [parent 'Alice 'Herb]
     ))
+
+(defne father [x y] ([x y] (parent x y) (male x)))
+(defne mother [x y] ([x y] (parent x y) (female x)))

 (defn is-grand-parent?
   "Indicates whether x is a grand-parent of y"
@@ -50,12 +58,7 @@
 (defn have-child?
   "Indicates whether x and y had a child together"
   [x y]
-  (fresh [z]
-    (male x)
-    (female y)
-    (parent x z)
-    (parent y z)
-    ))
+  (fresh [z] (father x z) (mother y z)))

 (defn get-couples []
   (run* [parents]
@@ -64,10 +67,33 @@
       (=== parents [x y]))
     ))

+(defn full-siblings?
+  "Identify whether two individuals have the same parents"
+  [x y]
+  (fresh [p1 p2]
+    (!= x y)
+    (father p1 x) (mother p2 x)
+    (father p1 y) (mother p2 y)
+    ))
+
+(defn check-full-siblings?
+  [x y]
+  (not (empty?
+         (run 1 [r] (full-siblings? x y))
+         )))
+
+(defn get-all-siblings []
+  (run* [c1 c2]
+    (full-siblings? c1 c2)
+    ))
+
 (defn tests []
   (pldb/with-db family-facts-db
     (println (get-ancestors 'Herb))
     (println (get-grand-parents 'Herb))
     (println (get-couples))
+    (println (get-all-siblings))
+    ;;(println (check-full-siblings? 'Alice 'Mike))
+    ;;(println (check-full-siblings? 'Alice 'Nicola))
     ))


add borders to verify content

add borders to verify content

--- src/cljs/salava/badge/ui/verify.cljs
+++ src/cljs/salava/badge/ui/verify.cljs
@@ -59,16 +59,19 @@
            (case assertion-status
              404  [:div
                    [:div {:class "alert alert-danger"} (t :badge/Badgecheckfailed)]
-                   [:p [:i "404 not found"]]]
+                   [:p [:i "404 not found"]]
+                   [:hr.border]]
              410  [:div
                    [:div {:class "alert alert-danger"} (t :badge/Badgerevoked) #_(str (t :badge/Badge) " " (t :badge/Revoked))]
-                   #_[:a {:target "_blank" :rel "nofollow noopener" :href (str "https://badgecheck.io/?url="asr) :style {:float "right"}} "use external validator"]]
+                   #_[:a {:target "_blank" :rel "nofollow noopener" :href (str "https://badgecheck.io/?url="asr) :style {:float "right"}} "use external validator"]
+                   [:hr.border]]
              500 [:div
                   [:div {:class "alert alert-danger"}
                    (t :badge/Badgecheckfailed)]
                   [:br]
                   [:p [:i message]]
-                  #_[:a {:target "_blank" :rel "nofollow noopener" :href (str "https://badgecheck.io/?url="asr) :style {:float "right"}} "use external validator"]]
+                  #_[:a {:target "_blank" :rel "nofollow noopener" :href (str "https://badgecheck.io/?url="asr) :style {:float "right"}} "use external validator"]
+                  [:hr.border]]
              [:div
               (cond
                 revoked? [:div [:div {:class "alert alert-danger"}  (t :badge/Badgerevoked) #_(str (t :badge/Badge) " " (t :badge/Revoked))] [:p revocation_reason]]


prob25 2 versions of clojure

prob25 2 versions of clojure

--- src/poly_euler/prob25.clj
+++ src/poly_euler/prob25.clj
@@ -1,4 +1,7 @@
 (ns poly-euler.prob25)
+
+;; NOTE, for this solution, it will cause stack-overflow since it uses
+;; pure recursion without clojure's loop which is tail-recursion

 (defn expt
   [a m]
@@ -9,3 +12,21 @@
   (if (>= a lim)
     i
     (euler25 lim [(+' a b) a] (inc i))))
+
+;; poly-euler.prob25> (time (euler25 (expt 10 999) [1 1] 2))
+;; "Elapsed time: 6.218 msecs"
+
+;; This is the TCO version
+
+(defn euler25a
+  [lim]
+  (loop [[a b] [1 1] i 2]
+    (if (>= a lim)
+      i
+      (recur [(+' a b) a]
+             (inc i)))))
+
+;; poly-euler.prob25> (time (euler25a (expt 10 999)))
+;; "Elapsed time: 2.491 msecs"
+
+


fixed main class

fixed main class

--- src/leiningen/new/cryogen/project.clj
+++ src/leiningen/new/cryogen/project.clj
@@ -9,6 +9,6 @@
                            [ring-server "0.3.1"]
                            [cryogen-core "0.1.5"]]
             :plugins [[lein-ring "0.8.13"]]
-            :main cryogen.compiler
+            :main cryogen-core.compiler
             :ring {:init cryogen.server/init
                    :handler cryogen.server/handler})


starting to implement selection and movement functions

--- src/quick_chess/core.cljs
+++ src/quick_chess/core.cljs
@@ -62,6 +62,7 @@
 #_(swap! app-state assoc :height 500)
 #_(swap! app-state assoc-in [:board 7 4 :color] "#4286f4")
 #_(reset! app-state init-state)
+#_(swap! app-state assoc :turn :black)

 (defn board-style
   [data]
@@ -97,6 +98,20 @@
                         (let [val (js/parseInt (.-target.value e))]
                           (swap! app-state assoc :width val :height val)))}])

+(defn handle-text-input
+  "handles the text input given an event"
+  [state value]
+  (fn [e]
+    (let [c (-> e .-target .-value)]
+      (reset! value c)
+      (when (= (count c) 1)
+        (if-let [[row col] (get-in
+                            state
+                            [:string-map (:turn state) c])]
+          (swap!
+           app-state
+           assoc-in [:board row col :color] "#538ab5"))))))
+
 (defn input-view
   "input of commands through strings"
   []
@@ -104,9 +119,7 @@
     (fn [state]
       [:input {:type "text"
                :value @value
-               :on-change (fn [e]
-                            (let [c (-> e .-target .-value)]
-                              (reset! value c)))}])))
+               :on-change (handle-text-input state value)}])))

 (defn cell-view
   [state]


Allow leaving & re-entering grid while drawing

--- src/utf8ify/web/core.cljs
+++ src/utf8ify/web/core.cljs
@@ -17,8 +17,7 @@
              #js {:className "grid"
                   :onMouseDown #(xy-message mouse-events :start %)
                   :onMouseMove #(xy-message mouse-events :move %)
-                  :onMouseUp #(xy-message mouse-events :stop %)
-                  :onMouseLeave #(xy-message mouse-events :stop %)}
+                  :onMouseUp #(xy-message mouse-events :stop %)}
              (map (fn [cell] (dom/div #js {:data-id (:id cell) :data-on (:on cell) :className "cell"})) cells)))))

 (defn xy-message [ch msg-name xy-obj]


Remove pprint require.

Remove pprint require.

--- src/uuuurrrrllll/core.clj
+++ src/uuuurrrrllll/core.clj
@@ -2,8 +2,7 @@
   (:require [compojure.core :refer [defroutes routes GET POST]]
             [ring.middleware.json :refer [wrap-json-body
                                           wrap-json-response]]
-            [ring.adapter.jetty :as jetty]
-            [clojure.pprint :as pp]))
+            [ring.adapter.jetty :as jetty]))

 (def url-map (atom {}))


use from name when confirming to receiver

--- src/webapp/server/fns.clj
+++ src/webapp/server/fns.clj
@@ -118,7 +118,7 @@
                           )

        :from-email   (:from_email  send-endorsement-neo4j-node)
-       :from-name    "ConnectToUs.co"
+       :from-name    (:from_email  send-endorsement-neo4j-node)
        :to-email     (:to_email send-endorsement-neo4j-node)
        :to-name      (:to_full_name  send-endorsement-neo4j-node)
        )


Update demo main to use layers

Update demo main to use layers

--- src/zaffre/glterminal.clj
+++ src/zaffre/glterminal.clj
@@ -1139,7 +1139,7 @@
   "Show a terminal and echo input."
   [& _]
   ;; render in background thread
-   (let [terminal   (make-terminal [:text]
+   (let [terminal   (make-terminal [:text :rainbow]
                                    {:title "Zaffre demo"
                                     :columns 80 :rows 24
                                     :default-fg-color [250 250 250]
@@ -1157,7 +1157,7 @@
         fx-chan     (go-loop []
                       (dosync
                         (doseq [x (range (count "Rainbow"))]
-                          (zat/set-fx-fg! terminal :text (inc x) 1 [128 (rand 255) (rand 255)])))
+                          (zat/set-fx-fg! terminal :rainbow (inc x) 1 [128 (rand 255) (rand 255)])))
                         (zat/refresh! terminal)
                       (Thread/sleep 10)
                       (recur))
@@ -1170,7 +1170,7 @@
                           (doseq [[i c] (take 23 (map-indexed (fn [i c] [i (char c)]) (range (int \a) (int \z))))]
                             (zutil/put-string terminal :text 0 (inc i) (str c) [128 (* 10 i) 0] [0 0 50]))
                           (zutil/put-string terminal :text 12 0 (str key-in))
-                          (zutil/put-string terminal :text 1 1 "Rainbow")
+                          (zutil/put-string terminal :rainbow 1 1 "Rainbow")
                           (zat/refresh! terminal)))
                           ;; ~30fps
                         (Thread/sleep 33)


Slight restructure and split of generated tests.

--- test/cljs/go_test.clj
+++ test/cljs/go_test.clj
@@ -67,8 +67,8 @@
       (printf "}\n"))
     (printf "}\n")))

-(defn emit-test [package tests]
-  (let [^File f (io/file "target/generated" (str package ".go"))
+(defn emit-test [package file tests]
+  (let [^File f (io/file (str "target/generated/" package) (str file ".go"))
         src (gofmt (apply str (testify-header package) tests))]
     (io/make-parents f)
     (spit f src)
@@ -77,10 +77,10 @@
 (defn constant [expected actual]
   ["X" "Equal" expected (list 'def 'x actual)])

-(defn expr [expected actual op]
-  ["X" "Equal" expected (list 'def 'x actual) op])
+(defn expr [expected actual]
+  ["X" "Equal" expected (list 'def 'x actual)])

-(deftest go-emitter-tests
+(deftest constants
   (->>
    [(testify "Constants"
               (constant "nil" nil)
@@ -106,61 +106,67 @@
               (constant "&CljsCoreSymbol{Ns: `user`, Name: `x`, Str: `user/x`, Hash: float64(-568535109), Meta: nil}"
                         ''user/x)
               (constant "&CljsCoreKeyword{Ns: `user`, Name: `x`, Fqn: `user/x`, Hash: float64(2085900660)}"
-                        :user/x))
-    (testify "SpecialForms"
+                        :user/x))]
+   (emit-test "go_test" "constants_test")))
+
+(deftest special-forms
+  (->>
+   [(testify "Let"
              (expr 1 '(let [y 1]
-                        y) "let")
+                        y)))
+    (testify "If"
              (expr true '(let [y :foo]
-                           (if y true false)) "if")
+                           (if y true false)))
              (expr 1 '(let [y true
                             z (if y 1 0)]
-                        z) "if")
+                        z)))
+    (testify "Loop"
              (expr 5 '(loop [y 0]
                         (if (>= y 5)
                           y
-                          (recur (inc y)))) "loop")
-             (expr 3 '(do 1 2 3) "do")
-             (expr "&js.Date{Millis: 0}" '(js/Date. 0) "new")
-             (expr 1970 '(.getUTCFullYear (js/Date. 0)) "dot")
-             (expr "math.Inf(1)" 'js/Infinity "var")
+                          (recur (inc y))))))
+    (testify "Do"
+             (expr 3 '(do 1 2 3)))
+    (testify "New"
+             (expr "&js.Date{Millis: 0}" '(js/Date. 0)))
+    (testify "Dot"
+             (expr 1970 '(.getUTCFullYear (js/Date. 0))))
+    (testify "Var"
+             (expr "math.Inf(1)" 'js/Infinity))
+    (testify "Case"
              (expr true '(let [x 2]
                            (case x
                              2 true
                              1 false
-                             0))
-                   "case*")
+                             0))))
+    (testify "JS"
              (expr "reflect.Float64" '(let [x 1]
-                                        (js* "reflect.ValueOf(x).Kind()"))
-                   "js*")
+                                        (js* "reflect.ValueOf(x).Kind()")))
              (expr "reflect.Int" '(let [v (js* "reflect.ValueOf(1)")]
-                                    (-> v .Type .Kind))
-                   "js*")
+                                    (-> v .Type .Kind))))
+    (testify "Try"
              (expr "&js.Error{`Foo`}" '(try
                                          (throw (js/Error. "Foo"))
                                          (catch js/Error e
-                                           e))
-                   "try")
+                                           e)))
              (expr "`TypeError`" '(try
                                     (throw (js/TypeError. "Foo"))
                                     (catch js/Error _
                                       "Error")
                                     (catch js/TypeError _
-                                      "TypeError"))
-                   "try")
+                                      "TypeError")))
              (expr "`Bar`" '(try
                               "Bar"
                               (catch js/Error e
                                 e)
                               (finally
-                                "Baz"))
-                   "try")
+                                "Baz")))
              (expr "map[string]interface{}{`finally`: true}"
                    '(let [x (js* "map[string]interface{}{}")]
                       (try
                         x
                         (finally
-                          (js* "x[`finally`] = true"))))
-                   "try")
+                          (js* "x[`finally`] = true")))))
              (expr "map[string]interface{}{`catch`: true, `finally`: true, `last`: `finally`}"
                    '(let [x (js* "map[string]interface{}{}")]
                       (try
@@ -171,9 +177,8 @@
                           x)
                         (finally
                           (js* "x[`finally`] = true")
-                          (js* "x[`last`] = `finally`"))))
-                   "try"))]
-   (emit-test "go_test")))
+                          (js* "x[`last`] = `finally`"))))))]
+   (emit-test "go_test" "special_forms_test")))

 (deftest go-main-test
   (go-test "."))


Minor refactoring in social.cljs

Minor refactoring in social.cljs

--- frontend/src/faceboard/helpers/social.cljs
+++ frontend/src/faceboard/helpers/social.cljs
@@ -33,7 +33,7 @@
       (< (count parts) 2) [nil (first parts)]
       :else [(str/lower (first parts)) (str/lower (second parts))])))

-(defn complete-url [type id]
+(defn build-known-url [type id]
   ; TODO: add more services
   (condp = type                                             ; recognized urls from id
     "facebook" (str "https://github.com/" id)
@@ -47,7 +47,7 @@
 (defn social->url [[type id]]
   (if (str/starts-with? id "http")
     id
-    (complete-url type id)))
+    (or (build-known-url type id) id)))

 (defn social->icon [[type _]]
   (let [prefix-matches (filter #(str/starts-with? % type) known-icons)


Remove and reorganize imports on login ns.

--- frontend/src/uxbox/main/ui/auth/login.cljs
+++ frontend/src/uxbox/main/ui/auth/login.cljs
@@ -7,17 +7,17 @@
 (ns uxbox.main.ui.auth.login
   (:require [lentes.core :as l]
             [cuerdas.core :as str]
-            [uxbox.util.router :as rt]
-            [uxbox.util.dom :as dom]
             [potok.core :as ptk]
-            [uxbox.util.forms :as forms]
-            [uxbox.util.mixins :as mx :include-macros true]
             [uxbox.store :as st]
             [uxbox.main.data.auth :as da]
             [uxbox.main.data.messages :as udm]
             [uxbox.main.ui.icons :as i]
             [uxbox.main.ui.messages :as uum]
-            [uxbox.main.ui.navigation :as nav]))
+            [uxbox.main.ui.navigation :as nav]
+            [uxbox.util.mixins :as mx :include-macros true]
+            [uxbox.util.router :as rt]
+            [uxbox.util.dom :as dom]
+            [uxbox.util.forms :as forms]))

 (def form-data (forms/focus-data :login st/state))
 (def set-value! (partial forms/set-value! :login))


Fix schema check error in dropdown.

Fix schema check error in dropdown.

--- src/om_bootstrap/nav.cljs
+++ src/om_bootstrap/nav.cljs
@@ -153,9 +153,10 @@
   "Returns true if any of the necessary properties are in place to
   render the navbar-header and toggle button."
   [bs]
-  (or (:brand bs)
-      (:toggle-button bs)
-      (:toggle-nav-key bs)))
+  (boolean
+    (or (:brand bs)
+        (:toggle-button bs)
+        (:toggle-nav-key bs))))

 (defn render-header [owner bs]
   (d/div {:class "navbar-header"}


(maint) Fix decode failure test case

(maint) Fix decode failure test case

One of the updates to the ring-codec library made its `percent-decode`
function smarter, so it only detects `%` with two alphanumeric
characters after it as encoded bytes. Our test case used a string with
`%` followed by only one other character, so it didn't trigger the
"decode". This commit updates the test to use a string that looks like a
potentially valid encoding.

--- test/unit/puppetlabs/services/request_handler/request_handler_core_test.clj
+++ test/unit/puppetlabs/services/request_handler/request_handler_core_test.clj
@@ -266,8 +266,8 @@
   (testing "Improperly URL encoded content"
     (is (thrown+? [:kind :bad-request
                    :msg (str "Unable to URL decode the x-client-cert header: "
-                             "For input string: \"1%\"")]
-                  (jruby-request-with-client-cert-header "%1%2"))))
+                             "For input string: \"1Q\"")]
+                  (jruby-request-with-client-cert-header "%1Q%2"))))
   (testing "Bad certificate content"
     (is (thrown+? [:kind :bad-request
                    :msg (str "Unable to parse x-client-cert into "


add intercom and gocardless

add intercom and gocardless