:use -> :require/:refer

:use -> :require/:refer

--- src/leiningen/ancient.clj
+++ src/leiningen/ancient.clj
@@ -1,11 +1,11 @@
 (ns ^{:doc "Check your Project for outdated Dependencies."
       :author "Yannick Scherer"}
   leiningen.ancient
-  (:use [leiningen.ancient.verbose :only [verbose *verbose* yellow green red *colors*]]
-        [leiningen.ancient.maven-metadata :only [retrieve-metadata! latest-version version-seq filter-versions]]
-        [leiningen.ancient.version :only [version-outdated? version-sort version-map snapshot? qualified?]]
-        [leiningen.ancient.projects :only [collect-dependencies collect-metadata-retrievers dependency-map]])
-  (:require [leiningen.ancient.maven-metadata http local s3p]))
+  (:require [leiningen.ancient.verbose :refer [verbose *verbose* yellow green red *colors*]]
+            [leiningen.ancient.maven-metadata :refer [retrieve-metadata! latest-version version-seq filter-versions]]
+            [leiningen.ancient.version :refer [version-outdated? version-sort version-map snapshot? qualified?]]
+            [leiningen.ancient.projects :refer [collect-dependencies collect-metadata-retrievers dependency-map]]
+            [leiningen.ancient.maven-metadata http local s3p]))

 ;; ## Output Strings


Don't rescrape everything if our last img is gone

Before, we just used the id of the most recent image we'd seen in order
to determine where to stop when fetching new images. It seems that
sometimes, images are published and later removed, which would cause us
to rescrape everything, since we'd never run into our old image. Now, we
use the 100 most recent images to figure out when to stop, so we'll be
fine unless they remove 100 or more images that we've already scraped.

--- src/mars_ogler/scrape.clj
+++ src/mars_ogler/scrape.clj
@@ -122,14 +122,14 @@
   [i]
   (html/html-resource (java.net.URL. (page-url i))))

