Retour à la 5ème place de la ligue argent avec cette version du code en Clojure.

--- clojure/codingame/competition/coders-strike-back/src/coders_strike_back/core.clj
+++ clojure/codingame/competition/coders-strike-back/src/coders_strike_back/core.clj
@@ -37,11 +37,9 @@
   (cond
     (> (Math/abs next-checkpoint-angle) 90) "0"
     (and (< next-checkpoint-distance 1000) (> (Math/abs next-checkpoint-angle) 30)) "0"
-    ;;(and (< next-checkpoint-distance 1000) (< (Math/abs next-checkpoint-angle) 30)) "50"
-    (< (Math/abs next-checkpoint-angle) 30) "100"
-    (> next-checkpoint-distance 4000) "100"
+    ; (< (Math/abs next-checkpoint-angle) 30) "100"
+    ; (> next-checkpoint-distance 4000) "100"
     true "100"))
-    ;(str (Integer/valueOf (Math/round (* 100 (Math/abs (Math/cos (convert-degree-to-radian next-checkpoint-angle)))))))))

 (defn compute-x [x next-checkpoint-x next-checkpoint-angle next-checkpoint-distance]
   (if (> next-checkpoint-distance 1000)
@@ -86,18 +84,18 @@

                   ; (binding [*out* *err*]
                   ;   (println "Debug messages..."))
-                  (binding [*out* *err*]
-                    (println (str "Has the boost been used ? : " @boost-used?))
-                    (println (str "Next check point distance coordinates : (" nextCheckpointX "," nextCheckpointY ")"))
-                    (println (str "Given next check point distance : " nextCheckpointDist))
-                    (println (str "Calculated next check point distance : " (distance x y nextCheckpointX nextCheckpointY)))
-                    (println (str "Pod angle with checkpoint : " nextCheckpointAngle))
-                    (println (str "Calculated Pod angle with checkpoint : " (angle-between-2-points x y nextCheckpointX nextCheckpointY)))
-                    (println (str "Pod Position : (" x "," y ")"))
-                    (println (str "Opponent pod Position : (" opponentX "," opponentY ")"))
-                    (println (str "Opponent distance : " opponent-distance))
-                    (println (str "Calculated Pod angle with opponent : " (angle-between-2-points x y opponentX opponentY)))
-                    (println (str "Game loop counter : " @game-loop-counter)))
+                  ; (binding [*out* *err*]
+                  ;   (println (str "Has the boost been used ? : " @boost-used?))
+                  ;   (println (str "Next check point distance coordinates : (" nextCheckpointX "," nextCheckpointY ")"))
+                  ;   (println (str "Given next check point distance : " nextCheckpointDist))
+                  ;   (println (str "Calculated next check point distance : " (distance x y nextCheckpointX nextCheckpointY)))
+                  ;   (println (str "Pod angle with checkpoint : " nextCheckpointAngle))
+                  ;   (println (str "Calculated Pod angle with checkpoint : " (angle-between-2-points x y nextCheckpointX nextCheckpointY)))
+                  ;   (println (str "Pod Position : (" x "," y ")"))
+                  ;   (println (str "Opponent pod Position : (" opponentX "," opponentY ")"))
+                  ;   (println (str "Opponent distance : " opponent-distance))
+                  ;   (println (str "Calculated Pod angle with opponent : " (angle-between-2-points x y opponentX opponentY)))
+                  ;   (println (str "Game loop counter : " @game-loop-counter)))

                   ; You have to output the target position


Simplify how mappings are represented to be a 3-tuple

--- src/io/aviso/rook/internals.clj
+++ src/io/aviso/rook/internals.clj
@@ -7,14 +7,14 @@
   If a public method whose name matches a default mapping exists, then it will be added using the
   default mapping; for example, a method named \"index\" will automatically be matched against \"GET /\".
   This can be overriden by providing meta-data on the functions."
-  [[[:get "/new"] :new] ; :new is used to present an HTML form to a user, to create the entity, not needed in a pure web service
-   [[:get "/:id"] :show]
-   [[:put "/:id"] :update]
-   [[:patch "/:id"] :update]
-   [[:get "/:id/edit"] :edit] ; :edit parallels :new, a user-centric HTML form, not needed in a pure web service
-   [[:delete "/:id"] :destroy]
-   [[:get "/"] :index]
-   [[:post "/"] :create]])
+  [[:get "/new" :new] ; :new is used to present an HTML form to a user, to create the entity, not needed in a pure web service
+   [:get "/:id" :show]
+   [:put "/:id" :update]
+   [:patch "/:id" :update]
+   [:get "/:id/edit" :edit] ; :edit parallels :new, a user-centric HTML form, not needed in a pure web service
+   [:delete "/:id" :destroy]
+   [:get "/" :index]
+   [:post "/" :create]])

 (def supported-methods #{:get :put :patch :post :delete :head :all})

@@ -59,8 +59,8 @@
    )"
   [sym]
   (let [symbol-meta (meta sym)]
-    (when-let [path-spec (:path-spec symbol-meta)]
-      [path-spec (keyword (:name symbol-meta))])))
+    (when-let [[method path] (:path-spec symbol-meta)]
+      [method path (keyword (:name symbol-meta))])))

 (defn- ns-paths
   "Returns paths for <namespace> using DEFAULT_MAPPINGS and by scanning for functions :path-spec metadata.
@@ -85,7 +85,7 @@
     (require namespace-name))
   (let [inherited-meta-data (-> namespace-name find-ns meta (dissoc :doc))]
     (->> (ns-paths namespace-name)
-         (map (fn [[[route-method route-path] function-key]]
+         (map (fn [[route-method route-path function-key]]
                 (when-let [f (ns-function namespace-name function-key)]
                   [route-method route-path f (merge inherited-meta-data (meta f))])))
          (remove nil?)


some benchmarking

some benchmarking

--- worker/src/worker/core.cljs
+++ worker/src/worker/core.cljs
@@ -3,7 +3,7 @@
             [worker.worker :as w])
   (:require-macros [worker.macros :as wm]))

-(def tm 1000)
+(def tm 2000)
 (defn sleep [msec]
   (let [deadline (+ msec (.getTime (js/Date.)))]
     (while (> deadline (.getTime (js/Date.)))
@@ -35,16 +35,23 @@

 (defn ^:export main []
   (enable-console-print!)
-  (def some-worker (do-some))
+  (def strt (.getTime (js/Date.)))

-  (println some-worker)
-  (js/setTimeout #(do (sleep 2000) (println some-worker)), 3000)
+  (def w1 (do-some))
+  (def w2 (do-some))
+  (def w3 (do-some))
+  (def w4 (do-some))
+  (add-watch (:result w1) nil #(println (- (.getTime (js/Date.)) strt)))
+  (add-watch (:result w2) nil #(println (- (.getTime (js/Date.)) strt)))
+  (add-watch (:result w3) nil #(println (- (.getTime (js/Date.)) strt)))
+  (add-watch (:result w4) nil #(println (- (.getTime (js/Date.)) strt)))
+  (wrk)
+  (println (- (.getTime (js/Date.)) strt))
+  (wrk)
+  (println (- (.getTime (js/Date.)) strt))
+  (wrk)
+  (println (- (.getTime (js/Date.)) strt))
+  (wrk)
+  (println (- (.getTime (js/Date.)) strt))

-  ;;(println some-worker)
-
-;;  (println (w/js-func-name wrk))
-;;  (wm/do-some 1)
-;;    (w/do-some (meta (var wrk)))
-;;  (println "work2..")
-;;  (w/do-some `wrk2)
   )


CMR-4477: Fixed typo.

CMR-4477: Fixed typo.

--- system-int-test/test/cmr/system_int_test/ingest/variable_ingest_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/variable_ingest_test.clj
@@ -204,7 +204,7 @@
                           (variable-util/token-opts token))]
     (is (= 201 status))))

-(deftest veriable-ingest-schema-validation-test
+(deftest variable-ingest-schema-validation-test
   (let [{token :token} (variable-util/setup-update-acl
                         (s/context) "PROV1" "user1" "update-group")]
     (testing "ingest of variable concept JSON schema validation missing field"


[#92] Include copyright notice in Clojure's clojure.core source file

--- priv/clojure/core.clj
+++ priv/clojure/core.clj
@@ -1,3 +1,11 @@
+;   Copyright (c) Rich Hickey. All rights reserved.
+;   The use and distribution terms for this software are covered by the
+;   Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
+;   which can be found in the file epl-v10.html at the root of this distribution.
+;   By using this software in any fashion, you are agreeing to be bound by
+;   the terms of this license.
+;   You must not remove this notice, or any other, from this software.
+
 (ns clojure.core)

 (def


Fix reference to undefined spec.

Fix reference to undefined spec.

--- frontend/src/uxbox/main/data/shapes.cljs
+++ frontend/src/uxbox/main/data/shapes.cljs
@@ -649,7 +649,7 @@

 (defn update-selected-shapes-attrs
   [attrs]
-  {:pre [(us/valid? ::shape-attrs attrs)]}
+  {:pre [(us/valid? ::attributes attrs)]}
   (UpdateSelectedShapesAttrs. attrs))

 ;; --- Move Selected Layer


remove unused cljs.util import in macros files

--- src/main/clojure/cljs/core.cljc
+++ src/main/clojure/cljs/core.cljc
@@ -38,10 +38,9 @@
                             #?(:cljs alias)])
   #?(:cljs (:require-macros [cljs.core.macros :refer [import-macros alias]]))
   (:require clojure.walk
-    clojure.set
-    cljs.compiler
-    [cljs.util :as util]
-    [cljs.env :as env]))
+            clojure.set
+            cljs.compiler
+            [cljs.env :as env]))

 (alias 'core 'clojure.core)
 (alias 'ana 'cljs.analyzer)


keep the comparisons the same

keep the comparisons the same

--- src/strictly_specking/fuzzy.clj
+++ src/strictly_specking/fuzzy.clj
@@ -26,7 +26,7 @@
     (cond
       ;; less than 4 characters no matching
       (<= len 4) 0
-      (=  len 5) 1
+      (<= len 5) 1
       (<= len 6) 2
       (<= len 11) 3
       (<= len 20) 4


Better docstring for columns function.

Better docstring for columns function.

--- src/tabular/grafter/tabular.clj
+++ src/tabular/grafter/tabular.clj
@@ -145,8 +145,14 @@
         ::not-found))))

 (defn columns
-  "Given a dataset and a sequence of column identifiers, narrow the
-  dataset to just the supplied columns.
+  "Given a dataset and a sequence of column identifiers, columns
+  narrows the dataset to just the supplied columns.
+
+  Columns specified in the selection that are not included in the
+  Dataset will be silently ignored.
+
+  The order of the columns in the returned dataset will be determined
+  by the order of matched columns in the selection.

   The supplied sequence of columns are first cropped to the number of
   columns in the dataset before being selected, this means that


Fix: resource urls are now lisp-cased.

Fix: resource urls are now lisp-cased.

Also improved indentation of requires.

--- ssclj/jar/src/test/clojure/com/sixsq/slipstream/ssclj/resources/network_service_test.clj
+++ ssclj/jar/src/test/clojure/com/sixsq/slipstream/ssclj/resources/network_service_test.clj
@@ -1,21 +1,21 @@
 (ns com.sixsq.slipstream.ssclj.resources.network-service-test
   (:require
-    [clojure.test :refer :all]
-    [peridot.core :refer :all]
+    [clojure.test                                                     :refer :all]
+    [peridot.core                                                     :refer :all]

-    [korma.core :as kc]
+    [korma.core                                                       :as kc]

-    [com.sixsq.slipstream.ssclj.api.acl :as acl]
+    [com.sixsq.slipstream.ssclj.api.acl                               :as acl]
     [com.sixsq.slipstream.ssclj.resources.network-service-schema-test :refer [valid-firewall]]
-    [com.sixsq.slipstream.ssclj.resources.test-utils :refer [exec-request exec-post is-count]]
-    [com.sixsq.slipstream.ssclj.resources.network-service :refer :all]
-    [com.sixsq.slipstream.ssclj.app.params :as p]
-    [com.sixsq.slipstream.ssclj.resources.lifecycle-test-utils :as t]
-    [com.sixsq.slipstream.ssclj.db.impl :as db]
-    [com.sixsq.slipstream.ssclj.db.database-binding :as dbdb]
-    [com.sixsq.slipstream.ssclj.resources.common.debug-utils :as du]))
+    [com.sixsq.slipstream.ssclj.resources.test-utils                  :refer [exec-request exec-post is-count]]
+    [com.sixsq.slipstream.ssclj.resources.network-service             :refer :all]
+    [com.sixsq.slipstream.ssclj.app.params                            :as p]
+    [com.sixsq.slipstream.ssclj.resources.lifecycle-test-utils        :as t]
+    [com.sixsq.slipstream.ssclj.db.impl                               :as db]
+    [com.sixsq.slipstream.ssclj.db.database-binding                   :as dbdb]
+    [com.sixsq.slipstream.ssclj.resources.common.utils                :as u]))

-(def base-uri (str p/service-context resource-name))
+(def base-uri (str p/service-context (u/de-camelcase resource-name)))

 (defn fixture-set-impl
   [f]


Correctly handle new-segment trigger event type.

--- src/onyx/peer/window_state.cljc
+++ src/onyx/peer/window_state.cljc
@@ -100,7 +100,7 @@
                                      next-trigger-state ((:next-trigger-state trigger-record) trigger defaulted-trigger-state state-event)]
                                  (st/put-trigger! state-store trigger-idx group-id next-trigger-state)
                                  next-trigger-state))
-          fire-all? (or fire-all-extents? (not= (:event-type state-event) :segment))
+          fire-all? (or fire-all-extents? (not= (:event-type state-event) :new-segment))
           fire-extents (if fire-all?
                          (st/group-extents state-store idx group-id)
                          (:extents state-event))


Don't auto expand unary ugen args which are audio or control busses. Fixes #134

--- src/overtone/sc/machinery/ugen/fn_gen.clj
+++ src/overtone/sc/machinery/ugen/fn_gen.clj
@@ -131,6 +131,8 @@
          (= 1 (count args))
          (not (sc-ugen? (first args)))
          (not (isa? (type (first args)) :overtone.sc.buffer/buffer))
+         (not (isa? (type (first args)) :overtone.sc.bus/audio-bus))
+         (not (isa? (type (first args)) :overtone.sc.bus/control-bus))
          (map? (first args)))
       (apply f (flatten (seq (first args))))
       (apply f args))))


Add test string

Add test string

--- test/cljs/fatlip/core_test.cljs
+++ test/cljs/fatlip/core_test.cljs
@@ -90,4 +90,5 @@
                   (assoc :minus-ps [seg-1 node-1 node-2 seg-2 node-3 seg-3 node-4]))]
     (is (= (f/set-positions layer) (assoc layer :positions {seg-1 0, node-1 2, node-2 3
                                                             seg-2 4, node-3 7, seg-3 8
-                                                            node-4 9})))))
+                                                            node-4 9}))
+        "positions are set correctly")))


core: drop-last

core: drop-last

--- data/core.clj
+++ data/core.clj
@@ -1422,3 +1422,9 @@
                    (recur (dec n) (rest s))
                    s)))]
     (lazy-seq (step n coll))))
+
+(defn drop-last
+  "Return a lazy sequence of all but the last n (default 1) items in coll"
+  {:added "1.0"}
+  ([s] (drop-last 1 s))
+  ([n s] (map (fn [x _] x) s (drop n s))))


core: take

core: take

--- data/core.clj
+++ data/core.clj
@@ -1391,3 +1391,13 @@
   {:added "1.0"}
   [pred coll]
   (filter (complement pred) coll))
+
+(defn take
+  "Returns a lazy sequence of the first n items in coll, or all items if
+  there are fewer than n."
+  {:added "1.0"}
+  [n coll]
+  (lazy-seq
+   (when (pos? n)
+     (when-let [s (seq coll)]
+       (cons (first s) (take (dec n) (rest s)))))))


Can create triggers for AppShare apps now

This is important so that real time features can work on all appshare
apps

--- src/webapp/framework/server/systemfns.clj
+++ src/webapp/framework/server/systemfns.clj
@@ -1099,9 +1099,9 @@

 (defn do-real [& {:keys [:table-name]}]
-  ;(println "-real**: table name: " table-name)
-
-  (create-realtime-trigger  :table-name  (get-table-name  table-name)))
+  (println "-real**: table name: " table-name)
+
+  (create-realtime-trigger  :table-name  table-name));(get-table-name  table-name)))

@@ -1207,7 +1207,7 @@

-(defn get-record [db-table  id  fields  realtime client-id]
+(defn get-record [db-table  id  fields  realtime  client-id]
   (if id
     (do

@@ -1266,7 +1266,7 @@

-
+;zzz
 (defn !get-record-result
   [{:keys [
            db-table
@@ -1713,13 +1713,15 @@
                                      ]}]

   (let [
-         schema-name  (get-schema-name-for-session-id   data-session-id)
+         schema-name        (get-schema-name-for-session-id   data-session-id)
+         full-table-name    (str schema-name "." db-table)
          ]

     ;(if (not (= "public" schema-name ))
     (do
       (println "************************************************************************************")
-      (println (str "* SCHEMA: "  schema-name))
+      (println (str "* SCHEMA:          "  schema-name))
+      (println (str "* full-table-name: "  full-table-name))
       (println "************************************************************************************")
       (println ""))
     ;)
@@ -1756,7 +1758,7 @@
    (let [

          query-key   (create-query-key
-                      :db-table  (str schema-name "." db-table)
+                      :db-table  full-table-name
                       :where     where
                       :start     start
                       :end       end


Change server cache when record updated

Change server cache when record updated

Change the server cache when a record is updated. This changes the value
in the cache for the records only. It still needs to notify the clients

--- src/webapp/framework/server/systemfns.clj
+++ src/webapp/framework/server/systemfns.clj
@@ -704,16 +704,19 @@

 (defn get-record-from-database [db-table id fields]

-  (sql-1 (str
-          "select " (fields-to-str fields) " from " db-table " where id = ? "
-          (cond
-           (= *database-type* "postgres" )
-           " limit 1"
-
-           (= *database-type* "oracle" )
-           ""))
-
-         [id]))
+  (let [sql (str
+             "select " (fields-to-str fields) " from " db-table " where id = ? "
+             (cond
+              (= *database-type* "postgres" )
+              " limit 1"
+
+              (= *database-type* "oracle" )
+              ""))
+        ]
+    (do
+      (println "SQL::: " sql "," id)
+      (sql-1  sql [id])
+      )))

@@ -899,6 +902,14 @@

+(defn get-fields-for-table   [db-table]
+  [:id :item])
+
+
+(defn parse-int [s]
+   (Integer. (re-find  #"\d+" s )))
+
+

 ; ----------------------------------------------------------------
 ; Whenever a record changes an entry is added to the real time log
@@ -956,19 +967,24 @@
     (if (= (get realtime-log-entry :record_operation) "UPDATE")
       (do
         (println "Update record")
-        (let [id               (get realtime-log-entry :record_id)
+        (let [id               (parse-int (get realtime-log-entry :record_id))
               db-table         (get realtime-log-entry :record_table_name)
               cached-record    (get-record-from-server-cache-for-id  db-table   id)
-              ;record           (get-record-from-database    db-table id fields)
-              ;table            (get-table-from-server-cache-for-table    db-table)
-              ;query-time       (quot (System/currentTimeMillis) 1000)
+              fields           (get-fields-for-table   db-table)
+              ;zzz
+              record           (get-record-from-database    db-table id fields)
+              table            (get-table-from-server-cache-for-table    db-table)
+              query-time       (quot (System/currentTimeMillis) 1000)
               ]
+          (do
           (create-cache-for-table   db-table)
-          ;(if table
-            ;(swap!  table assoc id (atom {:value record :timestamp query-time}))
+          (println (str "Value before: "  (get-record-from-server-cache-for-id  db-table  id )))
+          (if table
+            (swap!  table assoc id (atom {:value record :timestamp query-time}))
             nil
-          ;  )
-        )
+            )
+          (println (str "Value after: "  (get-record-from-server-cache-for-id  db-table  id )))
+        ))
         ))

     ))


Generate values starting at size 0, not 1

* Change the string generator to use size [0, size], not size
* Change gen/such-that to increase the size parameter if it needs to
  recur and generate a new argument. This prevents infinite loops for
  some generators that can't be satisfied at size 0.

--- src/simple_check/generators.clj
+++ src/simple_check/generators.clj
@@ -17,7 +17,7 @@

 (defn make-size-range-seq
   [max-size]
-  (cycle (range 1 max-size)))
+  (cycle (range 0 max-size)))

 (defn sample-seq
   ([generator] (sample-seq generator 100))
@@ -154,7 +154,7 @@
     (let [value (call-gen gen rand-seed size)]
       (if (f value)
         value
-        (recur rand-seed size))))])
+        (recur rand-seed (inc size)))))])

 ;; Generic generators and helpers
 ;; ---------------------------------------------------------------------------
@@ -421,7 +421,8 @@

 (defn string-gen
   [rand-seed size]
-  (clojure.string/join (repeatedly size #(call-gen char rand-seed size))))
+  (clojure.string/join (repeatedly (call-gen (choose 0 size) rand-seed size)
+                                   #(call-gen char rand-seed size))))

 (def string
   "Generate strings."
@@ -429,7 +430,8 @@

 (defn string-ascii-gen
   [rand-seed size]
-  (clojure.string/join (repeatedly size #(call-gen char-ascii rand-seed size))))
+  (clojure.string/join (repeatedly (call-gen (choose 0 size) rand-seed size)
+                                   #(call-gen char-ascii rand-seed size))))

 (def string-ascii
   "Generate ascii strings."
@@ -437,7 +439,8 @@

 (defn string-alpha-numeric-gen
   [rand-seed size]
-  (clojure.string/join (repeatedly size #(call-gen char-alpha-numeric rand-seed size))))
+  (clojure.string/join (repeatedly (call-gen (choose 0 size) rand-seed size)
+                                   #(call-gen char-alpha-numeric rand-seed size))))

 (def string-alpha-numeric
   "Generate alpha-numeric strings."


another test for names

another test for names

--- test/clojure/digitalocean_expect/test.clj
+++ test/clojure/digitalocean_expect/test.clj
@@ -34,6 +34,9 @@
 (defn london? [region] (location-id :london region))
 (defn sf? [region] (location-id :sanfrancisco region))

+(defn valid-name? [name]
+  (re-matches #"test|staging|prod+-[a-z]+" name))
+
 ; not more than 100 nodes
 (expect (< (count nodes) 100))

@@ -66,3 +69,6 @@

 ; no more than 2 large nodes
 (expect (< (count (filter large? (map :size_id nodes))) 2))
+
+; check names match prescribed pattern
+(expect (every? valid-name? (map :name node)))


Remove comment

Remove comment

--- test/com/wsscode/pathom/connect_test.cljc
+++ test/com/wsscode/pathom/connect_test.cljc
@@ -960,17 +960,6 @@
   (pc/batch-resolver
     (fn [_ _] {:deadlock-3 3})
     (fn [_ inputs] (repeat (count inputs) {:deadlock-3 3}))))
-
-(comment
-  (-> @trace
-      pt/trace->tree)
-
-  (do
-    (def trace (atom []))
-    (async/<!!
-      (parser-p {::p/entity  (atom {:deadlock-1 1})
-                 ::pt/trace* trace}
-        [{:deadlock-items [:deadlock-2 :deadlock-3]}]))))

 (def i->l
   {1 "a"


Fix test

Fix test

--- test/com/wsscode/pathom/graphql_test.cljc
+++ test/com/wsscode/pathom/graphql_test.cljc
@@ -119,7 +119,7 @@
     "mutation { call(param: \"value\", value: 42) { id foo } }"

     '[{(call {:param "value" :item/value 42}) [:id :foo (:other {::pg/on "User"})]}]
-    "mutation { call(param: \\\"value\\\", value: 42) { id foo ... on User { other } } }"))
+    "mutation { call(param: \"value\", value: 42) { id foo ... on User { other } } }"))

 (comment
   (query->graphql '[(:property {::pg/alias "aliased"})])


Add a precondition to `update-size` event.

--- src/uxbox/main/data/shapes.cljs
+++ src/uxbox/main/data/shapes.cljs
@@ -111,6 +111,7 @@
   of the shape using the width and height attrs
   instread final point of coordinates."
   [sid opts]
+  {:pre [(uuid? sid)]}
   (reify
     udp/IPageUpdate
     rs/UpdateEvent


CMR-6087: use :indexer instead of :index-set.

For app connections use :indexer instead of :index-set.

--- transmit-lib/src/cmr/transmit/indexer.clj
+++ transmit-lib/src/cmr/transmit/indexer.clj
@@ -28,7 +28,7 @@
 (defn get-index-set
   "Submit a request to index-set app to fetch an index-set assoc with an id"
   [context id]
-  (let [conn (config/context->app-connection context :index-set)
+  (let [conn (config/context->app-connection context :indexer)
         response (client/request
                    (merge
                      (config/conn-params conn)
@@ -51,7 +51,7 @@
   "A helper function for submitting a request to modify the list of rebalancing collections."
   [context index-set-id concept-id url-fn target]
   (let [query-params (when target {:target (name target)})]
-    (h/request context :index-set
+    (h/request context :indexer
                {:url-fn #(url-fn % index-set-id concept-id)
                 :method :post
                 :http-options {:headers {config/token-header (config/echo-system-token)}


add deterioration to the finalize-frame pipeline

--- src/wombats/game/finalizers.clj
+++ src/wombats/game/finalizers.clj
@@ -11,11 +11,35 @@
                             [] meta)]
     (assoc cell :meta meta-update)))

-(defn- update-metadata-decay
-  [game-state]
+(defn- update-deterioration
+  "Determines the deterioration level and applies it to the element"
+  [{:keys [contents] :as cell} max-hp]
+  (let [percent-deteriorated (-> (:hp contents)
+                                 (/ max-hp)
+                                 (float))
+        deterioration-key (condp >= percent-deteriorated
+                            0.4 :high
+                            0.7 :medium
+                            :low)]
+    (assoc-in cell [:contents :deterioration-level] deterioration-key)))
+
+(defn- update-cell-deterioration-level
+  [cell arena-config]
+  (case (get-in cell [:contents :type])
+    :wombat (update-deterioration cell (:arena/wombat-hp arena-config))
+    :zakano (update-deterioration cell (:arena/zakano-hp arena-config))
+    :wood-barrier (update-deterioration cell (:arena/wood-wall-hp arena-config))
+    :steel-barrier (update-deterioration cell (:arena/steel-wall-hp arena-config))
+    cell))
+
+(defn- update-arena-data
+  "Maps over each cell updating attributes like metadata decay and damage levels"
+  [{:keys [arena-config] :as game-state}]
   (let [updated-arena
         (vec (map (fn [row]
-                    (vec (map update-cell-metadata row)))
+                    (vec (map #(-> %
+                                   (update-cell-metadata)
+                                   (update-cell-deterioration-level arena-config)) row)))
                   (get-in game-state [:frame :frame/arena])))]
     (assoc-in game-state [:frame :frame/arena] updated-arena)))

@@ -23,7 +47,7 @@
   [game-state]
   ;; TODO #152
   (-> game-state
-      (update-metadata-decay)))
+      (update-arena-data)))

 (defn finalize-game
   [game-state]


overall scheme written out

overall scheme written out

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@9507 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- plugins/SlideExplorer2/src/slide_explorer/main.clj
+++ plugins/SlideExplorer2/src/slide_explorer/main.clj
@@ -175,6 +175,28 @@
               (explore available-tiles-agent screen-state-atom
                        affine [tile-width tile-height]))))

+; Overall scheme
+; the GUI is generally reactive.
+; vars:
+; memory-tiles (indices -> pixels)
+; disk-tiles (set of indices)
+; overlay-tiles (indices -> pixels)
+; view-state
+; Whenever an image is acquired, it is added to memory-tiles. Tiles
+; added are automatically asynchronously saved to disk, and the indices
+; are added to disk-tiles.
+; memory-tiles and overlay-tiles are limited to 100 images each,
+; using an LRU eviction policy.
+; When view-state viewing area is adjusted, tiles needed for the
+; new viewing area are loaded back into memory-tiles. If we are
+; in explore mode, then images not available in memory-tiles and
+; disk tiles are acquired according to the spiral trajectory.
+; Overlay tiles are generated whenever memory tiles are added
+; or the contrast is changed.
+; The view redraws tiles inside viewing area whenever view-state
+; has been adjusted or a new image appears in overlay-tiles.
+
+
 (defn go
   "The main function that starts a slide explorer window."
   []


Launch Analysis modal openning automatically instead of when button is clicked

--- src/cljs/org/broadinstitute/firecloud_ui/page/workspace/method_configs/launch_analysis.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/workspace/method_configs/launch_analysis.cljs
@@ -138,7 +138,7 @@
      [comps/Button
       {:text "Launch Analysis..."
        :disabled? (:disabled? props)
-       :onClick (modal/push-modal
+       :onClick #(modal/push-modal
                  [Form (select-keys props [:config-id :workspace-id
                                            :root-entity-type :on-success :cromwell-version])])}])})


delete debug code from sample template

delete debug code from sample template

--- sample/template/index.html.clj
+++ sample/template/index.html.clj
@@ -62,10 +62,6 @@
 (p "See " (link "http://liquidz.github.com/misaki/demo"))
 CLOJURE

-    #-SH
-    $ cd ..
-    SH
-
 ;; Document
 (page-header "Document")
 ; Markdown like format with "p" function


Disable pretty printing on benchmark build.

--- scripts/watch-benchmarks.clj
+++ scripts/watch-benchmarks.clj
@@ -6,5 +6,5 @@
    :output-to "out/benchmarks.js"
    :output-dir "out/benchmarks"
    :optimizations :none
-   :pretty-print true
+   :pretty-print false
    :verbose true})


Ship can now be moved with the arrow keys.

--- Clojure/clojuroids.clj
+++ Clojure/clojuroids.clj
@@ -1,10 +1,18 @@
 ; :mode=clojure:
+
+; Asteroids written in Clojure

 (import
     '(java.awt Color Dimension Polygon RenderingHints)
     '(javax.swing JComponent JFrame JLabel Timer)
-    '(java.awt.event ActionListener KeyAdapter)
+    '(java.awt.event ActionListener KeyAdapter KeyEvent)
 )
+
+(def acceleration 100.0)
+(def efficiency 0.7)
+(def angular-acceleration 10.0)
+(def width 640)
+(def height 480)

 (defn do-mod [coll func v]
     (dosync (alter coll (fn [x] (apply func [x v])))))
@@ -21,6 +29,7 @@
         (.setColor g (Color/WHITE))
         (let [old-transform (.getTransform g)]
             (.translate g (:x player) (:y player))
+            (.rotate g (:a player))
             (.fill g (player-shape))
             (.setTransform g old-transform))))

@@ -41,7 +50,7 @@
     (doto
         (proxy [JComponent] []
             (paint [g] (dosync (game-render (deref game-state) g))))
-        (.setPreferredSize (new Dimension 640 480))
+        (.setPreferredSize (new Dimension width height))
         (.setDoubleBuffered true)
         (.setFocusable true)))

@@ -49,18 +58,51 @@

 (defn default-state [] {
     :time (now)
-    :player { :x 100.0 :y 100.0 :xv 10.0 :yv 5.0 } } )
+    :player { :x 100.0 :y 100.0 :xv 0.0 :yv 0.0 :a 0.0 :av 0.0 } } )

-(defn player-step [player time-step]
-    (assoc player
-        :x (+ (:x player) (* (:xv player) time-step))
-        :y (+ (:y player) (* (:yv player) time-step))))
+
+
+(defn player-step [player time-step keys-pressed]
+    (let [
+        player
+            (if
+                (contains? keys-pressed KeyEvent/VK_UP)
+                (assoc player
+                    :xv (+ (:xv player) (* time-step acceleration (Math/cos (:a player))))
+                    :yv (+ (:yv player) (* time-step acceleration (Math/sin (:a player)))))
+                player)
+        player
+            (if
+                (contains? keys-pressed KeyEvent/VK_LEFT)
+                (assoc player
+                    :av (- (:av player) (* time-step angular-acceleration)))
+                player)
+        player
+            (if
+                (contains? keys-pressed KeyEvent/VK_RIGHT)
+                (assoc player
+                    :av (+ (:av player) (* time-step angular-acceleration)))
+                player)
+        eff
+            (Math/pow efficiency time-step)
+
+        player
+            (assoc player
+                :x (mod (+ (:x player) (* (:xv player) time-step)) width)
+                :y (mod (+ (:y player) (* (:yv player) time-step)) height)
+                :a (mod (+ (:a player) (* (:av player) time-step)) (* Math/PI 2.0))
+                :xv (* (:xv player) eff)
+                :yv (* (:yv player) eff)
+                :av (* (:av player) eff))]
+
+        player))
+

 (defn game-step [state keys-pressed]
     (let [new-time (now) time-step (- new-time (:time state))]
         (assoc state
             :time new-time
-            :player (player-step (:player state) time-step))))
+            :player (player-step (:player state) time-step keys-pressed))))

 (defn create-game []
     (let [


minimal verification that tag stats are being displayed

--- pedestal-app/test/semtag_web/integration_test.clj
+++ pedestal-app/test/semtag_web/integration_test.clj
@@ -133,7 +133,8 @@
 (deftest direct-search-url-works
   (visit "#/search?query=maxwell&search-type=tagged-with-type")
   (url-ends-with "#/search?query=maxwell&search-type=tagged-with-type")
-  (is (seq (taxi/elements "#search_table tbody tr"))))
+  (is (seq (taxi/elements "#search_table tbody tr")))
+  (is (.contains (taxi/text "#content") "Tag Type Counts:")))

 (deftest direct-thing-page-works
   (visit "#/thing/feynman")
@@ -145,11 +146,11 @@
   (click "Tagged with feynman")
   (is (seq (taxi/elements "#search_table tbody tr"))))

-;; TODO - tests on stats table for type and search pages
 (deftest direct-type-page-works
   (visit "#/type/api")
   (url-ends-with "#/type/api")
-  (is (seq (taxi/elements "#type_show_table tbody tr"))))
+  (is (seq (taxi/elements "#type_show_table tbody tr")))
+  (is (.contains (taxi/text "#content") "Tag Type Counts:")))

 (deftest thing-link-works-on-tag-stats-table
   (visit "#/tag-stats")


Simplify instructions

Simplify instructions

--- src/app/core.cljs
+++ src/app/core.cljs
@@ -230,11 +230,11 @@
                                            (when (= 1 (count unique-guests))
                                              (select-party! owner (get-in unique-guests [0 :party])))))
                                      (om/update! data :error "Search query is too short!"))))}
-         [:label {:for "guestsearch"} "Enter the name on your invitation:"]
+         [:label {:for "guestsearch"} "Search for your name (first, last, or full):"]
          [:input {:type "text"
                   :name "guestseearch"
                   :class "guestsearch"
-                  :placeholder "e.g. Barack and Michelle Obama"
+                  :placeholder "e.g. Barack"
                   :value name
                   :ref "name"
                   :onChange #(om/update! data :name (.-value (om/get-node owner "name")))}]


Renamed state-work to kvs-do.

Renamed state-work to kvs-do.

--- src/cbfg/kvs.cljs
+++ src/cbfg/kvs.cljs
@@ -19,17 +19,11 @@
 ; TODO: Add snapshot ability.
 ; TODO: Readers not blocked by writers.
 ; TODO: Mutations shadow old values.
+; TODO: Conventions on :status, :status-info, :partial, :result responses.

 (defn make-kc [] ; A kc is a keys / changes map.
   {:keys (sorted-map)      ; key -> sq
    :changes (sorted-map)}) ; [sq key] -> {:key k, :sq s, :deleted true | :val v}
-
-(defn make-kvs [name uuid]
-  {:name name
-   :uuid uuid
-   :clean (make-kc) ; Read-only.
-   :dirty (make-kc) ; Mutations go here, until "persisted / made durable".
-   :next-sq 1})

 (defn kc-sq-by-key [kc key]
   (get (:keys kc) key))
@@ -40,9 +34,15 @@
 (defn kc-entry-by-key [kc key]
   (kc-entry-by-key-sq kc key (kc-sq-by-key kc key)))

-(defn kvs-ident-check [kvs-ident work-fn]
-  ; Wrapper that checks to see if kvs-ident refers to a current kvs.
-  (fn [state] ; Meant to be used as work-fn for state-work function.
+(defn make-kvs [name uuid]
+  {:name name
+   :uuid uuid
+   :clean (make-kc) ; Read-only.
+   :dirty (make-kc) ; Mutations go here, until "persisted / made durable".
+   :next-sq 1})
+
+(defn kvs-checker [kvs-ident work-fn]
+  (fn [state] ; Returns wrapper fn to check if kvs-ident is current.
     (if-let [[name uuid] kvs-ident]
       (if-let [kvs (get-in state [:kvss name])]
         (if (= uuid (:uuid kvs))
@@ -51,13 +51,13 @@
         [state {:status :not-found :status-info :no-kvs}])
       [state {:status :invalid :status-info :no-kvs-ident}])))

-(defn state-work [actx state-ch m work-fn]
-  (let [done-ch (achan actx)]
-    (act state-work actx
-         (aput state-work state-ch [work-fn done-ch]))
-         (aput state-work (:res-ch m)
-               (merge m (or (atake state-work done-ch)
-                            {:status :error :status-info :closed-ch})))))
+(defn kvs-do [actx state-ch m done-ch work-fn]
+  (act kvs-do actx
+       (aput kvs-do state-ch [work-fn done-ch])
+       (when done-ch
+         (aput kvs-do (:res-ch m)
+               (merge m (or (atake kvs-do done-ch)
+                            {:status :error :status-info :closed-ch}))))))

 (defn make-scan-fn [scan-kind result-key get-entry]
   (fn [actx state-ch m]
@@ -78,14 +78,12 @@
                             (aput scan-work res-ch
                                   (merge res-m {:status :ok}))))
                      nil)]
-       (act scan-start actx
-         (aput scan-start state-ch
-               [(kvs-ident-check (:kvs-ident m) work-fn) nil])))))
+       (kvs-do actx state-ch m nil (kvs-checker (:kvs-ident m) work-fn)))))

 (def op-handlers
   {:kvs-open
    (fn [actx state-ch m]
-     (state-work actx state-ch m
+     (kvs-do actx state-ch m (achan actx)
                  #(if-let [name (:name m)]
                     (if-let [kvs (get-in % [:kvss name])]
                       [% {:status :ok :status-info :reopened
@@ -99,11 +97,11 @@

    :kvs-remove
    (fn [actx state-ch m]
-     (state-work actx state-ch m
-                 (kvs-ident-check (:kvs-ident m)
-                                  (fn [state kvs]
-                                    [(dissoc-in state [:kvss (:name kvs)])
-                                     {:status :ok :status-info :removed}]))))
+     (kvs-do actx state-ch m (achan actx)
+             (kvs-checker (:kvs-ident m)
+                          (fn [state kvs]
+                            [(dissoc-in state [:kvss (:name kvs)])
+                             {:status :ok :status-info :removed}]))))

    :multi-get
    (fn [actx state-ch m]
@@ -122,9 +120,8 @@
                             (aput multi-get res-ch
                                   (merge res-m {:status :ok}))))
                      nil)]
-       (act multi-get-start actx
-         (aput multi-get-start state-ch
-               [(kvs-ident-check (:kvs-ident m) work-fn) nil]))))
+       (kvs-do actx state-ch m nil
+                   (kvs-checker (:kvs-ident m) work-fn))))

    :multi-change
    (fn [actx state-ch m]
@@ -142,9 +139,8 @@
                               (aput multi-change res-ch (merge res-m res)))
                             (aput multi-change res-ch (merge res-m {:status :ok})))
                        [(assoc-in state [:kvss (:name kvs)] next-kvs) nil]))]
-       (act multi-change-start actx
-         (aput multi-change-start state-ch
-               [(kvs-ident-check (:kvs-ident m) work-fn) nil]))))
+       (kvs-do actx state-ch m nil
+               (kvs-checker (:kvs-ident m) work-fn))))

    :scan-keys
    (make-scan-fn :keys :key kc-entry-by-key-sq)
@@ -154,14 +150,14 @@

    :sync
    (fn [actx state-ch m]
-     (state-work actx state-ch m
-                 (kvs-ident-check (:kvs-ident m)
-                                  (fn [state kvs]
-                                    [(assoc-in state [:kvss (:name kvs)]
-                                               (-> kvs
-                                                   (assoc :clean (:dirty kvs))
-                                                   (assoc :dirty (make-kc))))
-                                     {:status :ok :status-info :synced}]))))})
+     (kvs-do actx state-ch m (achan actx)
+             (kvs-checker (:kvs-ident m)
+                          (fn [state kvs]
+                            [(assoc-in state [:kvss (:name kvs)]
+                                       (-> kvs
+                                           (assoc :clean (:dirty kvs))
+                                           (assoc :dirty (make-kc))))
+                             {:status :ok :status-info :synced}]))))})

 (defn make-kvs-mgr [actx & op-handlers-in & {:keys [cmd-ch state-ch]}]
   (let [cmd-ch (or cmd-ch (achan actx))


Java to SMTLib translation

Java to SMTLib translation

--- src/be/ac/ua/aspchecker/transformation.clj
+++ src/be/ac/ua/aspchecker/transformation.clj
@@ -7,6 +7,115 @@
   (:import [org.antlr.v4.runtime.tree ParseTreeWalker]))

+(def SMTLib-equivalent
+  {"||" "or"
+   "&&" "and"
+   "!" "not"
+   "==" "="
+   "!=" "not ="
+   "%" "mod"
+   "+" "+"
+   "-" "-"
+   "*" "*"
+   "/" "/"
+   ">" ">"
+   "<" "<"
+   "<=" "<="
+   ">=" ">="
+   "++" "+"
+   "--" "-"})
+
+
+;Expression tests
+
+(defn logical-operator? [op]
+  (or
+    (= op "==")
+    (= op "!=")
+    (= op ">")
+    (= op ">=")
+    (= op "<")
+    (= op "<=")
+    (= op "&&")
+    (= op "||")))
+
+
+(defn arithmetic-operator? [op]
+  (or
+    (= op "+")
+    (= op "-")
+    (= op "*")
+    (= op "/")
+    (= op "%")))
+
+
+(defn unary-operator? [op]
+  (or
+    (= op "++")
+    (= op "--")
+    (= op "!")))
+
+
+(defn parentheses-char? [op]
+  (or
+    (= op ")")
+    (= op "(")))
+
+
+(defn terminal? [exp]
+  (= (.getChildCount exp) 0))
+
+
+(defn parentheses-expression? [exp]
+  (and
+    (= (.getChildCount exp) 3)
+    (parentheses-char? (.getText (.getChild exp 0)))
+    (parentheses-char? (.getText (.getChild exp 2)))))
+
+
+(defn logical-expression? [exp]
+  (and
+    (= (.getChildCount exp) 3)
+    (logical-operator? (.getText (.getChild exp 1)))))
+
+
+(defn arithmetic-expression? [exp]
+  (and
+    (= (.getChildCount exp) 3)
+    (arithmetic-operator? (.getText (.getChild exp 1)))))
+
+
+(defn unary? [exp]
+  (and
+    (= (.getChildCount exp) 2)
+    (or
+      (unary-operator? (.getText (.getChild exp 0)))
+      (unary-operator? (.getText (.getChild exp 1))))))
+
+
+(defn ternary? [exp]
+  (and
+    (= (.getChildCount exp) 5)
+    (= ":" (.getText (.getChild exp 1)))
+    (= "?" (.getText (.getChild exp 3)))))
+
+
+(defn method-call? [exp]
+  (and
+    (= (.getChildCount exp) 3)
+    (= "(" (.getText (.getChild exp 1)))
+    (= ")" (.getText (.getChild exp 2)))))
+
+
+(defn member-access? [exp]
+  (and
+    (= (.getChildCount exp) 3)
+    (not (number? (read-string (.getText (.getChild exp 0)))))
+    (= "." (.getText (.getChild exp 1)))))
+
+
+;Contract parsing
+
 (defn parse-contract [str]
   (let [lexer (JavaLexer. (ANTLRInputStream. str))
         tokens (CommonTokenStream. lexer)
@@ -14,14 +123,106 @@
     (.expression parser)))

+;Transformation rules
+
+(declare visit-rule)
+
+
+(defn dump-parentheses [rule]
+  (visit-rule (.getChild rule 1)))
+
+
+(defn visit-infix-expression [rule]
+  (str
+    "("
+    (SMTLib-equivalent (.getText (.getChild rule 1)))
+    " "
+    (visit-rule (.getChild rule 0))
+    " "
+    (visit-rule (.getChild rule 2))
+    ")"))
+
+
+(defn visit-unary [rule]
+  (let [fst (.getChild rule 0)
+        sec (.getChild rule 1)
+        fsttext (.getText fst)
+        sectext (.getText sec)]
+    (cond
+      (= fsttext "!") (str
+                        "(not "
+                        (visit-rule sec)
+                        ")")
+      (or
+        (= fsttext "++")
+        (= fsttext "--")) (str
+                            "("
+                            (SMTLib-equivalent fsttext)
+                            (visit-rule sec)
+                            " 1)")
+      (or
+        (= sectext "++")
+        (= sectext "--")) (visit-rule fst)
+      ;Shouldn't ever happen (postfix !)
+      :else (visit-rule fst))))
+
+
+(defn visit-ternary [rule]
+  (let [x (.getChild rule 0)
+        y (.getChild rule 2)
+        z (.getChild rule 4)]
+    (str
+      "(and (or (not "
+      (visit-rule x)
+      ") "
+      (visit-rule y)
+      ")(or "
+      (visit-rule x)
+      " "
+      (visit-rule z)
+      "))")))
+
+
+(defn visit-method-call [rule]
+  (str
+    "method_call_"
+    (visit-rule (.getChild rule 0))))
+
+
+(defn visit-member-access [rule]
+  (str
+    (visit-rule (.getChild rule 0))
+    "_messages_"
+    (visit-rule (.getChild rule 2))))
+
+
+(defn visit-children [rule]
+  (loop [result "" i 0 max (.getChildCount rule)]
+    (if
+      (= i max)
+      result
+      ;Recursively append transformations
+      (recur
+        (let [crule (.getChild rule i)]
+          (str result (visit-rule crule)))
+        (+ i 1)
+        max))))
+
+
 ;decision table
 (defn visit-rule [rule]
-  (case (.toString (.getClass rule))
-    "be.ac.ua.aspchecker.parser.JavaParser$ExpressionContext" "PLACEHOLDER"
-    ;Default
-    (.getText rule)))
-
-
-;starting point for the recursive transformation
-(defn visit-contract [expression]
- (visit-rule expression))+  (cond
+    (parentheses-expression? rule) (dump-parentheses rule)
+    (logical-expression? rule) (visit-infix-expression rule)
+    (arithmetic-expression? rule) (visit-infix-expression rule)
+    (unary? rule) (visit-unary rule)
+    (ternary? rule) (visit-ternary rule)
+    (method-call? rule) (visit-method-call rule)
+    (member-access? rule) (visit-member-access rule)
+    (terminal? rule) (.getText rule)
+    ;Recursively visit children
+    :else (visit-children rule)))
+
+
+(defn transform [contract]
+  (visit-rule (parse-contract contract)))


Explicitly disable *print-length* and *print-level* when generating scripts

--- pigpen-pig/src/main/clojure/pigpen/pig/script.clj
+++ pigpen-pig/src/main/clojure/pigpen/pig/script.clj
@@ -386,7 +386,9 @@
 (defn commands->script
   "Transforms a sequence of commands into a Pig script"
   [commands]
-  (let [state {:partitioner (atom -1)}]
-    (apply str
-      (for [command commands]
-        (command->script command state)))))
+  (binding [*print-length* false
+            *print-level* false]
+    (let [state {:partitioner (atom -1)}]
+      (apply str
+        (for [command commands]
+          (command->script command state))))))


Don't print the DB password upon startup - that goes into logs.

--- src/circle/db.clj
+++ src/circle/db.clj
@@ -53,7 +53,7 @@
   "Initializes the mongodb connection"
   [& [db]]
   (let [db (or db (default-db))]
-    (infof "Connecting to: %s" db)
+    (infof "Connecting to: %s" (dissoc db :password))
     (def mongodb (connect db))
     (mongo/set-connection! mongodb)))


Refactor some Useful functions in Sequences.

--- src/cljs/cljs_repl_web/cljs_api/utils.cljs
+++ src/cljs/cljs_repl_web/cljs_api/utils.cljs
@@ -7,15 +7,21 @@
 ;;; We can easily add or remove sections/topics and they will be automatically
 ;;; displayed in the API panel.
 (def custom-api-map
-  {:sections [(Section. "Useful Macros" ""
-                        [(Topic. "conditionals"
-                                 '(if if-not if-let cond condp and or not when when-let
-                                      when-not case))
-                         (Topic. "nesting, chaining, and interop"
-                                 '(-> ->> doto .. .))
-                         (Topic. "defining things"
-                                 '(def defn fn let letfn binding defmulti defmethod
-                                    deftype defrecord reify this-as declare ns))])
+  {:sections [(Section. "Useful Functions" ""
+                        [(Topic. "math"
+                                 '(+ - * / quot rem mod inc dec max min rand))
+                         (Topic. "comparison"
+                                 '(= == not= < > <= >=))
+                         (Topic. "predicates"
+                                 '(nil? identical? zero? pos? neg? even? odd? true? false?
+                                        distinct? empty? every? not-every? some not-any?))
+                         (Topic. "higher-order functions"
+                                 '(map map-indexed mapcat reduce filter partition-by
+                                       take-while keep remove merge-with mapcat iterate repeatedly))
+
+                         (Topic. "functions as data"
+                                 '(apply partial comp complement juxt))])
+
               (Section. "Datatypes" ""
                         [(Topic. "maps " '({:key1 val1 :key2 val2}))
                          (Topic. "vectors" '([1 2 3] [:a :b :c]))
@@ -31,28 +37,27 @@
                                  '("(fn |NAME| [<ARGS*>] |CONSTRAINTS| <ACTIONS*>)"))
                          (Topic. "anonymous inline funcion"
                                  '("#(<ACTION> |% %2 %3 OR %&|)"))])
-              (Section. "Useful Functions" ""
-                        [(Topic. "math"
-                                 '(+ - * / quot rem mod inc dec max min rand))
-                         (Topic. "comparison"
-                                 '(= == not= < > <= >=))
-                         (Topic. "predicates"
-                                 '(nil? identical? zero? pos? neg? even? odd? true? false?
-                                        distinct? empty? every? not-every? some not-any?))
-                         (Topic. "higher-order functions"
-                                 '(map map-indexed mapcat reduce filter partition-by
-                                       take-while keep remove merge-with mapcat iterate repeatedly))
-                         (Topic. "data creation"
+              (Section. "Sequences" ""
+                        [(Topic. "creation"
                                  '(vector vec hash-map set for list list* sorted-map
                                           repeat range cycle))
-                         (Topic. "data inspection"
+                         (Topic. "inspection"
                                  '(first last rest next get get-in count keys
                                          vals nth contains? find take ))
-                         (Topic. "data manipulation"
+                         (Topic. "manipulation"
                                  '(seq into conj cons assoc flatten merge assoc-in
-                                       dissoc zipmap partition update-in reverse))
-                         (Topic. "functions as data"
-                                 '(apply partial comp complement juxt))])
+                                       dissoc zipmap partition update-in reverse))])
+              (Section. "Useful Macros" ""
+                        [(Topic. "conditionals"
+                                 '(if if-not if-let cond condp and or not when when-let
+                                      when-not case))
+                         (Topic. "nesting, chaining, and interop"
+                                 '(-> ->> doto .. .))
+                         (Topic. "defining things"
+                                 '(def defn fn let letfn binding defmulti defmethod
+                                    deftype defrecord reify this-as declare ns))])
+
+
               (Section. "JavaScript Interop" ""
                         [(Topic. "method call" '("(.the-method target-object args...)"))
                          (Topic. "property access" '("(.-property target-object -property)"))


better logging

better logging

--- src/clojure/zensols/actioncli/resource.clj
+++ src/clojure/zensols/actioncli/resource.clj
@@ -82,9 +82,9 @@
                        (if system-file
                          (list (remove nil? `(sysfile ~system-file
                                                       ~system-default)))))
+        _ (log/debugf "registering form: %s" (pr-str fnform))
         ;; bind since calling from other *ns* fails the eval (i.e. requires)
         fval (binding [*ns* our-ns]
                (eval (concat (list 'fn [] fnform))))]
-    (log/debugf "registering form: %s" (pr-str fnform))
     (swap! res-paths assoc key fval)
     fval))


Add test for adjust-to-range

Add test for adjust-to-range

--- test/cljs/player/view_test.cljs
+++ test/cljs/player/view_test.cljs
@@ -38,3 +38,8 @@
   (is (= (v/format-time 0.88) "00:00"))
   (is (= (v/format-time 1.00) "00:01"))
   (is (= (v/format-time 133.95) "02:13")))
+
+(deftest adjust-to-range-test
+  (is (= (v/adjust-to-range 1 -5 5) 1))
+  (is (= (v/adjust-to-range -6 -5 5) -5))
+  (is (= (v/adjust-to-range 6 -5 5) 5)))


unit test fix.

unit test fix.

--- test/metabase/api/card_test.clj
+++ test/metabase/api/card_test.clj
@@ -50,9 +50,9 @@
                                                (map :id)
                                                set)
                                           card-id))]
-          [(card-returned? 1 id1)
-           (card-returned? 2 id1)
-           (card-returned? 2 id2)])))))
+          [(card-returned? (db-id) id1)
+           (card-returned? dbid id1)
+           (card-returned? dbid id2)])))))

 ;; Make sure `id` is required when `f` is :database
 (expect {:errors {:id "id is required parameter when filter mode is 'database'"}}


Replace VictorOps tests with tests that call to a mock clj-http

--- test/riemann/victorops_test.clj
+++ test/riemann/victorops_test.clj
@@ -1,43 +1,23 @@
 (ns riemann.victorops-test
-  (:use riemann.victorops
-        clojure.test)
-  (:require [riemann.logging :as logging]))
+  (:require [clj-http.client :as client]
+            [clojure.test :refer :all]
+            [riemann.victorops :as vo]
+            [riemann.test-utils :refer [with-mock]]))

