Renames optional clauses (with default binding).

--- src/active/clojure/match.clj
+++ src/active/clojure/match.clj
@@ -362,7 +362,7 @@
 (s/def ::key-matches-with-binding
   (s/or :required (s/cat :key ::key :match-value ::match-value :binding-key ::binding-key :binding ::binding)))

-(s/def ::optional-key-matches-with-binding
+(s/def ::optional-key-with-default-binding
   (s/or :required (s/cat :qmark ::qmark :key ::key :default-value ::default-value :binding-key ::binding-key :binding ::binding)))

 (s/def ::path-matches-without-binding
@@ -371,7 +371,7 @@
 (s/def ::path-matches-with-binding
   (s/or :required (s/cat :path ::path :match-value ::match-value :binding-key ::binding-key :binding ::binding)))

-(s/def ::optional-path-matches-with-binding
+(s/def ::optional-path-with-default-binding
   (s/or :required (s/cat :qmark ::qmark :path ::path :default-value ::default-value :binding-key ::binding-key :binding ::binding)))

 (s/def ::clause
@@ -385,8 +385,8 @@
         :path-matches-with-binding ::path-matches-with-binding
         :optional-key-exists-with-binding ::optional-key-exists-with-binding
         :optional-path-exists-with-binding ::optional-path-exists-with-binding
-        :optional-key-matches-with-binding ::optional-key-matches-with-binding
-        :optional-path-matches-with-binding ::optional-path-matches-with-binding))
+        :optional-key-with-default-binding ::optional-key-matches-with-binding
+        :optional-path-with-default-binding ::optional-path-with-default-binding))

 (defn match-value->matcher
   [[kind match-value]]
@@ -469,7 +469,7 @@
                 b (make-binding (:binding body))]
             `(key-matches-with-binding-clause ~k (match-value->matcher ~(:match-value body)) ~b))

-          :optional-key-matches-with-binding
+          :optional-key-with-default-binding
           (let [k (make-key (:key body))
                 b (make-binding (:binding body))]
             `(optional-key-with-default-binding-clause ~k ~(:default-value body) ~b))
@@ -483,7 +483,7 @@
                 b    (make-binding (:binding body))]
             `(path-matches-with-binding-clause ~path (match-value->matcher ~(:match-value body)) ~b))

-          :optional-path-matches-with-binding
+          :optional-path-with-default-binding
           (let [path (mapv make-key (:path body))
                 b    (make-binding (:binding body))]
               `(optional-path-with-default-binding-clause ~path ~(:default-value body) ~b)))))))
@@ -576,7 +576,7 @@
               [`{~k ~match-value}
                `[~(symbol b) (get-in ~message [~k])]]))

-          :optional-key-matches-with-binding
+          :optional-key-with-default-binding
           (let [k           (make-key (:key body))
                 b           (make-binding (:binding body))]
               [{} `[~(symbol b) (get-in ~message [~k] ~(:default-value body))]])
@@ -610,7 +610,7 @@
               [`~path-map
                `[~(symbol b) (get-in ~message ~path)]]))

-          :optional-path-matches-with-binding
+          :optional-path-with-default-binding
           (let [path        (mapv make-key (:path body))
                 b           (make-binding (:binding body))]
             [{} `[~(symbol b) (get-in ~message ~path ~(:default-value body))]]))))))


Move a letfn into a separate private fn

Move a letfn into a separate private fn

--- src/catalog/layout/common.clj
+++ src/catalog/layout/common.clj
@@ -169,16 +169,15 @@
        (str prefix s postfix))
      "")))

+(defn- safe-blank? [s]
+  (and (string? s) (string/blank? s)))

 (defn empty-or-blank? [s]
-  ;; FIXME: might not be needed with clojure 1.8
-  (let [safe-blank? (fn [s] (and (string? s)
-                                 (string/blank? s)))]
-    (or (nil? s)
-        (and (coll? s)
-             (or (empty? s) (every? safe-blank? s)))
-        (safe-blank? s)
-        false)))
+  (or (nil? s)
+      (and (coll? s)
+           (or (empty? s) (every? safe-blank? s)))
+      (safe-blank? s)
+      false))

 (defn- braille-signature [[signature grade volumes double-spaced? accompanying-material :as item]]
   (when item


autofocus first input on home-page

autofocus first input on home-page

--- src/cat_camp/views/home_page.cljs
+++ src/cat_camp/views/home_page.cljs
@@ -2,14 +2,16 @@
   (:require [cat-camp.session :as ses]
             [secretary.core :as sec]))

-
 (defn player-input [key placeholder]
   [:div
    [:input.player-input
-    {:type "text"
-     :value (ses/global-state key)
-     :placeholder placeholder
-     :on-change #(ses/global-put! key (-> % .-target .-value))}]])
+    (let [pi {:type "text"
+              :value (ses/global-state key)
+              :placeholder placeholder
+              :on-change #(ses/global-put! key (-> % .-target .-value))}]
+      (if (= key :p1)
+        (assoc pi :autofocus "autofocus")
+        pi))]])

 (defn named-players []
   (->> [:p1 :p2 :p3 :p4]


Enable "lein run migrate" command for db migration

--- src/clj/five_three_one/server.clj
+++ src/clj/five_three_one/server.clj
@@ -6,6 +6,7 @@
   (:gen-class))

 (defn -main [& args]
-  (let [port (Integer/parseInt (or (env :port) "3000"))]
+  (if (some #{"migrate"} args)
     (migrate)
-    (run-jetty app {:port port :join? false})))
+    (let [port (Integer/parseInt (or (env :port) "3000"))]
+      (run-jetty app {:port port :join? false}))))


adjusted trends to return nil values upon failure

--- src/clj/forma/trends/analysis.clj
+++ src/clj/forma/trends/analysis.clj
@@ -71,14 +71,15 @@
   [ts]
   (let [ts-mat (i/matrix ts)
         foc (first-order-conditions ts-mat)
-        foc-mat (i/mmult foc (i/trans foc))]
-    (try
-      (let [focsum (map i/cumulative-sum foc)
-            focsum-mat (i/mmult focsum (i/trans focsum))]
-        (-> (i/solve (i/mult foc-mat (i/nrow ts-mat)))
-            (i/mmult focsum-mat)
-            (i/trace)))
-      (catch Exception e))))
+        foc-mat (i/mmult foc (i/trans foc))
+        focsum (map i/cumulative-sum foc)
+        focsum-mat (i/mmult focsum (i/trans focsum))
+        scaled-foc (i/mult foc-mat (i/nrow ts-mat))]
+    (if-not (singular? scaled-foc)
+      (-> (i/solve scaled-foc)
+          (i/mmult focsum-mat)
+          (i/trace))
+      nil)))

 ;; Long-term trend characteristic; supporting functions

@@ -123,10 +124,14 @@
   (let [time-step (utils/idx ts)
         X (if (empty? cofactors)
             (i/matrix time-step)
-            (apply i/bind-columns time-step cofactors))]
-    (try (map second (trend-characteristics ts X))
-         (catch Throwable e
-           (error (str "TIMESERIES ISSUES: " ts ", " cofactors) e)))))
+            (apply i/bind-columns time-step cofactors))
+        result (try (map second (trend-characteristics ts X))
+                    (catch Throwable e
+                      (error (str "TIMESERIES ISSUES: " ts ", " cofactors) e)))]
+    (if (or (nil? result)
+            (string? result))
+      [nil nil]
+      (vec result))))

 ;; Short-term trend characteristic; supporting functions


add test for Haarpsichord Studios

add test for Haarpsichord Studios

--- src/clj/test/cards-identities.clj
+++ src/clj/test/cards-identities.clj
@@ -61,6 +61,28 @@
       (is (= 3 (count (:discard (get-corp)))))
       (run-empty-server state "HQ")
       (is (= 4 (count (:discard (get-corp)))) "1 operation trashed from HQ; accessed non-operation in Archives first"))))
+
+(deftest haarpsichord-studios
+  "Haarpsichord Studios - Prevent stealing more than 1 agenda per turn"
+  (do-game
+    (new-game
+      (make-deck "Haarpsichord Studios: Entertainment Unleashed" [(qty "15 Minutes" 3)])
+      (default-runner [(qty "Gang Sign" 1)]))
+    (take-credits state :corp)
+    (play-from-hand state :runner "Gang Sign")
+    (run-empty-server state "HQ")
+    (prompt-choice :runner "Steal")
+    (is (= 1 (:agenda-point (get-runner))))
+    (run-empty-server state "HQ")
+    (prompt-choice :runner "Steal")
+    (is (= 1 (:agenda-point (get-runner))) "Second steal of turn prevented")
+    (take-credits state :runner)
+    (play-from-hand state :corp "15 Minutes" "New remote")
+    (score-agenda state :corp (get-content state :remote1 0))
+    (let [gs (get-in @state [:runner :rig :resource 0])]
+      (card-ability state :runner gs 0)
+      (prompt-choice :runner "Steal")
+      (is (= 2 (:agenda-point (get-runner))) "Steal prevention didn't carry over to Corp turn"))))

 (deftest haas-bioroid-stronger-together
   "Stronger Together - +1 strength for Bioroid ice"


Suppress another :key warning.

Suppress another :key warning.

--- src/cljs/cljs_repl_web/views.cljs
+++ src/cljs/cljs_repl_web/views.cljs
@@ -479,11 +479,11 @@
      :size (str "0 1 " (quot 100 cols) "%")
      :gap "10px"
      :children (for [sections partitioned-sections]
-                 [v-box
-                  :size "1 1 auto"
-                  :gap "10px"
-                  :children (for [section sections]
-                              [build-section-ui section])])]))
+                 ^{:key sections} [v-box
+                                   :size "1 1 auto"
+                                   :gap "10px"
+                                   :children (for [section sections]
+                                               [build-section-ui section])])]))

 (defn api-panel []
   [build-api-panel-ui 2 (:sections api-utils/custom-api-map)])


support childs for hidden

support childs for hidden

--- src/cljs/material/components.cljs
+++ src/cljs/material/components.cljs
@@ -1,7 +1,8 @@
 (ns material.components
   (:refer-clojure :exclude [stepper list])
   (:require [material.factory :as f]
-            [sablono.core :refer-macros [html]]))
+            [sablono.core :refer-macros [html]]
+            [cuerdas.core :as str]))

 ;;; Theme components

@@ -14,6 +15,7 @@
                              :light        "#957ed1"
                              :dark         "#362870"
                              :contrastText "#fff"}}
+   :typography  {:fontFamily (str/join "," ["Roboto" "Helvetica" "Arial" "sans-serif"])}
    :overrides   {:MuiCardHeader  {:action {:color "rgb(117, 117, 117)"}}
                  :MuiCardActions {:root {:padding 16}}}
    :breakpoints {:values {:xs 0
@@ -159,8 +161,8 @@
   (f/fab (clj->js props) comp))

 (defn hidden
-  [props comp]
-  (f/hidden (clj->js props) comp))
+  [props & childs]
+  (f/hidden (clj->js props) childs))

 (defn app-bar
   [props drawer]


add a footer with contact info

add a footer with contact info

--- src/cljs/tictag/views/common.cljs
+++ src/cljs/tictag/views/common.cljs
@@ -35,8 +35,14 @@

 (defn footer [] [h-box
                  :justify :center
-                 :children [[box
-                             :child ""]]])
+                 :style {:background-color "#444"
+                         :color            "#fff"
+                         :padding          "50px"}
+                 :children [[re-com/p
+                             "Feel free to contact me at "
+                             [re-com/hyperlink-href :href "mailto:tictag@agh.io" :label "tictag@agh.io"]
+
+                             " with any suggestions, comments, or questions!"]]])

 (defn page
   [& content]
@@ -49,4 +55,5 @@
               [h-box
                :justify :center
                :children [content]]
+              [re-com/gap :size "50px"]
               [footer]]])


Fixed off by one error

Fixed off by one error