-(defn fetch-images-since
-  [last-id]
-  (let [last-img? (fn [img] (= (:id img) last-id))]
+(defn fetch-new-images
+  [known-imgs]
+  (let [seen? (fn [img] (some #(= (:id %) (:id img)) (take 100 known-imgs)))]
     (println "Checking for new photos...")
     (loop [i 1, imgs ()]
       (let [page-imgs (body->images (fetch-page i))
-            last-page? (some last-img? page-imgs)
-            imgs' (concat imgs (take-while (complement last-img?) page-imgs))]
+            last-page? (some seen? page-imgs)
+            imgs' (concat imgs (take-while (complement seen?) page-imgs))]
         (if (or last-page? (empty? page-imgs))
           imgs'
           (do
@@ -250,8 +250,7 @@

 (defn fetch-tick
   [old-imgs]
-  (let [last-id (-> old-imgs first :id)
-        new-imgs (map parse-dates (fetch-images-since last-id))
+  (let [new-imgs (map parse-dates (fetch-new-images old-imgs))
         all-imgs (concat new-imgs old-imgs)]
     {:all all-imgs, :new new-imgs, :old old-imgs}))


paramaterising naming of json files to use today's date

--- src/neo4j_meetup/core.clj
+++ src/neo4j_meetup/core.clj
@@ -4,6 +4,7 @@
   (:require [environ.core :as e])
   (:require [clj-time.core :as t])
   (:require [clj-time.coerce :as c])
+  (:require [clj-time.format :as f])
   (:require [neo4j-meetup.db :as db])
   (:require [clojurewerkz.neocons.rest :as nr]
             [clojurewerkz.neocons.rest.transaction :as tx]))
@@ -98,14 +99,22 @@
 (defn load-json [file]
   (json/read-str (slurp file) :key-fn keyword))

-(defn save-other-groups []
-  (doseq [id (map :id (load-json "data/groups-2014-05-14.json"))]
-    (save (str "data/members-2014-05-14/" id ".json")
-          (get-all members-of-other-group {:groupid id}))))
+(defn timed [fn description]
+  (println (str description ":" (with-out-str (time (fn))))))
+
+(defn save-other-groups [date]
+  (.mkdir (java.io.File. (str "data/members-" date)))
+  (doseq [id (map :id (load-json (str "data/groups-" date ".json")))]
+    (timed #(save (str "data/members-" date "/" id ".json")
+                  (get-all members-of-other-group {:groupid id})) (str "group " id))))
+
+(def format-as-year-month-day (f/formatter "yyyy-MM-dd"))

 (defn -main [& args]
-  (save "data/groups-2004-05-14.json" (get-all groups))
-  (save "data/members-2014-05-13.json" (get-all members))
-  (save "data/events-2014-05-13.json" (get-all events))
-  (save "data/rsvps-2014-05-13.json"
-        (mapcat #(get-all (partial rsvps %)) (map :id (load-json "data/events-2014-05-13.json")))))
+  (let [date (f/unparse format-as-year-month-day (t/now))]
+    (timed #(save (str "data/groups-" date ".json") (get-all groups)) "groups")
+    (save-other-groups date)
+    (timed #(save (str "data/events-" date ".json") (get-all events)) "events")
+    (timed #(save (str "data/rsvps-" date ".json")
+                  (mapcat (fn [data] ( get-all (partial rsvps data)))
+                         (map :id (load-json (str "data/events-" date ".json"))))) "rsvps") ))


Refactor bonus

Refactor bonus

--- src/obb_rules/element.clj
+++ src/obb_rules/element.clj
@@ -55,20 +55,45 @@
       0)
     0))

+(defn- category-bonus
+  "Gets the category bonus on a given context"
+  [bonus-type source-unit target-unit]
+  (let [category (unit/unit-category target-unit)]
+    (get-bonus source-unit bonus-type :category category)))
+
+(defn- displacement-bonus
+  "Gets the displacement bonus on a given context"
+  [bonus-type source-unit target-unit]
+  (let [displacement (unit/unit-displacement target-unit)]
+    (get-bonus source-unit bonus-type :displacement displacement)))
+
+(defn- type-bonus
+  "Gets the type bonus on a given context"
+  [bonus-type source-unit target-unit]
+  (let [unit-type (unit/unit-type target-unit)]
+    (get-bonus source-unit bonus-type :type unit-type)))
+
+(defn- terrain-bonus
+  "Gets the terrain bonus on a given context"
+  [bonus-type board unit]
+  (get-bonus unit bonus-type :terrain (keyword (get board :terrain))))
+
+(defn- resolve-bonus
+  "Resolves bonus between two units"
+  [bonus-type board attacker-unit defender-unit]
+  (+ (category-bonus bonus-type attacker-unit defender-unit)
+     (terrain-bonus bonus-type board attacker-unit)
+     (displacement-bonus bonus-type attacker-unit defender-unit)
+     (type-bonus bonus-type attacker-unit defender-unit)))
+
 (defn element-attack
   "Gets the attack of this element for the given target"
   [board element target]
   (let [attacker-unit (element-unit element)
         defender-unit (element-unit target)
         attack (unit/unit-attack attacker-unit)
-        target-cat (unit/unit-category defender-unit)
-        target-displacement (unit/unit-displacement defender-unit)
-        target-type (unit/unit-type defender-unit)
-        terrain-bonus (get-bonus attacker-unit :attack :terrain (keyword (get board :terrain)))
-        category-bonus (get-bonus attacker-unit :attack :category target-cat)
-        type-bonus (get-bonus attacker-unit :attack :type target-type)
-        displacement-bonus (get-bonus attacker-unit :attack :displacement target-displacement)]
-    (+ attack category-bonus terrain-bonus displacement-bonus type-bonus)))
+        bonus (resolve-bonus :attack board attacker-unit defender-unit)]
+    (+ attack bonus)))

 (defn element-defense
   "Gets the defense of this element for the given target"
@@ -76,12 +101,8 @@
   (let [attacker-unit (element-unit element)
         defender-unit (element-unit target)
         defense (unit/unit-defense defender-unit)
-        target-cat (unit/unit-category attacker-unit)
-        target-displacement (unit/unit-displacement attacker-unit)
-        terrain-bonus (get-bonus defender-unit :defense :terrain (keyword (get board :terrain)))
-        category-bonus (get-bonus defender-unit :defense :category target-cat)
-        displacement-bonus (get-bonus defender-unit :defense :displacement target-displacement)]
-    (+ defense category-bonus displacement-bonus terrain-bonus)))
+        bonus (resolve-bonus :defense board defender-unit attacker-unit)]
+    (+ defense bonus)))

 (defn element-quantity
   "Gets/Sets element's quantity"


Don't bother rebuilding od117 as it seems to be finished.

--- src/od117_walker/core.clj
+++ src/od117_walker/core.clj
@@ -154,7 +154,7 @@
 (defn -main
   "Calculate and print graphs of OD-117 to ranked.dot and general.dot."
   [& args]
-  (let [{:keys [wiki-address turns]} (edn/read-string (slurp "data/od117.edn"))]
+  #_(let [{:keys [wiki-address turns]} (edn/read-string (slurp "data/od117.edn"))]
     (let [authors (extract-links (find-id (find-and-parse-page "scholars"
                                                                wiki-address)
                                           "page-content")


add docstring

add docstring

--- src/overtone/sc/synth.clj
+++ src/overtone/sc/synth.clj
@@ -249,6 +249,8 @@
 ; TODO: Figure out how to generate the let-bindings rather than having them
 ; hard coded here.
 (defmacro pre-synth
+  "Resolve a synth def to a list of its name, params, ugens (nested if necessary) and
+   constants."
   [& args]
   (let [[sname params param-proxies ugen-form] (normalize-synth-args args)]
     `(let [~@param-proxies]


Snapshot Version for Cook Scheduler

Snapshot Version for Cook Scheduler

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -13,7 +13,7 @@
 ;; See the License for the specific language governing permissions and
 ;; limitations under the License.
 ;;
-(defproject cook "1.8.1"
+(defproject cook "1.8.2-SNAPSHOT"
   :description "This launches jobs on a Mesos cluster with fair sharing and preemption"
   :license {:name "Apache License, Version 2.0"}
   :dependencies [[org.clojure/clojure "1.8.0"]


Bumps version to 1.51.15-SNAPSHOT

Bumps version to 1.51.15-SNAPSHOT

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -13,7 +13,7 @@
 ;; See the License for the specific language governing permissions and
 ;; limitations under the License.
 ;;
-(defproject cook "1.51.14"
+(defproject cook "1.51.15-SNAPSHOT"
   :description "This launches jobs on a Mesos cluster with fair sharing and preemption"
   :license {:name "Apache License, Version 2.0"}
   :dependencies [[org.clojure/clojure "1.8.0"]


Fixing rollback of elasticsearch databases

--- joplin.elasticsearch/src/joplin/elasticsearch/database.clj
+++ joplin.elasticsearch/src/joplin/elasticsearch/database.clj
@@ -76,7 +76,7 @@
 (defn es-remove-migration-id [migration-id]
   (let [es-client (ensure-connected)]
     (esd/put es-client migration-index migration-type migration-document-id
-             {:migrations (dissoc (es-get-applied) migration-id)})))
+             {:migrations (dissoc (es-get-applied) (keyword migration-id))})))

 ;; ============================================================================
 ;; Data migration


Include fine channels in all channel list, oops!

--- src/afterglow/channels.clj
+++ src/afterglow/channels.clj
@@ -47,7 +47,8 @@
   "Returns all the addresses being used by a list of patched fixtures,
   including those used by any fixture heads."
   [fixtures]
-  (map :address (mapcat :channels (afterglow.channels/expand-heads fixtures))))
+  (mapcat #(vals (select-keys % [:address :fine-address]))
+          (mapcat :channels (afterglow.channels/expand-heads fixtures))))

 (defn extract-heads-with-some-matching-channel


Make hue a centered parameter.

Make hue a centered parameter.

--- src/afterglow/examples.clj
+++ src/afterglow/examples.clj
@@ -513,7 +513,7 @@

     (ct/set-cue! (:cue-grid *show*) 7 6
                  (cues/cue :adjust-strobe (fn [_] (fun/adjust-strobe))
-                           :variables [{:key :strobe-hue :min 0 :max 360 :name "Hue"}
+                           :variables [{:key :strobe-hue :min 0 :max 360 :name "Hue" :centered true}
                                        {:key :strobe-saturation :min 0 :max 100 :name "Saturatn"}]))

     ;; The upper page of torrent config cues


Version 0.0.43

Version 0.0.43

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject pe-fp-core "0.0.43-SNAPSHOT"
+(defproject pe-fp-core "0.0.43"
   :description "A Clojure library encapsulating the various domain objects associated with the Gas Jot application."
   :url "https://github.com/evanspa/pe-fp-core"
   :license {:name "MIT"


lein-release plugin: preparing 0.1.0 release

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject org.clojars.mhuebert/re-view-hiccup "0.1.0-SNAPSHOT"
+(defproject org.clojars.mhuebert/re-view-hiccup "0.1.0"

   :description "Hiccup parser"


Update com.taoensso/timbre to 4.1.0-alpha1

--- project.clj
+++ project.clj
@@ -9,7 +9,7 @@
                  [ring/ring-json "0.3.1"]
                  [clj-http "1.1.2"]
                  [tentacles "0.4.0"]
-                 [com.taoensso/timbre "4.0.2"]
+                 [com.taoensso/timbre "4.1.0-alpha1"]
                  [com.novemberain/monger "3.0.0-rc2"]
                  [ancient-clj "0.3.9"]
                  [com.draines/postal "1.11.3"]


remove lol

remove lol

--- project.clj
+++ project.clj
@@ -13,7 +13,6 @@

   :figwheel {:http-server-root "public"
              :server-port 3449
-             :css-dirs ["resources/public/css"]
              :repl true}

   :cljsbuild {:builds


Updated ClojureScript version

Updated ClojureScript version

--- project.clj
+++ project.clj
@@ -4,14 +4,12 @@
   :plugins [[lein-cljsbuild "0.3.3"]
             [lein-midje "3.0.0"]]
   :dependencies [[org.clojure/clojure "1.5.1"]
-                 [org.clojure/clojurescript "0.0-1877"]
-
+                 [org.clojure/clojurescript "0.0-1909"]
                  [midje "1.6-beta1"]
                  [com.taoensso/timbre "2.6.1"]
                  [cheshire "5.2.0"]
                  [http-kit "2.1.10"]
                  [compojure "1.1.5"]
-
                  [prismatic/dommy "0.1.1"]]
   :main nonojure.runner
   :aot [nonojure.runner]
@@ -20,10 +18,11 @@
                 :compiler {:output-dir "resources/public/js/",
                            :output-to "resources/public/js/main.js",
                            :pretty-print true,
-                           :optimizations :whitespace}}]}
+                           :optimizations :whitespace
+                           :source-map "resources/public/js/main.js.map"}}]}
   :profiles {:dev {:dependencies [[org.clojure/tools.namespace "0.2.4"]
                                   [com.cemerick/pomegranate "0.2.0"]
                                   [criterium "0.4.2"]]
                    :source-paths ["dev"]
-;                   :main user
+                   ;; :main user
                    }})


Version 0.2.2

Version 0.2.2

--- project.clj
+++ project.clj
@@ -7,7 +7,7 @@
                               "1.7.0"))

-(defproject lambdacd-artifacts "0.2.2-SNAPSHOT"
+(defproject lambdacd-artifacts "0.2.2"
   :description "provides a way to access build artifacts generated by a step in LambdaCD"
   :url "http://github.com/flosell/lambdacd-artifacts"
   :license {:name "Apache License, version 2.0"


Fix :optional packing

Fix :optional packing

--- src/main/cljc/mikron/compiler/processor/pack.cljc
+++ src/main/cljc/mikron/compiler/processor/pack.cljc
@@ -102,9 +102,11 @@
           global-options))

   (defmethod pack :optional [[_ _ schema'] value global-options]
-    `(do ~(pack [:boolean] value global-options)
-         (when ~value
-           ~(pack schema' value global-options))))
+    (macrowbar/macro-context {:gen-syms [value-some?]}
+      `(let [~value-some? (some? ~value)]
+         ~(pack [:boolean] value-some? global-options)
+         (when ~value-some?
+           ~(pack schema' value global-options)))))

   (defmethod pack :wrapped [[_ _ pre _ schema'] value global-options]
     (macrowbar/macro-context {:gen-syms [value']}


Release version 0.10.0.0-beta1.

Release version 0.10.0.0-beta1.

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject org.onyxplatform/onyx-kafka "0.10.0.0-SNAPSHOT"
+(defproject org.onyxplatform/onyx-kafka "0.10.0.0-beta1"
   :description "Onyx plugin for Kafka"
   :url "https://github.com/onyx-platform/onyx-kafka"
   :license {:name "Eclipse Public License"
@@ -13,7 +13,7 @@
                              :sign-releases false}}
   :dependencies [[org.clojure/clojure "1.8.0"]
                  ^{:voom {:repo "git@github.com:onyx-platform/onyx.git" :branch "master"}}
-                 [org.onyxplatform/onyx "0.10.0-alpha7"]
+                 [org.onyxplatform/onyx "0.10.0-beta1"]
                  [ymilky/franzy "0.0.1"]
                  [ymilky/franzy-admin "0.0.1" :exclusions [org.slf4j/slf4j-log4j12]]
                  [com.stuartsierra/component "0.2.3"]]


Set version to 0.9.0-SNAPSHOT and release

--- project.clj
+++ project.clj
@@ -1,5 +1,5 @@
-(defproject chestnut/lein-template "0.9.0"
-  :description "A Leiningen template for a ClojureScript setup with Figwheel, Austin, Om."
+(defproject chestnut/lein-template "0.9.0-SNAPSHOT"
+  :description "A Leiningen template for a ClojureScript setup with Figwheel, Om."
   :url "https://github.com/plexus/chestnut"
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}


Fix lein aliases

Fix lein aliases

--- project.clj
+++ project.clj
@@ -60,10 +60,8 @@
   ;;    -SNAPSHOT versions.
   :aliases {"test-auto"  ["do"
                           ["clean"]
-                          ["shell" "git" "update-index" "--assume-unchanged" "package.json"]
                           ["shadow" "watch" "browser-test"]]
             "karma-once" ["do"
                           ["clean"]
-                          ["shell" "git" "update-index" "--assume-unchanged" "package.json"]
                           ["shadow" "compile" "karma-test"]
                           ["shell" "karma" "start" "--single-run" "--reporters" "junit,dots"]]})


project stuff

project stuff

--- project.clj
+++ project.clj
@@ -3,35 +3,16 @@
   :url "http://example.com/FIXME"
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
+
   :dependencies [[org.clojure/clojure "1.5.1"]
                  [liberator "0.10.0"]
                  [com.cemerick/friend "0.2.0"]

-
                  [prismatic/dommy "0.1.1"]
                  [cljs-ajax "0.2.3"]

-                 ;; Transitive: Because we depend directly on jig/extensions/cljs-builder, remove me when we don't
-                 [org.clojure/clojurescript "0.0-2138"]
-                 ;;[org.clojure/clojurescript "0.0-2030"]
+                 [jig/cljs-builder "2.0.1-SNAPSHOT"]]

-                 ]
+  :source-paths ["src" "src-cljs"]

-  :plugins [[lein-cljsbuild "1.0.1"]]
-
-  ;; This isn't great, but until Malcolm gets the Jig cljs stuff working again
-  :resource-paths ["resources"]
-
-  :source-paths ["src" "src-cljs" "/Users/neale/workspace/jig/extensions/cljs-builder/src"]
-
-  :cljsbuild {
-              :builds [{
-                        ;; The path to the top-level ClojureScript source directory:
-                        :source-paths ["src-cljs"]
-                        ;; The standard ClojureScript compiler options:
-                        ;; (See the ClojureScript compiler documentation for details.)
-                        :compiler {
-                                   :output-to "target/cljsbuild-main.js" ; default: target/cljsbuild-main.js
-                                   :optimizations :whitespace
-                                   :pretty-print true}}]}
   )


Update fs.

Update fs.

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
 (defproject tokyocabinet "1.24.1"
   :description "native tokyo cabinet libraries"
   :dependencies [[clojure "1.3.0"]]
-  :dev-dependencies [[fs "1.1.1"]])
+  :dev-dependencies [[fs "1.1.2"]])


Update raven-clj 1.1.0 -> 1.2.0

Update raven-clj 1.1.0 -> 1.2.0

--- project.clj
+++ project.clj
@@ -17,7 +17,7 @@
                  [prone "0.6.0"]
                  [ring-server "0.3.1"]
                  [selmer "0.7.2"]
-                 [raven-clj "1.1.0"]]
+                 [raven-clj "1.2.0"]]

   :repl-options {:init-ns servisne-info.repl}
   :plugins [[lein-ring "0.8.10"]


Update lein-droid

Update lein-droid

--- project.clj
+++ project.clj
@@ -8,7 +8,7 @@
                  [leiningen "2.3.4"]
                  [lein-ancient "0.5.4" :exclusions [clj-aws-s3]]
                  [lein-cljsbuild "1.0.3"]
-                 [lein-droid "0.2.2"]
+                 [lein-droid "0.2.3"]
                  [lein-fruit "0.2.0"]
                  [net.java.balloontip/balloontip "1.2.4.1"]
                  [org.apache.bcel/bcel "5.2"]


Preserve metadata for mapping/reducing fns

--- src/deepfns/core.cljc
+++ src/deepfns/core.cljc
@@ -53,12 +53,12 @@
   ([f m]
    (cond
      ;; map deepfmap over all the entries until it thunks out
-     (list? m) (reverse (flst f m))
-     (vector? m) (fvec f m)
-     (seq? m) (fseq f m)
-     (set? m) (fset f m)
+     (list? m) (with-meta (reverse (flst f m)) (meta m))
+     (vector? m) (with-meta (fvec f m) (meta m))
+     (seq? m) (with-meta (fseq f m) (meta m))
+     (set? m) (with-meta (fset f m) (meta m))
      ;; map deepfmap over all the vals (nested too)
-     (associative? m) (fassc f m)
+     (associative? m) (with-meta (fassc f m) (meta m))
      ;; two base cases here:
      ;; compose fns
      (fn? m) (comp f m)
@@ -69,11 +69,11 @@
    ;; same thing here but we'll mutually walk ms
    (let [mcoll (cons m ms)]
      (cond
-       (list? m) (map (partial flst f) mcoll)
-       (vector? m) (map (partial fvec f) mcoll)
-       (seq? m) (map (partial fseq f) mcoll)
-       (set? m) (map (partial fset f) mcoll)
-       (associative? m) (fassc f m ms)
+       (list? m) (with-meta (map (partial flst f) mcoll) (meta m))
+       (vector? m) (with-meta (map (partial fvec f) mcoll) (meta m))
+       (seq? m) (with-meta (map (partial fseq f) mcoll) (meta m))
+       (set? m) (with-meta (map (partial fset f) mcoll) (meta m))
+       (associative? m) (with-meta (fassc f m ms) (meta m))
        (fn? m) (map #(comp f %) mcoll)
        :else
        (apply f mcoll)))))
@@ -148,13 +148,13 @@
   ([fs m]
    (cond
      ;; map the fn for sequential/set types
-     (list? fs) (lst-fapply fs m)
-     (seq? fs) (seq-fapply fs m)
-     (vector? fs) (vec-fapply fs m)
-     (set? fs) (set-fapply fs m)
+     (list? fs) (with-meta (lst-fapply fs m) (meta m))
+     (seq? fs) (with-meta (seq-fapply fs m) (meta m))
+     (vector? fs) (with-meta (vec-fapply fs m) (meta m))
+     (set? fs) (with-meta (set-fapply fs m) (meta m))
      ;; match keys for maps and if found apply the fn (otherwise
      ;;  just leave it)
-     (map? fs) (assc-fapply fs m)
+     (map? fs) (with-meta (assc-fapply fs m) (meta m))
      ;; base cases:
      ;; either use the fn
      (fn? fs) (fs m)
@@ -165,12 +165,12 @@
    (let [mcoll (cons m ms)]
      (cond
        ;; mapcat all the results for sequential/set types
-       (list? fs) (lst-fapply fs m ms)
-       (seq? fs) (seq-fapply fs m ms)
-       (vector? fs) (vec-fapply fs m ms)
-       (set? fs) (set-fapply fs m ms)
+       (list? fs) (with-meta (lst-fapply fs m ms) (meta m))
+       (seq? fs) (with-meta (seq-fapply fs m ms) (meta m))
+       (vector? fs) (with-meta (vec-fapply fs m ms) (meta m))
+       (set? fs) (with-meta (set-fapply fs m ms) (meta m))
        ;; match all keys for maps and apply the fn if ther was a match
-       (map? fs) (assc-fapply fs m ms)
+       (map? fs) (with-meta (assc-fapply fs m ms) (meta m))
        ;; apply the fn to the args
        (fn? fs) (apply fs mcoll)
        :else
@@ -258,22 +258,22 @@
        (filterapply f m))))
   ([fs m]
    (cond
-     (list? fs) (lst-fapply fs m)
-     (seq? fs) (seq-fapply fs m)
-     (vector? fs) (vec-fapply fs m)
-     (set? fs) (set-fapply fs m)
-     (map? fs) (assc-filterapply fs m)
+     (list? fs) (with-meta (lst-fapply fs m) (meta m))
+     (seq? fs) (with-meta (seq-fapply fs m) (meta m))
+     (vector? fs) (with-meta (vec-fapply fs m) (meta m))
+     (set? fs) (with-meta (set-fapply fs m) (meta m))
+     (map? fs) (with-meta (assc-filterapply fs m) (meta m))
      (fn? fs) (fs m)
      :else
      ((constantly fs) m)))
   ([fs m & ms]
    (let [mcoll (cons m ms)]
      (cond
-       (list? fs) (lst-fapply fs m ms)
-       (seq? fs) (seq-fapply fs m ms)
-       (vector? fs) (vec-fapply fs m ms)
-       (set? fs) (set-fapply fs m ms)
-       (map? fs) (assc-filterapply fs m ms)
+       (list? fs) (with-meta (lst-fapply fs m ms) (meta m))
+       (seq? fs) (with-meta (seq-fapply fs m ms) (meta m))
+       (vector? fs) (with-meta (vec-fapply fs m ms) (meta m))
+       (set? fs) (with-meta (set-fapply fs m ms) (meta m))
+       (map? fs) (with-meta (assc-filterapply fs m ms) (meta m))
        (fn? fs) (apply fs mcoll)
        :else
        (map (constantly fs) mcoll)))))
@@ -311,20 +311,20 @@
    (repeat x))
   ([fs x]
    (cond
-     (vector? fs) (vec-zip fs x)
-     (seq? fs) (reverse (vec-zip fs x))
-     (map? fs) (map-zip fs x)))
+     (vector? fs) (with-meta (vec-zip fs x) (meta x))
+     (seq? fs) (with-meta (reverse (vec-zip fs x)) (meta x))
+     (map? fs) (with-meta (map-zip fs x) (meta x))))
   ([fs x y]
    (cond
-     (vector? fs) (vec-zip fs x [y])
-     (seq? fs) (reverse (vec-zip fs x [y]))
-     (map? fs) (map-zip fs x y)))
+     (vector? fs) (with-meta (vec-zip fs x [y]) (meta x))
+     (seq? fs) (with-meta (reverse (vec-zip fs x [y])) (meta x))
+     (map? fs) (with-meta (map-zip fs x y) (meta x))))
   ([fs x y & args]
    (let [more-args (cons y args)]
      (cond
-       (vector? fs) (vec-zip fs x more-args)
-       (seq? fs) (reverse (vec-zip fs x more-args))
-       (map? fs) (apply (partial map-zip fs x y) args)))))
+       (vector? fs) (with-meta (vec-zip fs x more-args) (meta x))
+       (seq? fs) (with-meta (reverse (vec-zip fs x more-args)) (meta x))
+       (map? fs) (with-meta (apply (partial map-zip fs x y) args) (meta x))))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


Show live search results

Show live search results

--- src/discuss/find.cljs
+++ src/discuss/find.cljs
@@ -6,15 +6,10 @@
             [discuss.utils.common :as lib]
             [discuss.utils.views :as vlib]))

-;(def data (atom {}))
-(def counter (atom 0))
-
-(defn prepare-search-results
+(defn get-search-results
   "Extract values and create a list of maps."
   []
-  (let [vals (get-in @lib/app-state [:discussion :search :values])
-        vals-dict (for [[k v] vals] {k v})]
-    (vec vals-dict)))
+  (get-in @lib/app-state [:discussion :search :values]))

 (defn statement-handler
   "Called when received a response in the search."
@@ -26,10 +21,7 @@
       (lib/error-msg! error)
       (do
         (lib/no-error!)
-        (lib/update-state-item! :discussion :search (fn [_] res))
-        #_(let [foo (prepare-search-results)]
-          (println foo)
-          (println (count foo)))))))
+        (lib/update-state-item! :discussion :search (fn [_] res))))))

 (defn statement
   "Find related statements to given keywords."
@@ -43,8 +35,10 @@
 (defn item-view [data owner]
   (reify om/IRender
     (render [_]
-      (dom/li nil
-              (vlib/safe-html data)))))
+      (dom/div #js {:className "bs-callout bs-callout-info"}
+               (vlib/safe-html (:text data))
+               (dom/span #js {:className "badge pull-right"}
+                         (lib/str->int (:distance data)))))))

 (defn form-view []
   (reify om/IRender
@@ -55,18 +49,11 @@
                                   (vlib/fa-icon "fa-search fa-fw"))
                         (dom/input #js {:className   "form-control"
                                         :onChange    #(statement (.. % -target -value))
-                                        :placeholder "Find Statement"}))
-               ;(println (prepare-search-results))
-               #_(apply dom/ol #js {:className "foobar"}
-                        (om/build-all item-view (lib/get-bubbles)))
-               #_(apply dom/div nil
-                        (om/build-all item-view vals-dict
-                                      ))
-               ))))
+                                        :placeholder "Find Statement"}))))))

 (defn results-view []
   (reify om/IRender
     (render [_]
       (dom/div nil
-               (apply dom/ol nil
-                      (om/build-all item-view (prepare-search-results)))))))+               (apply dom/div nil
+                      (om/build-all item-view (get-search-results)))))))


Correct docstring

Correct docstring

--- src/fatlip/order.cljs
+++ src/fatlip/order.cljs
@@ -526,7 +526,7 @@

 (def count-and-mark-crossings
   ^{:doc "Takes an OrderedGraph, counts edge crossings and marks edges that should not
-         be drawn straight, and returns a new graph with this information. Memoized."}
+         be drawn straight. Memoized."}
   (memoize
    (fn [ordered-graph]
      (let [{:keys [minus-ps minus-qs preds succs characters]} ordered-graph


Reading from the body instead of the query string.

--- src/funsocks/core.clj
+++ src/funsocks/core.clj
@@ -22,7 +22,7 @@
                   (ws/send! ch (apply str (reverse m))))})

 (defn broadcast [req]
-  (let [msg (:query-string req)]
+  (let [msg (slurp (:body req))]
     (prn "Broadcasting" msg)
     (doall (map (fn [ch] (ws/send! ch msg))
                 @connected-channels))))


file-triples -> word-file-triples

file-triples -> word-file-triples

--- src/hangman/words.clj
+++ src/hangman/words.clj
@@ -60,7 +60,7 @@
     (mapv word-triples coll)))

-(defn file-triples [filename]
+(defn word-file-triples [filename]
   (r/fold clojure.set/union clojure.set/union
     (mapv word-triples (words-from-file filename))))

@@ -86,7 +86,7 @@
   ([]
      (build-word-db! +default-corpus-file+))
   ([filename]
-     (set-word-db! (make-graph (file-triples filename)))
+     (set-word-db! (make-graph (word-file-triples filename)))
      @word-db))

 ;;;


Make sure we read version.properties from the jar, fixes #254 (#255)

The bug was that we were not using io/resource on the file and therefore we
could not read it when embedded in the jar.

--- src/io/perun/core.clj
+++ src/io/perun/core.clj
@@ -10,7 +10,9 @@
 (defn perun-version
   []
   (let [m (doto (java.util.Properties.)
-            (.load ^java.io.Reader (io/reader +version-file-name+)))]
+            (.load ^java.io.Reader (-> (or (io/resource +version-file-name+)
+                                           (io/file +version-file-name+))
+                                       io/reader)))]
     (if-let [[k v] (find m "VERSION")]
       v
       (throw (Exception. (str "The " +version-file-name+ " file does not contain a VERSION property, this is a bug."))))))


Exercise 1.6

Exercise 1.6

--- src/sicp/chapter1/1_7.clj
+++ src/sicp/chapter1/1_7.clj
@@ -33,7 +33,37 @@
 (square (sqrt 1000))

 ;; Exercise 1.6
-;; TODO
+(defn new-if [predicate then-clause else-clause]
+  (cond predicate then-clause
+        :else else-clause))
+
+(new-if (= 2 3) 0 5)
+
+(new-if (= 1 1) 0 5)
+
+(defn square-iter' [guess x]
+  (new-if (good-enough? guess x)
+          guess
+          (square-iter' (improve guess x)
+                        x)))
+
+;; > (square-iter' 1.0 2)
+;; java.lang.StackOverflowError
+;;
+;; Reason: Since all the argments of `new-if` are always evaluated even if `predicate` is evaluated to false,
+;;   recursion does not stop forever. You can control evaluation of arguments using macros as follows:
+
+(defmacro new-if' [predicate then-clause else-clause]
+  `(cond ~predicate ~then-clause
+         :else ~else-clause))
+
+(defn square-iter'' [guess x]
+  (new-if' (good-enough? guess x)
+           guess
+           (square-iter'' (improve guess x)
+                          x)))
+
+(square-iter'' 1.0 2)

 ;; Exercise 1.7
 ;; TODO


1.2.1  Linear Recursion and Iteration, Exercise 1.9, 1.10


tseitin cnf for nand, nor added

tseitin cnf for nand, nor added

--- src/logic/tseitin.clj
+++ src/logic/tseitin.clj
@@ -24,10 +24,20 @@
                   (list 'or (list 'not tsym) b)
                   (list 'or tsym (list 'not a) (list 'not b)))

+            nand (list 'nand
+                   (list 'or (list 'not tsym) (list 'not a) (list 'not b))
+                   (list 'or tsym a)
+                   (list 'or tsym b))
+
             or (list 'and
                  (list 'or tsym (list 'not a))
                  (list 'or tsym (list 'not b))
                  (list 'or (list 'not tsym) (list 'not a) b))
+
+            nor (list 'and
+                  (list 'or tsym a b)
+                  (list 'or (list 'not tsym) (list 'not a))
+                  (list 'or (list 'not tsym) (list 'not b)))

             impl (list 'and
                    (list 'or tsym a)


fix(core): fix #62 remove obsolete SIMD check

- obsolete because SIMD.js proposal has been abandoned

--- src/thi/ng/geom/core.cljc
+++ src/thi/ng/geom/core.cljc
@@ -1,7 +1,5 @@
 (ns thi.ng.geom.core
   (:refer-clojure :exclude [into]))
-
-#?(:cljs (def ^:export native-simd? (not (nil? (aget js/self "SIMD")))))

 (def ^:dynamic *resolution* 20)


Typo - thanks @jcrossley3!

Typo - thanks @jcrossley3!

--- core/src/immutant/codecs.clj
+++ core/src/immutant/codecs.clj
@@ -37,7 +37,7 @@
      :string.
    * :encode - A single-arity function that encodes its argument to
      the expected type.
-   * :encode - A single-arity function that decodes its argument from
+   * :decode - A single-arity function that decodes its argument from
      the expected type to clojure data."
   [{:keys [name content-type type encode decode] :or {type :string}}]
   `(proxy [~(if (= :bytes type) 'BytesCodec 'StringCodec)]


Parse port number as Int

Parse port number as Int

--- src/yorck_ratings/web.clj
+++ src/yorck_ratings/web.clj
@@ -37,5 +37,6 @@
 (defn -main [& args]
   (let [handler (if (in-dev? args)
                   (reload/wrap-reload #'app)
-                  app)]
-    (run-server handler {:port (or (env :port) 8000)})))+                  app)
+        port (Integer/parseInt (or (env :port) "8000"))]
+    (run-server handler {:port port})))


Show highest score in game

Show highest score in game

We save the max score in localstorage

--- src/mrunner/core.cljs
+++ src/mrunner/core.cljs
@@ -28,6 +28,18 @@
             [mrunner.routes :as routes]))

+;; Localstorage methods
+(defn set-item!
+  "Set `key' in browser's localStorage to `val`."
+  [key val]
+  (.setItem (.-localStorage js/window) key val))
+
+(defn get-item
+  "Returns value of `key' from browser's localStorage."
+  [key]
+  (.getItem (.-localStorage js/window) key))
+
+
 ;;
 ;;  Application state
 ;;  =================
@@ -36,6 +48,7 @@
 (defonce app-state
   (r/atom {:data nil
            :game nil
+           :max-score (or (get-item "runner-max-score") 0)
            :view [:init]}))

 (def initial-state
@@ -119,7 +132,7 @@
       (swap! state update :score + 10)
       (swap! state assoc-in [:obstacles 0 :scored] true))))

-(defn game-loop [state end]
+(defn game-loop [state end max-score]
   (let [{:keys [cur-time]} @state
         next-time (js/performance.now)
         delta (- next-time cur-time)]
@@ -129,22 +142,25 @@
       (swap! state update :speed-y + (* gravity delta))
       (swap! state update-obstacles)
       (update-score state)
-      (when (detect-collision @state) (swap! state assoc :game-over true)))
+      (when (detect-collision @state)
+        (swap! state assoc :game-over true)
+        (swap! max-score max (:score @state))
+        (set-item! "runner-max-score" @max-score)))
     (swap! state assoc :cur-time next-time))
   (when-not @end
-    (js/requestAnimationFrame #(game-loop state end))))
-
-(defn game-view [state]
+    (js/requestAnimationFrame #(game-loop state end max-score))))
+
+(defn game-view [state max-score]
   (r/with-let [end (atom false)
                keys [(events/listen js/window "keydown" #(handle-key state %))
                      (events/listen js/window "keyup" #(handle-key-up state %))]
-               loop (js/requestAnimationFrame #(game-loop state end))]
+               loop (js/requestAnimationFrame #(game-loop state end max-score))]

     [:div.game
      (when (and (:pause @state) (not (:game-over @state))) [:div.pause "PAUSED"])
      (when (:game-over @state) [:div.game-over "GAME OVER"
                                 [:button.restart {:on-click #(reset! state initial-state)} "restart"]])
-     [:div.score (:score @state)]
+     [:div.score "HI " @max-score " / " (:score @state)]
      [:div.sky {:style {:background-position-x (/ (- (:pos-x @state )) 5)}}]
      [:div.road {:style {:background-position-x (- (:pos-x @state ))}}]
      [:div.runner {:class (when (:down @state) "down")
@@ -163,11 +179,12 @@
              (reset! end true))))

 (defn main-view [state]
-  (r/with-let [game-state (r/cursor state [:game])]
+  (r/with-let [game-state (r/cursor state [:game])
+               max-score (r/cursor state [:max-score])]
     [:h1 "mRunner"]
     [:div.game-wrapper
      (if @game-state
-       [game-view game-state]
+       [game-view game-state max-score]
        [:button.start {:on-click #(reset! game-state initial-state)} "start"])]))


small fix

small fix

--- src/cljs/salava/extra/socialuser/ui/connections.cljs
+++ src/cljs/salava/extra/socialuser/ui/connections.cljs
@@ -44,7 +44,7 @@
     [:div.panel.expandable-block
      [:div.panel-heading
       [:a {:href "#" :on-click #(do (.preventDefault %) (toggle-panel panel-identity visible-area-atom))}
-       [:h3
+       [:h2
         (str (t :social/Followedusers) " (" (count users) ")")]
        [:i.fa.fa-lg.panel-status-icon {:class icon-class}]]]
      (when (= panel-identity @visible-area-atom)
@@ -107,7 +107,7 @@
     [:div.panel.expandable-block
      [:div.panel-heading
       [:a {:href "#" :on-click #(do (.preventDefault %) (toggle-panel panel-identity visible-area-atom))}
-       [:h3
+       [:h2
         (str (t :social/Followersusers) " (" (count users) ")")]
        [:i.fa.fa-lg.panel-status-icon {:class icon-class}]]]
      (when (= panel-identity @visible-area-atom)


Making algorithm for minimum set cover a bit faster

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

--- src/conexp/contrib/experimental/ryssel_algorithm.clj
+++ src/conexp/contrib/experimental/ryssel_algorithm.clj
@@ -19,7 +19,7 @@
   (if (empty? base-set)
     true
     (loop [rest (transient base-set),
-           sets (seq sets)]
+           sets sets]
       (if-not sets
         false
         (let [new-rest (reduce disj! rest (first sets))]
@@ -29,26 +29,28 @@

 (defn- redundant? [cover]
   (exists [set cover]
-    (covers? set (disj cover set))))
+    (forall [x set]
+      (exists [other-set (disj cover set)]
+        (contains? other-set x)))))

 (defn- minimum-covers [base-set sets]
-  (let [drop   (memoize drop),
-        sets   (vec (sort #(>= (count %1) (count %2)) sets)),
-        result (atom (transient [])),
-        search (fn search [rest-base-set current-cover i]
-                 (cond
-                  (redundant? current-cover)
-                  nil,
-                  (empty? rest-base-set)
-                  (swap! result conj! current-cover),
-                  (>= i (count sets))
-                  nil,
-                  :else (do
-                          (when (covers? rest-base-set (drop i sets))
-                            (search (difference rest-base-set (sets i))
-                                    (conj current-cover (sets i))
-                                    (inc i))
-                            (search rest-base-set current-cover (inc i))))))]
+  (let [drop    (memoize drop),
+        sets    (vec (sort #(>= (count %1) (count %2)) sets)),
+        nr-sets (count sets),
+        result  (atom (transient [])),
+        search  (fn search [rest-base-set current-cover i]
+                  (cond
+                   (redundant? current-cover)  nil,
+                   (empty? rest-base-set)      (swap! result conj! current-cover),
+                   (>= i nr-sets)              nil,
+                   :else
+                   (when (covers? rest-base-set (drop i sets))
+                     (when (exists [x (sets i)]
+                             (contains? rest-base-set x))
+                       (search (difference rest-base-set (sets i))
+                               (conj current-cover (sets i))
+                               (inc i)))
+                     (search rest-base-set current-cover (inc i)))))]
     (search base-set #{} 0)
     (persistent! @result)))


(SERVER-1320)additional changes in response to reviews

--- test/integration/puppetlabs/services/certificate_authority/certificate_authority_int_test.clj
+++ test/integration/puppetlabs/services/certificate_authority/certificate_authority_int_test.clj
@@ -170,10 +170,8 @@
 (deftest ^:integration certificate-with-ca-true-extension-refused
   (testing (str "Validates that the server rejects a csr for signing"
                 " that has the v3 CA:TRUE extension")
-    (let [master-conf-dir (str "./dev-resources/puppetlabs/services/"
-                               "certificate_authority/"
-                               "certificate_authority_int_test/"
-                               "ca_true_test/master/conf")]
+    (let [master-conf-dir (str test-resources-dir
+                               "/ca_true_test/master/conf")]
       (bootstrap/with-puppetserver-running
         app
         {:jruby-puppet {:master-conf-dir master-conf-dir}}


More on atoms.

More on atoms.

--- test/com/nomistech/clojure_the_language/intro_to_state.clj
+++ test/com/nomistech/clojure_the_language/intro_to_state.clj
@@ -10,11 +10,11 @@
 ;;;; References
 ;;;; - There are a fair few types of reference.
 ;;;;   - atoms, refs, vars, agents, promises, futures...
-;;;; - Some are for managing state.
-;;;; - Some are for managing concurrency.
+;;;; - Some are primarily for managing state.
+;;;; - Some are primarily for managing concurrency.
 ;;;; - Some combine the two.

-;;;; Here we will look at two reference types, both for managing state
+;;;; Here we will look at two reference types, both for managing state.
 ;;;; - Atoms
 ;;;; - Refs (confusing names! A ref is one kind of reference.)

@@ -44,7 +44,7 @@
 (fact @my-number-atom => 64)

-;; Maps in atoms
+;;;; Maps in atoms

 (def my-map-atom (atom {}))

@@ -60,8 +60,13 @@
                        :address {:line-1 "78 Green Lane"
                                  :line-2 "New Town"}})

+(swap! my-map-atom assoc-in [:address :line-1] "780 Green Lane")
+(fact @my-map-atom => {:first-name "Bob"
+                       :address {:line-1 "780 Green Lane"
+                                 :line-2 "New Town"}})
+
 ;;;; ___________________________________________________________________________
-;;;; `compare-and-set!`
+;;;; Atoms: `compare-and-set!`

 (fact @my-number-atom => 64)
 (fact (compare-and-set! my-number-atom 99 42) => false)
@@ -71,7 +76,7 @@
 (fact @my-number-atom => 42)

 ;;;; ___________________________________________________________________________
-;;;; `reset!`
+;;;; Atoms: `reset!`

 (reset! my-number-atom 100)
 (fact @my-number-atom => 100)


get rid of ?reply-fn

get rid of ?reply-fn

--- src/pc/http/sente.clj
+++ src/pc/http/sente.clj
@@ -1104,7 +1104,7 @@
           tx (plan-model/extend-trial plan 7 :annotations {:transaction/team (:db/id team)
                                                            :transaction/broadcast true
                                                            :cust/uuid (:cust/uuid cust)})]
-      (?reply-fn {:plan (plan-model/read-api (d/entity (:db-after tx) (:db/id plan)))}))))
+      (send-reply req {:plan (plan-model/read-api (d/entity (:db-after tx) (:db/id plan)))}))))

 (defmethod ws-handler :frontend/save-browser-settings [{:keys [client-id ?data ?reply-fn] :as req}]
   (if-let [cust (-> req :ring-req :auth :cust)]


cleanup outdated comment

cleanup outdated comment

--- src/pc/http/sente.clj
+++ src/pc/http/sente.clj
@@ -215,12 +215,11 @@
         (try
           (send-chat "Invite sent!")
           (email/send-chat-invite {:cust cust :to-email email :doc-id doc-id})
-          ;; TODO: should this come from the admin or a special bot user?
-
           (catch Exception e
             (log/error e)
             (.printStackTrace e)
             (send-chat "Sorry! There was a problem sending the invite."))))
+
       (send-chat "Please sign up to send an invite."))))

 (defmethod ws-handler :chsk/ws-ping [req]


Remove assert from set-screen! function

Remove assert from set-screen! function

--- src/play_clj/core.clj
+++ src/play_clj/core.clj
@@ -504,8 +504,6 @@

     (set-screen! my-game main-screen text-screen)"
   [^Game game-object & screen-objects]
-  (assert (isa? (type game-object) Game) "The first argument in set-screen!
-must be the defgame object.")
   (let [run-fn! (fn [k & args]
                   (doseq [screen screen-objects]
                     (apply (get screen k) args)))]


rm unused imports

rm unused imports

--- src/playmary/one.cljs
+++ src/playmary/one.cljs
@@ -2,8 +2,8 @@
   (:require-macros [cljs.core.async.macros :refer [go]])
   (:require [goog.dom :as dom]
             [goog.events :as events]
-            [cljs.core.async :as async :refer [<! >! put! chan timeout sliding-buffer close!
-                                               mapcat< onto-chan closed?]]
+            [cljs.core.async :as async :refer [<! >! chan timeout sliding-buffer mapcat<
+                                               onto-chan]]
             [playmary.util :as util]
             [playmary.scales :as scales]))


CMR-2808 respond to comments

CMR-2808 respond to comments

--- transmit-lib/src/cmr/transmit/echo/soap/access_control.clj
+++ transmit-lib/src/cmr/transmit/echo/soap/access_control.clj
@@ -13,7 +13,7 @@
   ;; vector with no element name string causes an error, but a sequence of vectors works properly.
   ;; Update this if we think of a better way.
   (seq [["ns3:Sid"
-          (if (or (= group-guid "GUEST") (= group-guid "REGISTERED"))
+          (if (#{"GUEST", "REGISTERED"} group-guid)
             ["ns3:UserAuthorizationTypeSid"
               ["ns3:UserAuthorizationType" group-guid]]
             ["ns3:GroupSid"


Restore only existing snapshot

Restore only existing snapshot

--- src/pot/core/act.cljs
+++ src/pot/core/act.cljs
@@ -27,5 +27,6 @@
   [state history storage]
   (when-let [stored-history (.get storage :history)]
     (when-let [restored-history (read-string stored-history)]
-      (reset! state (get-in restored-history [:snapshots (:cursor restored-history)]))
+      (when-let [restored-state (get-in restored-history [:snapshots (:cursor restored-history)])]
+        (reset! state restored-state))
       (reset! history restored-history))))


Remove undo/push/pop. Handle backwards seek by resetting. Do magic in JoinIterator.

--- src/aurora/btree.cljs
+++ src/aurora/btree.cljs
@@ -367,21 +367,16 @@
 ;; On creation/reset, points to first key
 ;; On next, either point to next key or set .-end? true. Return (not .-end?)
 ;; On seek, point to first key greater than or equal to seek-key. Return (key= (.key this) seek-key)
-;; On push, push current position onto a stack
-;; On pop, pop last position from the stack
 ;; NOTE iterators are not write-safe unless reset after writing

-(deftype Iterator [tree ^:mutable node ^:mutable ix ^:mutable end? ^:mutable old-node ^:mutable old-ix ^:mutable old-end? pushed-nodes pushed-ixes pushed-end?s key-len]
+(deftype Iterator [tree ^:mutable node ^:mutable ix ^:mutable end? key-len]
   Object
   (reset [this]
          (set! node (.-root tree))
          (set! ix 0)
          (while (not (nil? (.-children node)))
            (set! node (aget (.-children node) 0)))
-         (set! end? (<= (alength (.-keys node)) 0))
-         (aclear pushed-nodes)
-         (aclear pushed-ixes)
-         (aclear pushed-end?s))
+         (set! end? (<= (alength (.-keys node)) 0)))
   (key [this]
        (when (false? end?)
          (aget (.-keys node) ix)))
@@ -389,9 +384,6 @@
        (when (false? end?)
          (aget (.-vals node) ix)))
   (next [this]
-        (set! old-node node)
-        (set! old-ix ix)
-        (set! old-end? end?)
         (if (true? end?)
           false
           (if (nil? (.-children node))
@@ -418,11 +410,13 @@
                     (set! node (aget (.-children node) 0))
                     (recur))))))))
   (seek [this key]
-        (set! old-node node)
-        (set! old-ix ix)
-        (set! old-end? end?)
         (let [start-node node
               start-ix ix]
+          ;; TODO seek backwards instead of resetting and seeking forwards
+          (when (key-lt key (.key this))
+            (set! node (.-root tree))
+            (set! ix 0)
+            (set! end? false))
           (if (true? end?)
             false
             (loop []
@@ -451,19 +445,7 @@
                         (do
                           (set! node (aget (.-children node) ix))
                           (set! ix 0)
-                          (recur)))))))))))
-  (undo [this]
-        (set! node old-node)
-        (set! ix old-ix)
-        (set! end? old-end?))
-  (push [this]
-        (apush pushed-nodes node)
-        (apush pushed-ixes ix)
-        (apush pushed-end?s end?))
-  (pop [this]
-       (set! node (.pop pushed-nodes))
-       (set! ix (.pop pushed-ixes))
-       (set! end? (.pop pushed-end?s))))
+                          (recur))))))))))))

 (defn iterator [tree]
   (let [iterator (Iterator. tree (.-root tree) 0 false nil nil nil #js [] #js [] #js [] (.-key-len tree))]
@@ -471,39 +453,32 @@
     iterator))

 ;; used only inside Join
-(deftype JoinIterator [iterator outer->inner inner->outer seek-key key-len]
+(deftype JoinIterator [iterator inner->outer inner-key outer-key key-len blocked?]
   Object
+  (maintain [this]
+            (if (.-end? iterator)
+              (set! blocked? true)
+              (let [new-key (.key iterator)]
+                (set! blocked? false)
+                (dotimes [inner-ix (alength inner->outer)]
+                  (aset outer-key (aget inner->outer inner-ix) (aget new-key inner-ix))))))
   (reset [this]
-         (.reset iterator))
-  (outer-key [this]
-             (when (false? (.-end? iterator))
-               (let [inner-key (.key iterator)
-                     outer-key (make-array key-len)]
-                 (dotimes [i (alength inner->outer)]
-                   (aset outer-key (aget inner->outer i) (aget inner-key i)))
-                 outer-key)))
-  (inner-key [this]
-             (.key iterator))
-  (key-at [this outer-ix]
-          (when (false? (.-end? iterator))
-            (let [inner-key (.key iterator)]
-              (aget inner-key (aget outer->inner outer-ix)))))
+         (.reset iterator)
+         (.maintain this))
+  (key [this]
+       outer-key)
   (next [this]
-        (.next iterator))
-  (seek [this outer-key]
+        (.next iterator)
+        (.maintain this))
+  (seek [this key]
         (dotimes [inner-ix (alength inner->outer)]
-          (aset seek-key inner-ix (aget outer-key (aget inner->outer inner-ix))))
-        (.seek iterator seek-key))
-  (undo [this]
-        (.undo iterator))
-  (push [this]
-        (.push iterator))
-  (pop [this]
-       (.pop iterator))
-  (end? [this]
-        (.-end? iterator)))
-
-(deftype Join [seek-key iterators var->iterators var->nextable var->iterator->push|pop? ^:mutable end?]
+          (aset inner-key inner-ix (aget outer-key (aget inner->outer inner-ix))))
+        (.seek iterator seek-key)
+        (dotimes [outer-ix (alength outer->inner)]
+          (aset outer-key outer-ix (aget key outer-ix)))
+        (.maintain this)))
+
+(deftype Join [current-key iterators ^:mutable end?]
   Object
   (reset [this]
          (debug)


sketch of non-functionam media server

sketch of non-functionam media server

--- src/sledge/server.clj
+++ src/sledge/server.clj
@@ -96,6 +96,23 @@
      :headers {"Content-type" "text/html; charset=UTF-8"}
      :body (h/html (view req))}))

+(defn base64 [string]
+  (.encodeBuffer (sun.misc.BASE64Encoder.) (.getBytes string)))
+
+(defn unbase64 [string]
+  (String. (.decodeBuffer (sun.misc.BASE64Decoder.) string)))
+
+
+(defn bits-handler [req]
+  (let [urlpath (str/split (:uri req) #"/")
+        [b64 ext] (str/split (get urlpath 2) #"\.")
+        real-pathname (unbase64 b64)]
+    (println real-pathname)
+    ;; XXX this *really* needs to be an exact match
+    (if-let [track (search/search search/index {:pathname real-pathname} 1)]
+      (send-to-client real-pathname :transcoding-to ext)
+      {:status 404 :body "not found"})))
+

 ;; avconv -i /srv/media/Music/flac/Delerium-Karma\ Disc\ 1/04.Silence.flac -f mp3 pipe: |cat > s.mp3

@@ -104,6 +121,7 @@
   (let [u (:uri req)]
     (cond
      (.startsWith u "/tracks.json") (tracks-json req)
+     (.startsWith u "/bits/") (bits-handler req)
      :else ((ringo front-page-view) req)
      )))


Update to latest version of zprint. Fixes #16.

--- src/boot_fmt/core.clj
+++ src/boot_fmt/core.clj
@@ -8,7 +8,7 @@
             [boot.util :as bu]))

 (def pod-deps
-  '[[zprint "0.3.1"] [clojure-future-spec "1.9.0-alpha15"]
+  '[[zprint "0.4.2"] [clojure-future-spec "1.9.0-alpha17"]
     [com.google.guava/guava "18.0"]])

 (defn find-files-git


More cvt-ago-loop progress.

More cvt-ago-loop progress.

--- src/cbfg/zgo/core.clj
+++ src/cbfg/zgo/core.clj
@@ -60,12 +60,28 @@
      (re-find #"\?$" plast) "bool" ; When ends with '?'.
      :default (string/capitalize plast))))

+(declare cvt-expr)
+
 (defn cvt-ago [scope name [self-actx actx body]]
   ["go {" body "}"])

 (defn cvt-ago-loop [scope name [self-actx actx bindings body]]
-  [bindings ";\n"
-   "go for {" body "}"])
+  (println bindings)
+  ["(func() chan interface{} { result := chan interface{}\n"
+   "go func() chan interface{} {\n"
+   (interpose "\n"
+              (map-indexed (fn [idx [var-name init-val]]
+                             [(str "l" idx) ":=" (cvt-expr scope init-val)])
+                           (partition 2 bindings)))
+   "\nfor {\n"
+   (interpose "\n"
+              (map-indexed (fn [idx [var-name init-val]]
+                             [(cvt-sym var-name) ":=" (str "l" idx)])
+                           (partition 2 bindings)))
+   "\n"
+   body
+   "\n}}()\n"
+   "return result })()"])

 (def cvt-special-fns
   {"ago" cvt-ago
@@ -82,12 +98,14 @@
                                           [(cvt-expr scope k) ":"
                                            (cvt-expr scope v)])
                                         expr)) "}"]
+   (set? expr) expr
    (coll? expr) (let [[fn-name & args] expr
                       fn-handler (get cvt-special-fns (str fn-name)
                                       cvt-normal-fn)]
                   (fn-handler scope fn-name args))
    (symbol? expr) (cvt-sym expr)
    (keyword? expr) (str expr)
+   (nil? expr) "nil"
    :default ["DEFAULT-EXPR" expr]))

 (defn cvt-fn-params [params]


clean-up core

clean-up core

--- src/cljs_dnd/core.clj
+++ src/cljs_dnd/core.clj
@@ -2,39 +2,33 @@
 (ns cljs-dnd.core
   (:require-macros [cljs.core.async.macros :refer [go go-loop]])
   (:require
-    ; [reagent.core :as r]
-    ; [re-frame.core :refer [dispatch]]
-
+    [cljs-dnd.state :refer [state]]
     [cljs.core.async :refer [<! put! chan timeout]]
     [goog.dom :as g-dom]
     [goog.events :as events])
   (:import [goog.events EventType]))

+
+(defn parse-event [e]
+  {:index (-> e .-target .-dataset .-index int) ;; index of hovering or hoverable item?
+   :drag-index (:drag-index @dnd-store)
+   :brect-bottom (-> e .-target .getBoundingClientRect .-bottom)
+   :brect-top (-> e .-target .getBoundingClientRect .-top)
+   :middle-y (/ (- brect-bottom brect-top) 2)
+   :item-type  (-> e .-target .-dataset .-type)
+   :event-type (-> e .-type)}) ;; TODO check!
+
 (defn on-drag-start [e]
-  (let [index (int (.-index (.-dataset (.-target e)))) ;; TODO: not being bound to .-dataset
-        brect-bottom (.-bottom (.getBoundingClientRect (.-target e)))
-        brect-top (.-top (.getBoundingClientRect (.-target e)))
-        middle-y (/ (- brect-bottom brect-top) 2)]
-      (swap! dnd-store assoc :drag-id index)))
+  (let [{:keys [index drag-index brect-top brect-bottom middle-y item-type event-type]} (parse-event e)]))
+    ;; (swap! dnd-store assoc :drag-id index)))
+
+(defn on-drag-over [e]
+  (let [{:keys [index drag-index brect-top brect-bottom middle-y item-type event-type]} (parse-event e)]))
+    ;; (put! dnd-chan)))

 (defn on-drag [e]
   "nimp")
-
-(defn on-drag-over [e]
-  (let [index (int (.-index (.-dataset (.-target e))))
-        brect-bottom (.-bottom (.getBoundingClientRect (.-target e)))
-        brect-top (.-top (.getBoundingClientRect (.-target e)))
-        middle-y (/ (- brect-bottom brect-top) 2)
-        client-y (.-clientY e)]
-      ;; TODO: not seems to belong here
-      (swap! dnd-store assoc :client-y client-y)
-      ;;
-      (if (and index brect-top brect-bottom middle-y)
-          (put! dnd-chan {:client-y client-y
-                          :hover {:index index
-                                  :brect-bottom brect-bottom
-                                  :brect-top brect-top
-                                  :middle-y middle-y}}))))
+  ;; update client-y

 (defn on-drag-end [e]
   "nimp")
@@ -42,14 +36,18 @@
 (defn listen! []
   (events/listen js/window EventType.DRAGSTART on-drag-start)
   (events/listen js/window EventType.DRAGOVER on-drag-over)
-  ;; TODO:
-  ;; moar events
+  (events/listen js/window EventType.DRAGEND on-drag-end)
+  ; (events/listen js/window EventType.DRAGENTER on-drag-enter)
+  ; (events/listen js/window EventType.DROP on-drop)
+
   (go-loop []
      (let [e (<! dnd-chan)
-           {:keys [hover client-y]} e
-           drag-index (:drag-index @dnd-store)]
+           {:keys [hover client-y]} e        ;; destruct event
+           {:keys [drag-index]} @dnd-store]  ;; destruct state
+
         (when-not (= drag-index (:index hover))
           (dispatch [:reorder_msg drag-index hover client-y]))
+
        (recur))))

 (listen!)


replaced build-sitemap instances with crawl

--- src/crawler/crawl.clj
+++ src/crawler/crawl.clj
@@ -88,21 +88,21 @@

    Performs bfs traversal with 1 lookahead."
   ([entry-point leaf? extract stop?]
-     (build-sitemap entry-point 1 leaf? extract stop?))
+     (crawl entry-point 1 leaf? extract stop?))

   ([entry-point lookahead leaf? extract stop?]
      (let [body           (utils/download-with-cookie entry-point)
            body-queue-ele {:url  entry-point
                            :body body}]
-      (build-sitemap [body-queue-ele]
-                     [entry-point]
-                     lookahead
-                     leaf?
-                     extract
-                     stop?
-                     []
-                     50
-                     {})))
+       (crawl [body-queue-ele]
+              [entry-point]
+              lookahead
+              leaf?
+              extract
+              stop?
+              []
+              50
+              {})))

   ([url-queue visited lookahead leaf? extract stop? leaf-paths leaf-limit corpus]
      (do


added enlive requirement to notepad

added enlive requirement to notepad

--- src/notepad.clj
+++ src/notepad.clj
@@ -1,6 +1,7 @@
 (ns notepad
   (:require [clojure.test :refer :all])
   (:require [clojure.pprint :refer [pprint]])
+  ;(:require [net.cgrand.enlive-html :as eh])
   ;(:require [mastersign.wordcloud-test])
   ;(:require [distillery.data :refer :all])
   ;(:require [distillery.tasks :refer :all])


Shorten parse function

Shorten parse function

--- src/hu/ssh/github_changelog/dependencies/bundler.clj
+++ src/hu/ssh/github_changelog/dependencies/bundler.clj
@@ -19,6 +19,4 @@

 (defn parse [file]
   (with-open [rdr (reader file)]
-    (->> rdr
-         get-specs
-         parse-specs)))
+    (parse-specs (get-specs rdr))))


Added ability to serialize offheap records to a file

--- src/main/clojure/hikesaber/off_heap_ride_records.clj
+++ src/main/clojure/hikesaber/off_heap_ride_records.clj
@@ -1,11 +1,13 @@
 (ns hikesaber.off-heap-ride-records
   (:require
    [hikesaber.dates :as dates]
-            [clojure.string :as string]
-            [hikesaber.divvy-ride-records :as records]
-            [hikesaber.util.integer-ids :as ids]
-            [hikesaber.performance-tools :as perf])
+   [clojure.string :as string]
+   [hikesaber.divvy-ride-records :as records]
+   [hikesaber.util.integer-ids :as ids]
+   [hikesaber.performance-tools :as perf]
+   [clojure.java.io :as io])
   (:import [sun.misc Unsafe]
+           [java.io OutputStream DataOutputStream]
            [org.joda.time DateTime]))

 ;; This namespace is an implementation of the ideas in http://mechanical-sympathy.blogspot.com/2012/10/compact-off-heap-structurestuples-in.html
@@ -86,6 +88,8 @@

 (defn stoptime ^DateTime [loaded-record]
   (:stoptime loaded-record))
+
+(defprotocol Serializable (serialize [this ^OutputStream output-stream]))

 (defprotocol Disposable (dispose [this]))

@@ -124,6 +128,13 @@
              @ret
              (recur (inc i) (+ offset object-size) ret)))))))

+(defn serialize-bytes [^OutputStream ostream ^Unsafe unsafe address num-bytes]
+  (let [ostream (DataOutputStream. ostream)]
+    (.writeLong ostream num-bytes)
+    (dotimes [i num-bytes]
+      (.write ostream (.getByte unsafe (+ address i))))))
+
+
 ;; deftype - implement Indexed,Counted,
 (deftype RecordCollection [^Unsafe unsafe address num-records]

@@ -140,8 +151,11 @@
   (unsafe [_] unsafe)
   (address [_] address)

+  Serializable
+  (serialize [this output-stream]
+    (serialize-bytes output-stream unsafe address (* num-records object-size)))
+
   Disposable
-
   (dispose [_] (.freeMemory unsafe address)))

 (defn make-record-collection [loaded-records]
@@ -192,4 +206,6 @@
      :usertype (id->user-type (get-user-type unsafe address))
      }))

-
+(defn to-file [record-collection filename]
+  (with-open [w (io/output-stream (io/file filename))]
+    (serialize record-collection w)))


Update core.clj

Update core.clj

--- src/tiny_clj/core.clj
+++ src/tiny_clj/core.clj
@@ -7,7 +7,7 @@
             [environ.core :refer [env]]
             [net.cgrand.enlive-html :as html]))

-(= 1)
+(= 1)

 (html/deftemplate base "templates/main.html"
   [title h1]


Fix date format bug

Fix date format bug

--- src/transit/write.clj
+++ src/transit/write.clj
@@ -313,6 +313,14 @@
            false
            cache))

+(def ^:private thread-local-utc-date-format
+  ;; SimpleDateFormat is not thread-safe, so we use a ThreadLocal proxy for access.
+  ;; http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4228335
+  (proxy [ThreadLocal] []
+    (initialValue []
+      (doto (java.text.SimpleDateFormat. "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
+        (.setTimeZone (java.util.TimeZone/getTimeZone "GMT"))))))
+
 (defn stringable-keys?
   [m]
   (let [ks (keys m)]
@@ -431,7 +439,9 @@
   java.util.Date
   (tag [inst] "t")
   (rep [inst] (.getTime inst))
-  (str-rep [inst] (subs (pr-str inst) 7 36))
+  (str-rep [inst]
+    (let [format (.get thread-local-utc-date-format)]
+      (.format foramt inst)))

   java.util.UUID
   (tag [uuid] "u")
@@ -459,7 +469,7 @@
   (tag [s] "set")
   (rep [s] (as-tag "array" s nil))
   (str-rep [s] nil)
-)
+  )

 (deftype Writer [marshaler])


Start using apply-rotation in the container-rect function.

--- src/uxbox/shapes.cljs
+++ src/uxbox/shapes.cljs
@@ -93,15 +93,8 @@
         x2 (- (+ x width) center-x)
         y2 (- y center-y)

-        rx1 (- (* x1 (mth/cos angle))
-               (* y1 (mth/sin angle)))
-        ry1 (+ (* x1 (mth/sin angle))
-               (* y1 (mth/cos angle)))
-
-        rx2 (- (* x2 (mth/cos angle))
-               (* y2 (mth/sin angle)))
-        ry2 (+ (* x2 (mth/sin angle))
-               (* y2 (mth/cos angle)))
+        [rx1 ry1] (apply-rotation [x1 y1] rotation)
+        [rx2 ry2] (apply-rotation [x2 y2] rotation)

         [d1 d2] (cond
                   (and (>= rotation 0)


Alura, Introdução a Programação Funcional com Clojure, Aula 4

--- alura/clojure/forca/src/forca/core.clj
+++ alura/clojure/forca/src/forca/core.clj
@@ -14,12 +14,23 @@
   (empty? (letras-faltantes palavra acertos))
 )

+(defn le-letra! [] (read-line))
+
+(defn acertou? [chute palavra] (.contains palavra chute))
+
+(defn avalia-chute [chute vidas palavra acertos]
+  (if (acertou? chute palavra)
+    (jogo vidas palavra (conj acertos chute))
+    (jogo (dec vidas) palavra acertos)
+  )
+)
+
 (defn jogo [vidas palavra acertos]
   (if (= vidas 0)
     (perdeu)
     (if (acertou-a-palavra-toda? palavra acertos)
       (ganhou)
-      (print "Chuta, amigo!")
+      (avalia-chute (le-letra!) vidas palavra acertos)
     )
   )
 )


checkpoint: frame ancestors work, need to trim nils

--- clojure_dmap/utilities/frame.clj
+++ clojure_dmap/utilities/frame.clj
@@ -156,29 +156,43 @@
 		(doseq [s (get-specializations frame-name)] (print-frame s))
 		(doseq [a (get-abstractions frame-name)] (print-frame a)) )) )

+		;;(assert (= (find-ancestors :abs-frame-2), (list ))
+		;;(assert (= (find-ancestors :test-frame-4), (list :abs-frame-2 ))
+		;;(assert (= (find-ancestors :sec-frame-2), (list :test-frame-4 :abs-frame-2 ))
 (defn find-ancestors
-	"Go up the abstraction hierarchy and collect ancestors/abstractions"
+	"Go up the abstraction hierarchy and collect specializaionts/abstractions"
 	{:test #(do
-		(create-frame :test-frame-4 (list :test-slot-1 :test-slot-2) (list "a" "b") (list) (list))
-		(create-frame :spec-frame-2 (list :spec-slot-1 :spec-slot-2) (list "x" "z") (list) (list))
-		(create-frame :abs-frame-2 (list :abs-slot-1 :abs-slot-2) (list "m" "n") (list) (list))
-		(find-ancestors :abs-frame-2)
+		(create-frame :abs-frame-2 (list :abs-slot-1 :abs-slot-2) (list "m" "n")    (list :test-frame-4) (list))
+		(create-frame :test-frame-4 (list :test-slot-1 :test-slot-2) (list "a" "b") (list :spec-frame-2) (list :abs-frame-2) )
+		(create-frame :spec-frame-2 (list :spec-slot-1 :spec-slot-2) (list "x" "z") (list)               (list :test-frame-4) )
+		(println "ANCESTORS abs " (find-ancestors :abs-frame-2))
+		(println "")
+		(println "ANCESTORS test" (find-ancestors :test-frame-4))
+		(println "")
+		(println "ANCESTORS spec" (find-ancestors :spec-frame-2))
+		(println "")
 	)}
 	[frame-name ]
-	(let [ancestor-set #{} ]
-		(loop [frame-list #{frame-name} visited-set #{nil} ]
-			(println "debug2:" frame-name visited-set "frame-list:" frame-list)
-			(map (fn [x] (do
-					(def ancestor-set (conj ancestor-set (get-abstractions x)) )))
-			 	frame-list)
-			; recur on the built-up abstractions minus the visited-set
-			(println "debug3:"
-				(difference (conj frame-list (get-abstractions x)) (conj visited-set frame-name)))
-			(if (> (count (difference (conj frame-list (get-abstractions x)) (conj visited-set frame-name)))
-				0)
-				(recur (difference (conj frame-list (get-abstractions x)) (conj visited-set frame-name))
-					(conj visited-set frame-name))))
-		ancestor-set ))
+		(loop [	loop-frame frame-name
+				ancestor-set #{}
+				visited-set #{frame-name} ]
+				(cond
+					(<= (count (difference
+									(conj (conj ancestor-set  (get-abstractions loop-frame)) loop-frame)
+									visited-set))
+					0)
+					(do
+						(println  "exiting:" loop-frame ancestor-set visited-set);
+						ancestor-set  )
+
+					:t
+					(do
+						(println  "recurring:" loop-frame ancestor-set visited-set  )
+						(recur
+							(first (difference ancestor-set visited-set))
+							(conj (conj ancestor-set (get-abstractions loop-frame)) loop-frame)
+							(conj visited-set loop-frame) )))))
+

 (defn get-feature
 	"looks first in the native frame, then abstractions, then specializations, returning the first found


ARM: shmobile: remove Makefile.boot

ARM: shmobile: remove Makefile.boot

Now that the only multiplatform boot is supported for all
shmobile platforms Makefile.boot may be removed.

This seems correct to me given:
* Setting MACHINE to no value in arch/arm/Makefile
  if CONFIG_ARCH_MULTIPLATFORM is set
* Not including Makefile.boot in arch/arm/boot/Makefile
  if MACHINE has no value

Signed-off-by: Simon Horman <9662bddcc379be37df16f02a449c344b4718c1a1@verge.net.au>
Acked-by: Geert Uytterhoeven <a1ff81395f7e6bf5b509fe9aab06bf3419493e1d@glider.be>


Clarify after-render doc string

Clarify after-render doc string

--- src/reagent/core.cljs
+++ src/reagent/core.cljs
@@ -336,7 +336,8 @@
 (defn after-render
   "Run f using requestAnimationFrame or equivalent.

-  f will be called just after components are rendered."
+  f will be called just after any queued renders in the next animation
+  frame (and even if no renders actually occur)."
   [f]
   (batch/do-after-render f))


saves image data now

saves image data now

--- src/server/rooms.cljs
+++ src/server/rooms.cljs
@@ -1,6 +1,7 @@
 (ns moomoo.rooms
   (:require [cljs.nodejs :as nodejs]
             [cljs.reader :as reader]
+            [clojure.string :as string]
             [cognitect.transit :as transit]))

 (defonce fs (nodejs/require "fs"))
@@ -10,6 +11,7 @@
 (defonce redis-client (.createClient (nodejs/require "redis")))
 (defonce redis-lua-loader (nodejs/require "redis-lua-loader"))
 (defonce redis-lua (redis-lua-loader. redis-client #js {:src "./redis"}))
+(defonce album-art-directory "public/images/albums")

 (defn redis-room-prefix [room-id suffix]
   (str "room:" room-id ":" suffix))
@@ -210,14 +212,19 @@
     (fn [err reply]
       (callback reply))))

-(defn handle-album-art [tags callback]
-  (println "PICTURE FORMAT " (get (first (get tags
-                                  "picture"))
-                                              "format"))
-  (let [picture (first (get tags "picture"))
-        picture-format (get picture "format")
-        picture-data   (get picture "data")])
-  (callback (dissoc tags "picture")))
+(defn handle-album-art [tags track-id callback]
+  (let [pictures (get tags "picture")]
+    (if (nil? pictures)
+      (callback tags)
+      (let [picture (first (get tags "picture"))
+            picture-format (get picture "format")
+            picture-data   (get picture "data")
+            filename  (subs track-id 0 7)
+            file-path (str album-art-directory "/" filename "." picture-format)]
+        (println "Saving album art to:" file-path)
+        (.writeFile fs file-path picture-data)
+        (callback (merge {"picture" (string/replace file-path "public" "")}
+                         (dissoc tags "picture")))))))

 (defn set-music-info [absolute-file-path
                       track-id
@@ -226,7 +233,7 @@
                       callback]
   (mm (.createReadStream fs absolute-file-path)
     (fn [err tags]
-      (handle-album-art (js->clj tags)
+      (handle-album-art (js->clj tags) track-id
         (fn [tags-without-album-art]
           (get-room-from-user-id socket-id
             (fn [room]
@@ -423,7 +430,7 @@
         (callback (clj->js track-order))))))

 (defn change-track [room track-num sound-id callback]
-  (println "Chainging track in room " room
+  (println "Changing track in room " room
            "to" track-num "with sound-id" sound-id)
   ((.scriptWrap redis-lua "changeTrack")
     0 room track-num sound-id


cleanup

cleanup

--- src/sormilla/leap.clj
+++ src/sormilla/leap.clj
@@ -39,10 +39,7 @@
        :yaw           (-> aim .yaw yaw)
        :roll          (-> hand .palmNormal .roll roll)})))

-(defn connect ^Controller []
-  (Controller.))
-
-(defonce ^Controller connection (connect))
+(defonce ^Controller connection (Controller.))

 (defn leap [_]
   (when (.isConnected connection)


Rename to avoid clashes

Rename to avoid clashes

--- src/tick/interval.clj
+++ src/tick/interval.clj
@@ -147,26 +147,26 @@

 ;; Operations on relations

-(defn complement
+(defn complement-relation
   "Return the complement of the general relation. The complement ~r of
   a relation r is the relation consisting of all basic relations not
   in r."
   [^GeneralRelation r]
   (assoc r :relations (remove (set (:relations r)) basic-relations)))

-(defn compose
+(defn compose-relation
   "Return the composition of r and s"
   [r s]
   (throw (new UnsupportedOperationException "Not yet implemented")))

-(defn converse
+(defn converse-relation
   "Return the converse of the given general relation. The converse !r
   of a relation r is the relation consisting of the converses of all
   basic relations in r."
   [^GeneralRelation r]
   (assoc r :relations (map conv (:relations r))))

-(defn intersection
+(defn intersection-relation
   "Return the intersection of the r with s"
   [^GeneralRelation r ^GeneralRelation s]
   (s/assert r #(instance? GeneralRelation %))
@@ -176,7 +176,7 @@
 ;; Useful relations

 (def disjoint? (make-relation precedes? preceded-by? meets? met-by?))
-(def concur? (complement disjoint?))
+(def concur? (complement-relation disjoint?))

 ;; Functions that make use of Allens' Interval Algebra

@@ -190,6 +190,19 @@
     (\S \F \D) y
     nil))

+(defn concurrencies
+  "Return a sequence of occurances where intervals coincide (having non-nil intersections)."
+  [& intervals]
+  (let [intervals (vec intervals)]
+    (for [xi (range (count intervals))
+          yi (range (count intervals))
+          :when (< xi yi)
+          :let [x (get intervals xi)
+                y (get intervals yi)
+                ins (intersection x y)]
+          :when ins]
+      {:x x :y y :intersection ins})))
+
 (defn partition-by-date
   "Split the interval in to a lazy sequence of intervals, one for each local date."
   [interval ^ZoneId zone]


include il.pixi

include il.pixi

--- examples/tilemap/project.clj
+++ examples/tilemap/project.clj
@@ -9,7 +9,9 @@
   :dependencies [[org.clojure/clojure "1.8.0"]
                  [org.clojure/clojurescript "1.9.229"]
                  [org.clojure/core.async "0.2.391"
-                  :exclusions [org.clojure/tools.reader]]]
+                  :exclusions [org.clojure/tools.reader]]
+
+                 [infinitelives/infinitelives.pixi "0.1.1-SNAPSHOT"]]

   :plugins [[lein-figwheel "0.5.8"]
             [lein-cljsbuild "1.1.4" :exclusions [[org.clojure/clojure]]]]


CMR-2878 Change if to when

CMR-2878 Change if to when

--- umm-spec-lib/src/cmr/umm_spec/validation/spatial.clj
+++ umm-spec-lib/src/cmr/umm_spec/validation/spatial.clj
@@ -56,7 +56,7 @@
   "Validates the existence of orbit parameters when the granule spatial representation is orbit"
   [field-path spatial-extent]
   (let [{:keys [GranuleSpatialRepresentation OrbitParameters]} spatial-extent]
-    (if (and (= GranuleSpatialRepresentation "ORBIT") (nil? OrbitParameters))
+    (when (and (= GranuleSpatialRepresentation "ORBIT") (nil? OrbitParameters))
       {field-path
        [(str "Orbit Parameters must be defined for a collection "
              "whose granule spatial representation is ORBIT.")]})))


Use time.format instead of hand crafting the format

--- src/catalog/layout/obi.clj
+++ src/catalog/layout/obi.clj
@@ -3,7 +3,9 @@
   XML](http://www.daisy.org/z3986/2005/Z3986-2005.html). This will be
   used to narrate the book in Obi later in the tool chain"
   (:require [catalog.layout.common :as layout]
-            [clj-time.core :as time.core]
+            [clj-time
+             [core :as time.core]
+             [format :as time.format]]
             [clojure.data.xml :as xml]))

 (defn- heading-keyword [level]
@@ -70,7 +72,7 @@
              :dc:Subject ""
              :dc:Description ""
              :dc:Publisher creator
-             :dc:Date (format "%s-%s-%s" (time.core/year date) (time.core/month date) (time.core/day date))
+             :dc:Date (time.format/unparse (time.format/formatters :date) date)
              :dc:Format "ANSI/NISO Z39.86-2005"
              :dc:Language language}]
         [:meta {:name (name k) :content v}])]


Fix validation for previous commit

Fix validation for previous commit

i.e. the simplified braille-grade mapping

--- src/catalog/validation.clj
+++ src/catalog/validation.clj
@@ -22,8 +22,7 @@
 (def ProducerBrief
   (apply s/enum (set (vals vubis/producer-raw-to-producer))))

-(def BrailleGrade
-  (apply s/enum (vals vubis/braille-grade-raw-to-braille-grade)))
+(def BrailleGrade (s/enum :kurzschrift :vollschrift :schwarzschrift))

 (def SignatureRE #"(DS |GDB |BG |ED |BM |BK |PS|DY|GD)\d{4,6}|LUD \d{1,3}|BK \d{3}|VI \d{1,3}")


remove some nesting

remove some nesting

--- src/clj/cljs/sourcemap.clj
+++ src/clj/cljs/sourcemap.clj
@@ -27,18 +27,17 @@
       nseg)))

 (defn update-result [result segmap gline]
-  (update-in result [(:source segmap)]
-    (fnil (fn [m]
-            (update-in m [(:line segmap)]
-              (fnil (fn [m]
-                      (assoc m (:col segmap)
-                        (let [d {:gline gline
-                                 :gcol (:gcol segmap)}]
-                          (if-let [name (:name segmap)]
-                            (assoc d :name name)
-                            d))))
-                    (sorted-map))))
-          (sorted-map))))
+  (let [{:keys [gcol source line col name]} segmap
+        d {:gline gline
+           :gcol gcol}
+        d (if name (assoc d :name name) d)]
+    (update-in result [source]
+      (fnil (fn [m]
+              (update-in m [line]
+                (fnil (fn [m]
+                        (assoc m col d))
+                      (sorted-map))))
+            (sorted-map)))))

 (defn decode
   ([source-map]
@@ -81,5 +80,5 @@
     (json/read-json (slurp (io/file "samples/repl/repl_sample_map.json"))))

   ;; test it out
-  (first (decode raw-source-map))
+  (second (decode raw-source-map))
   )


Select should read the atom when returning

--- src/clj/minijava/munch.clj
+++ src/clj/minijava/munch.clj
@@ -35,7 +35,7 @@
 	(do
 		(reset! *instr* '()) ;;reset instr to empty list
 		(munch irtree)
-		 *instr*))
+		 @*instr*))

 ;;Munch the move statement
 ;;This method contains a bunch of special cases, organized by preference (size), of x86 statements that can


Forgot to properly load Slot in types...

--- src/clj/schedule/types.clj
+++ src/clj/schedule/types.clj
@@ -19,22 +19,6 @@
   (let [state (.state this)]
     (dosync (alter state assoc k v)) v))

-(gen-class
- :name schedule.types.Slot
- :prefix "slot-"
- :init init
- :state state
- :extends java.lang.Object
- :constructors {[java.lang.Integer org.joda.time.ReadablePeriod] []}
- :methods [[getSlotsForDay [org.joda.time.DateTime] org.joda.time.Interval]])
-
-(defn- slot-init [start length]
-  [[] (ref {:start start :length length})])
-
-(defn- slot-getSlotsForDay [this day]
-  (let [beginSlot (t/plus day (t/hours (getValue this :start)))
-        endSlot (t/plus beginSlot (getValue this :length))]
-    (t/interval beginSlot endSlot)))
-
 (load "solution")
-(load "event")+(load "event")
+(load "slot")


add test for Morph ICE

add test for Morph ICE

--- src/clj/test/cards-ice.clj
+++ src/clj/test/cards-ice.clj
@@ -58,6 +58,30 @@
       (take-credits state :corp 2)
       (is (= 5 (:current-strength (refresh lotus))) "Lotus Field strength increased"))))

+(deftest morph-ice-subtype-changing
+  "Morph ice gain and lose subtypes from normal advancements and placed advancements"
+  (do-game
+    (new-game (default-corp [(qty "Wendigo" 1) (qty "Shipment from SanSan" 1) (qty "Superior Cyberwalls" 1)])
+              (default-runner))
+    (core/gain state :corp :click 2)
+    (play-from-hand state :corp "Superior Cyberwalls" "New remote")
+    (let [sc (get-in @state [:corp :servers :remote1 :content 0])]
+      (score-agenda state :corp sc)
+      (play-from-hand state :corp "Wendigo" "HQ")
+      (let [wend (get-in @state [:corp :servers :hq :ices 0])]
+        (core/rez state :corp wend)
+        (is (= 4 (:current-strength (refresh wend))) "Wendigo at normal 4 strength")
+        (core/advance state :corp {:card (refresh wend)})
+        (is (= true (has? (refresh wend) :subtype "Barrier")) "Wendigo gained Barrier")
+        (is (= false (has? (refresh wend) :subtype "Code Gate")) "Wendigo lost Code Gate")
+        (is (= 5 (:current-strength (refresh wend))) "Wendigo boosted to 5 strength by scored Superior Cyberwalls")
+        (play-from-hand state :corp "Shipment from SanSan")
+        (prompt-choice :corp "1")
+        (prompt-select :corp wend)
+        (is (= false (has? (refresh wend) :subtype "Barrier")) "Wendigo lost Barrier")
+        (is (= true (has? (refresh wend) :subtype "Code Gate")) "Wendigo gained Code Gate")
+        (is (= 4 (:current-strength (refresh wend))) "Wendigo returned to normal 4 strength")))))
+
 (deftest special-offer-trash-ice-during-run
   "Special Offer trashes itself and updates the run position"
   (do-game


Exclude resolve to avoid warning on compile

Minor change to avoid a compiler warning when using replumb

--- src/cljs/replumb/repl.cljs
+++ src/cljs/replumb/repl.cljs
@@ -1,5 +1,5 @@
 (ns replumb.repl
-  (:refer-clojure :exclude [load-file ns-publics ns-interns find-ns])
+  (:refer-clojure :exclude [load-file ns-publics ns-interns find-ns resolve])
   (:require-macros [cljs.env.macros :refer [with-compiler-env]])
   (:require [cljs.js :as cljs]
             [cljs.tagged-literals :as tags]


Asteroids now split when shot.

Asteroids now split when shot.

--- Clojure/clojuroids.clj
+++ Clojure/clojuroids.clj
@@ -19,10 +19,18 @@
 (def sparkle-kick-velocity 1.0)
 (def sparkle-amount 0.3)
 (def sparkle-limit 200)
+(def smallest-asteroid 5.0)
+(def initial-asteroid-size 30.0)

 (def width 640)
 (def height 480)
 (def fire-delay 0.3)
+
+(declare generate-asteroid)
+
+(defn separate [f s]
+    (let [t (map vector (map f s) s)]
+    [ (map second (filter first t)), (map second (filter (complement first) t)) ]))

 (defn do-mod [coll func v]
     (dosync (alter coll (fn [x] (apply func [x v])))))
@@ -147,6 +155,17 @@
         p (:poly asteroid)]
         (.contains p x y)))

+(defn average [radii]
+    (/ (apply + radii) (count radii)))
+
+(defn split-asteroid [asteroid]
+    (let [current-radius (average (:radii asteroid))]
+        (filter (fn [ast] (>= (average (:radii ast)) smallest-asteroid))
+            [
+                (generate-asteroid (:x asteroid) (:y asteroid) (* current-radius 0.6))
+                (generate-asteroid (:x asteroid) (:y asteroid) (* current-radius 0.4))
+            ])))
+
 (defn filter-collisions [bullets asteroids]
     [
         (filter
@@ -154,22 +173,25 @@
                 (fn [a] (collided? b a))
                 asteroids)))
             bullets)
-        (filter
-            (fn [a] (nil? (some
-                (fn [b] (collided? b a))
-                bullets)))
-            asteroids)])
-
-(defn generate-asteroid []
+        (let [
+            [survived hit]
+                (separate
+                    (fn [a] (nil? (some
+                        (fn [b] (collided? b a))
+                        bullets)))
+                    asteroids)]
+            (apply concat (cons survived (map split-asteroid hit))))])
+
+(defn generate-asteroid [x y radius]
     (let [a
         {
-            :x (rand width)
-            :y (rand height)
+            :x x
+            :y y
             :xv (rand 10)
             :yv (rand 10)
             :a 0.0
             :av (rand)
-            :radii (take 10 (repeatedly #(myrand 5 30)))
+            :radii (take 10 (repeatedly #(myrand (* radius 0.5) (* radius 1.5))))
             :eff 1.0
             :acc 0.0
         }]
@@ -190,7 +212,8 @@
         :eff player-efficiency
         :sparkle-color Color/RED}
     :next-fire-time (now)
-    :asteroids (take 10 (repeatedly generate-asteroid))
+    :asteroids
+        (take 10 (repeatedly #(generate-asteroid (rand width) (rand height) initial-asteroid-size)))
     :sparkles []
 } )


fix NPE in javac task

fix NPE in javac task

handle the case where (.getSource d) returns nil. I ran into that with
the following warning:

,----
| WARNING: Supported source version 'RELEASE_6' from annotation processor
| 'org.sonatype.guice.bean.scanners.index.SisuIndexAPT6' less than -source
| '1.8'
`----

While I'm here, also show the number of files being compiled.

--- boot/core/src/boot/task/built_in.clj
+++ boot/core/src/boot/task/built_in.clj
@@ -460,16 +460,20 @@
                                Arrays/asList
                                (.getJavaFileObjectsFromFiles file-mgr))]
         (when srcs
-          (util/info "Compiling Java classes...\n")
+          (util/info "Compiling %d Java source files...\n" (count srcs))
           (-> compiler (.getTask *err* file-mgr diag-coll opts nil srcs) .call)
           (doseq [d (.getDiagnostics diag-coll) :let [k (.getKind d)]]
             (when (= Diagnostic$Kind/ERROR k) (reset! throw? true))
             (let [log (handler k util/info)]
-              (log "%s: %s, line %d: %s\n"
-                   (.toString k)
-                   (.. d getSource getName)
-                   (.getLineNumber d)
-                   (.getMessage d nil))))
+              (if (nil? (.getSource d))
+                (log "%s: %s\n"
+                     (.toString k)
+                     (.getMessage d nil))
+                (log "%s: %s, line %d: %s\n"
+                     (.toString k)
+                     (.. d getSource getName)
+                     (.getLineNumber d)
+                     (.getMessage d nil)))))
           (.close file-mgr)
           (when @throw? (throw (Exception. "java compiler error")))))
       (-> fileset (core/add-resource tgt) core/commit!))))


CMR-1438: Slight refactoring of test

CMR-1438: Slight refactoring of test

--- system-int-test/test/cmr/system_int_test/ingest/granule_ingest_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/granule_ingest_test.clj
@@ -161,13 +161,14 @@
     (is (= 1 (- delete-revision-id ingest-revision-id)))))

 ;; Verify deleting non-existent concepts returns good error messages
-(deftest delete-non-existing-granule-gives-good-error-message-test
-  (let [collection (d/ingest "PROV1" (dc/collection {}))
-        granule (d/item->concept (dg/granule collection {:concept-id "G1-PROV1"}))
-        response (ingest/delete-concept granule {:raw? true})
+(deftest delete-non-existing-concept-gives-good-error-message-test
+  (testing "granule"
+    (let [collection (d/ingest "PROV1" (dc/collection {}))
+          granule (d/item->concept (dg/granule collection {:concept-id "G1-PROV1"}))
+          response (ingest/delete-concept granule {:raw? true})
           {:keys [errors]} (ingest/parse-ingest-body :xml response)]
       (is (re-find #"Granule with native id \[.*?\] in provider \[PROV1\] does not exist"
-                   (first errors)))))
+                   (first errors))))))

 ;; Verify ingest is successful for request with content type that has parameters
 (deftest content-type-with-parameter-ingest-test


[inbox] Fix header CSS and delete dead code.

--- src-cljs/pepa/style.cljs
+++ src-cljs/pepa/style.cljs
@@ -286,9 +286,6 @@
        [:&.right {:background-image (image-url "material/page-rotate-right.svg")}]
        [:&.left {:background-image (image-url "material/page-rotate-left.svg")}]]])])

-;; [:&.inbox {:background
-;; [:&.active {:background-color blue-background}
-;;         [:&.inbox {:background {:image (image-url "menu-icons/inbox-active.svg")}}]]
 ;;; Workflows

 (def document-width 250)
@@ -308,9 +305,10 @@
               :flex-direction :row
               :align-items :center
               :justify-content :space-between}
-     [:>span {:overflow :hidden
-              :text-overflow :ellipsis
-              :white-space :nowrap}]
+     [:.title :.editable {:flex-grow 2}]
+     [:span {:overflow :hidden
+             :text-overflow :ellipsis
+             :white-space :nowrap}]
      [:>a.show {:font-size (pt 8)
                 :padding (px 12)
                 :text-decoration :underline}]
@@ -337,13 +335,13 @@
        [:.rotate {:display :flex
                   :padding-left (px padding)}]
        [:.left :.right :.delete {:width (px button-height)
-                                :height (px button-height)
-                                :text-align :center
-                                :cursor :pointer
-                                :opacity 0.3
-                                :user-select :none
-                                :background {:repeat :no-repeat
-                                             :position :center}}
+                                 :height (px button-height)
+                                 :text-align :center
+                                 :cursor :pointer
+                                 :opacity 0.3
+                                 :user-select :none
+                                 :background {:repeat :no-repeat
+                                              :position :center}}
         ;; Give buttons full opacity when hovered
         [:&:hover {:opacity 1}]
         [:&.right {:background-image (image-url "material/page-rotate-right.svg")}]
@@ -410,48 +408,7 @@
                  :justify-content :center
                  :align-items :center
                  :text-align :center}
-      [:>button {:margin (px 15)}]]]]
-   ;; Create Document Column
-   ;; [:.create-document {:align-items :center
-   ;;                     :justify-content :space-around}
-   ;;  [:.note
-   ;;   [:.arrow {:background {:image (image-url "drop-arrow.svg")
-   ;;                          :repeat :no-repeat
-   ;;                          :position :center
-   ;;                          :size (px 72)}
-   ;;             :height (px 72)}]]]
-   ;; A 'Document' (with pages inside)
-   ;; [:.document
-   ;;  [:header {:max-height :initial}
-   ;;   [:.tags {:margin-bottom (px 5)}]]
-
-   ;;  [:ul.pages {:margin 0, :padding 0
-   ;;              :overflow-y :auto
-   ;;              :flex-shrink 999}
-   ;;   [:li.page {:width "100%"
-   ;;              :list-style-type :none
-   ;;              :user-select :none}
-   ;;    ;; TODO: Move this into a generic css rule
-   ;;    [:&.selected
-   ;;     [:.thumbnail {:position :relative}
-   ;;      [:&:before {:content (pr-str " ")
-   ;;                  :display :block
-   ;;                  :width "100%", :height "100%"
-   ;;                  :position :absolute
-   ;;                  :top 0 :left 0
-   ;;                  :background-color "rgba(0,0,1,0.5)"
-   ;;                  :z-index 10}]]]
-   ;;    page-css
-   ;;    [:img {:max-width "100%"
-   ;;           :max-height "100%"}]]]
-   ;;  [:barter {:min-height (px 40)
-   ;;            :max-height (px 40)
-   ;;            :display :flex
-   ;;            :flex-direction :row
-   ;;            :justify-content :space-around
-   ;;            :align-items :center
-   ;;            :background-color header-color}]]
-   ])
+      [:>button {:margin (px 15)}]]]]])

 ;;; Dashboard
 (def dashboard-css


(maint) covert table-based layout to divs

--- dev/cljs/puppetlabs/metrics/dashboard/demo/core.cljs
+++ dev/cljs/puppetlabs/metrics/dashboard/demo/core.cljs
@@ -108,31 +108,29 @@

 (defn sortable-tables [requests-atom functions-atom]
   (fn []
-    [:table
-     [:tbody
-      [:tr
-       [:td
-        (sortable-table/sortable-table
-          "Top 10 Requests"
-          {:id-field :id
-           :fields [:id "Route"
-                    :count "Count"
-                    :mean "Mean"
-                    :aggregate "Aggregate"]
-           :sort-field :aggregate
-           :ascending false}
-          requests-atom)]
-       [:td
-        (sortable-table/sortable-table
-          "Top 10 Functions"
-          {:id-field :id
-           :fields [:id "Function"
-                    :count "Count"
-                    :mean "Mean"
-                    :aggregate "Aggregate"]
-           :sort-field :aggregate
-           :ascending false}
-          functions-atom)]]]]))
+   [:div {:class "clearfix"}
+    [:div {:class "left table-panel"}
+     (sortable-table/sortable-table
+       "Top 10 Requests"
+       {:id-field :id
+        :fields [:id "Route"
+                 :count "Count"
+                 :mean "Mean"
+                 :aggregate "Aggregate"]
+        :sort-field :aggregate
+        :ascending false}
+       requests-atom)]
+    [:div {:class "left table-panel"}
+     (sortable-table/sortable-table
+       "Top 10 Functions"
+       {:id-field :id
+        :fields [:id "Function"
+                 :count "Count"
+                 :mean "Mean"
+                 :aggregate "Aggregate"]
+        :sort-field :aggregate
+        :ascending false}
+       functions-atom)]]))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Public


dsets.clj: finished refactoring

dsets.clj: finished refactoring

--- clojure/org/gavrog/clojure/dsets.clj
+++ clojure/org/gavrog/clojure/dsets.clj
@@ -1,5 +1,6 @@
 (ns org.gavrog.clojure.dsets
   (:use (org.gavrog.clojure
+          [util]
           [generators :only [make-backtracker results]]
           [delaney])))

@@ -8,7 +9,7 @@
             (for [j (indices ds) :when (or (< j (dec i)) (> j (inc i)))]
               (orbit ds [i j] D))))

-(defn- traversed-from [ds D]
+(defn- trace [ds D]
   (let [plus-all (fn [pairs D] (into pairs (for [i (indices ds)] [i D])))
         step (fn step [o2n n2o n free]
                (when-let [[i D] (first free)]
@@ -21,32 +22,17 @@
                                             (disj free [i D] [i Di]))))))))]
     (step {D 1} {1 D} 1 (plus-all (sorted-set) 1))))

-(defn- compare-with-start [ds D]
-  (loop [o2n {D 1}
-         n2o {1 D}
-         n 1
-         free (into (sorted-set) (for [i (indices ds)] [i 1]))]
-    (if (empty? free)
-      0
-      (let [[i D] (first free)
-            oDi (s ds i (n2o D))]
-        (if (nil? oDi)
-          0
-          (let [Di (or (o2n oDi) (inc n))
-                d (- Di (s ds i D))
-                free (if (<= Di n)
-                       free
-                       (into free (for [j (indices ds)] [j Di])))]
-            (cond (nil? (s ds i D)) 0
-                  (neg? d) -1
-                  (pos? d) 1
-                  :else (recur (assoc o2n oDi Di)
-                               (assoc n2o Di oDi)
-                               (max n Di)
-                               (disj free [i D] [i Di])))))))))
+(defn- cmp [xs ys]
+  (if (or (empty? xs) (empty? ys))
+    0
+    (let [d (compare (first xs) (first ys))]
+      (if (not= 0 d)
+        d
+        (recur (rest xs) (rest ys))))))

 (defn- best? [ds alt-starts]
-  (let [results (into {} (for [D alt-starts] [D (compare-with-start ds D)]))]
+  (let [base (trace ds 1)
+        results (into {} (for [D alt-starts] [D (cmp (trace ds D) base)]))]
     [(not-any? #(neg? (results %)) alt-starts)
      (apply disj alt-starts (filter #(pos? (results %)) alt-starts))]))


Change the interval when weather data is fetched

Had to change the data fetching interval to later because the data was
not usually available when fetching it earlier.

--- src/env_logger/handler.clj
+++ src/env_logger/handler.clj
@@ -120,9 +120,9 @@
   (POST "/observations" [json-string]
         (let [start-time (calculate-start-time)
               start-time-int (t/interval (t/plus start-time
-                                                 (t/seconds 45))
+                                                 (t/minutes 4))
                                          (t/plus start-time
-                                                 (t/minutes 3)))
+                                                 (t/minutes 7)))
               weather-data (if (t/within? start-time-int (t/now))
                              (get-latest-fmi-data (get-conf-value :fmi-api-key)
                                                   (get-conf-value :station-id))


Ready for release

Ready for release

--- project.clj
+++ project.clj
@@ -1,6 +1,6 @@
 ;; Copyright © 2014 JUXT LTD.

-(defproject cylon "0.1.1-SNAPSHOT"
+(defproject cylon "0.1.1"
   :description "An integrated security system for applications built on component"
   :url "https://github.com/juxt/cylon"
   :license {:name "The MIT License"


Update medley to 0.5.5

Update medley to 0.5.5

--- project.clj
+++ project.clj
@@ -6,7 +6,7 @@
   :dependencies [[org.clojure/clojure "1.5.1"]
                  [org.clojure/tools.macro "0.1.5"]
                  [clout "2.1.0"]
-                 [medley "0.5.3"]
+                 [medley "0.5.5"]
                  [ring/ring-core "1.3.2"]
                  [ring/ring-codec "1.0.0"]]
   :plugins [[codox "0.8.10"]]


next version

next version

[ci skip]

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject insn "0.2.1"
+(defproject insn "0.3.0-SNAPSHOT"
   :description "Functional JVM bytecode generation for Clojure."
   :url "https://github.com/jgpc42/insn"
   :license {:name "Eclipse Public License"


Prepare for next release cycle.

Prepare for next release cycle.

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject org.onyxplatform/onyx-datomic "0.10.0.0-beta4"
+(defproject org.onyxplatform/onyx-datomic "0.10.0.0-SNAPSHOT"
   :description "Onyx plugin for Datomic"
   :url "https://github.com/onyx-platform/onyx-datomic"
   :license {:name "Eclipse Public License"