-(def api-key (System/getenv "VICTOROPS_API_KEY"))
-(def routing-key (System/getenv "VICTOROPS_ROUTING_KEY"))
-
-(when-not api-key
-  (println "export VICTOROPS_API_KEY=\"...\" to run these tests."))
-
-(when-not routing-key
-  (println "export VICTOROPS_ROUTING_KEY=\"...\" to run these tests."))
-
-(logging/init)
-
-(deftest ^:victorops ^:integration test-info
-  (let [vo (victorops api-key routing-key)]
-    ((:info vo) {:host "localhost"
-                :service "victorops info notification"
-                :metric 42
-                :state "info"})))
-
-(deftest ^:victorops ^:integration test-recovery
-  (let [vo (victorops api-key routing-key)]
-    ((:recovery vo) {:host "localhost"
-                    :service "victorops recovery notification"
-                    :metric 0.5
-                    :state "ok"})))
-
-(deftest ^:victorops ^:integration test-warning
-  (let [vo (victorops api-key routing-key)]
-    ((:warning vo) {:host "localhost"
-                    :service "victorops warning notification"
-                    :metric 0.5
-                    :state "warning"})))
-
-(deftest ^:victorops ^:integration test-critical
-  (let [vo (victorops api-key routing-key)]
-    ((:critical vo) {:host "localhost"
-                    :service "victorops critical notification"
-                    :metric 0.5
-                    :state "critical"})))
+(deftest victorops-test
+  (with-mock [calls client/post]
+    (let [vo (vo/victorops "my-dumb-api-key" "my-dumb-routing-key")]
+      ((:info vo) {:host    "my-dumb-host"
+                   :service "victorops info notification"
+                   :metric   42
+                   :time     12345678
+                   :state    "info"})
+      (is (= 1 (count @calls)))
+      (is (= (last @calls)
+             ["https://alert.victorops.com/integrations/generic/20131114/alert/my-dumb-api-key/my-dumb-routing-key"
+              {:body "{\"message_type\":\"INFO\",\"entity_id\":\"my-dumb-host/victorops info notification\",\"timestamp\":12345678,\"state_start_time\":12345678,\"state_message\":\"my-dumb-host victorops info notification is info (42)\",\"entity_is_host\":false,\"monitoring_tool\":\"riemann\"}"
+               :socket-timeout 5000
+               :conn-timeout 5000
+               :content-type :json
+               :accept :json
+               :throw-entire-message? true}])))))