--- src/clojure/staircase/handler.clj
+++ src/clojure/staircase/handler.clj
@@ -94,8 +94,9 @@
              [original (get-one histories id)
               title (or (get body "title") (str "Fork of " (:title original)))
               history (assoc (dissoc original :id :steps) :title title)
-              i     (try (Integer/parseInt idx) (catch NumberFormatException e nil))
-              inherited-steps (data/get-history-steps-of histories id (+ 1 i))
+              ;; Don't really have to nummify it - but is good to catch error here.
+              limit (try (Integer/parseInt idx) (catch NumberFormatException e nil))
+              inherited-steps (data/get-history-steps-of histories id limit)
               hid (create histories history)]
              (do
               (data/add-all-steps histories hid inherited-steps)


Auto-ack isnt working, going to leave it as pre-ack.

--- src/onyx/plugin/hornetq.clj
+++ src/onyx/plugin/hornetq.clj
@@ -40,6 +40,7 @@
   (let [config {"host" (:hornetq/host task-map) "port" (:hornetq/port task-map)}
         tc (TransportConfiguration. (.getName NettyConnectorFactory) config)
         locator (HornetQClient/createServerLocatorWithoutHA (into-array [tc]))]
+    (.setBlockOnAcknowledge locator true)
     (let [session-factory (.createSessionFactory locator)
           session (.createSession session-factory true true 0)
           consumer (.createConsumer session (:hornetq/queue-name task-map))]
@@ -55,7 +56,6 @@

 (defmethod l-ext/close-lifecycle-resources :hornetq/read-segments
   [_ event]
-  (prn "Shut it down")
   (.close (:hornetq/consumer event))
   (.close (:hornetq/session event))
   (.close (:hornetq/session-factory event))
@@ -71,18 +71,18 @@
           rets (filter (comp not nil? :message)
                        (take-segments f (:onyx/batch-size task-map)))]
       (doseq [m rets]
+        (.acknowledge (:message m))
         (swap! pending-messages assoc (:id m) (:message m))
         (go (try (<! (timeout 5000))
-                 ;; (prn "Unblock")
-                 ;; (when (get @pending-messages (:id m))
-                 ;;   (p-ext/replay-message event (:id m)))
+                 (when (get @pending-messages (:id m))
+                   (p-ext/replay-message event (:id m)))
                  (catch Exception e
                    (taoensso.timbre/warn e)))))
       {:onyx.core/batch (or rets [])})))

 (defmethod p-ext/decompress-batch [:input :hornetq]
   [{:keys [onyx.core/batch]}]
-  (let [decompress-f #(fressian/read (.toByteBuffer (.getBodyBuffer %)))]
+  (let [decompress-f #(fressian/read (.toByteBuffer (.getBodyBufferCopy %)))]
     {:onyx.core/decompressed (map #(assoc % :message (decompress-f (:message %))) batch)}))

 (defmethod p-ext/apply-fn [:input :hornetq]


Changed source to src in fire.

Changed source to src in fire.

--- src/clj/forma/source/fire.clj
+++ src/clj/forma/source/fire.clj
@@ -107,9 +107,9 @@
   position and value all defined. In this case, the value `?tuple` is
   a `FireTuple` thrift object containing all relevant characteristics
   of fires for that particular day."
-  [source]
+  [src]
   (<- [?dataset ?date ?t-res ?lat ?lon ?tuple]
-      (source ?line)
+      (src ?line)
       (p/mangle ?line :> ?lat ?lon ?kelvin _ _ ?datestring _ _ ?conf _ _ _)
       (p/add-fields "fire" "01" :> ?dataset ?t-res)
       (format-datestring ?datestring :> ?date)
@@ -118,8 +118,8 @@
 (defn reproject-fires
   "Aggregates fire data at the supplied path by modis pixel at the
   supplied resolution."
-  [m-res source]
-  (let [fires (fire-source source)]
+  [m-res src]
+  (let [fires (fire-source src)]
     (<- [?dataset ?m-res ?t-res ?tilestring ?date ?sample ?line ?tuple]
         (p/add-fields m-res :> ?m-res)
         (fires ?dataset ?date ?t-res ?lat ?lon ?tuple)


Longer badge cron time limit

Longer badge cron time limit

--- src/clj/salava/badge/cron.clj
+++ src/clj/salava/badge/cron.clj
@@ -2,6 +2,7 @@
   (:require [clojure.tools.logging :as log]
             [clojure.java.jdbc :as jdbc]
             [clojure.string :as string]
+            [clj-time.core :as t]
             [salava.core.util :as u]
             [salava.core.http :as http]))

@@ -27,7 +28,7 @@
       :else nil)))

 (defn- issuer-verified? [factory-url asr]
-  (when (and (string? factory-url) (map? asr))
+  (when (and (string? factory-url) (map? asr) (string/starts-with? (get asr :id "") factory-url))
     (try
       (let [badge (if (map? (:badge asr)) (:badge asr) (http/json-get (:badge asr)))
             issuer-url (if (map? (:issuer badge)) (get-in badge [:issuer :id]) (:issuer badge))
@@ -54,13 +55,13 @@

 (defn- check-badges [db-conn factory-url]
   (log/info "check-badges: started working")
-  (let [time-limit (+ (System/currentTimeMillis) (* 15 60 1000))
+  (let [time-limit (+ (System/currentTimeMillis) (* 30 60 1000))
         sql "SELECT id, badge_id, assertion_url FROM user_badge
             WHERE assertion_url IS NOT NULL
             AND deleted = 0 AND revoked = 0 AND status = 'accepted'
             AND (expires_on IS NULL OR expires_on > UNIX_TIMESTAMP())
             ORDER BY last_checked LIMIT 1000"]
-    (doseq [chunk (partition-all 10 (jdbc/query db-conn [sql]))]
+    (doseq [chunk (partition-all 5 (jdbc/query db-conn [sql]))]
       (when (> time-limit (System/currentTimeMillis))
         (doseq [user-badge chunk]
           (try
@@ -68,6 +69,8 @@
             (check-badge db-conn factory-url user-badge)
             (jdbc/execute! db-conn ["UPDATE user_badge SET last_checked = UNIX_TIMESTAMP() WHERE id = ?"
                               (:id user-badge)])
+            (Thread/sleep 100)
+            (catch InterruptedException _)
             (catch Throwable ex
               (log/error "check-badges failed")
               (log/error (.toString ex)))))
@@ -76,5 +79,8 @@

 ;;;

+
 (defn every-hour [ctx]
-  (check-badges (:connection (u/get-db ctx)) (get-in ctx [:config :factory :url])))
+  (let [h (t/hour (t/now))]
+    (when (and (not= h 14) (not= h 15)) ; skip during afternoon hours
+      (check-badges (:connection (u/get-db ctx)) (get-in ctx [:config :factory :url])))))


Filter initial publication.

Filter initial publication.

--- src/cljx/geschichte/sync.cljx
+++ src/cljx/geschichte/sync.cljx
@@ -121,7 +121,7 @@
         (when metas
           (debug "initial state publication:" metas)
           (>! out {:topic :meta-pub
-                   :metas metas
+                   :metas (filter-subs sub-metas metas)
                    :peers pn})))

       (go-loop>? error-ch


Remove randomization of default hasher.

Remove randomization of default hasher.

--- src/clojure/buddy/hashers.clj
+++ src/clojure/buddy/hashers.clj
@@ -44,14 +44,6 @@
    :scrypt {:cpucost 65536
             :memcost 8}})

-(def ^:no-doc ^:static
-  +recommended-algorithms+
-  [:pbkdf2+sha3-256
-   :pbkdf2+sha512
-   :pbkdf2+blake2b-512
-   :bcrypt+blake2b-512
-   :bcrypt+sha512])
-
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Impl Interface
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -219,6 +211,7 @@
             candidate (derive-password params')]
         (bytes/equals? (:password params)
                        (:password candidate)))
+
       ;; Backward compatibility for password checking
       ;; for old algorithm
       (let [candidate (-> (bytes/concat attempt (:salt params))
@@ -364,14 +357,11 @@
   "Encrypts a raw string password."
   ([password] (encrypt password {}))
   ([password options]
-   (let [alg (or (:algorithm options nil)
-                 (:alg options)
-                 (rand-nth +recommended-algorithms+))
-         pwdparams (assoc options
-                          :alg alg
-                          :password (codecs/str->bytes password))]
-     (-> (derive-password pwdparams)
-         (format-password)))))
+   (-> (assoc options
+              :alg (:alg options :bcrypt+sha512)
+              :password (codecs/str->bytes password))
+       (derive-password)
+       (format-password))))

 (defn check
   "Check if a unencrypted password matches


comment

comment

write some comment as document use English

--- src/clojure/sparkling/sql.clj
+++ src/clojure/sparkling/sql.clj
@@ -1,7 +1,6 @@
 (ns sparkling.sql
-  "封装了部分 spark sql api ，使之更符合 clojure 的风格。
-参数风格参考 sparkling，数据集尽量放在最后一个参数。read json 和 wrte json 与
-sparkling 的 text-file 和 save-as-text-file 一致。 "
+  "spark sql api for clojure. As sparkling.core, pass the sql context as last parameter.
+Read json or write json like sparkling.core/text-file or save-as-text-file."
   (:require [sparkling.function :as func])
   (:import [org.apache.spark.sql SQLContext]
            [org.apache.spark.sql functions]
@@ -108,12 +107,12 @@
   (.orderBy data-frame (into-array cols)))

 (defn order-by-cols
-  "根据给定的字段文本列表构造order by操作并调用"
+  "order by columns named by the columns parameter"
   [columns data-frame]
   (.orderBy data-frame (into-array (cols columns data-frame))))

 (defn register-udf1
-  "向 SQLContext 中注册 udf ，这个函数适配 java api udf1 。函数返回传入的 SQLContext。"
+  "register a user defined function match java api udf1 return SQLContext."
   [name func data-type sqlc]
   (-> sqlc
       .udf
@@ -121,7 +120,7 @@
   sqlc)

 (defn register-udf2
-  "向 SQLContext 中注册 udf ，这个函数适配 java api udf2 。函数返回传入的 SQLContext。"
+  "register a user defined function match java api udf2 return SQLContext."
   [name func data-type sqlc]
   (-> sqlc
       .udf
@@ -129,21 +128,21 @@
   sqlc)

 (defn json-rdd
-  "将 data frame 转为 json 格式的 java rdd"
+  "convert data frame as json java rdd"
   [data-frame]
   (-> data-frame
       .toJSON
       .toJavaRDD))

 (defn read-json
-  "将给定的 json 资源（文件路径或 rdd ）加载为 data-frame"
+  "read json (file in path or a java rdd) as data-frame"
   [sqlc data-source]
   (-> sqlc
       .read
       (.json data-source)))

 (defn write-json
-  "将给定的 data-frame 以 json 格式保存到指定路径。"
+  "save data-frame as json file to path"
   [data-source data-frame]
   (-> data-frame
       .write


CMR-615: Added support for validating content type.

--- src/cmr/search/api/routes.clj
+++ src/cmr/search/api/routes.clj
@@ -27,6 +27,10 @@
 (def CURL_CLIENT_ID "curl")
 (def UNKNOWN_CLIENT_ID "unknown")

+(def supported-content-types
+  "The content types supported by search"
+  #{"application/x-www-form-urlencoded"})
+
 (def extension->mime-type
   "A map of URL file extensions to the mime type they represent."
   {"json" "application/json"
@@ -232,7 +236,7 @@
         {:status 200}))
     (route/not-found "Not Found")))

-;; Copies the body into a new attributed called :body-copy so that after a post of form content type
+;; Copies the body into a new attribute called :body-copy so that after a post of form content type
 ;; the original body can still be read. The default ring params reads the body and parses it and we
 ;; don't have access to it.
 (defn copy-of-body-handler
@@ -243,11 +247,23 @@
                 :body-copy body
                 :body (java.io.ByteArrayInputStream. (.getBytes body)))))))

+;; Validates the content type of the request.
+(defn content-type-handler
+  [f]
+  (fn [request]
+    (println request)
+    (let [content-type (get-in request [:headers "content-type"])]
+      (if (get supported-content-types content-type)
+        (f request)
+        (svc-errors/throw-service-error :bad-request
+                                        (str "Unsupported content type [" content-type "]"))))))
+
 (defn make-api [system]
   (-> (build-routes system)
       (http-trace/build-request-context-handler system)
-      errors/exception-handler
       handler/site
       copy-of-body-handler
+      content-type-handler
+      errors/exception-handler
       ring-json/wrap-json-body
       ring-json/wrap-json-response))


Fix doc string example for on-start

Fix doc string example for on-start

--- src/com/palletops/leaven.cljx
+++ src/com/palletops/leaven.cljx
@@ -141,7 +141,7 @@

   {:on-start
     {:sub-comp1 (update-subcomponent :sub-comp2)
-     :sub-comp2 #(assoc-in %1 [:sub-comp2 :comp1] %3)}}
+     :sub-comp2 #(assoc-in %1 [:sub-comp3 :comp1] %3)}}

   A body can be supplied as used by defrecord, to implement extra
   protocols on the system."


Fixed whitespace

Fixed whitespace

--- src/overtunes/songs/canone_alla_quarta.clj
+++ src/overtunes/songs/canone_alla_quarta.clj
@@ -39,20 +39,23 @@
     (range a (inc b))
     (reverse (run b a))))

-(def call {:time (concat (repeat 2 1/4) [1/2] (repeat 14 1/4) [3/2])
-           :pitch (concat [0] (run -1 3) (run 2 0) [4] (run 1 8))})
+(def call
+  {:time (concat (repeat 2 1/4) [1/2] (repeat 14 1/4) [3/2])
+   :pitch (concat [0] (run -1 3) (run 2 0) [4] (run 1 8))})

-(def response {:time (concat (repeat 10 1/4) [1/2] (repeat 2 1/4) [9/4])
-               :pitch (concat (run 7 -1) [0] (run 0 -3))})
+(def response
+  {:time (concat (repeat 10 1/4) [1/2] (repeat 2 1/4) [9/4])
+   :pitch (concat (run 7 -1) [0] (run 0 -3))})

-(def development {:time (concat [3/4] (repeat 12 1/4) [1/2 1 1/2] (repeat 12 1/4) [3])
-               :pitch (concat [4] (run 4 -2) [-1 -2 0] (run 3 5) (repeat 3 1) [2] (run -1 1) [0 -1] (run 5 0))})
+(def development
+  {:time (concat [3/4] (repeat 12 1/4) [1/2 1 1/2] (repeat 12 1/4) [3])
+   :pitch (concat [4] (run 4 -2) [-1 -2 0] (run 3 5) (repeat 3 1) [2] (run -1 1) [0 -1] (run 5 0))})

 (defn lower [v] (- v 7))
 (def bass (update-all
-                           {:time (range 25)
-                           :pitch (map lower (mapcat (partial repeat 3) (concat (run 0 -3) (run -5 -3) [0 7])))}
-  [:pitch :time] natural-map ))
+            {:time (range 25)
+             :pitch (map lower (mapcat (partial repeat 3) (concat (run 0 -3) (run -5 -3) [0 7])))}
+            [:pitch :time] natural-map ))

 (defn subsequent [melody1 melody2]
   (merge-with concat melody1 melody2))
@@ -84,9 +87,9 @@
         after-a-half (after 1/2)
         with-sharps (update :pitch #(comp (sharps [12 22]) %))
         with-flats (update :pitch #(comp (flats [37]) %))]
-  (-> bass in-key with-beat melody#)
-   (-> melody after-a-half canone-alla-quarta in-key with-beat melody#)
-   (-> melody after-a-half in-key with-sharps with-flats with-beat melody#)
+    (-> bass in-key with-beat melody#)
+    (-> melody after-a-half canone-alla-quarta in-key with-beat melody#)
+    (-> melody after-a-half in-key with-sharps with-flats with-beat melody#)
     ))

 (play#)


Render date as 'Pending...' if value not present

--- src/cljs/org/broadinstitute/firecloud_ui/page/workspace/monitor/common.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/workspace/monitor/common.cljs
@@ -7,8 +7,10 @@

 (defn render-date [date]
-  (let [m (js/moment date)]
-    (str (.format m "L [at] LTS") " (" (.fromNow m) ")")))
+  (if date
+    (let [m (js/moment date)]
+      (str (.format m "L [at] LTS") " (" (.fromNow m) ")"))
+    [:span {:style {:fontStyle "oblique"}} "Pending..."]))

 (def wf-success-statuses #{"Succeeded"})


refactor; improve logging; remove obsolete comments

--- src/babel/francais/morphology.cljc
+++ src/babel/francais/morphology.cljc
@@ -210,11 +210,11 @@
               info (log/debug "get-string: input word: " word)]

           (log/trace (str "get-string: word: " word))
-          (log/debug (str "get-string: word (stripped-refs): " (strip-refs word)))
-          (log/debug (str "word's :a is a string? " (get-in word '(:a)) " => " (string? (get-in word '(:a)))))
-          (log/debug (str "word's :b is a map? " (get-in word '(:b)) " => " (map? (get-in word '(:b)))))
+          (log/trace (str "get-string: word (stripped-refs): " (strip-refs word)))
+          (log/trace (str "word's :a is a string? " (get-in word '(:a)) " => " (string? (get-in word '(:a)))))
+          (log/trace (str "word's :b is a map? " (get-in word '(:b)) " => " (map? (get-in word '(:b)))))

-          (log/debug (str "word's :a french is a string? " (get-in word '(:a :français)) " => " (string? (get-in word '(:a :français)))))
+          (log/trace (str "word's :a french is a string? " (get-in word '(:a :français)) " => " (string? (get-in word '(:a :français)))))

           (cond
             (= word :top) ".."
@@ -470,59 +470,36 @@
                                    ;; and the value is a list of lexemes for that string.
                                    (log/trace (str (first lexeme-kv) ": looking at path: " path))
                                    (mapcat (fn [lexeme]
-                                             ;; this is where a unify/dissoc that supported
-                                             ;; non-maps like :top and :fail, would be useful:
-                                             ;; would not need the (if (not (fail? lexeme)..)) check
-                                             ;; to avoid a difficult-to-understand
-                                             ;; "java.lang.ClassCastException: clojure.lang.Keyword
-                                             ;; cannot be cast to clojure.lang.IPersistentMap" error.
-                                             (log/debug "lexeme: " (get-in lexeme [:français :français]))
-                                             (log/debug " path: " path)
                                              (if-let [value (get-in lexeme path)]
                                                (log/debug " value@" path ": " value))
                                              (if (not (= ::none (get-in lexeme path ::none)))
                                                (let [exceptional-lexeme
                                                      (apply merge-fn (list lexeme))]
                                                  (log/debug " exceptional-lexeme: " exceptional-lexeme)
-                                                 (cond (or (seq? exceptional-lexeme)
-                                                           (vector? exceptional-lexeme))
-                                                       (map (fn [exceptional-lexeme]
-                                                              (log/debug " RESULT(in-list): " exceptional-lexeme)
-                                                              (log/debug "   conjugated:"
-                                                                         (get-in exceptional-lexeme
-                                                                                [:français :français]))
-                                                              (let [exceptional-lexeme
-                                                                    (unify
-                                                                     exceptional-lexeme
-                                                                     (dissoc-paths lexeme [path
-                                                                                [:français :français]])
-                                                                     {:français {:exception true}})]
-                                                                (log/debug " RESULT(in-list)1: "
-                                                                           (dissoc
-                                                                            exceptional-lexeme
-                                                                            :dag_unify.core/serialized))
-                                                                {(get-in exceptional-lexeme [:français :français])
-                                                                 exceptional-lexeme}))
-                                                            exceptional-lexeme)
-
-                                                       true
-                                                       (let [exceptional-lexeme
-                                                             (unify
-                                                              exceptional-lexeme
-                                                              (dissoc-paths lexeme [path
-                                                                                [:français :français]])
-                                                              {:français {:exception true}})]
-                                                         (log/debug " RESULT1: "
-                                                                    (unify
-                                                                     exceptional-lexeme
-                                                                     (dissoc-paths lexeme [path
-                                                                                [:français :français]])))
-                                                         (log/debug " RESULT2: "
-                                                                    (dissoc
-                                                                     exceptional-lexeme
-                                                                     :dag_unify.core/serialized))
-                                                         (list {(get-in exceptional-lexeme [:français :français])
-                                                                exceptional-lexeme}))))))
+                                                 (let [exceptional-lexemes
+                                                       (cond (or (seq? exceptional-lexeme)
+                                                                 (vector? exceptional-lexeme))
+                                                             exceptional-lexeme
+                                                             true [exceptional-lexeme])]
+                                                   (when (not (empty? exceptional-lexemes))
+                                                     (log/debug "infinitive: " (get-in lexeme [:français :français]))
+                                                     (log/debug " path: " path))
+                                                   (map (fn [exceptional-lexeme]
+                                                          (log/debug "   conjugated:"
+                                                                     (get-in exceptional-lexeme
+                                                                             [:français :français]))
+                                                          (let [exceptional-lexeme
+                                                                (unify
+                                                                 exceptional-lexeme
+                                                                 (dissoc-paths lexeme [path
+                                                                                [:français :français]])
+                                                                 {:français {:exception true}})
+                                                                surface
+                                                                (get-in exceptional-lexeme [:français :français])]
+                                                            (log/debug (str "  surface: " surface " => " (strip-refs exceptional-lexeme)))
+                                                            {surface
+                                                             exceptional-lexeme}))
+                                                        exceptional-lexemes)))))
                                            lexemes)))
                                [;; 1. past-tense exceptions
                                 {:path [:français :past-participle]


(declare fo)

(declare fo)

--- src/babel/italiano/morphology.cljc
+++ src/babel/italiano/morphology.cljc
@@ -1178,6 +1178,8 @@
            {:a (if (nil? a) :top a)
             :b (if (nil? b) :top b)}))))

+(declare fo)
+
 (defn fo-ps1 [expr]
   (let [head-first? (get-in expr [:first] :none)]
     (cond
@@ -1256,7 +1258,7 @@

      (and (map? expr)
           (:italiano expr))
-     (fo-ps-it (:italiano expr))
+     (fo-ps (:italiano expr))

      (and (map? expr)
           (:rule expr)


The meta-data function needs a path not a prodcution


Update to conversion docs.

Update to conversion docs.

--- src/clj/forma/conversion.clj
+++ src/clj/forma/conversion.clj
@@ -57,11 +57,15 @@
    (interval (date-time (year a))
              a)))

-;; the julian function complements the other "date-piece"
-;; functions supplied by the clj-time library; day, month, year, and
-;; the others each allow for extraction of that particular element of
-;; a date. We define the delta function to allow us to take the
-;; difference
+;; the julian function complements the other "date-piece" functions
+;; supplied by the clj-time library; day, month, year, and the others
+;; each allow for extraction of that particular element of a date. We
+;; define the delta function to allow us to take the difference of a
+;; specific date-piece between two dates.
+
+(defn delta [f a b] (- (f b) (f a)))
+
+;; For example,
 ;;
 ;;     (delta julian a b)
 ;;
@@ -70,8 +74,6 @@
 ;; year value of each of the dates. That function returns the same
 ;; value for a = Jan 1st, 2000, b = Feb 25th, 2000 and b = Feb 25th,
 ;; 2002.
-
-(defn delta [f a b] (- (f b) (f a)))

 (defn per-year
   "Calculates how many periods of the given span of supplied units can


Localize.

Localize.

--- src/clj/triangulate/core.clj
+++ src/clj/triangulate/core.clj
@@ -8,10 +8,10 @@
   (:import [polyline PolylineDecoder]
            [polyline Location]))

-(defn polyline []
+(defn polyline [src dst]
   (let [body (:body (client/get "http://maps.googleapis.com/maps/api/directions/json"
-                                {:query-params {:origin "Intersection of Main Street and Stephenson Street, Duryea, PA"
-                                                :destination "Intersection of Main Street and Phoenix Street, Duryea, PA"
+                                {:query-params {:origin src
+                                                :destination dst
                                                 :sensor false}}))]
     (-> (parse-string body true) :routes first :overview_polyline :points)))

@@ -23,7 +23,7 @@
         lon1 (:long a)
         lat2 (:lat b)
         lon2 (:long b)
-        R 6372800
+        radius-of-earth 6372800
         dlat (Math/toRadians (- lat2 lat1))
         dlon (Math/toRadians (- lon2 lon1))
         lat1 (Math/toRadians lat1)
@@ -31,7 +31,7 @@
         a (+ (* (Math/sin (/ dlat 2)) (Math/sin (/ dlat 2)))
              (* (Math/sin (/ dlon 2)) (Math/sin (/ dlon 2))
                 (Math/cos lat1) (Math/cos lat2)))]
-    (* R 2 (Math/asin (Math/sqrt a)))))
+    (* radius-of-earth 2 (Math/asin (Math/sqrt a)))))

 (defn interpolate-coordinates [a b c d]
   (let [lat1 (:lat a)
@@ -56,37 +56,22 @@
        n
        (recur tail distance (+ k head) (inc n)))))

-(def coordinates (reverse (decode-polyline (polyline))))
-
-(def meters-away 200)
-
-(def pairs (partition 2 1 coordinates))
-
-(def segments (map (fn [[a b]] (haversine a b)) pairs))
-
-(def back-segment (take-segments segments meters-away))
-
-(def front-segment (dec back-segment))
-
-(def back-distance (reduce + (take back-segment segments)))
-
-(def front-distance (reduce + (take front-segment segments)))
-
-(def back-coordinate (nth coordinates back-segment))
-
-(def front-coordinate (nth coordinates front-segment))
-
-(def distance-to-front-segment (- back-distance meters-away))
-
-(def target-to-front-segment (- meters-away front-distance))
-
-;;(pprint coordinates)
-
+(defn target-coordinates [src dst meters-away]
+  (let [coordinates (reverse (decode-polyline (polyline src dst)))
+        pairs (partition 2 1 coordinates)
+        segments (map (fn [[a b]] (haversine a b)) pairs)
+        back-segment (take-segments segments meters-away)
+        front-segment (dec back-segment)
+        front-distance (reduce + (take front-segment segments))
+        back-coordinate (nth coordinates back-segment)
+        front-coordinate (nth coordinates front-segment)
+        front-to-target (- meters-away front-distance)]
+    (interpolate-coordinates front-coordinate back-coordinate front-to-target meters-away)))

 (defroutes routes
   (POST "/rush-hour/api/triangulate/edn" {:keys [body]}
         (let [{:keys [src dst]} (read-string (slurp body))]
-          (pr-str {}))))
+          (pr-str {:coordinates (interpolate-coordinates)}))))

 (def app (wrap-params #'routes))


Remove print

Remove print

--- src/cljs/todogo_cljs/db.cljs
+++ src/cljs/todogo_cljs/db.cljs
@@ -65,7 +65,6 @@

 (defn prepare-todo [data]
   (let [todo (keywordize-keys data)]
-    (print (= (:dead_line_at todo) "0001-01-01T00:00:00Z") (:dead_line_at todo) "0001-01-01T00:00:00Z" todo)
     (if (= (:dead_line_at todo) "0001-01-01T00:00:00Z")
       (assoc todo :dead_line_at nil)
       (assoc todo :dead_line_at (f/parse custom-formatter-from (:dead_line_at todo))))))
@@ -115,7 +114,8 @@
                         (re-frame/dispatch [:set-user-login nil])
                         (nav! (str "/"))))
     :data data
-    :error-handler (fn [] (re-frame/dispatch [:set-form-errors {:error "Login or password is incorrect"}]))))
+    :error-handler (fn [] (re-frame/dispatch
+                            [:set-form-errors {:error "Login or password is incorrect"}]))))

 (defn sign-up [data]
   (api-call


Finish demo island fn

Finish demo island fn

--- src/cljx/robinson/prism.cljx
+++ src/cljx/robinson/prism.cljx
@@ -132,15 +132,15 @@
 (defn sample-island
   [n x y]
   (let [c  ((coerce (scale 4.3 (offset (vnoise n) (radius)))) x y)
-        c1 ((coerce (s+ -0.5 (offset [0.5 0.5] (scale 0.6 (noise n))))) x y)
-        c2 ((coerce (s+ -0.5 (offset [-110.5 -640.5] (scale 0.8 (noise n))))) x y)
-        cgt (> c1 c2)]
+        c1 ((coerce (offset [0.5 0.5] (scale 0.6 (snoise n)))) x y)
+        c2 ((coerce (offset [-110.5 -640.5] (scale 0.8 (snoise n)))) x y)
+        cgt #+clj (> (Math/abs c1) (Math/abs c2))
+            #+cljs (> (.abs js/Math c1) (.abs js/Math c2))]
     (cond
       ;; interior biomes
       (> 0.55  c)
         (cond
           (and (pos? c1) (pos? c2) cgt)
-          ;; interior jungle
           :jungle
           (and (pos? c1) (pos? c2))
           :heavy-forest


Allow printing of AsyncSeq

Allow printing of AsyncSeq

--- src/clj/momentum/core/deferred.clj
+++ src/clj/momentum/core/deferred.clj
@@ -10,7 +10,9 @@
     Pipeline
     Pipeline$Catcher
     Pipeline$Recur
-    Receiver]))
+    Receiver]
+   [java.io
+    Writer]))

 (defprotocol DeferredValue
   (receive   [_ success error]))
@@ -194,3 +196,7 @@
         (if-let [[v & more] seq]
           (cons (map-entry k v) (splice (assoc map k more)))
           (splice (dissoc map k)))))))
+
+(defmethod print-method AsyncSeq
+  [seq ^Writer w]
+  (.write w (str seq)))


Work around silly Windows and their backwards slashes.

--- src/clj/qualityclj/routes/repo.clj
+++ src/clj/qualityclj/routes/repo.clj
@@ -24,15 +24,15 @@
 (defn show-repo
   "Show the files from a particular repo."
   [user repo]
-  (let [files (db/source-files user repo)]
+  (let [files (db/source-files user repo)
+        files (map #(string/replace % #"\\" "/") files)]
     (layout/common
      [:div.container-fluid
       [:h2 (str user "/" repo)]
       (if (empty? files)
         [:p "No such repository."]
         [:ul#files
-         (for [file (map #(string/replace-first % repo-path "")
-                         (db/source-files user repo))]
+         (for [file (map #(string/replace-first % repo-path "") files)]
            [:li.file (link-to (str "/repo" file ".html") file)])])])))

 (defn serve-file


Ensure that the return val from js eval is always a string. Fixes errors when loading a file.

--- src/cljs/clojure/browser/repl.cljs
+++ src/cljs/clojure/browser/repl.cljs
@@ -25,7 +25,7 @@
   "Process a single block of JavaScript received from the server"
   [block]
   (log-obj (str "evaluating: " block))
-  (let [result (try {:status :success :value (js* "eval(~{block})")}
+  (let [result (try {:status :success :value (str (js* "eval(~{block})"))}
                     (catch js/Error e {:status :exception :value (pr-str e)}))]
     (log-obj (str "result: " result))
     (pr-str result)))


Minor: change initial dimensions so we get a nice centered mandelbrot on a normal screen

--- src/cljs/mandelbrot_cljs/core.cljs
+++ src/cljs/mandelbrot_cljs/core.cljs
@@ -9,10 +9,10 @@
   "Defines a rectangle (not necessarily of the same aspect ratio as the screen)
   in the complex plane to be displayed. This will then be centred on the screen
   using advanced maths."
-  {:x0             -3
-   :y0             1
-   :width          4
-   :height         2
+  {:x0             -1.6
+   :y0             1.2
+   :width          2
+   :height         2.4
    })

 (defonce app-state (atom {:canvas         (.getElementById js/document "canvas")


Fixing using correct number of argument, else binary data will fail with websockets.

--- src/clojure/nginx/clojure/core.clj
+++ src/clojure/nginx/clojure/core.clj
@@ -195,7 +195,7 @@
     (.addListener ch ch (proxy [WholeMessageAdapter] [max-message-size]
                           (onOpen [c] (if on-open (on-open c)))
                           (onWholeTextMessage [c msg] (if on-message (on-message c msg)))
-                          (onWholeBiniaryMessage [c msg rem?] (if on-message (on-message c msg)))
+                          (onWholeBiniaryMessage [c msg] (if on-message (on-message c msg)))
                           (onClose ;([c] (if on-close (on-close c "0")))
                                    ([c status reason] (if on-close (on-close c (str status ":" reason)))))
                           (onError [c status] (if on-error (on-error c (NginxClojureAsynSocket/errorCodeToString status)))))))


Fix a NullPointerException in nrepl-refactor.core/prefix

When a file contains the symbol '/ (e.g. `(/ 6 2)`), then `symbols-in-file`
through `fix-ns-of-backquoted-symbols` will try to find the prefix of that
symbol. The prefix function thinks the slash is a namespace separator, and
things blow up.

This seems to have been introduced in

3839db7 Fix clean-ns with namespaced keywords

Before (prefix '/) would simply return nil, this fix restores the old behavior.

--- src/refactor_nrepl/core.clj
+++ src/refactor_nrepl/core.clj
@@ -206,8 +206,9 @@
   clojure.walk/walk -> clojure.walk
   :clojure.core/kw -> kw"
   [fully-qualified-name]
-  (if(re-find #"/" (str fully-qualified-name))
-    (-> fully-qualified-name str (.split "/") first (str/replace #"^:" ""))
+  (if (re-find #"/" (str fully-qualified-name))
+    (when-let [ns-name (-> fully-qualified-name str (.split "/") first)]
+      (str/replace ns-name #"^:" ""))
     (let [parts (-> fully-qualified-name str (.split "\\.") butlast)]
       (when (seq parts)
         (str/join "." parts)))))


remove use of map-function-on-map-vals for clarity: simply call (into {})

--- src/babel/lexiconfn.cljc
+++ src/babel/lexiconfn.cljc
@@ -866,18 +866,21 @@

 ;; TODO: s/unifyc/unify/ for performance
 (defn constrain-vals [lexicon if-has-with-fn unify-with-fn]
-  (map-function-on-map-vals
-   lexicon
-   (fn [k vals]
-     (mapcat (fn [val]
-               (let [result (unifyc val (if-has-with-fn val))]
-                 (cond (not (fail? result))
-                       (do
-                         (log/debug (str val ": matches: if-has-with-fn: " if-has-with-fn " then " unify-with-fn))
-                         (list (unifyc val (unify-with-fn val))))
-                       true
-                       (list val))))
-             vals))))
+  (into {}
+        (map (fn [k]
+               [k
+                (map
+                 (fn [val]
+                   (let [result (unifyc val (if-has-with-fn val))]
+                     (cond (not (fail? result))
+                           (do
+                             (log/debug (str val ": matches: if-has-with-fn: "
+                                             if-has-with-fn " then " unify-with-fn))
+                             (unifyc val (unify-with-fn val)))
+                           true
+                           val)))
+                 (get lexicon k))])
+             (keys lexicon))))

 (defn get-fail-path [map1 map2]
   (if (and (map? map1)


wrap agr in {:synsem {:agr}}

wrap agr in {:synsem {:agr}}

--- src/babel/morphology.clj
+++ src/babel/morphology.clj
@@ -52,11 +52,11 @@
          (merge pattern
                 (let [{g :g agr :agr p :p u :u} pattern]
                   (let [u (unify unify-with
-                                 (or agr :top)
+                                 (if agr {:synsem {:agr agr}} :top)
                                  (or u :top))]
                     {:u u
                      :g g
-              :agr agr
+                     :agr agr
                      :p p}))))
        patterns))


Functions to determine whether meta-info represents a single-file or multi-file torrent.

--- src/bencode/metainfo.clj
+++ src/bencode/metainfo.clj
@@ -9,6 +9,16 @@
     (doseq [b byte-arr]
       (.append sb (.substring (Integer/toString (+ (bit-and b 0xff) 0x100) 16) 1)))
     (.toString sb)))
+
+(defn single-file-torrent?
+  "Returns whether meta-info represents a single-file torrent."
+  [meta-info]
+  (pos? (get-in meta-info ["info" "length"] 0)))
+
+(defn multi-file-torrent?
+  "Returns whether meta-info represents a multi-file torrent."
+  [meta-info]
+  (not (single-file-torrent? meta-info)))

 (defn torrent-piece-length
   "Returns the length of each piece, in bytes."


Fix preconditions for register style & config vars

Register style should also take a map, since some style things aren't
just plain vectors (animations, for example).

Register config var's name & docstring indicate that it takes a single
keyword, but is written to take a vector of keywords; changed to work
with a single keyword.

--- src/braid/core/core.cljc
+++ src/braid/core/core.cljc
@@ -57,7 +57,7 @@
      (defn register-styles!
        "Add Garden CSS styles to the page styles"
        [styles]
-       {:pre [(vector? styles)]}
+       {:pre [(or (vector? styles) (map? styles))]}
        (swap! braid.core.client.ui.views.styles/module-styles conj styles))

      (defn register-state!
@@ -83,10 +83,9 @@
    (do
      (defn register-config-var!
        "Add a keyword to be read from `env` and added to the `config` state"
-       [vars]
-       {:pre [(vector? vars)
-              (every? keyword? vars)]}
-       (swap! braid.core.server.conf/config-vars concat vars))
+       [var]
+       {:pre [(keyword? var)]}
+       (swap! braid.core.server.conf/config-vars conj var))

      (defn register-additional-script!
        "Add a javascript script tag to client html. Values can be a map with a `:src` or `:body` key or a function with no arguments, returing the same."


Default to UTF-8 instead of latin, and check the file.encoding property too

--- src/cake/tasks/swank.clj
+++ src/cake/tasks/swank.clj
@@ -14,7 +14,9 @@
           [socket socket, context context]
           (let [socket-serve     (ns-resolve 'swank.core.server 'socket-serve)
                 connection-serve (ns-resolve 'swank.swank 'connection-serve)
-                opts {:encoding (or (System/getProperty "swank.encoding") "iso-latin-1-unix")}]
+                opts {:encoding (or (some #(System/getProperty %)
+                                          ["swank.encoding" "file.encoding"])
+                                    "UTF-8")}]
             (eval (:swank-init *project*))
             (set-context! context)
             (socket-serve connection-serve socket opts)))))


Remove useless requirements

Remove useless requirements

--- src/cyanite_remover/path_store.clj
+++ src/cyanite_remover/path_store.clj
@@ -2,7 +2,6 @@
   (:require [clojurewerkz.elastisch.rest :as esr]
             [clojurewerkz.elastisch.rest.index :as esri]
             [clojurewerkz.elastisch.rest.document :as esrd]
-            [clojurewerkz.elastisch.rest.response :as esrr]
             [clojure.string :as str]
             [clojure.tools.logging :as log]
             [cyanite-remover.logging :as clog]))


Remember selected tab

Remember selected tab

--- src/day8/re_frame/trace.cljs
+++ src/day8/re_frame/trace.cljs
@@ -317,13 +317,13 @@
 (defn devtools []
   ;; Add clear button
   ;; Filter out different trace types
-  (let [position             (r/atom :right)
-        panel-width%         (r/atom (localstorage/get "panel-width-ratio" 0.35))
-        showing?             (r/atom (localstorage/get "show-panel" false))
-        dragging?            (r/atom false)
-        pin-to-bottom?       (r/atom true)
-        selected-tab         (r/atom :traces)
-        window-width         (r/atom js/window.innerWidth)
+  (let [position          (r/atom :right)
+        panel-width%      (r/atom (localstorage/get "panel-width-ratio" 0.35))
+        showing?          (r/atom (localstorage/get "show-panel" false))
+        dragging?         (r/atom false)
+        pin-to-bottom?    (r/atom true)
+        selected-tab      (r/atom (localstorage/get "selected-tab" :traces))
+        window-width      js/window.innerWidth
         handle-window-resize (fn [e]
                                ;; N.B. I don't think this should be a perf bottleneck.
                                (reset! window-width js/window.innerWidth))
@@ -356,6 +356,10 @@
                :update-show-panel
                (fn [_ _ _ new-state]
                  (localstorage/save! "show-panel" new-state)))
+    (add-watch selected-tab
+               :update-selected-tab
+               (fn [_ _ _ new-state]
+                 (localstorage/save! "selected-tab" new-state)))
     (r/create-class
       {:component-will-mount   (fn []
                                  (toggle-traces showing?)


Clarify this a bit

Clarify this a bit

--- web/src/immutant/web.clj
+++ web/src/immutant/web.clj
@@ -77,10 +77,11 @@
    switch of dispatching them to the worker thread pool, at the
    risk of refusing client requests under load.

-   When used inside WildFly, all handlers are mounted as servlets, so
-   any options specific to the web server are ignored (because WildFly
-   provides its own), and all invocations of `run` must be within the
-   initialization function for your application (your `-main`)"
+   Inside WildFly, the :host, :port, and :dispatch? options are
+   ignored, since all handlers are mounted as servlets contained within
+   WildFly's own Undertow instance. Further, all invocations of `run`
+   must be within the initialization function for your application,
+   i.e. your `-main`."
   [handler & options]
   (let [options (-> options
                   kwargs-or-map->map


fixing namespace parameter so it doesnt break keys

--- src/plugins/Scripts/Funimage/SpatialAnalysis/local_area_coverage.clj
+++ src/plugins/Scripts/Funimage/SpatialAnalysis/local_area_coverage.clj
@@ -1,14 +1,11 @@
-; @ImagePlus(label="Target image",description="Input image (will be binarized)") segments
-; @Integer(label="Radius",description="Coverage within a ball of this radius will be analyzed.",value=25) density-radius
-; @OUTPUT ImagePlus density-imp
-(ns plugins.Scripts.Funimage.SpatialAnalysis.local-area-coverage
+; @ImagePlus(label="Target image",description="Input image (will be binarized)") Funimage.SpatialAnalysis.local-area-coverage/segments
+; @Integer(label="Radius",description="Coverage within a ball of this radius will be analyzed.",value=25) Funimage.SpatialAnalysis.local-area-coverage/density-radius
+; @OUTPUT ImagePlus Funimage.SpatialAnalysis.local-area-coverage/density-imp
+(ns Funimage.SpatialAnalysis.local-area-coverage
   (:use [funimage img imp project conversion utils]
         [funimage.segmentation utils imp]
         [funimage.imp calibration roi threshold calculator statistics])
-  (:require [clojure.string :as string])
   (:import [net.imglib2.algorithm.neighborhood Neighborhood]
-           [ij IJ ImagePlus WindowManager]
-           ;[ij.gui WaitForUserDialog PointRoi NewImage PolygonRoi Roi GenericDialog NonBlockingGenericDialog Line]
            [ij.process ImageConverter FloatProcessor ByteProcessor]))

 ;Should check if density-radius is less than this


Fix bearer token

Fix bearer token

--- src/clj/ozwiena/core.clj
+++ src/clj/ozwiena/core.clj
@@ -29,15 +29,14 @@

 (defn get-bearer [key secret]
   (let [auth (base64 (str key ":" secret))]
-    (prn auth)
     (client/post "https://api.twitter.com/oauth2/token"
                  {:headers {"Authorization" (str "Basic " auth)}
                   :content-type "application/x-www-form-urlencoded;charset=UTF-8"
                   :body "grant_type=client_credentials"})))

-(let [key (env :twitter-key)
-      secret (env :twitter-secret)]
-  (def bearer (if (and key secret)
+(def bearer (let [key (env :twitter-key)
+                  secret (env :twitter-secret)]
+              (if (and key secret)
                 (:access_token (get-bearer key secret)))))

 (defn- log [msg & vals]
@@ -52,6 +51,7 @@
 (defn twitter-search [query]
   (let [url (str "https://api.twitter.com/1.1/search/tweets.json?"
                  (encode-params query))]
+    (prn bearer)
     (client/get url
                 {:headers {"Authorization" (str "Bearer " bearer)}
                  :as :json})))


bugfix

bugfix

--- src/tango/import_engine.clj
+++ src/tango/import_engine.clj
@@ -59,7 +59,7 @@
                                                     excluded-rounds
                                                     recalled-html
                                                     spit)]
-                           (write-excluded-rounds excluded-rounds))
+                           (write-excluded-rounds new-excluded-rounds))
                          (log/info recalled-html)
                          (async/put! out-channel (merge message {:topic   :file/imported
                                                                  :payload import-result})))))


Port sandbox to Clojure

Port sandbox to Clojure

--- src/test_utils/sandbox.cljc
+++ src/test_utils/sandbox.cljc
@@ -1,6 +1,8 @@
 (ns test-utils.sandbox
-  (:require [test-utils.core :as tuc]
-            [test-utils.word-source :as ws]))
+  #?(:cljs (:require [test-utils.core :as tuc]
+                     [test-utils.word-source :as ws])
+     :clj (:require (test-utils [core :as tuc]
+                                [word-source :as ws]))))

 ;; Stuff I'm trying out

@@ -104,7 +106,7 @@
                      (tuc/draw-normal z 4)]))]
     (iterate next-fn [md x y z])))

-(defn typical-treatment-time-range
+(defn typical-treatment-time-range
   ([]
    (let [[year-0 month-0 day-0 hour-0 minute-0 second-0 :as start] (tuc/rand-timestamp 2016 2026)
          duration-hours (tuc/draw-normal 2.52 0.17)
@@ -112,7 +114,7 @@
          duration-minute (int (* 60 (- duration-hours duration-hour)))
          duration-seconds (rand-nth (range 60))]
     [start
-     [year-0 month-0 day-0
+     [year-0 month-0 day-0
       (rem (+ hour-0 duration-hour) 24)
       (rem (+ minute-0 duration-minute) 60)
       duration-seconds]]))
@@ -122,9 +124,9 @@
          start-duration-h (int start-duration)
          start-duration-min (int (* 60 (- start-duration start-duration-h)))
          start-duration-s (rand-nth (range 60))
-         start [start-a start-mo start-d
-                (rem (+ start-h start-duration-h) 24)
-                (rem (+ start-min start-duration-min) 60)
+         start [start-a start-mo start-d
+                (rem (+ start-h start-duration-h) 24)
+                (rem (+ start-min start-duration-min) 60)
                 start-duration-h]
          stop-duration (tuc/draw-normal 2.52 0.17)
          stop-duration-h (int stop-duration)
@@ -136,7 +138,7 @@
                stop-duration-s]]
      [start stop])))

-(defn treatment-times
+(defn treatment-times
   ([] (treatment-times (typical-treatment-time-range)))
   ([start-treatment-time-range]
    (let [[start-0 stop-0] start-treatment-time-range
@@ -155,7 +157,7 @@
                     [top bottom]))]
     (iterate next-fn extent-0)))

-(defn typical-interwell-distance [plot-angle]
+(defn typical-inter-well-distance [plot-angle]
   (let [euclidean-distance (tuc/draw-normal 874 37)
         x-distance (* euclidean-distance (Math/cos (* (/ (+ plot-angle 90) 180) #?(:cljs Math.PI))))
         y-distance (* euclidean-distance (Math/sin (* (/ (+ plot-angle 90) 180) #?(:cljs Math.PI))))]
@@ -375,12 +377,12 @@
          (value-from-typical-range 0.2 10)))

 (defn rand-uwi []
-  (apply str
-         (interpose "-"
+  (apply str
+         (interpose "-"
                     (map str [(two-digit-zero-pad (tuc/rand-2))
                               (tuc/rand-3)
                               (tuc/rand-5)
-                              (two-digit-zero-pad (tuc/rand-2))
+                              (two-digit-zero-pad (tuc/rand-2))
                               (two-digit-zero-pad (tuc/rand-2))]))))

 (defn rand-sensor-id []


ns update

ns update

--- src/v/hophacks2016/rake.clj
+++ src/v/hophacks2016/rake.clj
@@ -1,4 +1,4 @@
-(ns hophacks2016.rake)
+(ns v.hophacks2016.rake)

 (defn is-number [txt]
   (re-matches #"\d+(?:\.\d+)?" txt))


Make let-later more readable with a letfn

--- src/flatland/useful/utils.clj
+++ src/flatland/useful/utils.clj
@@ -227,22 +227,26 @@

    will only evaluate (do-stuff) if (whatever) is true."
   [bindings & body]
-  (reduce (fn [body [name val]]
-            (if (:delay (meta name))
-              (if (symbol? name)
-                (let [delay-sym (gensym (str "delay-" name))]
-                  `(let [~delay-sym (delay ~val)]
-                     (symbol-macrolet [~name (force ~delay-sym)]
-                       ~body)))
-                `(let-later [~@(apply concat
-                                      (for [[k v] (partition 2 (destructure [name val]))]
-                                        [(vary-meta k assoc :delay true)
-                                         v]))]
-                   ~body))
-              `(let [~name ~val]
-                 ~body)))
-          `(do ~@body)
-          (reverse (partition 2 bindings))))
+  (letfn [(let-delayed [body name val]
+            (let [delay-sym (gensym (str "delay-" name))]
+              `(let [~delay-sym (delay ~val)]
+                 (symbol-macrolet [~name (force ~delay-sym)]
+                   ~body))))
+          (destructure-delayed [body name val]
+            `(let-later [~@(apply concat
+                                  (for [[k v] (partition 2 (destructure [name val]))]
+                                    [(vary-meta k assoc :delay true)
+                                     v]))]
+               ~body))]
+    (reduce (fn [body [name val]]
+              (if (:delay (meta name))
+                (if (symbol? name)
+                  (let-delayed body name val)
+                  (destructure-delayed body name val))
+                `(let [~name ~val]
+                   ~body)))
+            `(do ~@body)
+            (reverse (partition 2 bindings)))))

 (defn copy-meta
   "Copy all the metadata from src to dest."


Don't know who put these dang tabs here, but they're spaces now

--- src/foreclojure/data_set.clj
+++ src/foreclojure/data_set.clj
@@ -5,83 +5,83 @@
   (do
     (mongo! :db :mydb)
     (insert! :problems
-	     {:_id 1
-	      :title "Nothing but the Truth"
-	      :times-solved 0
-	      :description "This is a clojure form.  Enter a value which will make the form evaluate to true.  Don't over think it!  If you are confused, see the getting started page."
-	      :tags ["elementary"]
-	      :tests ["(= __ true)"]})
-
-    (insert! :problems
-	     {:_id 2
-	      :title "Simple Math"
-	      :times-solved 0
-	      :description "If you are not familiar with polish notation, simple arithmetic might seem confusing."
-	      :tags ["elementary"]
-	      :tests ["(= (- 10 (* 2 3)) __)"]})
-
-    (insert! :problems
-	     {:_id 3
-	      :title "Intro to Strings"
-	      :times-solved 0
-	      :description "Clojure strings are Java strings.  This means that you can use any of the Java string methods on Clojure strings."
-	      :tags["elementary"]
-	      :tests ["(= __ (.toUpperCase \"hello world\"))"]})
-
-
-    (insert! :problems
-	     {:_id 4
-	      :title "Intro to Lists"
-	      :times-solved 0
-	      :description "Lists can be constructed with either a function or a quoted form."
-	      :tags["elementary"]
-	      :tests ["(= (list __) '(:a :b :c))"]})
-
-    (insert! :problems
-	     {:_id 5
-	      :title "Lists: conj"
-	      :times-solved 0
-	      :description "When operating on a list, the conj function will return a new list with one or more items \"added\" to the front."
-	      :tags["elementary"]
-	      :tests ["(= __ (conj '(2 3 4) 1))"
-		      "(= __ (conj '(3 4) 2 1))"]})
-
-    (insert! :problems
-	     {:_id 6
-	      :title "Intro to Vectors"
-	      :times-solved 0
-	      :description "Vectors can be constructed several ways.  You can compare them with lists."
-	      :tags["elementary"]
-	      :tests ["(= [__] (list :a :b :c) (vec '(:a :b :c)) (vector :a :b :c))"]})
-
-    (insert! :problems
-	     {:_id 7
-	      :title "Vectors: conj"
-	      :times-solved 0
-	      :description "When operating on a Vector, the conj function will return a new vector with one or more items \"added\" to the end."
-	      :tags["elementary"]
-	      :tests ["(= __ (conj [1 2 3] 4))"
-		      "(= __ (conj [1 2] 3 4))"]})
-
-
-    (insert! :problems
-	     {:_id 8
-	      :title "Intro to Sets"
-	      :times-solved 0
-	      :description "Sets are collections of unique values."
-	      :tags["elementary"]
-	      :tests ["(= __ (set '(:a :a :b :c :c :c :c :d :d)))"
-		      "(= __ (clojure.set/union #{:a :b :c} #{:b :c :d}))"]})
-
-    (insert! :problems
-	     {:_id 9
-	      :title "Sets: conj"
-	      :times-solved 0
-	      :description "When operating on a set, the conj function returns a new set with one or more keys \"added\"."
-	      :tags["elementary"]
-	      :tests ["(= #{1 2 3 4} (conj #{1 4 3} __))"]})
-
-
+             {:_id 1
+              :title "Nothing but the Truth"
+              :times-solved 0
+              :description "This is a clojure form.  Enter a value which will make the form evaluate to true.  Don't over think it!  If you are confused, see the getting started page."
+              :tags ["elementary"]
+              :tests ["(= __ true)"]})
+
+    (insert! :problems
+             {:_id 2
+              :title "Simple Math"
+              :times-solved 0
+              :description "If you are not familiar with polish notation, simple arithmetic might seem confusing."
+              :tags ["elementary"]
+              :tests ["(= (- 10 (* 2 3)) __)"]})
+
+    (insert! :problems
+             {:_id 3
+              :title "Intro to Strings"
+              :times-solved 0
+              :description "Clojure strings are Java strings.  This means that you can use any of the Java string methods on Clojure strings."
+              :tags["elementary"]
+              :tests ["(= __ (.toUpperCase \"hello world\"))"]})
+
+
+    (insert! :problems
+             {:_id 4
+              :title "Intro to Lists"
+              :times-solved 0
+              :description "Lists can be constructed with either a function or a quoted form."
+              :tags["elementary"]
+              :tests ["(= (list __) '(:a :b :c))"]})
+
+    (insert! :problems
+             {:_id 5
+              :title "Lists: conj"
+              :times-solved 0
+              :description "When operating on a list, the conj function will return a new list with one or more items \"added\" to the front."
+              :tags["elementary"]
+              :tests ["(= __ (conj '(2 3 4) 1))"
+                      "(= __ (conj '(3 4) 2 1))"]})
+
+    (insert! :problems
+             {:_id 6
+              :title "Intro to Vectors"
+              :times-solved 0
+              :description "Vectors can be constructed several ways.  You can compare them with lists."
+              :tags["elementary"]
+              :tests ["(= [__] (list :a :b :c) (vec '(:a :b :c)) (vector :a :b :c))"]})
+
+    (insert! :problems
+             {:_id 7
+              :title "Vectors: conj"
+              :times-solved 0
+              :description "When operating on a Vector, the conj function will return a new vector with one or more items \"added\" to the end."
+              :tags["elementary"]
+              :tests ["(= __ (conj [1 2 3] 4))"
+                      "(= __ (conj [1 2] 3 4))"]})
+
+
+    (insert! :problems
+             {:_id 8
+              :title "Intro to Sets"
+              :times-solved 0
+              :description "Sets are collections of unique values."
+              :tags["elementary"]
+              :tests ["(= __ (set '(:a :a :b :c :c :c :c :d :d)))"
+                      "(= __ (clojure.set/union #{:a :b :c} #{:b :c :d}))"]})
+
+    (insert! :problems
+             {:_id 9
+              :title "Sets: conj"
+              :times-solved 0
+              :description "When operating on a set, the conj function returns a new set with one or more keys \"added\"."
+              :tags["elementary"]
+              :tests ["(= #{1 2 3 4} (conj #{1 4 3} __))"]})
+
+
     (insert! :problems
            {:_id 10
             :title "Intro to Maps"
@@ -90,44 +90,44 @@
             :tags["elementary"]
             :tests ["(= __ ((hash-map :a 10, :b 20, :c 30) :b))"
                     "(= __ (:b {:a 10, :b 20, :c 30}))"]})
-
-    (insert! :problems
-	     {:_id 11
-	      :title "Maps: conj"
-	      :times-solved 0
-	      :description "When operating on a map, the conj function returns a new map with one or more key-value pairs \"added\"."
-	      :tags["elementary"]
-	      :tests ["(= {:a 1, :b 2, :c 3} (conj {:a 1} __ [:c 3]))"]})
-
-    (insert! :problems
-	     {:_id 12
-	      :title "Intro to Sequences"
-	      :times-solved 0
-	      :description "All Clojure collections support sequencing.  You can operate on sequences with functions like first, second, and last."
-	      :tags["elementary"]
-	      :tests ["(= __ (first '(3 2 1)))"
-		      "(= __ (second [2 3 4]))"
-		      "(= __ (last (list 1 2 3)))"]})
-
-    (insert! :problems
-	     {:_id 13
-	      :title "Sequences: rest"
-	      :times-solved 0
-	      :description "The rest function will return all the items of a sequence except the first."
-	      :tags["elementary"]
-	      :tests ["(= __ (rest [10 20 30 40]))"]})
-
-    (insert! :problems
-	     {:_id 14
-	      :title "Intro to Functions"
-	      :times-solved 0
-	      :description "Clojure has many different ways to create functions."
-	      :tags["elementary"]
-	      :tests ["(= __ ((fn add-five [x] (+ x 5)) 3))"
-		      "(= __ ((fn [x] (+ x 5)) 3))"
-		      "(= __ (#(+ % 5) 3))"
-		      "(= __ ((partial + 5) 3))"]})
-
+
+    (insert! :problems
+             {:_id 11
+              :title "Maps: conj"
+              :times-solved 0
+              :description "When operating on a map, the conj function returns a new map with one or more key-value pairs \"added\"."
+              :tags["elementary"]
+              :tests ["(= {:a 1, :b 2, :c 3} (conj {:a 1} __ [:c 3]))"]})
+
+    (insert! :problems
+             {:_id 12
+              :title "Intro to Sequences"
+              :times-solved 0
+              :description "All Clojure collections support sequencing.  You can operate on sequences with functions like first, second, and last."
+              :tags["elementary"]
+              :tests ["(= __ (first '(3 2 1)))"
+                      "(= __ (second [2 3 4]))"
+                      "(= __ (last (list 1 2 3)))"]})
+
+    (insert! :problems
+             {:_id 13
+              :title "Sequences: rest"
+              :times-solved 0
+              :description "The rest function will return all the items of a sequence except the first."
+              :tags["elementary"]
+              :tests ["(= __ (rest [10 20 30 40]))"]})
+
+    (insert! :problems
+             {:_id 14
+              :title "Intro to Functions"
+              :times-solved 0
+              :description "Clojure has many different ways to create functions."
+              :tags["elementary"]
+              :tests ["(= __ ((fn add-five [x] (+ x 5)) 3))"
+                      "(= __ ((fn [x] (+ x 5)) 3))"
+                      "(= __ (#(+ % 5) 3))"
+                      "(= __ ((partial + 5) 3))"]})
+
     (insert! :problems
            {:_id 15
             :title "Double Down"
@@ -138,45 +138,45 @@
                     "(= (__ 3) 6)"
                     "(= (__ 11) 22)"
                     "(= (__ 7) 14)"]})
-
-    (insert! :problems
-	     {:_id 16
-	      :title "Hello World"
-	      :times-solved 0
-	      :description "Write a function which returns a personalized greeting."
-
-	      :tags ["elementary"]
-	      :tests ["(= (__ \"Dave\") \"Hello, Dave!\")"
-		      "(= (__ \"Jenn\") \"Hello, Jenn!\")"
+
+    (insert! :problems
+             {:_id 16
+              :title "Hello World"
+              :times-solved 0
+              :description "Write a function which returns a personalized greeting."
+
+              :tags ["elementary"]
+              :tests ["(= (__ \"Dave\") \"Hello, Dave!\")"
+                      "(= (__ \"Jenn\") \"Hello, Jenn!\")"
                       "(= (__ \"Rhea\") \"Hello, Rhea!\")"]})
-
-    (insert! :problems
-	     {:_id 17
-	      :title "Sequences: map"
-	      :times-solved 0
-	      :description "The map function takes two arguments: a function (f) and a sequence (s).  Map returns a new sequence consisting of the result of applying f to each item of s.  Do not confuse the map function with the map data structure."
-	      :tags["elementary"]
-	      :tests ["(= __ (map #(+ % 5) '(1 2 3)))"]})
-
-    (insert! :problems
-	     {:_id 18
-	      :title "Sequences: filter"
-	      :times-solved 0
-	      :description "The filter function takes two arguments: a predicate function (f) and a sequence (s).  Filter returns a new sequence consisting of all the items of s for which (f item) returns true."
-	      :tags["elementary"]
-	      :tests ["(= __ (filter #(> % 5) '(3 4 5 6 7)))"]})
-
-    (insert! :problems
-	     {:_id 19
-	      :title "Last Element"
-	      :times-solved 0
-	      :restricted ["last"]
-	      :description "Write a function which returns the last element in a sequence."
-	      :tags ["easy" "seqs" "core-functions"]
-	      :tests ["(= (__ [1 2 3 4 5]) 5)"
-		      "(= (__ '(5 4 3)) 3)"
+
+    (insert! :problems
+             {:_id 17
+              :title "Sequences: map"
+              :times-solved 0
+              :description "The map function takes two arguments: a function (f) and a sequence (s).  Map returns a new sequence consisting of the result of applying f to each item of s.  Do not confuse the map function with the map data structure."
+              :tags["elementary"]
+              :tests ["(= __ (map #(+ % 5) '(1 2 3)))"]})
+
+    (insert! :problems
+             {:_id 18
+              :title "Sequences: filter"
+              :times-solved 0
+              :description "The filter function takes two arguments: a predicate function (f) and a sequence (s).  Filter returns a new sequence consisting of all the items of s for which (f item) returns true."
+              :tags["elementary"]
+              :tests ["(= __ (filter #(> % 5) '(3 4 5 6 7)))"]})
+
+    (insert! :problems
+             {:_id 19
+              :title "Last Element"
+              :times-solved 0
+              :restricted ["last"]
+              :description "Write a function which returns the last element in a sequence."
+              :tags ["easy" "seqs" "core-functions"]
+              :tests ["(= (__ [1 2 3 4 5]) 5)"
+                      "(= (__ '(5 4 3)) 3)"
                       "(= (__ [\"b\" \"c\" \"d\"]) \"d\")"]})
-
+
     (insert! :problems
              {:_id 20
               :title "Penultimate Element"
@@ -186,163 +186,163 @@
               :tests ["(= (__ (list 1 2 3 4 5)) 4)"
                       "(= (__ [\"a\" \"b\" \"c\"]) \"b\")"
                       "(= (__ [[1 2] [3 4]]) [1 2])"]})
-
-    (insert! :problems
-	     {:_id 21
-	      :title "Nth Element"
-	      :times-solved 0
-	      :restricted ["nth"]
-	      :description "Write a function which returns the Nth element from a sequence."
-	      :tags["easy" "seqs" "core-functions"]
-	      :tests ["(= (__ '(4 5 6 7) 2) 6)"
-		      "(= (__ [:a :b :c] 0) :a)"
-		      "(= (__ [1 2 3 4] 1) 2)"
+
+    (insert! :problems
+             {:_id 21
+              :title "Nth Element"
+              :times-solved 0
+              :restricted ["nth"]
+              :description "Write a function which returns the Nth element from a sequence."
+              :tags["easy" "seqs" "core-functions"]
+              :tests ["(= (__ '(4 5 6 7) 2) 6)"
+                      "(= (__ [:a :b :c] 0) :a)"
+                      "(= (__ [1 2 3 4] 1) 2)"
                       "(= (__ '([1 2] [3 4] [5 6]) 2) [5 6])"]})
-
-    (insert! :problems
-	     {:_id 22
-	      :title "Count a Sequence"
-	      :times-solved 0
-	      :restricted ["count"]
-	      :description "Write a function which returns the total number of elements in a sequence."
-	      :tags["easy" "seqs" "core-functions"]
-	      :tests ["(= (__ '(1 2 3 3 1)) 5)"
-		      "(= (__ \"Hello World\") 11)"
-		      "(= (__ [[1 2] [3 4] [5 6]]) 3)"
+
+    (insert! :problems
+             {:_id 22
+              :title "Count a Sequence"
+              :times-solved 0
+              :restricted ["count"]
+              :description "Write a function which returns the total number of elements in a sequence."
+              :tags["easy" "seqs" "core-functions"]
+              :tests ["(= (__ '(1 2 3 3 1)) 5)"
+                      "(= (__ \"Hello World\") 11)"
+                      "(= (__ [[1 2] [3 4] [5 6]]) 3)"
                       "(= (__ '(13)) 1)"
                       "(= (__ '(:a :b :c)) 3)"]})
-
-    (insert! :problems
-	     {:_id 23
-	      :title "Reverse a Sequence"
-	      :times-solved 0
-	      :restricted ["reverse"]
-	      :description "Write a function which reverses a sequence."
-	      :tags["easy" "seqs" "core-functions"]
-	      :tests ["(= (__ [1 2 3 4 5]) [5 4 3 2 1])"
-		      "(= (__ (sorted-set 5 7 2 7)) '(7 5 2))"
+
+    (insert! :problems
+             {:_id 23
+              :title "Reverse a Sequence"
+              :times-solved 0
+              :restricted ["reverse"]
+              :description "Write a function which reverses a sequence."
+              :tags["easy" "seqs" "core-functions"]
+              :tests ["(= (__ [1 2 3 4 5]) [5 4 3 2 1])"
+                      "(= (__ (sorted-set 5 7 2 7)) '(7 5 2))"
                       "(= (__ [[1 2][3 4][5 6]]) [[5 6][3 4][1 2]])"]})
-
-    (insert! :problems
-	     {:_id 24
-	      :title "Sum It All Up"
-	      :times-solved 0
-	      :description "Write a function which returns the sum of a sequence of numbers."
-	      :tags ["easy" "seqs"]
-	      :tests ["(= (__ [1 2 3]) 6)"
-		      "(= (__ (list 0 -2 5 5)) 8)"
-		      "(= (__ #{4 2 1}) 7)"
+
+    (insert! :problems
+             {:_id 24
+              :title "Sum It All Up"
+              :times-solved 0
+              :description "Write a function which returns the sum of a sequence of numbers."
+              :tags ["easy" "seqs"]
+              :tests ["(= (__ [1 2 3]) 6)"
+                      "(= (__ (list 0 -2 5 5)) 8)"
+                      "(= (__ #{4 2 1}) 7)"
                       "(= (__ '(0 0 -1)) -1)"
                       "(= (__ '(1 10 3)) 14)"]})
-
-    (insert! :problems
-	     {:_id 25
-	      :title "Find the odd numbers"
-	      :times-solved 0
-	      :description "Write a function which returns only the odd numbers from a sequence."
-	      :tags["easy" "seqs"]
-	      :tests ["(= (__ #{1 2 3 4 5}) '(1 3 5))"
-		      "(= (__ [4 2 1 6]) '(1))"
+
+    (insert! :problems
+             {:_id 25
+              :title "Find the odd numbers"
+              :times-solved 0
+              :description "Write a function which returns only the odd numbers from a sequence."
+              :tags["easy" "seqs"]
+              :tests ["(= (__ #{1 2 3 4 5}) '(1 3 5))"
+                      "(= (__ [4 2 1 6]) '(1))"
                       "(= (__ [2 2 4 6]) '())"
                       "(= (__ [1 1 1 3]) '(1 1 1 3))"]})
-
-    (insert! :problems
-	     {:_id 26
-	      :title "Fibonacci Sequence"
-	      :times-solved 0
-	      :description "Write a function which returns the first X fibonacci numbers."
-	      :tags["easy" "Fibonacci" "seqs"]
-	      :tests ["(= (__ 3) '(1 1 2))"
-		      "(= (__ 6) '(1 1 2 3 5 8))"
+
+    (insert! :problems
+             {:_id 26
+              :title "Fibonacci Sequence"
+              :times-solved 0
+              :description "Write a function which returns the first X fibonacci numbers."
+              :tags["easy" "Fibonacci" "seqs"]
+              :tests ["(= (__ 3) '(1 1 2))"
+                      "(= (__ 6) '(1 1 2 3 5 8))"
                       "(= (__ 8) '(1 1 2 3 5 8 13 21))"]})
-
-    (insert! :problems
-	     {:_id 27
-	      :title "Palindrome Detector"
-	      :times-solved 0
-	      :description "Write a function which returns true if the given sequence is a palindrome.

+
+    (insert! :problems
+             {:_id 27
+              :title "Palindrome Detector"
+              :times-solved 0
+              :description "Write a function which returns true if the given sequence is a palindrome.

                 Hint: \"racecar\" does not equal '(\\r \\a \\c \\e \\c \\a \\r)"
-	      :tags["easy" "seqs"]
-	      :tests ["(false? (__ '(1 2 3 4 5)))"
-		      "(true? (__ \"racecar\"))"
-		      "(true? (__ [:foo :bar :foo]))"
+              :tags["easy" "seqs"]
+              :tests ["(false? (__ '(1 2 3 4 5)))"
+                      "(true? (__ \"racecar\"))"
+                      "(true? (__ [:foo :bar :foo]))"
                       "(true? (__ '(1 1 3 3 1 1)))"
                       "(false? (__ '(:a :b :c)))"]})
-
-    (insert! :problems
-	     {:_id 28
-	      :title "Flatten a Sequence"
-	      :times-solved 0
-	      :restricted ["flatten"]
-	      :description "Write a function which flattens a sequence."
-
-	      :tags["easy" "seqs" "core-functions"]
-	      :tests ["(= (__ '((1 2) 3 [4 [5 6]])) '(1 2 3 4 5 6))"
-		      "(= (__ [\"a\" [\"b\"] \"c\"]) '(\"a\" \"b\" \"c\"))"
+
+    (insert! :problems
+             {:_id 28
+              :title "Flatten a Sequence"
+              :times-solved 0
+              :restricted ["flatten"]
+              :description "Write a function which flattens a sequence."
+
+              :tags["easy" "seqs" "core-functions"]
+              :tests ["(= (__ '((1 2) 3 [4 [5 6]])) '(1 2 3 4 5 6))"
+                      "(= (__ [\"a\" [\"b\"] \"c\"]) '(\"a\" \"b\" \"c\"))"
                       "(= (__ '((((:a))))) '(:a))"]})
-
-    (insert! :problems
-	     {:_id 29
-	      :title "Get the Caps"
-	      :times-solved 0
-	      :description "Write a function which takes a string and returns a new string containing only the capital letters."
-	      :tags["easy" "strings"]
-	      :tests ["(= (__ \"HeLlO, WoRlD!\") \"HLOWRD\")"
-		      "(empty? (__ \"nothing\"))"
+
+    (insert! :problems
+             {:_id 29
+              :title "Get the Caps"
+              :times-solved 0
+              :description "Write a function which takes a string and returns a new string containing only the capital letters."
+              :tags["easy" "strings"]
+              :tests ["(= (__ \"HeLlO, WoRlD!\") \"HLOWRD\")"
+                      "(empty? (__ \"nothing\"))"
                       "(= (__ \"$#A(*&987Zf\") \"AZ\")"]})
-
-    (insert! :problems
-	     {:_id 30
-	      :title "Compress a Sequence"
-	      :times-solved 0
-	      :description "Write a function which removes consecutive duplicates from a sequence."
-	      :tags ["easy" "seqs"]
-	      :tests ["(= (apply str (__ \"Leeeeeerrroyyy\")) \"Leroy\")"
-		      "(= (__ [1 1 2 3 3 2 2 3]) '(1 2 3 2 3))"
+
+    (insert! :problems
+             {:_id 30
+              :title "Compress a Sequence"
+              :times-solved 0
+              :description "Write a function which removes consecutive duplicates from a sequence."
+              :tags ["easy" "seqs"]
+              :tests ["(= (apply str (__ \"Leeeeeerrroyyy\")) \"Leroy\")"
+                      "(= (__ [1 1 2 3 3 2 2 3]) '(1 2 3 2 3))"
                       "(= (__ [[1 2] [1 2] [3 4] [1 2]]) '([1 2] [3 4] [1 2]))"]})
-
-    (insert! :problems
-	     {:_id 31
-	      :title "Pack a Sequence"
-	      :times-solved 0
-	      :description "Write a function which packs consecutive duplicates into sub-lists."
-	      :tags ["easy" "seqs"]
-	      :tests ["(= (__ [1 1 2 1 1 1 3 3]) '((1 1) (2) (1 1 1) (3 3)))"
-		      "(= (__ [:a :a :b :b :c]) '((:a :a) (:b :b) (:c)))"
+
+    (insert! :problems
+             {:_id 31
+              :title "Pack a Sequence"
+              :times-solved 0
+              :description "Write a function which packs consecutive duplicates into sub-lists."
+              :tags ["easy" "seqs"]
+              :tests ["(= (__ [1 1 2 1 1 1 3 3]) '((1 1) (2) (1 1 1) (3 3)))"
+                      "(= (__ [:a :a :b :b :c]) '((:a :a) (:b :b) (:c)))"
                       "(= (__ [[1 2] [1 2] [3 4]]) '(([1 2] [1 2]) ([3 4])))"]})
-
-    (insert! :problems
-	     {:_id 32
-	      :title "Duplicate a Sequence"
-	      :times-solved 0
-	      :description "Write a function which duplicates each element of a sequence."
-	      :tags ["easy" "seqs"]
-	      :tests ["(= (__ [1 2 3]) '(1 1 2 2 3 3))"
-		      "(= (__ [:a :a :b :b]) '(:a :a :a :a :b :b :b :b))"
+
+    (insert! :problems
+             {:_id 32
+              :title "Duplicate a Sequence"
+              :times-solved 0
+              :description "Write a function which duplicates each element of a sequence."
+              :tags ["easy" "seqs"]
+              :tests ["(= (__ [1 2 3]) '(1 1 2 2 3 3))"
+                      "(= (__ [:a :a :b :b]) '(:a :a :a :a :b :b :b :b))"
                       "(= (__ [[1 2] [3 4]]) '([1 2] [1 2] [3 4] [3 4]))"
                       "(= (__ [44 33]) [44 44 33 33])"]})

     (insert! :problems
-	     {:_id 33
-	      :title "Replicate a Sequence"
-	      :times-solved 0
-	      :description "Write a function which replicates each element of a sequence a variable number of times."
-	      :tags ["easy" "seqs"]
-	      :tests ["(= (__ [1 2 3] 2) '(1 1 2 2 3 3))"
-		      "(= (__ [:a :b] 4) '(:a :a :a :a :b :b :b :b))"
+             {:_id 33
+              :title "Replicate a Sequence"
+              :times-solved 0
+              :description "Write a function which replicates each element of a sequence a variable number of times."
+              :tags ["easy" "seqs"]
+              :tests ["(= (__ [1 2 3] 2) '(1 1 2 2 3 3))"
+                      "(= (__ [:a :b] 4) '(:a :a :a :a :b :b :b :b))"
                       "(= (__ [4 5 6] 1) '(4 5 6))"
                       "(= (__ [[1 2] [3 4]] 2) '([1 2] [1 2] [3 4] [3 4]))"
                       "(= (__ [44 33] 2) [44 44 33 33])"]})
-
-    (insert! :problems
-	     {:_id 34
-	      :title "Implement range"
-	      :times-solved 0
-	      :restricted ["range"]
-	      :description "Write a function which creates a list of all integers in a given range."
-	      :tags ["easy" "seqs" "core-functions"]
-	      :tests ["(= (__ 1 4) '(1 2 3))"
-		      "(= (__ -2 2) '(-2 -1 0 1))"
+
+    (insert! :problems
+             {:_id 34
+              :title "Implement range"
+              :times-solved 0
+              :restricted ["range"]
+              :description "Write a function which creates a list of all integers in a given range."
+              :tags ["easy" "seqs" "core-functions"]
+              :tests ["(= (__ 1 4) '(1 2 3))"
+                      "(= (__ -2 2) '(-2 -1 0 1))"
                       "(= (__ 5 8) '(5 6 7))"]})

     (insert! :problems
@@ -352,7 +352,7 @@
             :description "Clojure lets you give local names to values using the special let-form."
             :tags ["elementary" "syntax"]
             :tests ["(= __ (let [x 5] (+ 2 x)))"
-		    "(= __ (let [x 3, y 10] (- y x)))"
+                    "(= __ (let [x 3, y 10] (- y x)))"
                     "(= __ (let [x 21] (let [y 3] (/ x y))))"]})

   (insert! :problems
@@ -362,7 +362,7 @@
             :description "Can you bind x, y, and z so that these are all true?"
             :tags ["elementary" "math" "syntax"]
             :tests ["(= 10 (let __ (+ x y)))"
-		    "(= 4 (let __ (+ y z)))"
+                    "(= 4 (let __ (+ y z)))"
                     "(= 1 (let __ z))"]})

     (insert! :problems
@@ -377,11 +377,11 @@
            {:_id 38
             :title "Maximum value"
             :times-solved 0
-	    :restricted ["max" "max-key"]
+            :restricted ["max" "max-key"]
             :description "Write a function which takes a variable number of parameters and returns the maximum value."
             :tags ["easy" "core-functions"]
             :tests ["(= (__ 1 8 3 4) 8)"
-		    "(= (__ 30 20) 30)"
+                    "(= (__ 30 20) 30)"
                     "(= (__ 45 67 11) 67)"]})

@@ -389,25 +389,25 @@
            {:_id 39
             :title "Interleave Two Seqs"
             :times-solved 0
-	    :restricted ["interleave"]
+            :restricted ["interleave"]
             :description "Write a function which takes two sequences and returns the first item from each, then the second item from each, then the third, etc."
             :tags ["easy" "seqs" "core-functions"]
-	    :tests ["(= (__ [1 2 3] [:a :b :c]) '(1 :a 2 :b 3 :c))"
-		    "(= (__ [1 2] [3 4 5 6]) '(1 3 2 4))"
+            :tests ["(= (__ [1 2 3] [:a :b :c]) '(1 :a 2 :b 3 :c))"
+                    "(= (__ [1 2] [3 4 5 6]) '(1 3 2 4))"
                     "(= (__ [1 2 3 4] [5]) [1 5])"
                     "(= (__ [30 20] [25 15]) [30 25 20 15])"]})
-
-
+
+

     (insert! :problems
            {:_id 40
             :title "Interpose a Seq"
             :times-solved 0
-	    :restricted ["interpose"]
+            :restricted ["interpose"]
             :description "Write a function which separates the items of a sequence by an arbitrary value."
             :tags ["easy" "seqs" "core-functions"]
             :tests ["(= (__ 0 [1 2 3]) [1 0 2 0 3])"
-		    "(= (apply str (__ \", \" [\"one\" \"two\" \"three\"])) \"one, two, three\")"
+                    "(= (apply str (__ \", \" [\"one\" \"two\" \"three\"])) \"one, two, three\")"
                     "(= (__ :z [:a :b :c :d]) [:a :z :b :z :c :z :d])"]})

     (insert! :problems
@@ -417,7 +417,7 @@
             :description "Write a function which drops every Nth item from a sequence."
             :tags ["easy" "seqs"]
             :tests ["(= (__ [1 2 3 4 5 6 7 8] 3) [1 2 4 5 7 8])"
-		    "(= (__ [:a :b :c :d :e :f] 2) [:a :c :e])"
+                    "(= (__ [:a :b :c :d :e :f] 2) [:a :c :e])"
                     "(= (__ [1 2 3 4 5 6] 4) [1 2 3 5 6])"]})

     (insert! :problems
@@ -427,8 +427,8 @@
             :description "Write a function which calculates factorials."
             :tags ["easy" "math"]
             :tests ["(= (__ 1) 1)"
-		    "(= (__ 3) 6)"
-		    "(= (__ 5) 120)"
+                    "(= (__ 3) 6)"
+                    "(= (__ 5) 120)"
                     "(= (__ 8) 40320)"]})

     (insert! :problems
@@ -438,7 +438,7 @@
             :description "Write a function which reverses the interleave process into x number of subsequences."
             :tags ["medium" "seqs"]
             :tests ["(= (__ [1 2 3 4 5 6] 2) '((1 3 5) (2 4 6)))"
-		    "(= (__ (range 9) 3) '((0 3 6) (1 4 7) (2 5 8)))"
+                    "(= (__ (range 9) 3) '((0 3 6) (1 4 7) (2 5 8)))"
                     "(= (__ (range 10) 5) '((0 5) (1 6) (2 7) (3 8) (4 9)))"]})

     (insert! :problems
@@ -448,8 +448,8 @@
             :description "Write a function which can rotate a sequence in either direction."
             :tags ["medium" "seqs"]
             :tests ["(= (__ 2 [1 2 3 4 5]) '(3 4 5 1 2))"
-		    "(= (__ -2 [1 2 3 4 5]) '(4 5 1 2 3))"
-		    "(= (__ 6 [1 2 3 4 5]) '(2 3 4 5 1))"
+                    "(= (__ -2 [1 2 3 4 5]) '(4 5 1 2 3))"
+                    "(= (__ 6 [1 2 3 4 5]) '(2 3 4 5 1))"
                     "(= (__ 1 '(:a :b :c)) '(:b :c :a))"
                     "(= (__ -4 '(:a :b :c)) '(:c :a :b))"]})

@@ -479,8 +479,8 @@
             :description "The contains? function checks if a KEY is present in a given collection.  This often leads beginner clojurians to use it incorrectly with numerically indexed collections like vectors and lists."
             :tags ["easy"]
             :tests ["(contains? #{4 5 6} __)"
-		    "(contains? [1 1 1 1 1] __)"
-		    "(contains? {4 :a 2 :b} __)"
+                    "(contains? [1 1 1 1 1] __)"
+                    "(contains? {4 :a 2 :b} __)"
                     "(not (contains? '(1 2 4) __))"]})

        (insert! :problems
@@ -490,7 +490,7 @@
             :description "The some function takes a predicate function and a collection.  It returns the first logical true value of (predicate x) where x is an item in the collection."
             :tags ["easy"]
             :tests ["(= __ (some #{2 7 6} [5 6 7 8]))"
-		    "(= __ (some #(when (even? %) %) [5 6 7 8]))"]})
+                    "(= __ (some #(when (even? %) %) [5 6 7 8]))"]})

        (insert! :problems
            {:_id 49
@@ -500,7 +500,7 @@
             :description "Write a function which will split a sequence into two parts."
             :tags ["easy" "seqs" "core-functions"]
             :tests ["(= (__ 3 [1 2 3 4 5 6]) [[1 2 3] [4 5 6]])"
-		    "(= (__ 1 [:a :b :c :d]) [[:a] [:b :c :d]])"
+                    "(= (__ 1 [:a :b :c :d]) [[:a] [:b :c :d]])"
                     "(= (__ 2 [[1 2] [3 4] [5 6]]) [[[1 2] [3 4]] [[5 6]]])"]})

        (insert! :problems
@@ -510,7 +510,7 @@
             :description "Write a function which takes a sequence consisting of items with different types and splits them up into a set of homogeneous sub-sequences. The internal order of each sub-sequence should be maintained, but the sub-sequences themselves can be returned in any order (this is why 'set' is used in the test cases)."
             :tags ["medium" "seqs"]
             :tests ["(= (set (__ [1 :a 2 :b 3 :c])) #{[1 2 3] [:a :b :c]})"
-		    "(= (set (__ [:a \"foo\"  \"bar\" :b])) #{[:a :b] [\"foo\" \"bar\"]})"
+                    "(= (set (__ [:a \"foo\"  \"bar\" :b])) #{[:a :b] [\"foo\" \"bar\"]})"
                     "(= (set (__ [[1 2] :a [3 4] 5 6 :b])) #{[[1 2] [3 4]] [:a :b] [5 6]})"]})

        (insert! :problems


Simpler path expression

Simpler path expression

--- src/grimoire/api/fs/read.clj
+++ src/grimoire/api/fs/read.clj
@@ -153,7 +153,7 @@

 (defmethod api/-read-note ::fs/Config [config thing]
   {:pre [(t/note? thing)]}
-  (let [handle (impl/thing->notes-handle config (t/thing->parent thing))]
+  (let [handle (io/file (t/thing->path thing))]
     (if (.exists handle) ;; guard against missing files
       (-> handle slurp succeed)
       (fail (str "No note for object "


Fix comment

Fix comment

--- src/icecap/handlers/core.clj
+++ src/icecap/handlers/core.clj
@@ -6,7 +6,7 @@
 (def get-schema nil) ;; anti-defonce behaavior of get-schema
 (defmulti get-schema identity)

-(def execute nil) ;; anti-defonce behaavior of get-schema
+(def execute nil) ;; anti-defonce behaavior of execute
 (defmulti execute
   "Executes a plan.