added a option to fire a success/fail event on button-ajax and moved the api triggered events there

--- src-cljs/frontend/controllers/controls.cljs
+++ src-cljs/frontend/controllers/controls.cljs
@@ -73,18 +73,19 @@
 (defn button-ajax
   "An ajax/ajax wrapper that releases the current managed-button after the API
   request.  Exists to faciliate migration away from stateful-button."
-  [method url message channel & {:keys [context params events] :as opts}]
-  (let [uuid frontend.async/*uuid*
-        c (chan)]
+  [method url message channel & opts]
+  (let [uuid frontend.async/*uuid*
+        c (chan)
+        events (:events opts)]
     (apply ajax/ajax method url message c opts)
     (go-loop []
-             (when-let [[_ status _ :as event] (<! c)]
-               (when-let [track-event (-> opts :events status)]
-                 (track-event))
-               (when (#{:success :failed} status)
-                 (release-button! uuid status))
-               (>! channel event)
-               (recur)))))
+      (when-let [[_ status _ :as event] (<! c)]
+        (when-let [track-event (-> events status)]
+          (track-event))
+        (when (#{:success :failed} status)
+          (release-button! uuid status))
+        (>! channel event)
+        (recur)))))

 ;; --- Navigation Multimethod Declarations ---

@@ -465,8 +466,7 @@
                  :events {:success #(analytics/track {:event-type :project-followed
                                                       :current-state current-state
                                                       :properties {:org org-name
-                                                                   :repo repo-name}})})))
-
+                                                                   :repo repo-name}})})))

 (defmethod control-event :inaccessible-org-toggled
   [target message {:keys [org-name value]} state]
@@ -486,9 +486,9 @@
                  api-ch
                  :context {:project-id project-id}
                  :events {:success #(analytics/track {:event-type :project-followed
-                                                     :current-state current-state
-                                                     :properties {:org org-name
-                                                                  :repo repo-name}})})))
+                                                      :current-state current-state
+                                                      :properties {:org org-name
+                                                                   :repo repo-name}})})))

 (defmethod post-control-event! :unfollowed-repo
@@ -540,11 +540,11 @@
                  (gstring/format "/api/v1/project/%s/enable" project)
                  :stop-building-project
                  api-ch
-                 :context {:project-id project-id}
-                 :events {:success #(analytics/track {:event-type :project-builds-stopped
-                                                      :current-state current-state
-                                                      :properties {:org org-name
-                                                                   :repo repo-name}})})))
+                 :context {:project-id project-id})
+    :events {:success #(analytics/track {:event-type :project-builds-stopped
+                                         :current-state current-state
+                                         :properties {:org org-name
+                                                      :repo repo-name}})}))

 ;; XXX: clean this up
 (defmethod post-control-event! :container-parent-scroll
@@ -734,9 +734,10 @@
 (defmethod post-control-event! :saved-ssh-key
   [target message {:keys [project-id ssh-key]} previous-state current-state]
   (let [project-name (vcs-url/project-name project-id)
+        vcs-type (vcs-url/vcs-type project-id)
         api-ch (get-in current-state [:comms :api])]
     (button-ajax :post
-                 (gstring/format "/api/v1/project/%s/ssh-key" project-name)
+                 (api-path/project-ssh-key vcs-type project-name)
                  :save-ssh-key
                  api-ch
                  :params ssh-key
@@ -746,9 +747,10 @@
 (defmethod post-control-event! :deleted-ssh-key
   [target message {:keys [project-id hostname fingerprint]} previous-state current-state]
   (let [project-name (vcs-url/project-name project-id)
+        vcs-type (vcs-url/vcs-type project-id)
         api-ch (get-in current-state [:comms :api])]
     (ajax/ajax :delete
-               (gstring/format "/api/v1/project/%s/ssh-key" project-name)
+               (api-path/project-ssh-key vcs-type project-name)
                :delete-ssh-key
                api-ch
                :params {:fingerprint fingerprint
@@ -778,9 +780,10 @@
 (defmethod post-control-event! :saved-project-api-token
   [target message {:keys [project-id api-token]} previous-state current-state]
   (let [project-name (vcs-url/project-name project-id)
+        vcs-type (vcs-url/vcs-type project-id)
         api-ch (get-in current-state [:comms :api])]
     (button-ajax :post
-                 (gstring/format "/api/v1/project/%s/token" project-name)
+                 (api-path/project-tokens vcs-type project-name)
                  :save-project-api-token
                  api-ch
                  :params api-token
@@ -790,9 +793,10 @@
 (defmethod post-control-event! :deleted-project-api-token
   [target message {:keys [project-id token]} previous-state current-state]
   (let [project-name (vcs-url/project-name project-id)
+        vcs-type (vcs-url/vcs-type project-id)
         api-ch (get-in current-state [:comms :api])]
     (ajax/ajax :delete
-               (gstring/format "/api/v1/project/%s/token/%s" project-name token)
+               (api-path/project-token vcs-type project-name token)
                :delete-project-api-token
                api-ch
                :context {:project-id project-id
@@ -802,9 +806,10 @@
 (defmethod post-control-event! :set-heroku-deploy-user
   [target message {:keys [project-id login]} previous-state current-state]
   (let [project-name (vcs-url/project-name project-id)
+        vcs-type (vcs-url/vcs-type project-id)
         api-ch (get-in current-state [:comms :api])]
     (button-ajax :post
-                 (gstring/format "/api/v1/project/%s/heroku-deploy-user" project-name)
+                 (api-path/heroku-deploy-user vcs-type project-name)
                  :set-heroku-deploy-user
                  api-ch
                  :context {:project-id project-id
@@ -814,9 +819,10 @@
 (defmethod post-control-event! :removed-heroku-deploy-user
   [target message {:keys [project-id]} previous-state current-state]
   (let [project-name (vcs-url/project-name project-id)
+        vcs-type (vcs-url/vcs-type project-id)
         api-ch (get-in current-state [:comms :api])]
     (button-ajax :delete
-                 (gstring/format "/api/v1/project/%s/heroku-deploy-user" project-name)
+                 (api-path/heroku-deploy-user vcs-type project-name)
                  :remove-heroku-deploy-user
                  api-ch
                  :context {:project-id project-id})))
@@ -935,13 +941,14 @@
   [target message {:keys [project-id project-name key-type]} previous-state current-state]
   (let [uuid frontend.async/*uuid*
         api-ch (get-in current-state [:comms :api])
-        err-ch (get-in current-state [:comms :errors])]
+        err-ch (get-in current-state [:comms :errors])
+        vcs-type (vcs-url/vcs-type project-id)]
     (go (let [api-resp (<! (ajax/managed-ajax
                              :post
-                             (gstring/format "/api/v1/project/%s/checkout-key" project-name)
+                             (api-path/project-checkout-keys vcs-type project-name)
                              :params {:type key-type}))]
           (if (= :success (:status api-resp))
-            (let [api-resp (<! (ajax/managed-ajax :get (gstring/format "/api/v1/project/%s/checkout-key" project-name)))]
+            (let [api-resp (<! (ajax/managed-ajax :get (api-path/project-checkout-keys vcs-type project-name)))]
               (put! api-ch [:project-checkout-key (:status api-resp) (assoc api-resp :context {:project-name project-name})]))
             (put! err-ch [:api-error api-resp]))
           (release-button! uuid (:status api-resp))))))
@@ -950,12 +957,13 @@
   [target message {:keys [project-id project-name fingerprint]} previous-state current-state]
   (let [uuid frontend.async/*uuid*
         api-ch (get-in current-state [:comms :api])
-        err-ch (get-in current-state [:comms :errors])]
+        err-ch (get-in current-state [:comms :errors])
+        vcs-type (vcs-url/vcs-type project-id)]
     (go (let [api-resp (<! (ajax/managed-ajax
                              :delete
-                             (gstring/format "/api/v1/project/%s/checkout-key/%s" project-name fingerprint)))]
+                             (api-path/project-checkout-key vcs-type project-name fingerprint)))]
           (if (= :success (:status api-resp))
-            (let [api-resp (<! (ajax/managed-ajax :get (gstring/format "/api/v1/project/%s/checkout-key" project-name)))]
+            (let [api-resp (<! (ajax/managed-ajax :get (api-path/project-checkout-keys vcs-type project-name)))]
               (put! api-ch [:project-checkout-key (:status api-resp) (assoc api-resp :context {:project-name project-name})]))
             (put! err-ch [:api-error api-resp]))
           (release-button! uuid (:status api-resp))))))
@@ -1212,9 +1220,7 @@
            (put! api-ch [:org-plan (:status plan-api-result) (assoc plan-api-result :context {:org-name org-name})])
            (put! nav-ch [:navigate! {:path (routes/v1-org-settings {:org org-name
                                                                     :vcs_type vcs_type})
-                                     :replace-token? true}])
-           (analytics/track {:event-type :plan-cancelled
-                             :current-state current-state})))
+                                     :replace-token? true}])))
        (release-button! uuid (:status api-result))))))

 (defn track-and-redirect [event properties owner path]
@@ -1388,6 +1394,19 @@
   [_ _ {:keys [login scope]} _ {{api-ch :api} :comms}]
   (api/set-user-admin-scope login scope api-ch))

+(defmethod control-event :system-setting-changed
+  [_ _ {:keys [name]} state]
+  (update-in state state/system-settings-path
+             (fn [settings]
+               (mapv #(if (= name (:name %))
+                        (assoc % :updating true)
+                        %)
+                     settings))))
+
+(defmethod post-control-event! :system-setting-changed
+  [_ _ {:keys [name value]} _ {{api-ch :api} :comms}]
+  (api/set-system-setting name value api-ch))
+
 (defmethod control-event :insights-sorting-changed
   [_ _ {:keys [new-sorting]} state]
   (assoc-in state state/insights-sorting-path new-sorting))


Rename to reflect changes

Rename to reflect changes

--- desktop/src/nightmod/core/desktop_launcher.clj
+++ desktop/src/nightmod/core/desktop_launcher.clj
@@ -1,12 +1,12 @@
 (ns nightmod.core.desktop-launcher
   (:require [clojure.java.io :as io]
             [nightmod.core :refer :all]
-            [nightcode.core :as core]
             [nightcode.editors :as editors]
             [nightcode.dialogs :as dialogs]
             [nightcode.shortcuts :as shortcuts]
             [nightcode.ui :as ui]
             [nightcode.utils :as utils]
+            [nightcode.window :as window]
             [seesaw.core :as s]
             [seesaw.util :as s-util])
   (:import [java.awt BorderLayout Canvas Dimension Window]
@@ -32,7 +32,7 @@
 (defn create-layered-pane
   "Returns the pane with the editors."
   []
-  (let [pane (core/create-editor-pane)]
+  (let [pane (editors/create-pane)]
     (doto (JLayeredPane.)
       (.setPreferredSize (Dimension. editor-width window-height))
       (.addComponentListener (proxy [ComponentAdapter] []
@@ -76,22 +76,21 @@
           ; page down
           34 (editors/move-tab-selection! 1)
           ; Q
-          81 (core/confirm-exit-app!)
+          81 (window/confirm-exit-app!)
           ; W
           ;87 (editors/close-selected-editor!)
           ; else
           false)))
     ; set various window properties
-    core/enable-full-screen!
-    core/add-window-listener!))
+    window/enable-full-screen!
+    window/add-listener!))

 (defn -main
   "Launches the main window."
-  []
-  (s/native!)
-  (SubstanceLookAndFeel/setSkin (GraphiteSkin.))
+  [& args]
+  (window/set-theme! args)
   (s/invoke-later
     (s/show! (reset! ui/ui-root (create-window)))
-    (binding [editors/editor-widgets editor-widgets]
+    (binding [editors/*editor-widgets* editor-widgets]
       (comment editors/show-editor! "")))
   (Keyboard/enableRepeatEvents true))


Remove unused state key

Remove unused state key

--- src-cljs/frontend/state.cljs
+++ src-cljs/frontend/state.cljs
@@ -30,7 +30,6 @@
    :builds-per-page 30
    :current-user nil
    :crumbs nil
-   :current-repos []
    :render-context nil
    :projects nil
    :recent-builds nil


update for cider piggieback

update for cider piggieback

--- sidecar/src/figwheel_sidecar/repl.clj
+++ sidecar/src/figwheel_sidecar/repl.clj
@@ -165,6 +165,12 @@
   [_ figwheel-env]
   (try
     (cond
+      (and (require? 'cider.piggieback)
+           (when-let [present-var (resolve 'cider.piggieback/*cljs-repl-env*)]
+             (thread-bound? present-var)))
+      (let [cljs-repl (resolve 'cider.piggieback/cljs-repl)
+            opts' (:repl-opts figwheel-env)]
+        (apply cljs-repl figwheel-env (apply concat opts')))
       (and (require? 'cemerick.piggieback)
            (when-let [present-var (resolve 'cemerick.piggieback/*cljs-repl-env*)]
              (thread-bound? present-var)))
@@ -181,11 +187,11 @@

 example profile.clj code:
 -----
-:profiles {:dev {:dependencies [[com.cemerick/piggieback <current-version>]
+:profiles {:dev {:dependencies [[cider/piggieback <current-version>]
                                 [org.clojure/tools.nrepl  <current-version>]]
-                 :repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}}}
+                 :repl-options {:nrepl-middleware [cider.piggieback/wrap-cljs-repl]}}}
 -----
-Please see the documentation for piggieback here https://github.com/cemerick/piggieback#installation
+Please see the documentation for piggieback here https://github.com/clojure-emacs/piggieback#installation

 Note: Cider will inject this config into your project.clj.
 This can cause confusion when your are not using Cider."]


lein-release plugin: bumped version from 0.1.14 to 0.1.15-SNAPSHOT for next development cycle

--- re_view_hiccup/project.clj
+++ re_view_hiccup/project.clj
@@ -1,4 +1,4 @@
-(defproject re-view-hiccup "0.1.14"
+(defproject re-view-hiccup "0.1.15-SNAPSHOT"
   :description "Hiccup parser for re-view"

   :url "https://www.github.com/braintripping/re-view/tree/master/re_view_hiccup"


give an example `meal` derived from the recipe

--- src/whatsoup/recipe.clj
+++ src/whatsoup/recipe.clj
@@ -9,11 +9,12 @@
   (and (keyword? x) (= "property" (namespace x))))

 ;; Recipes mainly consist of an ordered list of ingredient descriptors.
-;; These specify one or more `properties` that the ingredient needs to satisfy.
+;; These specify one or more `properties` that the ingredient food(s) needs to satisfy.
 ;; Alternatively, they may also just list acceptable food choices.
 ;; Quantities are deliberately omitted for the moment.
 ;;
 ;; Here's an example:
+;;
 #_(def ex-recipe
     {:recipe/name        "Püree-Suppe"
      :recipe/ingredients [[:= :food/lauch]
@@ -43,3 +44,16 @@
 (spec/def :recipe/name string?)
 (spec/def ::recipe (spec/keys :req [:recipe/name :recipe/ingredients]))

+;; Meals list their ingredient foods, which may be grouped by `role`.
+;; Ingredients are listed in the same order as in the recipe.
+;;
+;; Here's an example:
+;;
+#_(def ex-out-meal
+    {:meal/name        "Püree-Suppe"
+     :meal/ingredients [["Zutat" :food/lauch]
+                        ["Zutat" :food/zwiebel]
+                        ["Zutat" :food/bouillon]
+                        ["Püreebasis" :food/kartoffel]
+                        ["Weitere Zutaten" :food/karotten :food/broccoli]
+                        ["Einlage" :food/crouton]]})


Updates to Luhn.

Updates to Luhn.

--- src/clojush/problems/software/benchmarks_v2/luhn.clj
+++ src/clojush/problems/software/benchmarks_v2/luhn.clj
@@ -11,19 +11,20 @@

 ; Atom generators
 (def luhn-atom-generators
-  (concat (list
-            2
-            9
-            10
-            ;;; end constants
-            ;;; end ERCs
-            (tag-instruction-erc [:integer :boolean :exec :vector_integer] 1000)
-            (tagged-instruction-erc 1000)
-            ;;; end tag ERCs
-            'in1
-            ;;; end input instructions
-            )
-          (registered-for-stacks [:integer :boolean :exec :vector_integer])))
+  (make-proportional-atom-generators
+   (concat
+    (registered-for-stacks [:integer :boolean :exec :vector_integer])
+    (list (tag-instruction-erc [:integer :boolean :exec :vector_integer] 1000) ; tags
+          (tagged-instruction-erc 1000)))
+   (list 'in1) ; inputs
+   (list 0
+         2
+         9
+         10
+         (fn [] (- (lrand-int 21) 10)) ; integer ERC [-10, 10]
+         ) ; constants
+   {:proportion-inputs 0.15
+    :proportion-constants 0.05}))

 ;; A list of data domains for the problem. Each domain is a vector containing
@@ -36,8 +37,24 @@
      [0 1 2 3 4 5 6 7 8 9 8 7 6 5 4 3]
      [9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9]
      [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
-     [5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5]) 4 0]
-   [(fn [] (vec (repeatedly 16 #(rand-int 10)))) 196 2000]
+     [5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5]
+     [4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4]
+     [1 0 2 0 4 3 2 1 0 4 1 2 3 4 2 1]
+     [0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0]
+     [2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
+     [0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0]
+     [0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0]
+     [0 0 0 0 0 5 0 0 0 0 0 0 0 0 0 0]
+     [0 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
+     [0 0 0 0 0 0 0 0 0 0 0 0 7 0 0 0]
+     [0 0 0 0 0 0 0 0 0 0 8 0 0 0 0 0]
+     [0 0 9 0 0 0 0 0 0 0 0 0 0 0 0 0]
+     [8 0 0 0 0 6 0 0 0 0 9 0 0 0 0 0]
+     [0 0 2 0 0 0 4 0 0 0 0 0 1 0 0 0]
+     [0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5]
+     [9 9 8 7 6 6 7 8 9 9 8 7 6 5 5 6]
+     [0 0 0 0 0 7 0 0 0 3 0 0 0 0 0 0]) 20 0]
+   [(fn [] (vec (repeatedly 16 #(rand-int 10)))) 180 2000]
    ])

 ;;Can make Luhn test data like this:
@@ -136,7 +153,7 @@
 ; Define the argmap
 (def argmap
   {:error-function (make-luhn-error-function-from-cases (first luhn-train-and-test-cases)
-                                                                   (second luhn-train-and-test-cases))
+                                                        (second luhn-train-and-test-cases))
    :atom-generators luhn-atom-generators
    :max-points 2000
    :max-genome-size-in-initial-program 250


Attempted test-put-take.

Attempted test-put-take.

--- test/ago/test.cljs
+++ test/ago/test.cljs
@@ -1,7 +1,7 @@
 (ns ago.test
   (:require-macros [cljs.core.async.macros :refer [go go-loop]]
                    [ago.macros :refer [ago]])
-  (:require [cljs.core.async :refer [chan <! !> alts! put! take!]]
+  (:require [cljs.core.async :refer [chan close! <! !> <!! >!! alts! put! take!]]
             [ago.core :refer [make-ago-world ago-chan ago-snapshot ago-restore
                               seqv+ compare-seqvs seqv-alive?]]
             [goog.dom :as gdom]
@@ -110,6 +110,7 @@
 (def success 0)

 (defn test-constructors []
+  (println "test-constructors")
   (assert (not= nil (make-ago-world nil)))
   (assert (= (:app-data @(make-ago-world :my-app-data)) :my-app-data))
   (assert (= (:logical-ms @(make-ago-world nil)) 0))
@@ -120,6 +121,7 @@
       (assert (= (count (:bufs @agw)) 0)))))

 (defn test-seqvs []
+  (println "test-seqvs")
   (let [agw (make-ago-world nil)
         sq0 (:seqv @agw)]
     (take! (ago agw 9)
@@ -128,23 +130,50 @@
              (let [sq1 (:seqv @agw)
                    agw2 (atom (seqv+ @agw))
                    sq2 (:seqv @agw2)]
-               (assert (= 0 (compare-seqvs sq0 sq0)))
-               (assert (= 0 (compare-seqvs sq1 sq1)))
-               (assert (= 1 (compare-seqvs sq1 sq0)))
-               (assert (= -1 (compare-seqvs sq0 sq1)))
-               (assert (= 0 (compare-seqvs sq2 sq2)))
-               (assert (= 1 (compare-seqvs sq2 sq0)))
-               (assert (= 1 (compare-seqvs sq2 sq1)))
-               (assert (= -1 (compare-seqvs sq0 sq2)))
-               (assert (= -1 (compare-seqvs sq1 sq2)))
+               (assert (= (compare-seqvs sq0 sq0) 0))
+               (assert (= (compare-seqvs sq1 sq1) 0))
+               (assert (> (compare-seqvs sq1 sq0) 0))
+               (assert (< (compare-seqvs sq0 sq1) 0))
+               (assert (= (compare-seqvs sq2 sq2) 0))
+               (assert (> (compare-seqvs sq2 sq0) 0))
+               (assert (> (compare-seqvs sq2 sq1) 0))
+               (assert (< (compare-seqvs sq0 sq2) 0))
+               (assert (< (compare-seqvs sq1 sq2) 0))
                (assert (seqv-alive? agw2 sq0))
                (assert (seqv-alive? agw2 sq1))
                (assert (seqv-alive? agw2 sq2))
                (assert (not (seqv-alive? agw sq2)))
-               (assert (not (seqv-alive? agw nil))))))))
+               (assert (seqv-alive? agw nil))
+               (assert (seqv-alive? agw2 nil)))))))
+
+(defn test-put-take []
+  (println "test-put-take")
+  (let [agw (make-ago-world nil)
+        ch0 (ago-chan agw 1)
+        ch1 (ago-chan agw 1)
+        echoer (ago agw
+                    (loop [acc []]
+                      (if-let [msg (<! ch0)]
+                        (do (>! ch1 {:msg msg})
+                            (recur (conj acc msg)))
+                        (do (close! ch1)
+                            acc))))
+        sender (ago agw
+                    (>! ch0 :hi)
+                    (>! ch0 :world)
+                    (close! ch0)
+                    :sender-done)]
+    (go (println "ch1 got x" (<! ch1))
+        (println "ch1 got x" (<! ch1))
+        (println "ch1 got x" (<! ch1))
+        (println "echoer got x" (<! echoer))
+        (println "echoer got x" (<! echoer))
+        (println "sender got x" (<! sender))
+        (println "sender got x" (<! sender)))))

 (defn ^:export run []
-  (.log js/console "ago test run started.")
+  (println "ago test run started.")
   (test-constructors)
   (test-seqvs)
+  (test-put-take)
   success)


Fixing gecode to detect g++44

Fixing gecode to detect g++44

--- config/software/gecode.clj
+++ config/software/gecode.clj
@@ -16,12 +16,17 @@
 ;; limitations under the License.
 ;;

+(let
+  [env (if (= 1 (get (sh "/bin/which" :args [ "g++44" ] :return-map true) :exit-status))
+         { "CC" "gcc44" "CXX" "g++44" }
+         { })]
+
 (software "gecode"
           :source "gecode-3.7.1"
           :steps [
-                  {:command "./configure" :args [ "--prefix=/opt/opscode/embedded" "--disable-doc-dot" "--disable-doc-search" "--disable-doc-tagfile" "--disable-doc-chm" "--disable-doc-docset" "--disable-qt" "--disable-examples" ]}
+                  {:command "./configure" :env env :args [ "--prefix=/opt/opscode/embedded" "--disable-doc-dot" "--disable-doc-search" "--disable-doc-tagfile" "--disable-doc-chm" "--disable-doc-docset" "--disable-qt" "--disable-examples" ]}
                   {:env {"LD_RUN_PATH" "/opt/opscode/embedded/lib"} :command "make"}
                   {:command "make" :args [ "install" ]}
-                 ])
+                 ]))


CMR-3260: Changed are2 to are3.

CMR-3260: Changed are2 to are3.

--- metadata-db-app/int_test/cmr/metadata_db/int_test/concepts/humanizer_test.clj
+++ metadata-db-app/int_test/cmr/metadata_db/int_test/concepts/humanizer_test.clj
@@ -2,7 +2,7 @@
   "Contains integration tests for saving, deleting, force deleting and searching humanizers."
   (:require [clojure.test :refer :all]
             [clj-time.core :as t]
-            [cmr.common.util :refer (are2)]
+            [cmr.common.util :refer (are3)]
             [cmr.metadata-db.int-test.utility :as util]
             [cmr.metadata-db.int-test.concepts.concept-save-spec :as c-spec]
             [cmr.metadata-db.int-test.concepts.concept-delete-spec :as cd-spec]))
@@ -35,7 +35,7 @@

 (deftest save-humanizer-failures-test
   (testing "saving invalid humanizer"
-    (are2 [humanizer exp-status exp-errors]
+    (are3 [humanizer exp-status exp-errors]
           (let [{:keys [status errors]} (util/save-concept humanizer)]
             (is (= exp-status status))
             (is (= (set exp-errors) (set errors))))
@@ -113,7 +113,7 @@
 (deftest find-humanizers
   (let [humanizer (util/create-and-save-humanizer 5)]
     (testing "find latest revsions"
-      (are2 [humanizers params]
+      (are3 [humanizers params]
             (= (set humanizers)
                (set (->> (util/find-latest-concepts :humanizer params)
                          :concepts


bump 0.9.0-wip15e-scala292

bump 0.9.0-wip15e-scala292

--- storm-kafka/project.clj
+++ storm-kafka/project.clj
@@ -1,4 +1,4 @@
-(defproject storm/storm-kafka "0.9.0-wip15d-scala292"
+(defproject storm/storm-kafka "0.9.0-wip15e-scala292"
   :java-source-paths ["src/jvm"]
   :repositories {"scala-tools" "http://scala-tools.org/repo-releases"
                   "conjars" "http://conjars.org/repo/"}


Solve part two of day 5 puzzle

Solve part two of day 5 puzzle

--- day-05/src/solver/core.clj
+++ day-05/src/solver/core.clj
@@ -16,8 +16,20 @@
    (not
     (contains-forbidden-string word))))

+(defn contains-repeated-pair [word]
+  (re-find #"(\w{2})\w*\1" word))
+(defn contains-palindrome-trigram [word]
+  (re-find #"(\w)\w\1" word))
+
+(defn nice-word2 [word]
+  (and
+   (contains-repeated-pair word)
+   (contains-palindrome-trigram word)))
+
 (defn -main
   "I don't do a whole lot ... yet."
   [& args]
   (with-open [rdr (clojure.java.io/reader "input")]
-    (println (count (filter nice-word (line-seq rdr))))))
+    (let [words (line-seq rdr)]
+      (println (count (filter nice-word words)))
+      (println (count (filter nice-word2 words))))))


Rename (tile) to (mk-tile) to avoid accidental shadowing

--- src/cas/world.cljs
+++ src/cas/world.cljs
@@ -8,10 +8,8 @@
                   :air true
                   :ore false})

-(defn tile
+(defn mk-tile
   [kind]
-  (if (= kind :ore)
-    (println "HEYO!"))
   {:kind kind
    :passable (passability kind)})

@@ -43,10 +41,10 @@
     (letfn [(new-column [bound]
               (let [dirt (rand-in-range 1 4)]
                 (vec (concat (repeat (- height bound)
-                                     (tile :air))
-                             (repeat dirt  (tile :dirt))
+                                     (mk-tile :air))
+                             (repeat dirt  (mk-tile :dirt))
                              (repeat (- bound dirt)
-                                     (tile :stone))))))]
+                                     (mk-tile :stone))))))]
       (vec (map new-column mrange)))))

 (defn new-coord-map
@@ -77,10 +75,10 @@

 (defn ores-transform
   [tiles x y noise]
-  (let [t (tile-at tiles x y)]
-    (if (and (= (:kind t) :stone) (< noise -0.7))
-      (tile :ore)
-      t)))
+  (let [tile (tile-at tiles x y)]
+    (if (and (= (:kind tile) :stone) (< noise -0.7))
+      (mk-tile :ore)
+      tile)))

 (defn hills-caves-transform
   [x y noise]
@@ -104,19 +102,19 @@

 (defn noise-to-tiles
   [x y noise]
-  (tile
+  (mk-tile
     (cond
       (< noise 0) :air
       (< noise 0.15) :dirt
       :else :stone)))

 (defn grow-grass
-  [tiles x y t]
+  [tiles x y tile]
   (if (and
-        (= (:kind t) :dirt)
+        (= (:kind tile) :dirt)
         (= (:kind (tile-at tiles x (dec y))) :air))
-    (tile :grass)
-    t))
+    (mk-tile :grass)
+    tile))

 (defn new-chunk
   [width height]


Remove defininition of a clj util from cljs.

--- src/active/clojure/lens.cljc
+++ src/active/clojure/lens.cljc
@@ -45,9 +45,10 @@
     (assoc data lens v)
     (lens data v)))

-(defn- throw-invalid-number-of-arguments-error [n]
-  (let [error-msg (str "invalid number of arguments (" n ") to lens")]
-    (throw (java.lang.IllegalArgumentException. error-msg))))
+#?(:clj
+   (defn- throw-invalid-number-of-arguments-error [n]
+     (let [error-msg (str "invalid number of arguments (" n ") to lens")]
+       (throw (java.lang.IllegalArgumentException. error-msg)))))

 (defrecord ExplicitLens
     ^{:private true}


handle empty return values from (comp-paths-to-complements)

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -175,7 +175,7 @@
   (if (not (empty? comp-paths))
     (let [path (first comp-paths)
           comps (filter not-fail? (comp-path-to-complements bolt path model depth max-depth))]
-      (if (or false (not (empty? comps)))
+      (if (not (empty? comps))
         (merge
          {path comps}
          (comp-paths-to-complements bolt (rest comp-paths) model depth max-depth))))))
@@ -189,21 +189,22 @@
   [spec model depth max-depth]
   (log/debug  (str "bolts-with-comps:" depth "/" max-depth ":" (strip-refs spec)))
   ;; using pmap rather than map improves performance about 40% in some cases.
-  (pmap (fn [lb]
-          (merge
-           {[]
-            (filter not-fail? [lb])}
-           (comp-paths-to-complements lb (find-comp-paths lb) model depth max-depth)))
-        (let [bolts (lightning-bolts model spec depth max-depth)]
-          (if (empty? bolts)
-            (do
-              (log/debug (str "bolts-with-comps:" depth "/" max-depth ":" (strip-refs spec) ": no bolts found."))
-              nil)
-            (do
-              (log/debug (str "bolts-with-comps:" depth "/" max-depth ":" (strip-refs spec) ": one or more bolts found."))
-              bolts)))))
-
-
+  (remove nil?
+          (pmap (fn [lb]
+                  (let [cp2c (comp-paths-to-complements lb (find-comp-paths lb) model depth max-depth)]
+                    (if (not (nil? cp2c))
+                      (merge
+               {[]
+                (filter not-fail? [lb])}
+               cp2c))))
+                (let [bolts (lightning-bolts model spec depth max-depth)]
+                  (if (empty? bolts)
+                    (do
+                      (log/debug (str "bolts-with-comps:" depth "/" max-depth ":" (strip-refs spec) ": no bolts found."))
+                      nil)
+                    (do
+                      (log/debug (str "bolts-with-comps:" depth "/" max-depth ":" (strip-refs spec) ": one or more bolts found."))
+                      bolts))))))

 ;; TODO: lightning-bolts should use this.
 (defn get-lexemes [model spec]


back to max-total-depth: 6

back to max-total-depth: 6

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -10,7 +10,7 @@

 ;; during generation, will not decend deeper than this when creating a tree:
 ;; TODO: should also be possible to override per-language.
-(def ^:const max-total-depth 10)
+(def ^:const max-total-depth 6)

 ;; TODO support setting max-generated-complements to :unlimited
 (def ^:const max-generated-complements 20000)


(unify parent spec) earlier

(unify parent spec) earlier

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -103,32 +103,33 @@
           (when (= false (get-in spec [:head :phrasal] false))
             (lazy-mapcat
              (fn [parent]
-               (when (= false (get-in parent [:head :phrasal] false))
-                 (let [parent (unifyc parent spec)
-                       pred (get-in spec [:synsem :sem :pred])
-                       cat (get-in spec [:synsem :cat])
-                       aux (get-in spec [:synsem :aux])
-                       non-empty-index-sets (filter #(not (empty? %))
-                                                    [(get (:pred2lex language-model) pred)
-                                                     (get (:cat2lex language-model) cat)
-                                                     (get (:aux2lex language-model) aux)])
-                       subset
-                       (cond
-                         (not (empty? non-empty-index-sets))
-                         (reduce intersection-with-identity non-empty-index-sets)
-                         true
-                         (do
-                           (log/warn (str "no index found for spec: " (spec-info spec)))
-                           (get-lex parent :head (:index language-model))))]
-                   (log/debug (str "lightning-bolts: (optimizeme) size of subset of candidate heads: " (count subset) " with spec: " (strip-refs spec) " and parent:  " (get-in parent [:rule])))
-                   (let [result (over/overh parent (lazy-shuffle subset))]
-                     (log/debug (str "lightning-bolts: (optimizeme) surviving candidate heads: " (count result)))
-                     (if (and (not (empty? subset)) (empty? result))
-                       ;; log/warn because it's very expensive to run
-                       ;; over/overh: for every candidate, both parent
-                       ;; and candidate head must be copied.
-                       (log/warn (str "tried: " (count subset) " lexical candidates with spec:" ( strip-refs spec) " and all of them failed as heads of parent:" (get-in parent [:rule]))))
-                     result))))
+               (let [parent (unify parent spec)]
+                 (when (= false (get-in parent [:head :phrasal] false))
+                   (let [pred (get-in spec [:synsem :sem :pred])
+                         cat (get-in spec [:synsem :cat])
+                         aux (get-in spec [:synsem :aux])
+                         non-empty-index-sets (filter #(not (empty? %))
+                                                      [(get (:pred2lex language-model) pred)
+                                                       (get (:cat2lex language-model) cat)
+                                                       (get (:aux2lex language-model) aux)])
+                         subset
+                         (cond
+                           (not (empty? non-empty-index-sets))
+                           (reduce intersection-with-identity non-empty-index-sets)
+                           true
+                           (do
+                             (log/warn (str "no index found for spec: " (spec-info spec)))
+                             (get-lex parent :head (:index language-model))))]
+                     (log/debug (str "lightning-bolts: (optimizeme) size of subset of candidate heads: " (count subset) " with spec: " (strip-refs spec) " and parent:  " (get-in parent [:rule])))
+                     (let [result (over/overh parent (lazy-shuffle subset))]
+                       (log/debug (str "lightning-bolts: (optimizeme) surviving candidate heads: " (count result)))
+                       (log/info (str "trying overh with spec: " (strip-refs spec)))
+                       (if (and (not (empty? subset)) (empty? result))
+                         ;; log/warn because it's very expensive to run
+                         ;; over/overh: for every candidate, both parent
+                         ;; and candidate head must be copied.
+                         (log/warn (str "tried: " (count subset) " lexical candidates with spec:" ( strip-refs spec) " and all of them failed as heads of parent:" (get-in parent [:rule]))))
+                       result)))))
              parents))
           phrasal ;; 2. generate list of all phrases where the head child of each parent is itself a phrase.
           (if (and (< total-depth max-total-depth)


+grammar/small

+grammar/small

--- src/babel/italiano.cljc
+++ src/babel/italiano.cljc
@@ -2,7 +2,7 @@
   (:refer-clojure :exclude [get-in])
   (:require
    [babel.engine :as engine]
-   [babel.italiano.grammar :refer [medium]]
+   [babel.italiano.grammar :refer [small medium np-grammar]]
    [babel.italiano.morphology :as morph]
    [babel.generate :as generate :refer [try-hard-to]]
    [babel.over :as over]


fix tests

fix tests

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -240,7 +240,7 @@
                                      :parses (parse (morph expr) @np-grammar))))))))

 (deftest forbid-mispelling
- (is (empty? (:parses (parse (morph "la donna difficila") @np-grammar)))))
+ (is (empty? (mapcat :parses (parse "la donna difficila" @np-grammar)))))

 (deftest generate-and-parse-noun-phrase-with-specifier
   ;; create a noun phrase where the determiner is "ventotto", but the head of the noun phrase
@@ -627,11 +627,11 @@
     (is (= (morph result) "io sono a casa"))))

 (deftest chiamarsi-1
-  (let [result (parse "io mi chiamo Luisa")]
+  (let [result (-> "io mi chiamo Luisa" parse)]
     (is (not (empty? (mapcat :parses result))))))

 (deftest chiamarsi-2
-  (let [result (parse "tu ti chiami Luisa")]
+  (let [result (-> "tu ti chiami Luisa" parse)]
     (is (not (empty? (mapcat :parses result))))))

 (deftest chiamarsi-3


rewrite tests with more finer-grained assertions

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -114,49 +114,41 @@
                         expressions))))))

 (deftest roundtrip-imperfect
-  (let [do-this-many 200]
-    (is (empty?
-         (filter #(not (nil? %))
-                 (let [expressions
-                       (take do-this-many
-                             (repeatedly
-                              #(generate {:synsem {:cat :verb
-                                                   :infl :imperfect
-                                                   :sem {:tense :past
-                                                         :aspec :progressive}
-                                                   :subcat '()}}
-                                         small)))]
-                   (pmap (fn [expr]
-                           (if (empty? (parse (fo expr) small))
-                             (do
-                               (log/error (str "failed to parse: " (fo expr)))
-                               {:fo (fo expr)
-                                :expr (get-in expr [:synsem :sem])
-                                :sem (get-in (first (parse (fo expr) small))
-                                             [:synsem :sem])})
-                             (log/info (str "parse OK:" (fo expr)))))
-                         expressions)))))))
+  (let [do-this-many 200
+        expressions (take do-this-many
+                          (repeatedly
+                           #(generate {:synsem {:cat :verb
+                                                :infl :imperfect
+                                                :sem {:tense :past
+                                                      :aspec :progressive}
+                                                :subcat '()}}
+                                      small)))]
+    (is (= 200
+           (count (pmap (fn [expr]
+                          (let [fo (fo expr)
+                                parsed (parse fo)]
+                            (if (not (empty? parsed))
+                              (log/info (str "parse OK:" fo))
+                              (log/error (str "parse failed: " fo)))
+                            (is (not (empty? parsed)))))
+                        expressions))))))

 (deftest roundtrip-future
-  (let [do-this-many 200]
-    (is (empty?
-         (filter #(not (nil? %))
-                 (let [expressions
-                       (take do-this-many
-                             (repeatedly
-                              #(generate {:synsem {:cat :verb
-                                                   :sem {:tense :future}
-                                                   :subcat '()}}
-                                         small)))]
-                   (pmap (fn [expr]
-                           (if (empty? (parse (fo expr) small))
-                             (do
-                               (log/error (str "failed to parse: " (fo expr)))
-                               {:fo (fo expr)
-                                :expr (get-in expr [:synsem :sem])
-                                :sem (get-in (first (parse (fo expr) small))
-                                             [:synsem :sem])})
-                             (log/info (str "parse OK:" (fo expr)))))
-                         expressions)))))))
+  (let [do-this-many 200
+        expressions (take do-this-many
+                          (repeatedly
+                           #(generate {:synsem {:cat :verb
+                                                :sem {:tense :future}
+                                                :subcat '()}}
+                                      small)))]
+    (is (= 200
+           (count (pmap (fn [expr]
+                          (let [fo (fo expr)
+                                parsed (parse fo)]
+                            (if (not (empty? parsed))
+                              (log/info (str "parse OK:" fo))
+                              (log/error (str "parse failed: " fo)))
+                            (is (not (empty? parsed)))))
+                        expressions))))))


add some accusative pronoun tests

add some accusative pronoun tests

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -864,3 +864,32 @@
                                  :sem {:reflexive true
                                        :tense :present
                                        :aspect :perfect}}}))
+
+(deftest io-lo-vedo
+  (is (= "io lo vedo"
+         (let [spec
+               {:modified false,
+                :synsem {:cat :verb,
+                         :subcat [],
+                         :sem {:pred :see,
+                               :tense :present,
+                               :subj {:pred :I},
+                               :obj {:pred :lui}}}}]
+           (-> spec
+               generate
+               morph)))))
+
+(deftest tu-mi-vedi
+  (is (= "tu mi vedi"
+         (let [spec
+               {:modified false,
+                :synsem {:cat :verb,
+                         :subcat [],
+                         :sem {:pred :see,
+                               :tense :present,
+                               :subj {:pred :tu},
+                               :obj {:pred :I}}}}]
+           (-> spec
+               generate
+               morph)))))
+


+logging

+logging

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -21,7 +21,9 @@
    [dag_unify.core :refer [copy fail? get-in strip-refs unify]]))

 (btest/init-db)
+(log/info (str "recompiling and writing lexicon to database.."))
 (write-lexicon "it" (grammar/compile-lexicon))
+(log/info (str "done."))
 (def model @@(get models :it))

 ;; TODO: consider removing special-purpose grammars like grammar/np-grammar


parse almost done

parse almost done

--- src/bitcoinrpc/core.clj
+++ src/bitcoinrpc/core.clj
@@ -78,183 +78,8 @@

-;;----------------------------------------------------------------------------------------------
-
-;;--------RPC calls-----------
-
-;== Blockchain ==
-
-(s/fdef getbestblockhash :ret string?)
-(def-rpc getbestblockhash)
-
-(s/fdef getblock :args (s/alt :verbose (s/cat :block-hash string?), :choice (s/cat :block-hash string?, :verbose boolean?)) :ret map?)
-(def-rpc-opt getblock 1 block-hash verbose)
-
-(s/fdef getblockchaininfo :ret map?)
-(def-rpc getblockchaininfo)
-
-(s/fdef getblockcount :ret ::height)
-(def-rpc getblockcount)
-
-
-(s/fdef getblockhash
-  :args ::height
-  :ret ::hex-string)
-(def-rpc getblockhash height)
-
-(s/fdef getblockheader
-  :args (s/alt :verbose (s/cat :hash string?), :choice (s/cat :hash string?, :verbose boolean?))
-  :ret map?)
-(def-rpc-opt getblockheader 1 hash verbose)
-
-(s/fdef getchaintips :ret vector?)
-(def-rpc getchaintips)
-
-(s/fdef getdifficulty :ret integer?)
-(def-rpc getdifficulty)
-
-(def-rpc-opt getmempoolancestors 1 txid verbose)
-(def-rpc-opt getmempooldescendants 1 txid verbose)
-(def-rpc getmempoolentry txid)
-(def-rpc getmempoolinfo)
-(def-rpc-opt getrawmempool 0 verbose)
-(def-rpc-opt gettxout 2 txid n include_mempool)
-
-(s/fdef gettxoutproof :args (s/alt :verbose (s/cat :txids vector?), :choice (s/cat :txids vector?, :blockhash boolean?)) :ret ::hex-string)
-(def-rpc gettxoutproof txids blockhash)
-
-(def-rpc gettxoutsetinfo)
-(def-rpc preciousblock blockhash)
-(def-rpc pruneblockchain)
-(def-rpc-opt verifychain 0 checklevel nblocks)
-(def-rpc verifytxoutproof proof)
-
-;== Control ==
-(def-rpc getinfo)
-(def-rpc getmemoryinfo)
-;help ( "command" )
-(def-rpc stop)
-
-;== Generating ==
-(def-rpc-opt generate 1 nblocks maxtries)
-(def-rpc-opt generatetoaddress 1 nblocks address maxtries)
-
-;== Mining ==
-(def-rpc-opt getblocktemplate 0 TemplateRequest )
-(def-rpc getmininginfo)
-(def-rpc-opt getnetworkhashps 0 nblocks height)
-#_(def-rpc prioritisetransaction txid priority_delta fee_delta)
-(def-rpc-opt submitblock 1 hexdata jsonparametersobject)
-
-;== Network ==
-(def-rpc addnode node action)
-(def-rpc clearbanned)
-(def-rpc disconnectnode address)
-(def-rpc-opt getaddednodeinfo 0 node)
-(def-rpc getconnectioncount)
-(def-rpc getnettotals)
-(def-rpc getnetworkinfo)
-(def-rpc getpeerinfo)
-(def-rpc listbanned)
-(def-rpc ping)
-
-(s/def ::ban-action #(or (= % "add") (= % "remove")))
-(s/fdef setban :args (s/alt :default (s/cat :subnet string?, :action ::ban-action) :optional (s/cat :subnet string?, :action ::ban-action, :bantime integer?, :absolute boolean?)))
-(def-rpc-opt setban 2 subnet ban-action bantime absolute)
-(def-rpc setnetworkactive b)
-
-;== Rawtransactions ==
-(s/def ::txid-opt (s/and map? #(subset? #{"txid" "vout"} (into #{} (keys %))) #(string? (% "txid")) #(integer? (% "vout"))))
-(s/def ::txid-opts (s/* ::txid-opt))
-(s/def ::address-amount (s/and map? #(every? string? (keys %)) #(every? double? (vals %))))
-(s/fdef createrawtransaction
-        :args (s/alt
-                :no-lock (s/cat :input ::txid-opts, :output ::address-amount)
-                :lock (s/cat :input ::txid-opts, :output ::address-amount, :locktime integer?))
-        :ret ::hex-string)
-#_(def-rpc-opt createrawtransaction 2 txids addresses locktime)
-
-(def-rpc decoderawtransaction hexstring)
-(def-rpc decodescript hexstring)
-(def-rpc-opt fundrawtransaction 1 hexstring options)
-(def-rpc-opt getrawtransaction 1 txid verbose)
-(def-rpc-opt sendrawtransaction 1 hexstring allowhighfees)
-(def-rpc-opt signrawtransaction 1 hexstring txids privatekeys sighashtype)
-
-;== Util ==
-(def-rpc createmultisig nrequired the-keys)
-(def-rpc estimatefee nblocks)
-;(def-rpc estimatepriority nblocks)
-;(def-rpc estimatesmartfee nblocks)
-;(def-rpc estimatesmartpriority nblocks)
-
-(s/fdef signmessagewithprivkey :args (s/cat :privkey string?, :message string?) :ret ::signature)
-(def-rpc signmessagewithprivkey privkey message)
-
-(s/fdef validateaddress :args (s/cat :address ::address) :ret map?)
-(def-rpc validateaddress address)
-
-(def-rpc verifymessage address signature message)
-
-;== Wallet ==
-(def-rpc abandontransaction txid)
-(def-rpc-opt addmultisigaddress 2 nrequired the-keys account)
-(def-rpc addwitnessaddress address)
-(def-rpc backupwallet destination)
-(def-rpc-opt bumpfee 1 txid options)
-(def-rpc dumpprivkey address)
-(def-rpc dumpwallet filename)
-(def-rpc encryptwallet passphrase)
-(def-rpc getaccount address)
-(def-rpc getaccountaddress account)
-(def-rpc getaddressesbyaccount account)
-(def-rpc-opt getbalance 0 account minconf include_watchonly)
-(def-rpc-opt getnewaddress 0 account)
-(def-rpc getrawchangeaddress)
-(def-rpc-opt getreceivedbyaccount 1 account minconf)
-(def-rpc-opt getreceivedbyaddress 1 address minconf)
-(def-rpc-opt gettransaction 1 txid include_watchonly)
-(def-rpc getunconfirmedbalance)
-(def-rpc getwalletinfo)
-(def-rpc-opt importaddress 1 address label rescan p2sh)
-(def-rpc importmulti requests options)
-(def-rpc-opt importprivkey 1 bitcoinprivkey label rescan)
-(def-rpc importprunedfunds)
-(def-rpc-opt importpubkey 1 pubkey label rescan)
-(def-rpc importwallet filename)
-(def-rpc-opt keypoolrefill 0 newsize)
-(def-rpc-opt listaccounts 0 minconf include_watchonly)
-(def-rpc listaddressgroupings)
-(def-rpc listlockunspent)
-(def-rpc-opt listreceivedbyaccount 0 minconf include_empty include_watchonly)
-(def-rpc-opt listreceivedbyaddress 0 minconf include_empty include_watchonly)
-(def-rpc-opt listsinceblock 0 blockhash target_confirmations include_watchonly)
-(def-rpc-opt listtransactions 0 account count skip include_watchonly)
-#_(def-rpc-opt listunspent 0 minconf maxconf  addresses include_unsafe)
-(def-rpc-opt lockunspent 0 unlock todo)
-(def-rpc-opt move 3 fromaccount toaccount amount minconf comment)
-(def-rpc removeprunedfunds txid)
-(def-rpc-opt sendfrom 3 fromaccount toaddress amount  minconf comment comment_to)
-#_(def-rpc-opt sendmany 2 fromaccount addess-map minconf comment addresses)
-
-
-
-(def-rpc-opt sendtoaddress 2 address amount comment comment_to subtractfeefromamount)
-(def-rpc setaccount address account)
-(def-rpc settxfee amount)
-(def-rpc signmessage address message)
-
-
-
 ;;--------------------------------

-
-(defn get-block-hashes [] (map getblockhash (range (getblockcount))))
-
-(defn block-of [block-hash] (getblock block-hash))
-
-(defn get-all-tx [])
-

 (defn print-it [a-list]
   (doseq [l a-list] (println l)))
@@ -273,18 +98,18 @@

 ;;---------------------------------------------------------------------------------
-;experiment
-
-(def help-parser
+
+(def rpc-parser
   (insta/parser
     "BTC = TITLE | FUNCTION | Epsilon
      TITLE = (<'=='> SPACE SYMBOL SPACE <'=='>)
      FUNCTION = SYMBOL | (SYMBOL SPACE ARGS)
-     ARGS = ((ARG SPACE)* ARG) | Epsilon
-     <ARG> = MAP-ARG | LIST-ARG | STRING-SYMBOL | SYMBOL  | OPTIONAL-ARG | ENUM
-     ENUM = ((SYMBOL <'|'>)* SYMBOL) | Epsilon
+     ARGS = ((ARG SPACE)* ARG OPTIONAL-SPACE) | Epsilon
+     <ARG> = MAP-ARG | LIST-ARG | STRING-SYMBOL | SYMBOL  | OPTIONAL-ARG | ENUM | ALT-LIST-ARG
+     ENUM = ((SYMBOL <'|'>)+ SYMBOL)
      OPTIONAL-ARG = (<'('> OPTIONAL-SPACE (ARG | ARGS) OPTIONAL-SPACE <')'>)
      LIST-ARG = <'['> ARG <',...'> <']'>
+     ALT-LIST-ARG = <'<'> (SYMBOL SPACE)* SYMBOL <'>'>
      MAP-ARG = (<'{'>) ((KEY-VALUE <','>)* KEY-VALUE) (<'}'>)
      KEY-VALUE = ARG <':'> ARG
      OPEN-KEY-VALUE = (KEY-VALUE <',...'>)
@@ -325,7 +150,8 @@
    :TITLE str
    :MAP-ARG (fn [& args] (symbol (str (reduce (fn [acc [_ k v]] (format "%s%s_%s" (if acc (str acc "-") "") k v)) nil args) "-map")))
    :LIST-ARG #(symbol (format "%s-list" %))
-   :ENUM (fn [& args] (reduce (fn [acc v] (format "%s%s" (if acc (str acc "-") "") v)) nil args))
+   :ALT-LIST-ARG (fn [& args] (symbol (reduce (fn [acc v] (format "%s%s" (if acc (str acc "-") "") v)) nil args)))
+   :ENUM (fn [& args] (symbol (reduce (fn [acc v] (format "%s%s" (if acc (str acc "-") "") v)) nil args)))
    :BTC (fn
           ([a] a)
           ([] nil))
@@ -336,23 +162,33 @@
     ast->clj-map
     ast))

-(def not-working #{"prioritisetransaction" "createrawtransaction" "listunspent" "sendmany"})
+
+;;the parser can't handle these RPC function yet.
+(def not-working #{"createrawtransaction" "listunspent" "sendmany"})
+;define them hardcoded
+(def-rpc-opt createrawtransaction 2 txids addresses locktime)
+(def-rpc-opt listunspent 0 minconf maxconf  addresses include_unsafe)
+(def-rpc-opt sendmany 2 fromaccount addess-map minconf comment addresses)
+
+

 (defn valid-fn [l]
   (let [n (first (.split l " "))]
     (not (contains? not-working n))))

 (defn parse [l]
-  (let [r (help-parser l)]
+  (let [r (rpc-parser l)]
     (if (insta/failure? r)
       (throw (IllegalStateException. (pr-str (insta/get-failure r))))
       (ast->clj r))))

-(defn def-rpcs []
-  (let [e (conj
-            (map parse (filter valid-fn (split-help)))
-            'do)]
-    e))
+(defn def-rpcs []
+  (eval
+    (conj
+      (map parse (filter valid-fn (split-help)))
+      'do)))
+
+(def-rpcs)

 ;;--------------------------------------------------------

@@ -475,4 +311,7 @@
   (gen-java-executor-source!
   "/Users/anderse/src/mz-dev2/mz-main/mediationzone/packages/bitcoin/src/main/java"
   "com.digitalroute.mz.bitcoin.agent" "BitcoinRpcExecutor" "AbstractBitcoinRpc")
-  )+  )
+
+
+


* src/clj/cljs/sourcemap/base64-vlq.clj: decode returns lazy-seq

--- src/clj/cljs/sourcemap/base64-vlq.clj
+++ src/clj/cljs/sourcemap/base64-vlq.clj
@@ -1,5 +1,6 @@
 (ns cljs.sourcemap.base64-vlq
-  (require [cljs.sourcemap.base64 :as base64]))
+  (require [clojure.string :as string]
+           [cljs.sourcemap.base64 :as base64]))

 (def ^:const vlq-base-shift 5)
 (def ^:const vlq-base (bit-shift-left 1 vlq-base-shift))
@@ -47,7 +48,11 @@
               shift (+ shift vlq-base-shift)]
           (if continuation?
             (recur i result shift)
-            {:value (from-vlq-signed result) :rest (.substring s i)}))))))
+            (lazy-seq
+             (cons (from-vlq-signed result)
+                   (let [s (.substring s i)]
+                     (when-not (string/blank? s)
+                       (decode s)))))))))))

 (comment
   ;; tests
@@ -62,4 +67,9 @@

   (encode 32) ; "gC"
   (decode "gC") ; {:value 32 :rest ""}
+
+  (decode "AAgBC") ; (0 0 16 1)
+
+  ;; lines kept count by semicolons
+  ;; the above is col 0, file 0, line 16, col 1
   )


return embedded styling for reagent forms

--- src/clj/conference_rating/handler.clj
+++ src/clj/conference_rating/handler.clj
@@ -21,6 +21,7 @@
              :content "width=device-width, initial-scale=1"}]
      (include-css "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css")
      (include-css "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css")
+     (include-css "css/reagent-forms.css")
      (include-css "css/site.css")]
     [:body {:class "bg-body"}
      [:div#app
@@ -66,6 +67,9 @@
                                          (println "req " request)
                                          (add-conference (:body request) db)))
    (resources "/")
+   (GET "/css/reagent-forms.css" [] (response (-> "reagent-forms.css"
+                                                  clojure.java.io/resource
+                                                  slurp))
    (GET "/" [] home-page)
    (not-found "Not Found")))


allow for no imports

allow for no imports

--- src/cljs/clj_money/views/imports.cljs
+++ src/cljs/clj_money/views/imports.cljs
@@ -49,12 +49,12 @@
     [:th "Entity Name"]
     [:th "Uploaded On"]
     [:th (util/space)]]
-   (if (empty? @imports)
-     [:tr [:td.status {:colSpan 3} [:span.inline-status "Loading..."]]]
-     (map import-row @imports))]])
+   (if @imports
+     (map import-row @imports)
+     [:tr [:td.status {:colSpan 3} [:span.inline-status "Loading..."]]])]])

 (defn- import-list []
-  (let [imports (r/atom [])]
+  (let [imports (r/atom nil)]
     (imports/get-all #(reset! imports %)
                      notify/danger)
     (with-layout


add remove! to dom

add remove! to dom

--- src/cljs/infinitelives/utils/dom.cljs
+++ src/cljs/infinitelives/utils/dom.cljs
@@ -29,6 +29,16 @@
   ([parent child]
      (doto parent
        (.appendChild child))))
+
+(defn remove!
+  "Remove `elem` from `parent`, return `parent`"
+  ([elem]
+     (let [p (parent elem)]
+       (assert p "Target element must have a parent")
+       (remove! p elem)))
+
+  ([p elem]
+     (doto p (.removeChild elem))))

 (defn create-element
   ([tag]


weird refer warning, might be cljs bug

weird refer warning, might be cljs bug

--- src/cljs/shadow/cljs/live_reload.cljs
+++ src/cljs/shadow/cljs/live_reload.cljs
@@ -1,5 +1,5 @@
 (ns shadow.cljs.live-reload
-  (:require [cljs.reader :refer (read-string)]
+  (:require [cljs.reader :as reader]
             [goog.net.jsloader :as loader]))

@@ -45,7 +45,7 @@
   (.debug js/console "LIVE RELOAD:" (pr-str config))
   (let [socket (js/WebSocket. socket-url)]
     (set! (.-onmessage socket) (fn [e]
-                                 (handle-changes config (-> e .-data read-string))))
+                                 (handle-changes config (-> e .-data (reader/read-string)))))
     (set! (.-onopen socket) (fn [e]
                               ;; patch away the already declared exception
                               (set! (.-provide js/goog) (aget js/goog "exportPath_"))


Solucionat problema amb sablono.

Solucionat problema amb sablono.

--- src/cljs/twitter_websockets/core.cljs
+++ src/cljs/twitter_websockets/core.cljs
@@ -35,8 +35,8 @@
     om/IRender
     (render [_]
       (html
-        [:h3 "Recived Tweets:"]
-        (map (dom/p nil %) tweets)
+        [:div [:h3 "Recived Tweets:"]
+         (map #(dom/p nil %) tweets)]
         ))))

 (defn application [cursor owner]
@@ -47,8 +47,9 @@
     om/IRender
     (render [_]
       (html
-        [:h1 "Twitter Streaming"]
-        (om/build tweets-view cursor)))))
+        [:div
+         [:h1 "Twitter Streaming"]
+         (om/build tweets-view cursor)]))))

 (defn main []


make defalias-macro handle &rest args

make defalias-macro handle &rest args

--- src/com/billpiel/sayid/util/other.clj
+++ src/com/billpiel/sayid/util/other.clj
@@ -149,7 +149,7 @@
                                                    (name '~source)
                                                    %))))))

-(defmacro defalias-macro
+(defn defalias-macro*
   [alias source]
   (let [body-sym (gensym "body")
         qualified-source (qualify-sym *ns* source)
@@ -157,12 +157,20 @@
                          (ns-resolve *ns*)
                          meta)
         arglists (:arglists source-meta)
+        split-at-& (fn [arg-vec]
+                     (let [[pre amp post]
+                           (partition-by #{'&} arg-vec)]
+                       (if (-> arg-vec
+                               first
+                               #{'&})
+                         (concat amp)
+                         (concat [(vec pre)] post))))
         forms (map (fn [args]
                      `(~args
                        (clojure.core/seq
                         (clojure.core/concat
                          (clojure.core/list '~qualified-source)
-                         ~args))))
+                         ~@(split-at-& args)))))
                    arglists)]
     `(do (defmacro ~alias ~@forms)
          (alter-meta! #'~alias merge
@@ -174,6 +182,10 @@
                                                      (name '~source)
                                                      %))))
          #'~alias)))
+
+(defmacro defalias-macro
+  [alias source]
+  (defalias-macro* alias source))

 (defn ns-unmap-all
   [ns']


Cleanup native windows objects when sketch is closed.

--- src/clj/quil/applet.clj
+++ src/clj/quil/applet.clj
@@ -26,6 +26,28 @@
 (defn target-frame-rate []
   (:target-frame-rate (meta (current-applet))))

+(def ^:private  executor (java.util.concurrent.Executors/newSingleThreadScheduledExecutor))
+
+(defn- destroy-window
+  "Cleanup native window object once sketch was closed. Processing doesn't perform cleanups
+  because its probably assumes that when sketch is closed - JVM is closed as well which is
+  not the case for clojure. So here we're performing renderer-specific cleanups. "
+  [applet]
+  (let [native (-> applet .getSurface .getNative)]
+    (condp = (.getClass native)
+
+      com.jogamp.newt.opengl.GLWindow
+      ; Cannot destroy GLWindow right away because there is some callbacks going on
+      ; and NPE is thrown when they execute if window is destroyed. It doesn't seem
+      ; to affect anything, but annoying to have NPE in logs. Delaying destroying
+      ; window for 1 sec. Ugly hack, but couldn't think of better way. Suggestions welcome.
+      (.schedule executor #(.destroy native) 1 java.util.concurrent.TimeUnit/SECONDS)
+
+      processing.awt.PSurfaceAWT$SmoothCanvas
+      (-> native .getFrame .dispose)
+
+      :nothing)))
+
 (defn applet-disposed
   "This function is called when PApplet executes 'dispose' method.
   It means we can dispose frame, call on-close function and perform other
@@ -33,7 +55,8 @@
   [applet]
   (with-applet applet
     ((:on-close (meta applet))))
-  (-> applet .getSurface(.setVisible false)))
+  (-> applet .getSurface(.setVisible false))
+  (destroy-window applet))

 (defn applet-state
   "Fetch an element of state from within the applet"


Update documentation for `text` to indicate that `z` parameter is only available for clj

--- src/cljc/quil/core.cljc
+++ src/cljc/quil/core.cljc
@@ -4039,7 +4039,7 @@
     :added "1.0"}
   text
   "Draws text to the screen in the position specified by the x and y
-  parameters and the optional z parameter. A default font will be used
+  parameters (and the optional z parameter in clj). A default font will be used
   unless a font is set with the text-font fn. Change the color of the
   text with the fill fn. The text displays in relation to the
   text-align fn, which gives the option to draw to the left, right, and


Mark Domain and UI parts of core.clj

Mark Domain and UI parts of core.clj

--- src/fp_contest_solution_tree/core.clj
+++ src/fp_contest_solution_tree/core.clj
@@ -19,6 +19,8 @@
                       ["Цвет лемпелей",            ["Жёлтый",  "Жёлтый",    "Жёлтый",    "Белый", "Белый"]],
                       ["Наличие пильских трапков", ["Да",      "Да",        "Да",        "Да",    "Да"]]])

+
+;; Domain logic
 (defn alternatives
   ([feature-values]
      (alternatives feature-values nil))
@@ -46,6 +48,11 @@
                        (assoc node :children children)))
                    node)))))))

+(defn get-subtree [tree option]
+  (first (filter #(= (:answer %) option) tree)))
+;; Domain logic end
+
+;; Console UI functions
 (defn print-answers [answers]
   (loop [current-answers answers
          index 1
@@ -86,11 +93,6 @@
         (for [{:keys [feature answer]} tree]
           [feature answer])))

-(defn get-subtree [tree option]
-  (first (filter #(= (:answer %) option) tree)))
-
-;; (get-subtree (solve-tree subject-matrix) "Да")
-
 (defn find-out [tree]
   (let [chosen-option (ask-question (answers tree))
         chosen-subtree (get-subtree tree chosen-option)]
@@ -116,7 +118,9 @@
       (catch IllegalStateException e (println "Your subject is not known to scientists, because" (.getMessage e))))))

+;; Testing in REPL stuff. It is commented, so it wont be compiled and executed.
 (comment
+  (get-subtree (solve-tree subject-matrix) "Да")
   (print-table [:value1 :value2] [{:value1 1 :value2 2}{:value1 3 :value2 4}])
   (time (pprint (solve-tree subject-matrix)))
   (solve-tree [["f1" ["yes" "yes" "no" "no"]] ["f2" ["1" "2" "2" "—"]]] nil)


* src/cljs/cljs/core.cljs: clarify == docstring

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -1115,7 +1115,8 @@

 (defn ^boolean ==
   "Returns non-nil if nums all have the equivalent
-  value (type-independent), otherwise false"
+  value, otherwise false. Behavior on non nums is
+  undefined."
   ([x] true)
   ([x y] (-equiv x y))
   ([x y & more]


Coorce a lack of arguments into the empty list

The variable in the rest position of the positional args will be
nil if there are no further arguments.  This commit uses or to
ensure we get an empty list.

    user=> (defn foo [& args] args)
    #'user/foo
    user=> (foo 1 2 3)
    (1 2 3)
    user=> (foo)
    nil

--- src/puppetlabs/trapperkeeper/core.clj
+++ src/puppetlabs/trapperkeeper/core.clj
@@ -157,7 +157,7 @@
   {:pre [((some-fn sequential? nil?) args)
          (every? string? args)]}
   (try+
-    (-> args
+    (-> (or args '())
         (internal/parse-cli-args!)
         (run))
     (catch map? m


Remove errant (run-tests) from test-dom

Remove errant (run-tests) from test-dom

--- src/test/clojure/cascade/test_dom.clj
+++ src/test/clojure/cascade/test_dom.clj
@@ -90,6 +90,4 @@
     "one < 2" "one < 2"
     "two > one" "two > one"
     "Calvin & Hobbes" "Calvin & Hobbes"
-    (str "What's this: " (char 128) (char 31)) "What's this: €"))
-
-(run-tests)+    (str "What's this: " (char 128) (char 31)) "What's this: €"))


fix fn argument order

fix fn argument order

--- src/asphalt/internal/sql.clj
+++ src/asphalt/internal/sql.clj
@@ -204,7 +204,7 @@

 (defn bad-st-arity
-  [^String sql-name ^long n]
+  [^long n ^String sql-name]
   (throw (clojure.lang.ArityException. n (str sql-name " (accepts 2 args)"))))


get the decode-fn out of the threading macro

--- src/datasplash/core.clj
+++ src/datasplash/core.clj
@@ -1168,20 +1168,20 @@
    (let [opts (assoc options
                      :label (str "read-json-file-from-"
                                  (clean-filename from))
-                     :coder (or (:coder options) (make-nippy-coder)))]
+                     :coder (or (:coder options) (make-nippy-coder)))
+         decode-fn (cond
+                     (and key-fn return-type) #(json/decode % key-fn return-type)
+                     key-fn #(json/decode % key-fn)
+                     return-type #(json/decode % nil return-type)
+                     :else #(json/decode %))]
      (pt->>
       (or (:name options) (str "read-json-file-from-" (clean-filename from)))
       p
       (read-text-file from (-> options
                                (dissoc :coder)
                                (assoc :name "read-text-file")))
-      (let [decode-fn (cond
-                        (and key-fn return-type) #(json/decode % key-fn return-type)
-                        key-fn #(json/decode % key-fn)
-                        return-type #(json/decode % nil return-type)
-                        :else #(json/decode %))]
-        (dmap decode-fn
-              (assoc options :name "json-decode"))))))
+      (dmap decode-fn
+            (assoc options :name "json-decode")))))
   ([from p] (read-json-file from {} p)))

 (def json-writer-schema


improves comment

improves comment

--- src/distillery/data.clj
+++ src/distillery/data.clj
@@ -171,7 +171,8 @@
   [xs] (apply + xs))

 (defn mean
-  "Computes the mean value of a numeric sequence."
+  "Computes the mean value of a numeric sequence.
+  Return `0` if the sequence is empty."
   [xs]
   (let [cnt (count xs)]
     (if (> cnt 0) (/ (apply + xs) cnt) 0)))


throw on :maybe-host-form

throw on :maybe-host-form

--- src/main/clojure/clojure/tools/analyzer/passes/js/validate.clj
+++ src/main/clojure/clojure/tools/analyzer/passes/js/validate.clj
@@ -17,6 +17,12 @@
 (defmethod -validate :maybe-class [{:keys [class env] :as ast}]
   (throw (ex-info (str "Cannot resolve: " class)
                   (merge {:sym class
+                          :ast (prewalk ast cleanup)}
+                         (source-info env)))) )
+
+(defmethod -validate :maybe-host-form [{:keys [form env] :as ast}]
+  (throw (ex-info (str "Cannot resolve: " form)
+                  (merge {:sym form
                           :ast (prewalk ast cleanup)}
                          (source-info env)))) )


Add card-input component

Add card-input component

--- src/cljs/decktouch/core.cljs
+++ src/cljs/decktouch/core.cljs
@@ -7,11 +7,20 @@
               [decktouch.card-data :as card-data])
     (:import goog.History))

+(defn get-card-input-value []
+  (.-value (.getElementById js/document "the-input")))
 ;; -------------------------
 ;; Views
 (defn card-in-list [card]
   [:li
    (str card)])
+
+(defn card-input []
+  [:form {:on-submit #(do
+                       (swap! card-data/cards (conj @card-data/cards)
+                                              (get-card-input-value))
+                       false)}
+   [:input#the-input {:type "text"}]])

 (defn card-list [cards]
   [:ul


Remove garbage comment.

Remove garbage comment.

--- src/cljs/reversi/phaser.cljs
+++ src/cljs/reversi/phaser.cljs
@@ -5,19 +5,8 @@
 (def *border* (atom rcore/*default-border*))
 (def *phaser-border* (atom [[] [] [] [] [] [] [] []]))
 (def *visible-possible-grids-pos* (atom '()))
-(def *black-piece-count* (atom 2))
-(def *white-piece-count* (atom 2))
 (def ^:dynamic *default-player-use-piece* rcore/*black-piece*)
 (def ^:dynamic *default-pc-use-piece* rcore/*white-piece*)
-
-;; (defn inc-piece-count [piece n]
-;;   (cond
-;;    (rcore/white-piece? piece)
-;;    (reset! *white-piece-count*
-;;            (+ n @*white-piece-count*))
-;;    (rcore/black-piece? piece)
-;;    (reset! *black-piece-count*
-;;            (+ n @*black-piece-count*))))

 (defn grid-name->rcore-grid [grid-name]
   (let [gn-rp-table


dont log take 204s

dont log take 204s

--- src/spq/server.clj
+++ src/spq/server.clj
@@ -111,8 +111,7 @@
             retry-timeout-minutes (Double/parseDouble (get (:params req) :retry-timeout-minutes (str (conf :server :retry-timeout-minutes))))
             task (dq/take! queue queue-name timeout-millis ::empty)]
         (if (= ::empty task)
-          (do (timbre/debug "take! nothing to take for queue:" queue-name)
-              {:status 204})
+          {:status 204}
           (try
             (let [item @task
                   id (-swap-take! state task queue-name retry-timeout-minutes)]


Use merge for optional map entries

Use merge for optional map entries

--- src/formlogic/views.clj
+++ src/formlogic/views.clj
@@ -212,7 +212,7 @@
      (for [choice (map-indexed vector (:choices question))
            :let [[idx text] choice]]
        [:div {:class elem-class}
-        [:label (elem-factory {:disabled (if admin? "true" "false")}
+        [:label (elem-factory (merge {} (when admin? {:disabled "true"}))
                               (elem-id idx)
                               (active? text)
                               (h text)) (h text)]])
@@ -222,9 +222,8 @@
   [{admin? :admin} {id :id :as question} progress]
   [:div {:class "form-group"}
    (question-label question)
-   (text-area {:class "form-control"
-               :rows "3"
-               :disabled (if admin? "true" "false")}
+   (text-area (merge {:class "form-control" :rows "3"}
+                    (when admin? {:disabled "true"}))
               (str "question" id "-fill")
               (first (:answers progress)))
    (when admin? (correct-radio-group question))])


Fix bug in ReactiveExpression.remove-watches (watchers -> watches)

--- src-cljs/freactive/core.cljs
+++ src-cljs/freactive/core.cljs
@@ -283,7 +283,7 @@
       (set! (.-watches this) (assoc watches key f)))
     this)
   (-remove-watch [this key]
-    (when (contains? watchers key)
+    (when (contains? watches key)
       (set! (.-watchers this) (dec watchers))
       (set! (.-watches this) (dissoc watches key)))
     this)


Check for OAuthCSRF token and GitHubCSRF token

--- src-cljs/frontend/utils.cljs
+++ src-cljs/frontend/utils.cljs
@@ -24,7 +24,8 @@
   (aget js/window "CSRFToken"))

 (defn oauth-csrf-token []
-  (aget js/window "OAuthCSRFToken"))
+  (or (aget js/window "OAuthCSRFToken")
+      (aget js/window "GitHubCSRFToken")))

 (def parsed-uri
   (goog.Uri. (-> (.-location js/window) (.-href))))


avoid NPE

avoid NPE

--- src/babel/francais/morphology.cljc
+++ src/babel/francais/morphology.cljc
@@ -256,31 +256,34 @@

 (defn fo [input]
   (cond
-   (= input :fail)
-   (str input)
-
-   (or (seq? input)
-       (vector? input))
-   (str "(" (string/join " , "
-                         (remove #(= % "")
-                                 (map #(let [f (fo %)] (if (= f "") "" (str "" f ""))) input)))
-        ")")
-
-   (string? input)
-   input
-
-   (get-in input [:français])
-   (string/trim (str (get-string (get-in input [:français]))))
-
-   (and (map? input)
-        (get-in input [:a])
-        (get-in input [:b]))
-   (str (string/join " "
-                     (list (fo (get-in input [:a]))
-                           (fo (get-in input [:b])))))
-
-   true
-   ""))
+    (nil? input)
+    nil
+
+    (= input :fail)
+    (str input)
+
+    (or (seq? input)
+        (vector? input))
+    (str "(" (string/join " , "
+                          (remove #(= % "")
+                                  (map #(let [f (fo %)] (if (= f "") "" (str "" f ""))) input)))
+         ")")
+
+    (string? input)
+    input
+
+    (get-in input [:français])
+    (string/trim (str (get-string (get-in input [:français]))))
+
+    (and (map? input)
+         (get-in input [:a])
+         (get-in input [:b]))
+    (str (string/join " "
+                      (list (fo (get-in input [:a]))
+                            (fo (get-in input [:b])))))
+
+    true
+    ""))

 (defn fo-ps [expr]
   "show the phrase-structure of a phrase structure tree, e.g [hh21 'mangiare (to eat)' [cc10 'il (the)' 'pane(bread)']]"


Remove old testing configs from project.clj

--- runner/project.clj
+++ runner/project.clj
@@ -6,14 +6,9 @@
   :dependencies [[org.clojure/clojure "1.5.1"]
                  [leiningen "2.3.4"
                   :exclusions [stencil]]
-                 [fs "1.3.3"]
-                 ]
-  ;:exclusions [org.clojure/clojurescript]
+                 [fs "1.3.3"]]
   :uberjar-name "lein-light-standalone.jar"
   :aot :all
-  :source-paths ["src/"
-                ;"/users/chris/repos/clojurescript/src/clj"
-               ;"/users/chris/repos/clojurescript/src/cljs"
-                 ]
+  :source-paths ["src/"]
   :jvm-opts ["-Xmx1g"]
   :main leiningen.light-nrepl)


No wasted whitespace (e.g. after punctuation)

--- src/harnocode/core.cljs
+++ src/harnocode/core.cljs
@@ -77,11 +77,15 @@
     (println (map :value tokens))
     (map :value tokens)))

-;; TODO: smarter whitespace handling -- we don't need that much whitespace
-(defn token-to-text [token]
-  (if (= (:type token) "Punctuator")
-   (str (:value token))
-   (str (:value token) " ")))
+;; TODO
+(defn tokens-to-text [[t1 t2 & tokens] result]
+  (if (nil? t1) result
+    (if (nil? t2) (conj result (:value t2))
+      (let [t1-punct? (= (:type t1) "Punctuator")
+            t2-punct? (= (:type t2) "Punctuator")
+            need-space (and (not t1-punct?) (not t2-punct?))
+            t1-text (str (:value t1) (if need-space " " ""))]
+        (recur (conj tokens t2) (conj result t1-text))))))

 (defn invert-image [img]
   (let [invert-row (fn [row] (map #(if (= % 0) 1 0) row))]
@@ -93,7 +97,7 @@
 ;; w    -- int, width of output, in chars
 (defn harnify [code img w]
   (let [tokens (js->clj (js/esprima.tokenize code) :keywordize-keys true)
-        ts (map token-to-text tokens)]
+        ts (tokens-to-text tokens [])]
     (string/join "\n" (reverse (arrange-tokens ts img)))              ; img must be resized by now, no need in w
     ))


Correct branching on error.

Correct branching on error.

--- src/caesium/crypto/generichash.clj
+++ src/caesium/crypto/generichash.clj
@@ -69,8 +69,8 @@
                             (b/call! blake2b-salt-personal buf msg key salt personal))
                           (b/call! blake2b buf msg key))]
      (if-not (zero? blake2b-result)
-       (throw (RuntimeException. "Error in BLAKE2b hashing")))
-     buf)))
+       (throw (RuntimeException. "Error in BLAKE2b hashing"))
+       buf))))

 (defn blake2b
   "Hashes a message using BLAKE2b. Optionally takes key, salt and personal.


Unify checking for seen eids

Unify checking for seen eids

--- src/datascript/pull_api.cljs
+++ src/datascript/pull_api.cljs
@@ -43,6 +43,17 @@
            :depth (update depth attr (fnil inc 0))
            :seen (conj seen eid))))

+(defn- seen-eid?
+  [frame eid]
+  (-> frame
+      (get-in [:recursion :seen] #{})
+      (contains? eid)))
+
+(defn- pull-seen-eid
+  [frame frames eid]
+  (when (seen-eid? frame eid)
+    (conj frames (update frame :results conj! {:db/id eid}))))
+
 (defn- recursion-result
   [frame]
   (some-> (:kvps frame) persistent! (get ::recursion)))
@@ -59,9 +70,8 @@
   (if-let [eids (seq (:eids frame))]
     (let [frame  (reset-frame frame (rest eids) (recursion-result frame))
           eid    (first eids)]
-      (if (get-in frame [:recursion :seen eid])
-        (conj frames (update frame :results conj! {:db/id eid}))
-        (conj frames frame (recursion-frame frame eid))))
+      (or (pull-seen-eid frame frames eid)
+          (conj frames frame (recursion-frame frame eid))))
     (let [kvps    (recursion-result frame)
           results (cond-> (:results frame)
                     (seq kvps) (conj! kvps))]
@@ -177,9 +187,8 @@
 (defn- pull-wildcard
   [db frame frames]
   (let [{:keys [eid pattern]} frame]
-    (if (get-in frame [:recursion :seen eid])
-      (conj frames (update frame :results conj! {:db/id eid}))
-      (pull-wildcard-expand db frame frames eid pattern))))
+    (or (pull-seen-eid frame frames eid)
+        (pull-wildcard-expand db frame frames eid pattern))))

 (defn- pull-pattern-frame
   [db [frame & frames]]


added area and coefficeant of lift function

--- src/hydrofoil/model.clj
+++ src/hydrofoil/model.clj
@@ -138,6 +138,20 @@
   (+ (/ (trapazoid-integral individual function (/ pieces 2)) 3)
      (/ (* 2 (integral-abstracted individual function middle-rule (/ pieces 2))) 3)))

+(defn area
+  [individual]
+  (- (simpson-integral individual upper-surface-y-function 90)
+     (simpson-integral individual lower-surface-y-function 90)))
+
+;;;---------------- Coefficantof lift ----------------
+(defn coefficeant-of-lift
+  [individual run-constants]
+  (let [attack-angle (run-constants :angle-of-attack)
+        camber-position (individual :corrected-position-camber)]
+    (* (* 2 (Math/pi))
+       (+ attack-angle (* 2 camber-position)))))
+
+
 ;;(defn lift-function
 ;;  [])


Don't do anything if there are no references

--- src/discuss/integration.cljs
+++ src/discuss/integration.cljs
@@ -93,4 +93,5 @@
 (defn process-references
   "Receives references through the API and prepares them for the next steps."
   [refs]
-  (doall (map convert-reference refs)))+  (when refs
+    (doall (map convert-reference refs))))


add abiltiy to pickup items

add abiltiy to pickup items

--- src/dungeon_crusade/main.clj
+++ src/dungeon_crusade/main.clj
@@ -177,23 +177,29 @@
         state))))

 (defn pick-up [state keyin]
-  (let [place (current-place state)
+  (let [place (-> state :world :current-place)
         [player-cell x y] (player-cellxy state)
-        items (player-cellxy :items)
-        item-index (.indexOf (state :world :remaining-hotkeys) keyin)]
-    (-> state
-      ;; dup the item into inventory with hotkey
-      (update-in [:world :player :inventory]
-        (fn [prev-inventory]
-          (conj prev-inventory (nth items item-index))))
-      ;; remove the item from cell
-      (update-in [:world :places place y x :items]
-        (fn [prev-items] (vec (concat (subvec prev-items 0 (dec item-index))
-                                      (subvec prev-items item-index (count prev-items))))))
-      ;; hotkey is no longer available
-      (update-in [:world :remaining-hotkeys]
-        (fn [prev-keys] (vec (concat (subvec prev-keys 0 (dec item-index))
-                                     (subvec prev-keys item-index (count prev-keys)))))))))
+        items (player-cell :items)
+        remaining-hotkeys (-> state :world :remaining-hotkeys)
+        item-index (.indexOf remaining-hotkeys keyin)
+        item (nth items item-index)
+        new-state (-> state
+          ;; dup the item into inventory with hotkey
+          (update-in [:world :player :inventory]
+            (fn [prev-inventory]
+              (conj prev-inventory (nth items item-index))))
+          ;; remove the item from cell
+          (assoc-in [:world :places place y x :items]
+           (vec (concat (subvec items 0 item-index)
+                        (subvec items (inc item-index) (count items)))))
+          ;;;; hotkey is no longer available
+          (assoc-in [:world :remaining-hotkeys]
+            (vec (concat (subvec remaining-hotkeys 0 item-index)
+                         (subvec remaining-hotkeys (inc item-index) (count remaining-hotkeys))))))]
+    (println "picking up at:" x y "item with index" item-index "item" item)
+    (println "new-state" new-state)
+    (println "cell-items (-> state :world :places" place y x ":items)")
+    new-state))

 (defn toggle-inventory [state]
   (println "toggle-inventory" (not (-> state :world :show-inventory?)))
@@ -205,32 +211,39 @@

 (defn update-state [state keyin]
-  (println "last-command " (get-last-command state))
-  (case (get-last-command state)
-    :open (let [state-with-command (set-last-command state nil)]
-            (open-door state-with-command (case keyin
-                                            \h :left
-                                            \j :down
-                                            \k :up
-                                            \l :right)))
-    :close (let [state-with-command (set-last-command state nil)]
-             (close-door state-with-command (case keyin
-                                              \h :left
-                                              \j :down
-                                              \k :up
-                                              \l :right)))
-    :pick-up (let [state-with-command(set-last-command state nil)]
-               (pick-up state-with-command keyin))
-    (case keyin
-      \h (move-left state)
-      \j (move-down state)
-      \k (move-up state)
-      \l (move-right state)
-      \i (toggle-inventory state)
-      \, (toggle-pick-up state)
-      \o (set-last-command state :open)
-      \c (set-last-command state :close)
-      state)))
+  (if (-> state :world :show-pick-up?)
+    ;; handle pickup
+    (let [state-with-command(set-last-command state nil)]
+      (println "picking up")
+      (case keyin
+        \, (toggle-pick-up state-with-command)
+        (pick-up state-with-command keyin)))
+    ;; handle main game commands
+    (do
+      (println "last-command " (get-last-command state))
+      (case (get-last-command state)
+        :open (let [state-with-command (set-last-command state nil)]
+                (open-door state-with-command (case keyin
+                                                \h :left
+                                                \j :down
+                                                \k :up
+                                                \l :right)))
+        :close (let [state-with-command (set-last-command state nil)]
+                 (close-door state-with-command (case keyin
+                                                  \h :left
+                                                  \j :down
+                                                  \k :up
+                                                  \l :right)))
+        (case keyin
+          \h (move-left state)
+          \j (move-down state)
+          \k (move-up state)
+          \l (move-right state)
+          \i (toggle-inventory state)
+          \, (toggle-pick-up state)
+          \o (set-last-command state :open)
+          \c (set-last-command state :close)
+          (do (println "command not found") state))))))

 (defn render-pick-up [state]
   ;; maybe draw pick up menu
@@ -245,22 +258,26 @@
                                                                 (%2 :name))
                                             cell-items)
                                (repeat (apply str (repeat 40 " ")))))]
-    (println "player-x" player-x "player-y" player-y)
-    (println "cell" cell)
-    (println "cell-items" cell-items)
-    (println "type-contents" (type contents))
-    (println "contents" contents)
+    ;(println "player-x" player-x "player-y" player-y)
+    ;(println "cell" cell)
+    ;(println "cell-items" cell-items)
+    ;(println "type-contents" (type contents))
+    ;(println "contents" contents)
     (doall (map-indexed (fn [y line] (do
-                                       (println "y" y "line" line "type" (type line))
+    ;                                   (println "y" y "line" line "type" (type line))
                                        (s/put-string (state :screen) 40 (inc y) line {:fg :black :bg :white :styles #{:bold}}))) contents))
     (println "header")
     (s/put-string (state :screen) 40 0 "  Pick up                               " {:fg :black :bg :white :styles #{:underline :bold}}))))

 (defn render-inventory [state]
-    (when (-> state :world :show-inventory?)
-        (println "render-inventory")
-        (dorun (map (fn [y] (s/put-string (state :screen) 40 y "                                        " {:bg :white})) (range 23)))
-        (s/put-string (state :screen) 40 0 "  Inventory                             " {:fg :black :bg :white :styles #{:underline}})))
+  (when (-> state :world :show-inventory?)
+    (let [contents (take 22
+                     (concat (map #(format "%-40s"  (% :name)) (-> state :world :player :inventory))
+                             (repeat (apply str (repeat 40 " ")))))]
+      (println "render-inventory")
+      (println "contents" contents)
+      (dorun (map-indexed (fn [y line] (s/put-string (state :screen) 40 (inc y) line {:fg :black :bg :white :styles #{:bold}})) contents))
+      (s/put-string (state :screen) 40 0 "  Inventory                             " {:fg :black :bg :white :styles #{:underline}}))))

 (defn render [state]
   (do
@@ -272,7 +289,7 @@
         ;;(println cell x y)
         (when (not (nil? cell))
           (let [cell-items (cell :items)
-                out-char (if (not (nil? cell-items))
+                out-char (if (and cell-items (not (empty? cell-items)))
                            (case :ring
                              :ring           ["="]
                              :food           ["%"]
@@ -330,10 +347,11 @@
     {:world (init-world) :screen screen :time 0}))

 (defn tick [state]
-  (let [keyin  (s/get-key-blocking (state :screen))]
-    (println "got " keyin " type " (type keyin))
-    (let [newstate (update-state state keyin)
-          state-with-tick (update-in newstate [:time] (fn [t] (inc t)))]
-      (render state-with-tick)
-      state-with-tick)))
-
+  (do
+    (render state)
+    (let [keyin  (s/get-key-blocking (state :screen))]
+      (println "got " keyin " type " (type keyin))
+      (let [newstate (update-state state keyin)
+            state-with-tick (update-in newstate [:time] (fn [t] (inc t)))]
+        state-with-tick))))
+


fix linking when body is just link

fix linking when body is just link

--- src/chat/client/views/helpers.cljs
+++ src/chat/client/views/helpers.cljs
@@ -18,10 +18,11 @@
   [text]
   (let [url-re #"http(?:s)?://\S+(?:\w|\d|/)"
         text-links-seq (interleave
-                         (map (partial assoc {} :text)
-                              (string/split text url-re))
-                         (map (partial assoc {} :link)
-                              (re-seq url-re text)))]
+                         (->> (string/split text url-re)
+                              seq (or [""])
+                              (map (partial assoc {} :text)))
+                         (->> (re-seq url-re text)
+                              (map (partial assoc {} :link))))]
     (if (empty? text-links-seq)
       (list text)
       (map


Remove refer-clojure for promise, not needed anymore.

--- src/clj/http/async/client/util.clj
+++ src/clj/http/async/client/util.clj
@@ -15,7 +15,6 @@
 (ns http.async.client.util
   "Asynchronous HTTP Client - Clojure - Utils"
   {:author "Hubert Iwaniuk"}
-  (:refer-clojure :exclude [promise])
   (:import (com.ning.http.client ProxyServer
                                  ProxyServer$Protocol
                                  Realm$AuthScheme


badge info init data fixed

badge info init data fixed

--- src/cljs/salava/badge/ui/info.cljs
+++ src/cljs/salava/badge/ui/info.cljs
@@ -18,12 +18,22 @@
             ))

 (defn init-data [state id]
-  (ajax/GET
+  (let [reporttool-init {:description ""
+                         :report-type "bug"
+                         :item-id ""
+                         :item-content-id ""
+                         :item-url   ""
+                         :item-name "" ;
+                         :item-type "" ;badge/user/page/badges
+                         :reporter-id ""
+                         :status "false"}]
+   (ajax/GET
     (path-for (str "/obpv1/badge/info/" id))
     {:handler (fn [data]
                 (reset! state (assoc data :id id
-                                          :show-link-or-embed-code nil
-                                          :initializing false)))}))
+                                     :show-link-or-embed-code nil
+                                     :initializing false
+                                     :reporttool reporttool-init)))})))

 (defn toggle-visibility [state]
   (let [id (:id @state)
@@ -199,24 +209,6 @@
          (if owner? "" (reporttool id name "badge" reporttool-atom))
          ]]])))

-(defn init-data [state id]
-  (let [reporttool-init {:description ""
-                         :report-type "bug"
-                         :item-id ""
-                         :item-content-id ""
-                         :item-url   ""
-                         :item-name "" ;
-                         :item-type "" ;badge/user/page/badges
-                         :reporter-id ""
-                         :status "false"}]
-   (ajax/GET
-    (path-for (str "/obpv1/badge/info/" id))
-    {:handler (fn [data]
-                (reset! state (assoc data :id id
-                                     :show-link-or-embed-code nil
-                                     :initializing false
-                                     :reporttool reporttool-init)))})))
-
 (defn handler [site-navi params]
   (let [id (:badge-id params)
         state (atom {:initializing true


same owner

same owner

--- src/cljs/tictactoe/logic/turn.cljs
+++ src/cljs/tictactoe/logic/turn.cljs
@@ -15,9 +15,9 @@
   "Indicates whether all positions are owned by the same player"
   [board positions]
   (let [owners (set (map #(get board %) positions))]
-    (and
-      (not= :owner/none (first owners))
-      (= 1 (count owners)))
+    (or
+      (= #{:owner/circle} owners)
+      (= #{:owner/cross} owners))
     ))

 (defn- has-winner?


New problem

New problem


Problem added - "Transitive Closure"

Problem added - "Transitive Closure"

--- src/foreclojure/data_set.clj
+++ src/foreclojure/data_set.clj
@@ -922,7 +922,7 @@
             :restricted ["intersection"]
             :description "Write a function which returns the intersection of two sets.  The intersection is the sub-set of items that each set has in common."
             :approved true
-            :tags ["easy" "sets"]
+            :tags ["easy" "set theory"]
             :tests ["(= (__ #{0 1 2 3} #{2 3 4 5}) #{2 3})"
 		    "(= (__ #{0 1 2} #{3 4 5}) #{})"
 		    "(= (__ #{:a :b :c :d} #{:c :e :a :f :d}) #{:a :c :d})"]})
@@ -954,9 +954,20 @@
                     "(= true (__ false true false))"
                     "(= false (__ true true true))"
                     "(= true (__ true true true false))"]})
+
+(insert! :problems
+           {:_id 84
+            :title "Transitive Closure"
+            :times-solved 0
+            :description "Write a function which generates the transitive closure of a binary relation.  The relation will be represented as a set of 2 item vectors."
+            :approved true
+            :tags ["hard" "set theory"]
+            :tests ["(let [divides #{[8 4] [9 3] [4 2] [27 9]}]\n  (= (__ divides) #{[4 2] [8 4] [8 2] [9 3] [27 9] [27 3]}))"
+                    "(let [more-legs\n      #{[\"cat\" \"man\"] [\"man\" \"snake\"] [\"spider\" \"cat\"]}]\n  (= (__ more-legs)\n     #{[\"cat\" \"man\"] [\"cat\" \"snake\"] [\"man\" \"snake\"]\n       [\"spider\" \"cat\"] [\"spider\" \"man\"] [\"spider\" \"snake\"]}))"
+                    "(let [progeny\n      #{[\"father\" \"son\"] [\"uncle\" \"cousin\"] [\"son\" \"grandson\"]}]\n  (= (__ progeny)\n     #{[\"father\" \"son\"] [\"father\" \"grandson\"]\n       [\"uncle\" \"cousin\"] [\"son\" \"grandson\"]}))"]})

       (insert! :problems
-          {:_id 84
+          {:_id 85
            :title "Create an Equation"
            :times-solved 0
            :description "Write a function which takes three or more integers.  Using these integers, your function should generate clojure code representing an equation.  The following rules for the equation must be satisfied:\n\n    1. All integers must be used once and only once.\n    2. The order of the integers must be maintained when reading the equation left-to-right.\n    3. The only functions you may use are +, *, or =.\n    4. The equation must use the minimum number of parentheses.\n    5. If no satisfying equation exists, return nil."
@@ -975,7 +986,7 @@

       (insert! :problems
-           {:_id 85
+           {:_id 86
             :title "Power Set"
             :times-solved 0
             :description "A power set is the set of all subsets of a given set. Given a list, produce a set of sublists while preserving the order of elements."


cleanup: removing useless old commented code

--- src/lambdacd/visual.clj
+++ src/lambdacd/visual.clj
@@ -17,14 +17,6 @@
     (if (sequential? fun)
       :step
       :unknown)))
-
-  ;(if (= `dsl/in-parallel fun)
-  ;  :parallel
-  ;  (if (=  :container)
-  ;    :container
-  ;    (if (not (or (string? fun) (map? fun)))
-  ;      :step
-  ;      :unknown))))

 (defn- is-step? [step]
   (= :step (display-type step)))


Use proper partition parameter on creating schema related tables.

--- src/continuo/postgresql/schema.clj
+++ src/continuo/postgresql/schema.clj
@@ -55,7 +55,7 @@

 (defmethod -apply-schema :db/add
   [conn [op ident opts]]
-  (let [tablename (attrs/normalize-attrname ident "attrs")
+  (let [tablename (attrs/normalize-attrname ident "user")
         typename (-> (attrs/lookup-type (:type opts))
                      (attrs/-sql-typename))
         opts (assoc opts :ident ident)
@@ -65,7 +65,7 @@

 (defmethod -apply-schema :db/drop
   [conn [op ident]]
-  (let [tablename (attrs/normalize-attrname ident "attrs")
+  (let [tablename (attrs/normalize-attrname ident "user")
         sql (tmpl/render "bootstrap/postgresql/tmpl-schema-db-drop.mustache"
                          {:name tablename})]
     (sc/execute conn sql)))


Update name

Update name

--- src/infoq_podcast/server.clj
+++ src/infoq_podcast/server.clj
@@ -31,8 +31,7 @@
                  (rss/description (str "Facilitating the spread of knowledge "
                                        "and innovation in enterprise software "
                                        "development"))
-                 (rss/image (base-url "/styles/i/logo-big.jpg")
-                            "InfoQ Presentations" (base-url))
+                 (rss/image (base-url "/styles/i/logo-big.jpg") "InfoQ" (base-url))
                  (rss/language "en-US")
                  (rss/generator "InfoQ-Feed-Generator/1.0")]
         extensions [:atom :itunes :feedburner :simple-chapters :content :history]


CMR-5273: Add int test for granule search.

Add int test for granule search from umm-g to echo10 and iso19115.

--- system-int-test/test/cmr/system_int_test/search/granule_search_format_test.clj
+++ system-int-test/test/cmr/system_int_test/search/granule_search_format_test.clj
@@ -1,6 +1,7 @@
 (ns cmr.system-int-test.search.granule-search-format-test
   "Integration tests for searching granules in csv format"
   (:require [clojure.test :refer :all]
+            [clojure.string :as string]
             [cmr.system-int-test.utils.ingest-util :as ingest]
             [cmr.system-int-test.utils.search-util :as search]
             [cmr.system-int-test.utils.index-util :as index]
@@ -10,6 +11,7 @@
             [cmr.system-int-test.data2.atom-json :as dj]
             [cmr.system-int-test.data2.core :as d]
             [cmr.system-int-test.data2.kml :as dk]
+            [cmr.system-int-test.data2.umm-spec-collection :as data-umm-c]
             [cmr.system-int-test.utils.url-helper :as url]
             [cmr.system-int-test.system :as s]
             [cmr.spatial.polygon :as poly]
@@ -22,6 +24,7 @@
             [cmr.common.mime-types :as mt]
             [cmr.common.util :as util]
             [cmr.umm.umm-core :as umm]
+            [cmr.umm.umm-granule :as umm-g]
             [cmr.umm.umm-spatial :as umm-s]
             [cmr.system-int-test.utils.dev-system-util :as dev-sys-util]))

@@ -69,6 +72,49 @@
       ;; The retrieved echo10 granule should contain the same SizeMBDataGranule as the umm granule size.
       (is (= 22.2031965255737 umm-granule-size))
       (is (= true (.contains metadata (str "<SizeMBDataGranule>" umm-granule-size "</SizeMBDataGranule>")))))))
+
+(deftest search-umm-g-granule-test
+  (let [collection (d/ingest-umm-spec-collection
+                    "PROV1"
+                    (data-umm-c/collection {:EntryTitle "UMM-G-Test"
+                                            :ShortName "U-G-T"
+                                            :Version "V1"}))
+        granule (dg/granule-with-umm-spec-collection
+                 collection
+                 (:concept-id collection)
+                 {:granule-ur "g1"
+                  :collection-ref (umm-g/map->CollectionRef {:entry-title "UMM-G-Test"})})
+        echo10-gran (d/item->concept granule :echo10)
+        iso19115-gran (d/item->concept granule :iso19115)
+        umm-g-gran (d/item->concept granule :umm-json)
+        umm-g-gran-concept-id (:concept-id (ingest/ingest-concept umm-g-gran))]
+    (index/wait-until-indexed)
+    (testing "Search UMM-G various formats"
+      (util/are3 [format-key granule-concept-id expected-granule accept url-extension]
+        (let [response (search/find-concepts-in-format
+                        format-key
+                        :granule
+                        {:concept-id granule-concept-id}
+                        {:accept accept
+                         :url-extension url-extension})
+              response-format (mt/mime-type->format (get-in response [:headers :Content-Type]))]
+          (is (= 200 (:status response)))
+          (is (= format-key response-format))
+          (if (= :iso19115 format-key) ; iso19115 item->concept doesn't exist, just do a ISO granule element test for now
+            (is (re-matches #"(?s).*<gmi:MI_Metadata.*" (:body response)))
+            (is (string/includes? (:body response) (:metadata expected-granule)))))
+
+        "Search echo10 via accept"
+        :echo10 umm-g-gran-concept-id echo10-gran "application/echo10+xml" nil
+
+        "Search echo10 via extension"
+        :echo10 umm-g-gran-concept-id echo10-gran nil "echo10"
+
+        "Search iso19115 via accept"
+        :iso19115 umm-g-gran-concept-id iso19115-gran "application/iso19115+xml" nil
+
+        "Search iso19115 via extension"
+        :iso19115 umm-g-gran-concept-id iso19115-gran nil "iso19115"))))

 (deftest search-granules-in-xml-metadata
   (let [c1-echo (d/ingest "PROV1" (dc/collection) {:format :echo10})


[#148] Fix refer-clojure, use the original code for simple-benchmark and add regex? predicate function

--- priv/benchmark/benchmark_runner.clj
+++ priv/benchmark/benchmark_runner.clj
@@ -1,4 +1,5 @@
-(ns benckmark.benckmark-runner)
+(ns benckmark.benckmark-runner
+  (:refer-clojure :exclude [println]))

 (def n 10000)
 ;;(def println print)