- corrected issues with clojurescript testing

--- test/smooth_spec/stub_spec.cljc
+++ test/smooth_spec/stub_spec.cljc
@@ -8,7 +8,8 @@
      (:import clojure.lang.ExceptionInfo))
   #?(:cljs (:require-macros [cljs.test :refer (are is deftest run-tests testing)]
              [smooth-spec.core :refer [specification behavior provided with-timeline async tick assertions]]))
-  #?(:cljs (:require [cljs.test :as t]
+  #?(:cljs (:require
+             [cljs.test :as t :refer (do-report)]
              [smooth-spec.stub :as s :include-macros true]
              ))
   )


more tests

more tests

--- test/swagger_gen/spray_test.clj
+++ test/swagger_gen/spray_test.clj
@@ -4,6 +4,43 @@

 (def petstore-yaml "resources/swagger/petstore.yaml")

+;; Model fixtures
+
+(def expiry-date
+  {:name "ExpiryDate",
+   :args [{:name "expiry_month", :type "string", :required true}
+          {:name "expiry_year", :type "string", :required true}]})
+
+(def error-model
+  {:name "Error",
+   :args [{:name "code", :type "integer", :items nil, :required true}
+          {:name "message", :type "string", :items nil, :required true}]})
+
+(deftest generate-case-object-test []
+  (testing "should generate a Scala case object when arity is zero"
+    (let [route {:name "Foo" :args []}]
+      (is (= "case object Foo" (render-case-class route))))))
+
+(deftest generate-case-class-test []
+  (testing "should generate a Scala case class"
+    (is (= "case class ExpiryDate(expiryMonth: String, expiryYear: String)"
+           (render-case-class expiry-date)))
+    (is (= "case class Error(code: Int, message: String)"
+           (render-case-class error-model)))))
+
+;; Routes
+
 (deftest starts-and-ends-with-test []
   (testing "should return true for spray route part"
     (is (= true (starts-and-ends-with? "{foo}" "{" "}")))))
+
+(deftest route-parts-test []
+  (testing "should split spray route into parts"
+    (is (= ["api" "users" "{id}"]
+           (route-parts "/api/users/{id}")))))
+
+(deftest to-spray-route-test []
+  (testing "should return a spray route string"
+    (is (= "api / users / Segment"
+           (to-spray-route "/api/users/{id}")))))
+


Adding Marginalia docs + updating a few deps

--- build.boot
+++ build.boot
@@ -5,7 +5,7 @@
   '[[adzerk/boot-cljs "1.7.228-1" :scope "test"]
     [adzerk/boot-cljs-repl "0.3.3" :scope "test"]
     [adzerk/boot-reload "0.4.12" :scope "test"]
-    [binaryage/devtools "0.8.1" :scope "test"]
+    [binaryage/devtools "0.8.2" :scope "test"]
     [cljsjs/clipboard "1.5.9-0"]
     [cljsjs/react "15.3.1-0"]
     [cljsjs/react-bootstrap "0.29.2-0"]
@@ -17,14 +17,15 @@
     [com.stuartsierra/component "0.3.1"]
     [com.taoensso/timbre "4.7.4"]
     [crisptrutski/boot-cljs-test "0.2.2-SNAPSHOT" :scope "test"]
-    [datascript "0.15.2"]
+    [datascript "0.15.4"]
     [deraen/boot-less "0.5.0" :scope "test"]
     [devcards "0.2.1-7" :scope "test"]
     [fipp "0.6.6" :scope "test"]
     [hashobject/boot-s3 "0.1.2-SNAPSHOT" :scope "test"]
     [hiccup "1.0.5"]
+    [it.frbracch/boot-marginalia "0.1.3-1" :scope "test"]
     [org.clojure/clojurescript "1.9.225"]
-    [org.clojure/core.async "0.2.385"]
+    [org.clojure/core.async "0.2.391"]
     [org.clojure/test.check "0.9.0"]
     [org.clojure/tools.nrepl "0.2.12" :scope "test"]
     [org.martinklepsch/boot-gzip "0.1.2" :scope "test"]
@@ -34,7 +35,7 @@
     [pandeiro/boot-http "0.7.3" :scope "test"]
     [perun "0.3.0" :scope "test"]
     [posh "0.3.5"]
-    [reagent "0.6.0-rc"]
+    [reagent "0.6.0"]
     [weasel "0.7.0" :scope "test"]])

 (require
@@ -47,6 +48,7 @@
   '[deraen.boot-less :refer :all]
   '[hashobject.boot-s3 :refer :all]
   '[io.perun :refer :all]
+  '[it.frbracch.boot-marginalia :refer [marginalia]]
   '[org.martinklepsch.boot-gzip :refer [gzip]]
   '[pandeiro.boot-http :refer :all])

@@ -164,6 +166,7 @@
   (comp (build-cljs)
         (build-html :metadata-file (str "perun.base." environment ".edn"))
         (build-css)
+        (marginalia)
         (gzip :regex #{#"\.html$" #"\.css$" #"\.js$"})
         (sift :move {#"^(.*)\.html$" "$1.html.orig"
                      #"^(.*)\.css$" "$1.css.orig"


deploy snapshot version

deploy snapshot version

--- build.boot
+++ build.boot
@@ -1,4 +1,4 @@
-(def +version+ "0.2.1")
+(def +version+ "0.3.0-SNAPSHOT")

 (set-env!
  :source-paths    #{"src/main"}


Update build.boot.

Update build.boot.

--- build.boot
+++ build.boot
@@ -1,33 +1,43 @@
 (set-env!
  :source-paths #{"src/clojure" "src/java" "test"}
  :resource-paths #{"resources"}
- :dependencies '[[org.clojure/clojure "1.7.0-beta3" :scope "provided"]
-                 [org.slf4j/slf4j-simple "1.7.10" :scope "provided"]
+ :dependencies '[;; Current runtime dependencies
+                 [org.clojure/clojure "1.7.0-beta3" :scope "provided"]
+                 [org.slf4j/slf4j-simple "1.7.12" :scope "provided"]

-                 [funcool/bootutils "0.1.0-SNAPSHOT" :scope "test"]
+                 ;; Boot dependencies
+                 [boot-deps "0.1.4" :scope "test"]
+                 [funcool/bootutils "0.1.0" :scope "test"]
+                 [funcool/boot-codeina "0.1.0-SNAPSHOT" :scope "test"]
                  [adzerk/boot-test "1.0.4" :scope "test"]
-                 [clj-http "1.1.0" :scope "test"]
-                 [cc.qbits/jet "0.6.1" :scope "test"]
+
+                 ;; Testing dependecines
+                 [clj-http "1.1.2" :scope "test"]
+                 [cc.qbits/jet "0.6.2" :scope "test"]
                  [org.clojure/tools.namespace "0.2.10" :scope "test"]
                  [ring/ring-core "1.3.2"
+                  :scope "test"
                   :exclusions [javax.servlet/servlet-api
-                               clj-time
-                               org.clojure/clojure]
-                  :scope "test"]
+                               org.clojure/clojure
+                               clj-time]]

+                 ;; Required dependencies
                  [org.clojure/core.async "0.1.346.0-17112a-alpha"]
                  [io.ratpack/ratpack-core "0.9.16"]
                  [com.stuartsierra/component "0.2.3"]
                  [buddy/buddy-core "0.5.0"]
                  [buddy/buddy-auth "0.5.3"]
+                 [cats "0.4.0"]
                  [funcool/cuerdas "0.4.0"]
                  [funcool/futura "0.1.0-alpha2" :exclusions [org.reactivestreams/reactive-streams]]
                  [environ "1.0.0"]
-                 [potemkin "0.3.12" :exclusions [riddley]]])
+                 [potemkin "0.3.13" :exclusions [riddley]]])

 (require
- '[bootutils.core :refer :all]
- '[adzerk.boot-test :refer :all])
+ '[funcool.bootutils :refer :all]
+ '[funcool.boot-codeina :refer :all]
+ '[adzerk.boot-test :refer :all]
+ '[boot-deps :refer [ancient]])

 (def +version+ "0.2.0-SNAPSHOT")

@@ -37,4 +47,36 @@
       :description "Asynchronous web toolkit for Clojure build on top of Ratpack."
       :url         "http://github.com/funcool/catacumba"
       :scm         {:url "https://github.com/funcool/catacumba"}
-      :license     {"BSD (2 Clause)" "http://opensource.org/licenses/BSD-2-Clause"}})
+      :license     {"BSD (2 Clause)" "http://opensource.org/licenses/BSD-2-Clause"}}
+
+ apidoc {:exclude ['catacumba.impl.context
+                   'catacumba.impl.helpers
+                   'catacumba.impl.parse
+                   'catacumba.impl.handlers
+                   'catacumba.impl.server
+                   'catacumba.impl.http
+                   'catacumba.impl.routing
+                   'catacumba.impl.streams
+                   'catacumba.impl.websocket
+                   'catacumba.impl.sse
+                   'catacumba.impl.types
+                   'catacumba.handlers.core
+                   'catacumba.handlers.cors
+                   'catacumba.handlers.security
+                   'catacumba.handlers.session
+                   'catacumba.handlers.interceptor
+                   'catacumba.experimental.stomp
+                   'catacumba.experimental.stomp.parser
+                   'catacumba.experimental.stomp.broker]
+         :sources #{"src/clojure"}
+         :reader :clojure
+         :writer :html5
+         :target "doc/api"
+         :src-uri "http://github.com/funcool/catacumba/blob/master/"
+         :src-uri-prefix "#L"})
+
+
+(deftask doc
+  []
+  (comp (javac)
+        (apidoc)))


Update bootutils dependency.

Update bootutils dependency.

--- build.boot
+++ build.boot
@@ -2,7 +2,7 @@
  :source-paths #{"src"}
  :resource-paths #{"assets"}
  :dependencies '[[cats "0.4.0"]
-                 [funcool/bootutils "0.1.0-SNAPSHOT" :scope "test"]
+                 [funcool/bootutils "0.1.0" :scope "test"]
                  [adzerk/boot-cljs "0.0-2814-3" :scope "test"]
                  [boot-cljs-test/node-runner "0.1.0" :scope "test"]
                  [org.clojure/clojurescript "0.0-3123"  :scope "test"]
@@ -11,7 +11,7 @@

 (require
  '[adzerk.boot-cljs :refer [cljs]]
- '[bootutils.core :refer :all]
+ '[funcool.bootutils :refer :all]
  '[boot-cljs-test.node-runner :refer :all])

 (def +version+ "0.1.2")


Spelling of initial.

Spelling of initial.

--- jlad/jlad.clj
+++ jlad/jlad.clj
@@ -288,13 +288,13 @@
 (defn binary-primitive [proc]
   (new primitive (fn [arg] (proc (:car arg) (:cdr arg)))))

-(def inital-env {'+ (binary-primitive +)
-		 'zero (new primitive zero)
-		 'bundle (binary-primitive make-bundle)
-		 'primal (new primitive :primal)
-		 'tangent (new primitive :tangent)})
+(def initial-env {'+ (binary-primitive +)
+		  'zero (new primitive zero)
+		  'bundle (binary-primitive make-bundle)
+		  'primal (new primitive :primal)
+		  'tangent (new primitive :tangent)})

 (defn jl-do [form]
-  (jl-eval (syntax form) inital-env))
-
-; (jl-eval (syntax-body (sexp-slurp (clojure.java.io/file "foo.jlad"))) inital-env)
+  (jl-eval (syntax form) initial-env))
+
+; (jl-eval (syntax-body (sexp-slurp (clojure.java.io/file "foo.jlad"))) initial-env)


fix redirect-query, it will already be a string

--- src/pc/server.clj
+++ src/pc/server.clj
@@ -258,7 +258,7 @@
                                :http-session-key (:cust/http-session-key cust))
                :headers {"Location" (str (or (get parsed-state "redirect-path") "/")
                                          (when-let [query (get parsed-state "redirect-query")]
-                                           (str "?" (url/map->query query))))}}))))
+                                           (str "?" query)))}}))))

    (POST "/logout" {{redirect-to :redirect-to} :params :as req}
          (when-let [cust (-> req :auth :cust)]


let librato notify us if we can't send http messages

--- src/pc/statsd.clj
+++ src/pc/statsd.clj
@@ -1,6 +1,32 @@
 (ns pc.statsd
-  (:require [clj-statsd :as s]
-            [pc.profile :as profile]))
+  (:require [clj-http.client :as http]
+            [clj-statsd :as s]
+            [pc.profile :as profile]
+            [pc.utils]))
+
+(def librato-api-name "daniel+start-trial@prcrsr.com")
+(def librato-api-token "d6f799f643c673a6eb2f555b78362324f6a39a0780fe03a5fff9c58a9d6c145f")
+
+(defn post-metric [type metric-name value & {:keys [source]}]
+  (http/post "https://metrics-api.librato.com/v1/metrics"
+             {:content-type :json
+              :basic-auth [librato-api-name librato-api-token]
+              :form-params {type
+                            {metric-name
+                             (merge {:value value}
+                                    (when source
+                                      {:source source}))}}}))
+
+(defn post-gauge [name value & {:keys [source]}]
+  (post-metric "gauges" name value :source source))
+
+(defn post-counter [name value & {:keys [source]}]
+  (post-metric "counters" name value :source source))
+
+;; Note: need something better when we have multiple servers
+(defn send-deadman-ping-cron []
+  (post-gauge "deadman" 1))

 (defn init []
-  (s/setup (profile/statsd-host) 8125))
+  (s/setup (profile/statsd-host) 8125)
+  (pc.utils/safe-schedule {:minute (range 0 60)} #'send-deadman-ping-cron))


Catch error when calling core/uuid?

Catch error when calling core/uuid?

--- backend/specs/akvo/lumen/specs.clj
+++ backend/specs/akvo/lumen/specs.clj
@@ -29,7 +29,9 @@

 (defn str-uuid? [v]
   (when (some? v)
-    (uuid? (read-string (format "#uuid \"%s\"" v)))))
+    (try
+      (uuid? (read-string (format "#uuid \"%s\"" v)))
+      (catch Throwable t false))))

 (s/def ::str-uuid
   (s/with-gen


updated ObjectId to match mongo2.0 java driver.

--- src/karras/collection.clj
+++ src/karras/collection.clj
@@ -23,7 +23,8 @@
 (ns karras.collection
   (:use [clojure.contrib.def :only [defnk]]
         [karras.core :only [*mongo-db* to-dbo to-clj]])
-  (:import [com.mongodb Mongo DB DBCollection DBObject ObjectId]))
+  (:import [com.mongodb Mongo DB DBCollection DBObject]
+           [org.bson.types ObjectId]))

 (defn- keyword-str [kw]
   (if (keyword? kw)


Use when-not instead of (when (not...

Use when-not instead of (when (not...

--- src/lazada_quest/core.clj
+++ src/lazada_quest/core.clj
@@ -24,7 +24,7 @@
   "If category tree file exists in filesystem, do nothing, otherwise
    scrape lazada website and save the generated category tree into file"
   [site-key priority-key]
-  (when (not (.exists (clojure.java.io/as-file FILE_NAME)))
+  (when-not (.exists (clojure.java.io/as-file FILE_NAME))
     (-> (scrapper/create-category-tree site-key priority-key MAX_PRODUCTS)
         (save-to-file))))


added documentation and fixed some bugs

added documentation and fixed some bugs

--- src/mail_sieve_e/core.clj
+++ src/mail_sieve_e/core.clj
@@ -12,7 +12,9 @@

 (defn connect
   "Takes: server - host ip to connect to
-          port   - port to connect to"
+          port   - port to connect to
+  and returns a map of channels to read/write to
+  and a raw socket"
   [server port]
   (let [socket (Socket. server port)
         in (-> socket
@@ -40,12 +42,6 @@
   (let [writer (io/writer socket)]
     (.write writer (str msg "\n"))
     (.flush writer)))
-
-(defn send-to-all
-  "Sends a msg to all connected machines"
-  [connected msg]
-  (doall
-   (map #(write % msg) @connected)))

 (defn read-handler
   "Given a socket and returns a channel which is populated
@@ -96,7 +92,7 @@
                 (when @running?
                   (do
                     (alt! [client-in] ([msg] (write sock (@handler msg)))
-                          [send-chan] ([msg] (send-to-all connected msg)))
+                          [send-chan] ([msg] (doall (map #(write % msg) @connected))))
                     (recur))))))))
       (catch Exception e nil))
     (go-loop []
@@ -161,7 +157,8 @@
                  bounds  (get chunks (inc mi))]] ; first chunk is for lead
        (do
          (write machine (+ mi 2))
-         (write machine bounds))))
+         (write machine bounds)
+         (write machine 1))))
     ; Now we can start the sieve
     (s/sieve-e 1 true (chan 10) lead-chunk send-chan)
     (println "Waiting for other machines to finish...\n")
@@ -170,8 +167,11 @@
     ; shut down server
     (println "Shutting down server...\n")
     (do
+      ; send kill signal
       (>!! send-chan 0)
+      ; wait for machines to recieve signal
       (<!! (timeout 200))
+      ; shutdown various parts
       (reset! (:running server) false)
       (mapv #(.close %) connected)
       (a/close! send-chan)
@@ -182,19 +182,26 @@
   "Starts a following process listening on host:port"
   [host port]
   (println "connecting to host...")
+  ; first connect to lead computer
   (let [lead (connect host port)]
     (println "connected to host!\n")
     (println "waiting for all other computers to connect...\n")
+    ; recieve machine number and bounds while conveniently waiting for lead to send info
     (let [my-num (int(<!! (:in lead)))
           bounds (mapv int (<!! (:in lead)))
           chunk  (s/gen-table bounds)]
+      ; wait for start signal
       (when-let [start? (<!! (:in lead))]
+        ; run sieve listening on lead channels
         (s/sieve-e my-num false (:in lead) chunk (:out lead))
+        ; then wait for kill signal
         (println "Waiting for kill signal...")
         (while (not= 0 (<!! (:in lead)))
           (<!! (timeout 50)))
+        ; Then close the channels and socket
         (do (a/close! (:in lead))
-            (a/close! (:out lead)))
+            (a/close! (:out lead))
+            (.close (:socket lead)))
         (println "Done!")))))

 (defn -main


fix idiotic hardcoded bug

fix idiotic hardcoded bug

--- src/main/om_css/core.cljc
+++ src/main/om_css/core.cljc
@@ -43,7 +43,7 @@
        (let [[pre post] (split-with (complement map?) props)
              props' (concat (map #(cond-> %
                                     (keyword? %)
-                                    (utils/format-unevaluated-class-names component-info #{:root}))
+                                    (utils/format-unevaluated-class-names component-info classes-seen))
                               pre)
                       (map #(reshape-props % component-info classes-seen) post))]
          props')


CMR-1115: Added handling of missing OribtCalculatedSpatialDomains for granule with orbit spatial during atom search.

--- search-app/src/cmr/search/results_handlers/orbit_swath_results_helper.clj
+++ search-app/src/cmr/search/results_handlers/orbit_swath_results_helper.clj
@@ -69,10 +69,11 @@
         start-date (when start-date (str/replace (str start-date) #"\+0000" "Z"))
         end-date (when end-date (str/replace (str end-date) #"\+0000" "Z"))
         orbit-calculated-spatial-domains (map ocsd-json->map orbit-calculated-spatial-domains-json)]
-    (when orbit-asc-crossing-lon
+    (when (and orbit-asc-crossing-lon
+               (not-empty orbit-calculated-spatial-domains))
       (swath/to-polygons
-          (orbits-by-collection collection-concept-id)
-          orbit-asc-crossing-lon
-          orbit-calculated-spatial-domains
-          start-date
-          end-date))))+        (orbits-by-collection collection-concept-id)
+        orbit-asc-crossing-lon
+        orbit-calculated-spatial-domains
+        start-date
+        end-date))))


s/small/small-plus-vp-pronoun/

s/small/small-plus-vp-pronoun/

--- src/babel/english/writer.clj
+++ src/babel/english/writer.clj
@@ -28,7 +28,7 @@
                                 (process [{:fill-one-language
                                            {:count 1
                                             :spec spec
-                                            :model small
+                                            :model small-plus-vp-pronoun
                                             }}]
                                          source-language-short-name)
                                 (catch Exception e


Fix refine-mark

Fix refine-mark

--- src/bogo_clojure/bg_word.clj
+++ src/bogo_clojure/bg_word.clj
@@ -216,7 +216,9 @@
 (defn refine-mark
   [word]
   (let [mark (vowel-of-word->mark word)]
-    (mark->word word mark)))
+    (if (not= :nomark mark)
+      (mark->word word mark)
+      word)))

 (defn refine-word
   [word]


Fix thumbnail? predicate

Fix thumbnail? predicate

--- src/mars_ogler/images.clj
+++ src/mars_ogler/images.clj
@@ -99,8 +99,7 @@

 (defn thumbnail?
   [img]
-  (let [t (:type img)]
-    (or (= t "I") (= t "T") (= t "Q") false)))
+  (= (:type img) "Thumbnail"))

 ;;
 ;; Stereo Pairs


Don't clear timeline when refresh button is clicked.

--- samples/twitterbuzz/src/twitterbuzz/timeline.cljs
+++ samples/twitterbuzz/src/twitterbuzz/timeline.cljs
@@ -36,9 +36,4 @@
         (doseq [tweet tweets]
           (add-timeline-tweet tweet)))))

-(defn refresh [_]
-  (let [parent (dom/getElement "timeline-content")]
-    (do (dom/removeChildren parent))))
-
 (core/register :new-tweets update-timeline)
-(core/register :refresh-clicked refresh)


CMR-6185: Remove unused require

CMR-6185: Remove unused require

--- search-app/src/cmr/search/api/concepts_search.clj
+++ search-app/src/cmr/search/api/concepts_search.clj
@@ -13,7 +13,6 @@
    [cmr.common.services.errors :as svc-errors]
    [cmr.common.util :as util]
    [cmr.search.api.core :as core-api]
-   [cmr.search.data.shapefile :as shapefile]
    [cmr.search.services.parameters.legacy-parameters :as lp]
    [cmr.search.services.query-service :as query-svc]
    [cmr.search.services.result-format-helper :as rfh]


Deduplicate card IDs in query :spades:

Deduplicate card IDs in query :spades:

--- src/metabase/api/card.clj
+++ src/metabase/api/card.clj
@@ -68,7 +68,7 @@
    Make sure cards are returned in the same order as CARD-IDS`; `[in card-ids]` won't preserve the order."
   [card-ids]
   {:pre [(every? integer? card-ids)]}
-  (let [card-id->card (db/select-id->obj Card, :id [:in card-ids], :archived false)]
+  (let [card-id->card (db/select-id->obj Card, :id [:in (set card-ids)], :archived false)]
     (filter identity (map card-id->card card-ids))))

 (defn- cards:recent


Fixed the apply-mocha

Fixed the apply-mocha

--- src/mocha_tester/core.clj
+++ src/mocha_tester/core.clj
@@ -35,14 +35,15 @@
 ;; Ring helper stuff

 (defn- head-str [base]
-  (format
-   "<link rel='stylesheet' type='text/css' href='%1$s/mocha.css'>
-
-   " base))
+  (enlive/html
+   [:link {:rel "stylesheet" :type "text/css" :href (str base "/mocha.css")}]
+   [:script {:src (str base "/mocha.js")}]
+   [:script "mocha.setup('bdd');"]))

 (def ^:private body-str
-  "

-   ")
+  (enlive/html
+   [:div#mocha]
+   [:script "mocha.run();"]))

 (defn apply-mocha [html base]
   (enlive/sniptest html


Simplified demo# with destructuring

Simplified demo# with destructuring

--- src/overtunes/songs/canone_alla_quarta.clj
+++ src/overtunes/songs/canone_alla_quarta.clj
@@ -14,10 +14,10 @@
     (->> notes (map play-at#) dorun)))

 (defn demo# [pitches]
-  (loop [play-at (now), still-to-play pitches]
-    (if still-to-play (do
-      (at play-at (piano# (first still-to-play)))
-      (recur (+ 300 play-at) (next still-to-play))))))
+  (loop [play-at (now), [current & still-to-play] pitches]
+    (at play-at (piano# current))
+    (if still-to-play
+      (recur (+ 300 play-at) still-to-play))))

 ;(piano# 50)
 ;(demo# (range 60 73))
@@ -122,7 +122,7 @@
     (=> melody (skew pitch -) (shift [7/2 -3]) play-now#)))

 ;((bpm 120) 2)
-;(canone-alla-quarta#)
+(canone-alla-quarta#)


Extract repeats and runs because we use them more than once.

--- src/overtunes/songs/canone_alla_quarta.clj
+++ src/overtunes/songs/canone_alla_quarta.clj
@@ -46,7 +46,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (defn sums [series] (map (partial sum-n series) (range (count series))))
-
+(def repeats (partial mapcat (partial apply repeat)))
 (defn run [[a & bs]]
   (let [up-or-down
           #(if (<= %1 %2)
@@ -57,15 +57,14 @@
         (up-or-down a (first bs))
         (run bs))
       [a])))
+(def runs (partial mapcat run))

 ;(demo# (map g-major
 ;            (run [0 3 1 3 -1 0])
 ;            ))

 (def melody
-  (let [repeats (partial mapcat (partial apply repeat))
-        runs (partial mapcat run)
-        call
+  (let [call
           {:length (repeats [[2 1/4] [1 1/2] [14 1/4] [1 3/2]])
            :pitch (runs [[0 -1 3 0] [4] [1 8]])}
         response
@@ -79,9 +78,7 @@
     (map vector (sums (:length line)) (:pitch line))))

 (def bassline
-  (let [triples (partial mapcat (partial repeat 3))
-        repeats (partial mapcat (partial apply repeat))
-        runs (partial mapcat run)]
+  (let [triples (partial mapcat (partial repeat 3))]
     (map vector
        (sums (repeats [[21 1] [12 1/4]]))
        (concat (triples (runs [[0 -3] [-5 -3]])) (run [12 0])))))


fix pdf link

fix pdf link

--- src/clj/salava/badge/pdf.clj
+++ src/clj/salava/badge/pdf.clj
@@ -37,25 +37,14 @@
                            :content %2)) badge-with-content temp)]
     (replace-nils badges)))

+
 #_(defn process-pdf-page [stylesheet template badge ul]
-  (if-let [p (blank? (slurp (io/piped-input-stream (fn [out] (pdf/pdf (into [stylesheet] (template badge)) out)))))]
-    (io/piped-input-stream (fn [out] (pdf/pdf [{} [:paragraph (t :core/Errorpage ul) #_"Error while processing, Page can't be displayed"]] out)))
-    (io/piped-input-stream (fn [out] (pdf/pdf (into [stylesheet] (template badge)) out)))))
-
-(defn process-pdf-page [stylesheet template badge ul]
-  (let [file (java.io.File/createTempFile "temp" ".pdf")
-        pdf (pdf/pdf (into [stylesheet] (template badge)) (.getAbsolutePath file))]
-    (if (blank? (slurp file))
-      (pdf/pdf [{} [:paragraph (t :core/Errorpage ul)]] (.getAbsolutePath file))
-      file)))
-
-
-#_(defn process-markdown [markdown]
-  (if (== 1 (count markdown))
-    markdown
-      (if-let [p (blank? (slurp (io/piped-input-stream (fn [out] (pdf/pdf [{} (markdown->clj-pdf {:spacer {:extra-starting-value 1 :allow-extra-line-breaks? true :single-value 2} :wrap {:global-wrapper :paragraph}} markdown)] out)))))]
-        ;""
-        (markdown->clj-pdf {:image {:x 10 :y 10} :spacer {:extra-starting-value 1 :allow-extra-line-breaks? true :single-value 2} :wrap {:global-wrapper :paragraph}} markdown))))
+    (let [file (java.io.File/createTempFile "temp" ".pdf")
+          pdf (pdf/pdf (into [stylesheet] (template badge)) (.getAbsolutePath file))]
+      (if (blank? (slurp file))
+        (pdf/pdf [{} [:paragraph (t :core/Errorpage ul)]] (.getAbsolutePath file))
+        file)))
+

 (defn process-markdown-helper [markdown id context]
@@ -133,9 +122,11 @@
                                                                                [:chunk {:style :italic} (:description a)] "\n"
                                                                                [:chunk.link (:url a)] [:spacer 0]]) )]))]
                                                                 [:paragraph
-                                                                 [:chunk.chunk (str (t :badge/Criteria ul)": ")] [:anchor {:target (:criteria_url %) :style{:family :times-roman :color [66 100 162]}} (:criteria_url %)]]
-                                                                [:spacer 0]
-                                                                (process-markdown (:criteria_content %) $id "Criteria")]
+                                                                 [:chunk.chunk (str (t :badge/Criteria ul)": ")] [:anchor {:target (:criteria_url %)} [:chunk.link (t :badge/Opencriteriapage ul)]]"\n"
+                                                                 [:paragraph {:style :italic} (:criteria_url %)]
+
+                                                                 [:spacer 0]
+                                                                 (process-markdown (:criteria_content %) $id "Criteria")]]

                                                                (when-not (empty? $endorsements)
                                                                  [:paragraph.generic
@@ -182,7 +173,7 @@
                                                                             [:paragraph {:indent 0}
                                                                              (:issuer_name e) "\n"
                                                                              [:anchor {:target (:issuer_url e) :style{:family :times-roman :color [66 100 162]}} (:issuer_url e)] "\n"
-                                                                             [:chunk.link (if (number? (:issued_on e)) (date-from-unix-time (long (* 1000 (:issued_on e)))) (:issued_on e))] "\n"
+                                                                             [:chunk (if (number? (:issued_on e)) (date-from-unix-time (long (* 1000 (:issued_on e)))) (:issued_on e))] "\n"
                                                                              (process-markdown (:content e) $id "Issuer Endorsements")]))]))

                                                                [:pdf-table {:align :right :width-percent 100 :cell-border false}
@@ -194,13 +185,24 @@
                                content (if (= lang "all") (map template $content) (map template (filter #(= (:default_language_code %) (:language_code %)) $content)))]

                            (reduce into [] content)))
-        files (into [] (for [b badges] (process-pdf-page pdf-settings badge-template (list b) ul)))]
-    (fn [output-stream]
+        ;files (into [] (for [b badges] (process-pdf-page pdf-settings badge-template (list b) ul)))
+        ]
+    (fn [out]
       (try
-        (apply pdf/collate output-stream
-               (map #(-> %
-                         (.getAbsolutePath)) files))
+        (pdf/pdf (into [pdf-settings] (badge-template badges)) out)
         (catch Exception e
           (log/error "PDF not generated")
+          (log/error (.getMessage e))
+          (pdf/pdf [{} [:paragraph (t :core/Errorpage ul)]] out)
           )
-        (finally (doseq [f files] (.delete f)))))))
+        )
+      )
+    #_(fn [output-stream]
+        (try
+          (apply pdf/collate output-stream
+                 (map #(-> %
+                           (.getAbsolutePath)) files))
+          (catch Exception e
+            (log/error "PDF not generated")
+            )
+          (finally (doseq [f files] (.delete f)))))))


Fix rare bug preventing the correct root path from being found

--- src/clojure/nightcode/ui.clj
+++ src/clojure/nightcode/ui.clj
@@ -113,7 +113,9 @@
   "Returns the root path that the selected path is contained within."
   []
   (when-let [^String path (get-selected-path)]
-    (-> #(.startsWith path %) (filter @tree-projects) first)))
+    (-> #(.startsWith path (str % File/separator))
+        (filter @tree-projects)
+        first)))

 ; data for the project tree


CMR-4266: As a client, I want to search for a variable by measurement name.

--- system-int-test/test/cmr/system_int_test/search/variable/variable_search_test.clj
+++ system-int-test/test/cmr/system_int_test/search/variable/variable_search_test.clj
@@ -43,7 +43,7 @@
                                                          :LongName "Measurement3"})
         variable4 (variables/ingest-variable-with-attrs {:native-id "var4"
                                                          :Name "v.other"
-                                                         :LongName "OtherMeasurement"})
+                                                         :LongName "m.other"})
         all-variables [variable1 variable2 variable3 variable4]]
     (index/wait-until-indexed)

@@ -89,7 +89,45 @@

       "By multiple variable-names with options"
       [variable1 variable4]
-      {:variable-name ["Variable1" "*other"] "options[variable-name][pattern]" true})))
+      {:variable-name ["Variable1" "*other"] "options[variable-name][pattern]" true}
+
+      ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+      ;; measurement Param
+      "By measurement case sensitive - exact match"
+      [variable1]
+      {:measurement "Measurement1"}
+
+      "By measurement case sensitive, default ignore-case true"
+      [variable1]
+      {:measurement "measurement1"}
+
+      "By measurement ignore case false"
+      []
+      {:measurement "measurement1" "options[measurement][ignore-case]" false}
+
+      "By measurement ignore case true"
+      [variable1]
+      {:measurement "measurement1" "options[measurement][ignore-case]" true}
+
+      "By measurement Pattern, default false"
+      []
+      {:measurement "*other"}
+
+      "By measurement Pattern true"
+      [variable4]
+      {:measurement "*other" "options[measurement][pattern]" true}
+
+      "By measurement Pattern false"
+      []
+      {:measurement "*other" "options[measurement][pattern]" false}
+
+      "By multiple measurements"
+      [variable1 variable2]
+      {:measurement ["Measurement1" "measurement2"]}
+
+      "By multiple measurements with options"
+      [variable1 variable4]
+      {:measurement ["measurement1" "*other"] "options[measurement][pattern]" true})))

 (deftest deleted-variables-not-found-test
   (let [{token :token} (variables/setup-update-acl (s/context) "PROV1")


Avoid creating redundant attr frame

Avoid creating redundant attr frame

--- src/datascript/pull_api.cljs
+++ src/datascript/pull_api.cljs
@@ -130,10 +130,9 @@
              (update :kvps assoc! attr-key (:default opts)))
            (conj frames)))))

-(defn- pull-attr-frame
-  [db frame frames]
-  (let [{:keys [spec eid]} frame
-        [attr-key opts] spec]
+(defn- pull-attr
+  [db spec eid frames]
+  (let [[attr-key opts] spec]
     (if (= :db/id attr-key)
       (if (not-empty (dc/-datoms db :eavt [eid]))
         (conj (rest frames)
@@ -181,10 +180,8 @@
       (if-let [specs (seq (:specs frame))]
         (let [spec       (first specs)
               pattern    (:pattern frame)
-              new-frames (conj frames (assoc frame :specs (rest specs)))
-              attr-frame {:state :attr :pattern pattern :spec spec
-                          :eid (first eids)}]
-          (pull-attr-frame db attr-frame new-frames))
+              new-frames (conj frames (assoc frame :specs (rest specs)))]
+          (pull-attr db spec (first eids) new-frames))
         (->> frame :kvps persistent! not-empty
              (reset-frame frame (rest eids))
              (conj frames)


Pick median correctly

Pick median correctly

--- src/aurora/btree.cljs
+++ src/aurora/btree.cljs
@@ -68,7 +68,7 @@
              (.split! this max-keys)))
   (split! [this max-keys]
           ;; TODO try using push/pop instead of splice/slice
-          (let [median (js/Math.floor (/ max-keys 2))
+          (let [median (js/Math.floor (/ (alength keys) 2))
                 median-key (aget keys median)
                 median-val (aget vals median)
                 right-node (Node. parent (+ parent-ix 1) nil nil nil nil upper)]


Get simple examples working

Get simple examples working

--- src/aurora/btree.cljs
+++ src/aurora/btree.cljs
@@ -558,7 +558,10 @@
                      (when (val-lt new-hi (aget his ix))
                        (set!! changed? true)
                        (aset his ix new-hi))
-                     (when (val-lt (aget his ix) (aget los ix))
+                     ;; TODO need a better way to indicate failure
+                     (when (or (identical? greatest (aget los ix))
+                               (identical? least (aget his ix))
+                               (val-lt (aget his ix) (aget los ix)))
                        (set! failed? true))))
                  changed?))
   (split [this current]
@@ -580,14 +583,14 @@
              (set! los (.pop pushed-los))
              (set! his (.pop pushed-his))
              (set! depth (- depth 1))
+             (set! failed? false)
              (let [splitter (.pop pushed-splitters)]
                (debug :backtracked los his splitter)
                (.write-bounds this splitter)
                (debug :splitting-right los his splitter)
                (.split-right (aget constraints splitter) (aget constraint->los splitter) (aget constraint->his splitter))
                (.read-bounds this splitter)
-               (debug :split-right los his splitter)
-               (set! failed? false)))
+               (debug :split-right los his splitter failed?)))
   (next [this]
         (debug :next los his pushed-los pushed-his)
         (loop [current 0
@@ -966,15 +969,7 @@
     (alength (time (iterator->keys j)))
   )

-
-
-
-
- )
-
-(enable-console-print!)
-
-(let [tree1 (tree 10)
+  (let [tree1 (tree 10)
       _ (.assoc! tree1 #js ["a" "b"] 0)
       _ (.assoc! tree1 #js ["b" "c"] 0)
       _ (.assoc! tree1 #js ["c" "d"] 0)
@@ -993,3 +988,39 @@
   [(.next s) (.next s) (.next s)]
   )

+  (let [tree1 (tree 10)
+      _ (.assoc! tree1 #js ["a" "b"] 0)
+      _ (.assoc! tree1 #js ["b" "c"] 0)
+      _ (.assoc! tree1 #js ["c" "d"] 0)
+      _ (.assoc! tree1 #js ["d" "b"] 0)
+      s (solver 4
+                #js [(contains (iterator tree1))
+                     (contains (iterator tree1))]
+                #js [#js [0 1]
+                     #js [2 3]])
+      ]
+  (take 100 (take-while identity (repeatedly #(.next s))))
+  )
+
+  (let [tree1 (tree 10)
+      _ (.assoc! tree1 #js ["a" "b"] 0)
+      _ (.assoc! tree1 #js ["b" "c"] 0)
+      _ (.assoc! tree1 #js ["c" "d"] 0)
+      _ (.assoc! tree1 #js ["d" "b"] 0)
+      tree2 (tree 10)
+      _ (.assoc! tree2 #js ["b" "a"] 0)
+      _ (.assoc! tree2 #js ["c" "b"] 0)
+      _ (.assoc! tree2 #js ["d" "c"] 0)
+      _ (.assoc! tree2 #js ["b" "d"] 0)
+      s (solver 3
+                #js [(contains (iterator tree1))
+                     (contains (iterator tree2))]
+                #js [#js [0 2]
+                     #js [1 2]])
+      ]
+  [(.next s) (.next s) (.next s) (.next s) (.next s)]
+  )
+
+ )
+
+(enable-console-print!)


Remove js tag from macros file

Remove js tag from macros file

--- src/aurora/macros.clj
+++ src/aurora/macros.clj
@@ -9,7 +9,7 @@
     `(cljs.core.prn ~@args)))

 (defmacro amake [[ix size] & body]
-  `(let [arr# #js []]
+  `(let [arr# (make-array 0)]
      (dotimes [~ix ~size]
        (.push arr# (do ~@body)))
      arr#))


set aima player to 1 second

set aima player to 1 second

--- src/c4_arena/core.clj
+++ src/c4_arena/core.clj
@@ -137,7 +137,7 @@
                       (= against "random")
                       (spawn-random-player)
                       (= against "aima")
-                      (spawn-aima-player 0.5)
+                      (spawn-aima-player 1.)
                       (= against "aima10")
                       (spawn-aima-player 10.)
                       (= against "perfect")


Compare element by element

Compare element by element

instead of first comparing by length of sequence. That way "1. Mai" is
still before "Regenbogenfarben", which is what we want. The comparator
is now modeled after the `cmp-seq-lexi` function in the [Clojure
Comparators Guide](http://www.clojure.org/guides/comparators)

--- src/catalog/vubis.clj
+++ src/catalog/vubis.clj
@@ -422,23 +422,31 @@
    (re-seq #"\d+|\D+")
    (map #(or (parse-int %) %))))

-(defn- locale-comparator [v1 v2]
-  (let [c1 (count v1)
-        c2 (count v2)]
-    (cond
-      (< c1 c2) -1
-      (> c1 c2) 1
-      :else (reduce
-             (fn [_ [s1 s2]]
-               (let [comparison (if (every? seq? [s1 s2])
-                                  ;; a chunked string
-                                  (locale-comparator s1 s2)
-                                  ;; locale aware comparison
-                                  (locale-compare s1 s2))]
-                 (if (not= 0 comparison)
-                   (reduced comparison)
-                   comparison)))
-             nil (partition 2 (interleave v1 v2))))))
+(defn- locale-comparator [x y]
+  "Compare two sequences `x` and `y` using the locale aware
+  `locale-compare`. See also `cmp-seq-lexi` in
+  http://www.clojure.org/guides/comparators"
+  (loop [x x
+         y y]
+    (if (seq x)
+      (if (seq y)
+        (let [x1 (first x)
+              y1 (first y)
+              c (if (every? seq? [x1 y1])
+                  ;; a chunked string
+                  (locale-comparator x1 y1)
+                  ;; locale aware comparison
+                  (locale-compare x1 y1))]
+          (if (zero? c)
+            (recur (rest x) (rest y))
+            c))
+        ;; else we reached end of y first, so x > y
+        1)
+      (if (seq y)
+        ;; we reached end of x first, so x < y
+        -1
+        ;; Sequences contain same elements.  x = y
+        0))))

 (defn- get-update-keys
   "Return the update keys for a given item containing `format`,


Added c2g-type for simple type conversion herustics.

--- src/cbfg/zgo/core.clj
+++ src/cbfg/zgo/core.clj
@@ -43,8 +43,25 @@

 (defn j [v] (string/join " " (flatten v)))

-(defn c2g [sym]
-  (string/replace (str sym) "-" "_"))
+(defn c2g-sym [sym]
+  (-> (str sym)
+      (string/replace "-" "_")
+      (string/replace "?" "p")))
+
+(defn c2g-type [sym]
+  (let [parts (string/split (str sym) #"-")
+        plast (last parts)
+        [p0 & prest] parts]
+    (cond
+     (= p0 "name") "string"
+     (= p0 "max") "int"
+     (= p0 "min") "int"
+     (re-find #"\?" plast) "bool" ; When ends with '?'.
+     :default (string/capitalize plast))))
+
+(defn process-fn-params [params]
+  ["(" (interpose "," (map (fn [sym] [(c2g-sym sym) (c2g-type sym)])
+                           params)) ")"])

 (defn process-fn-body [params forms]
   (map-indexed (fn [idx form]
@@ -53,11 +70,10 @@
                forms))

 (defn process-fn [params body]
-  ["func" ["(" (interpose "," (map c2g params)) ")"]
-   "{" (process-fn-body params body) "}"])
+  ["func" (process-fn-params params) "{" (process-fn-body params body) "}"])

 (defn process-defn [name params body]
-  ["func" (c2g name) (rest (process-fn params body))])
+  ["func" (c2g-sym name) (rest (process-fn params body))])

 (defn process-top-level-form [smodel form]
   (let [[op name & more] form]


correcting key

correcting key

--- src/celestial/api.clj
+++ src/celestial/api.clj
@@ -182,7 +182,7 @@
       (catch Throwable e {:body (.getMessage e) :status 500}))))

 (defn force-https [rs]
-  (binding [friend/*default-scheme-ports* {:http (get* :celestial :port) :https (get* :celestial :https)}]
+  (binding [friend/*default-scheme-ports* {:http (get* :celestial :port) :https (get* :celestial :https-port)}]
     (friend/requires-scheme rs :https)))

 (defn compose-routes


Problem retagged

Problem retagged

--- src/foreclojure/data_set.clj
+++ src/foreclojure/data_set.clj
@@ -368,5 +368,5 @@
             :title "Regular Expressions"
             :times-solved 0
             :description "Regex patterns are supported with a special reader macro."
-            :tags ["elementary" "math" "syntax"]
-            :tests ["(= __ (apply str (re-seq #\"[A-Z]+\" \"bA1B3Ce\")))"]})))+            :tags ["elementary" "regex" "syntax"]
+            :tests ["(= __ (apply str (re-seq #\"[A-Z]+\" \"bA1B3Ce \")))"]})))


use vector instead of list for fail-messages

this insures correct ording within each deftest

--- src/leiningen/new/reagent_liveedit/testrunner.cljs
+++ src/leiningen/new/reagent_liveedit/testrunner.cljs
@@ -4,7 +4,7 @@
             [{{ns-name}}.core-test]))

 ;; temporary state, we don't want to mess with the app state during testing
-(def fail-messages (atom '()) )
+(def fail-messages (atom []) )

 (defmethod report :pass [{:keys [test-env] :as m}]
   (t/inc-report-counter test-env :pass))
@@ -42,5 +42,5 @@
 (defn run-tests []
   (enable-console-print!)
   (println "Running tests...")
-  (reset! fail-messages '())
+  (reset! fail-messages [])
   (t/run-all-tests))


Updated Hiccup to 1.0.0-RC1

Updated Hiccup to 1.0.0-RC1

--- ring-devel/project.clj
+++ ring-devel/project.clj
@@ -2,6 +2,6 @@
   :description "Ring development and debugging libraries."
   :url "http://github.com/mmcgrana/ring"
   :dependencies [[ring/ring-core "1.1.0-beta2"]
-                 [hiccup "1.0.0-beta1"]
+                 [hiccup "1.0.0-RC1"]
                  [clj-stacktrace "0.2.4"]
                  [ns-tracker "0.1.1"]])