The catnip plant contains an oil called hepetalactone which does for cats what marijuana does to some people. Not all cats react to it those that do appear to enter a trancelike state. A positive reaction takes the form of the cat sniffing the catnip, then licking, biting, chewing it, rub & rolling on it repeatedly, purring, meowing & even leaping in the air.

--- src/clj/quiz_site/server.clj
+++ src/clj/quiz_site/server.clj
@@ -1,5 +1,6 @@
 (ns quiz-site.server
   (:require [clojure.java.io :as io]
+            [clojure.string :as string]
             [compojure.core :refer [context ANY GET PUT POST DELETE defroutes]]
             [compojure.route :refer [resources]]
             [ring.middleware.defaults :refer [wrap-defaults api-defaults]]
@@ -17,6 +18,9 @@
     {:status 200
      :headers {"Content-Type" "text/html; charset=utf-8"}
      :body (io/input-stream (io/resource "public/index.html"))})
+  (GET "/quiz/:quiz-id" [quiz-id] {:status 200
+                                   :headers {"Content-Type" "text/html; charset=utf-8"}
+                                   :body (string/replace (slurp (io/resource "public/takequiz.html")) ":quiz-id:" quiz-id)})
   (context "/api" []
            (-> (defroutes document-routes
                  quiz-site.routes.quiz/quiz-routes)


Added To: header to emails

Added To: header to emails

--- src/clj/salava/mail/mail.clj
+++ src/clj/salava/mail/mail.clj
@@ -8,34 +8,32 @@
             [slingshot.slingshot :refer :all]
             [salava.core.i18n :refer [t]]))

+(defn- send-mail-to [mail-host-config msg to]
+  (try+
+    (log/info "sending to" to)
+    (if (nil? mail-host-config)
+      (send-message (assoc msg :to to))
+      (send-message mail-host-config (assoc msg :to to)))
+    (catch Object ex
+      (log/error ex))))
+
 (defn send-mail [ctx subject message recipients]
-  (try+
-    (let [mail-host-config (get-in ctx [:config :core :mail-host-config])
-          data {:from    (get-in ctx [:config :core :mail-sender])
-                :bcc      recipients
-                :subject subject
-                :body    [{:type    "text/plain; charset=utf-8"
-                           :content message}]}]
-      (if (nil? mail-host-config)
-        (send-message data)
-        (send-message mail-host-config data)))
-    (catch Object ex
-      ex)))
+  (let [mail-host-config (get-in ctx [:config :core :mail-host-config])
+        data {:from    (get-in ctx [:config :core :mail-sender])
+              :subject subject
+              :body    [{:type    "text/plain; charset=utf-8"
+                         :content message}]}]
+    (doseq [to recipients]
+      (-> (send-mail-to mail-host-config data to) log/info))))

 (defn send-html-mail [ctx subject message recipients]
-  (try+
-    (let [mail-host-config (get-in ctx [:config :core :mail-host-config])
-          data {:from    (get-in ctx [:config :core :mail-sender])
-                :bcc      recipients
-                :subject subject
-                :body    [{:type "text/html; charset=utf-8"
-                           :content message}]}]
-      (if (nil? mail-host-config)
-        (send-message data)
-        (send-message mail-host-config data)))
-    (catch Object _
-      ;TODO log an error
-      )))
+  (let [mail-host-config (get-in ctx [:config :core :mail-host-config])
+        data {:from    (get-in ctx [:config :core :mail-sender])
+              :subject subject
+              :body    [{:type "text/html; charset=utf-8"
+                         :content message}]}]
+    (doseq [to recipients]
+      (-> (send-mail-to mail-host-config data to) log/info))))

 (defn send-activation-message [ctx site-url activation-link login-link fullname email-address lng]
   (let [site-name (get-in ctx [:config :core :site-name])
@@ -46,8 +44,7 @@
                      "\n\n" (t :core/Emailactivation5 lng) "\n" (t :core/Emailactivation6 lng) ".\n\n" (t :core/Emailactivation7 lng) "\n"
                      login-link
                      " " (t :core/Emailactivation8 lng) ".\n\n--  "site-name " -"(t :core/Team lng))]
-    (log/info "sending to" email-address)
-    (-> (send-mail ctx subject message [email-address]) log/info)))
+    (send-mail ctx subject message [email-address])))

 (defn send-password-reset-message [ctx site-url activation-link fullname email-address lng]
   (let [site-name (get-in ctx [:config :core :site-name])
@@ -56,9 +53,8 @@
                      ".\n\n" (t :core/Emailactivation4 lng)":\n\n"
                      activation-link
                      "\n\n" (t :core/Emailactivation5 lng) "\n" (t :core/Emailactivation6 lng) ".\n\n" (t :core/Emailresetmessage2 lng) ".\n\n--  "
-                      site-name " -"(t :core/Team lng))]
-    (log/info "sending to" email-address)
-    (-> (send-mail ctx subject message [email-address]) log/info)))
+                     site-name " -"(t :core/Team lng))]
+    (send-mail ctx subject message [email-address])))

 (defn send-verification [ctx site-url email-verification-link fullname email lng]
   (let [site-name (get-in ctx [:config :core :site-name])
@@ -66,8 +62,7 @@
         message (str fullname "\n\n" (t :core/Emailverification2 lng) " '" email "' " (t :core/Emailverification3 lng) " " site-url".\n" (t :core/Emailverification4 lng) ":\n\n"
                      email-verification-link
                      "\n\n" (t :core/Emailverification6 lng)".\n")]
-    (log/info "sending to" email)
-    (-> (send-mail ctx subject message [email]) log/info)))
+    (send-mail ctx subject message [email])))


Update my data pdf export

Update my data pdf export

--- src/clj/salava/user/data.clj
+++ src/clj/salava/user/data.clj
@@ -70,7 +70,7 @@
          events (map #(-> %
                           (assoc :info (events-helper ctx % user-id false))) (so/get-all-user-events ctx user-id))
          connections (so/get-connections-badge ctx current-user-id)
-         endorsements (-> (all-user-endorsements ctx user-id true) :all-endorsements)
+         endorsements (-> (all-user-endorsements ctx user-id true))
          pending-badges (b/user-badges-pending ctx user-id)
          user-followers-fn (first (util/plugin-fun (util/get-plugins ctx) "db" "get-user-followers-connections"))
          user-followers (if-not (nil? user-followers-fn) (user-followers-fn ctx user-id) nil)
@@ -162,7 +162,8 @@
                     :link {:family :times-roman
                            :color [66 100 162]}
                     :chunk {:size 11
-                            :style :bold}}
+                            :style :bold}
+                    :small-heading {:size 13 :style :bold}}
         pdf-settings  (if (empty? font-path) {:stylesheet stylesheet  :bottom-margin 0 :footer {:page-numbers false :align :right}} {:font font :stylesheet stylesheet  :bottom-margin 0 :footer {:page-numbers false :align :right}})
         user-info-template (pdf/template
                              (let [template (cons [:paragraph]
@@ -465,25 +466,46 @@
                                                   [:chunk.chunk (str (t :page/Description ul) ": ")][:chunk (str (:description c))]"\n"
                                                   [:chunk.chunk (str (t :badge/Imagefile ul) ": ")][:anchor {:target (str site-url "/" (:image_file c))} [:chunk.link (str site-url "/" (:image_file c))]]"\n"]))])])

-        user-endorsements-template (pdf/template
-                                     [:paragraph.generic
-                                      (when-not (empty? $endorsements)
-                                        [:paragraph
-                                         [:heading.heading-name (str (t :badge/Myendorsements ul) ": ")]
-                                         [:spacer 0]
-                                         (into [:paragraph]
-                                               (for [c $endorsements
-                                                     :let [name (str (:first_name c) " " (:last_name c))]]
-                                                 [:paragraph
-                                                  [:chunk name]"\n"
-                                                  [:chunk (:name c)]"\n"
-                                                  [:chunk (date-from-unix-time (long (* 1000 (:mtime c))) "date")]"\n"
-                                                  (process-markdown (:content c) (:user_badge_id c) "User Endorsements")]))])])
-                                                  ;[:chunk.chunk (str (t :badge/BadgeID ul) ": ")] [:chunk (str (:id c))]"\n"
-                                                  ;[:chunk.chunk (str (t :badge/Name ul) ": ")][:chunk (str (:name c))]"\n"
-                                                  ;[:chunk.chunk (str (t :page/Description ul) ": ")][:chunk (str (:description c))]"\n"
-                                                  ;[:chunk.chunk (str (t :badge/Imagefile ul) ": ")][:anchor {:target (str site-url "/" (:image_file c))} [:chunk.link (str site-url "/" (:image_file c))]]"\n"
-
+         user-endorsements-template  (pdf/template
+                                      [:paragraph.generic
+                                       (when-not (empty? $endorsements)
+                                        (let [{:keys [given received sent-requests]} $endorsements]
+                                          [:paragraph
+                                           [:heading.heading-name (str (t :badge/Myendorsements ul) ": ")]
+                                           [:spacer 0]
+                                           (when (seq given)
+                                             [:paragraph
+                                              [:chunk..small-heading (t :badge/Iendorsed ul)]
+                                              [:spacer 1]
+                                              (into [:paragraph] (for [g given
+                                                                       :let [name (str (:first_name g) " " (:last_name g))]]
+                                                                    [:paragraph
+                                                                     [:chunk name]"\n"
+                                                                     [:chunk.chunk (:name g)]"\n"
+                                                                     [:chunk (date-from-unix-time (long (* 1000 (:mtime g))) "date")]"\n"
+                                                                     (process-markdown (:content g) (:user_badge_id g) "User Endorsements")]))])
+                                           (when (seq received)
+                                             [:paragraph
+                                              [:chunk.small-heading (t :badge/Endorsedme ul)]
+                                              [:spacer 1]
+                                              (into [:paragraph] (for [r received
+                                                                       :let [name (str (:first_name r) " " (:last_name r))]]
+                                                                    [:paragraph
+                                                                     [:chunk (:issuer_name r)]"\n"
+                                                                     [:chunk.chunk (:name r)]"\n"
+                                                                     [:chunk (date-from-unix-time (long (* 1000 (:mtime r))) "date")]"\n"
+                                                                     (process-markdown (:content r) (:user_badge_id r) "User Endorsements")]))])
+                                           (when (seq sent-requests)
+                                             [:paragraph
+                                              [:chunk.small-heading (t :badge/Sentendorsementrequests ul)]
+                                              [:spacer 1]
+                                              (into [:paragraph] (for [sr sent-requests
+                                                                       :let [name (str (:first_name sr) " " (:last_name sr))]]
+                                                                    [:paragraph
+                                                                     [:chunk (:issuer_name sr)]"\n"
+                                                                     [:chunk.chunk (:name sr)]"\n"
+                                                                     [:chunk (date-from-unix-time (long (* 1000 (:mtime sr))) "date")]"\n"
+                                                                     (process-markdown (:content sr) (:user_badge_id sr) "User Endorsements")]))])]))])

         events-template (pdf/template
                           (let [template (cons [:paragraph]


fix api token handler

fix api token handler

--- src/clj/swarmpit/handler.clj
+++ src/clj/swarmpit/handler.clj
@@ -81,8 +81,9 @@
 ;; Password handler

 (defn password
-  [{{:keys [body identity]} :parameters}]
-  (let [username (get-in identity [:usr :username])]
+  [{{:keys [body]} :parameters
+    {:keys [usr]}  :identity}]
+  (let [username (:username usr)]
     (if (api/user-by-credentials (merge body {:username username}))
       (do (-> (api/user-by-username username)
               (api/change-password (:new-password body)))
@@ -92,15 +93,15 @@
 ;; User api token handler

 (defn api-token-generate
-  [{{:keys [identity]} :parameters}]
-  (->> identity :usr :username
+  [{{:keys [usr]} :identity}]
+  (->> (:username usr)
        (api/user-by-username)
        (api/generate-api-token)
        (resp-ok)))

 (defn api-token-remove
-  [{{:keys [identity]} :parameters}]
-  (->> identity :usr :username
+  [{{:keys [usr]} :identity}]
+  (->> (:username usr)
        (api/user-by-username)
        (api/remove-api-token))
   (resp-ok))


remove unused namespace

remove unused namespace

--- src/cljs/clj_money/util.cljs
+++ src/cljs/clj_money/util.cljs
@@ -1,6 +1,5 @@
 (ns clj-money.util
-  (:require [goog.string :as gstring]
-            [clojure.string :as string]
+  (:require [clojure.string :as string]
             [cljs-time.format :as f]))

 (defn parse-date [str-date]


updated POST function to support json content

--- src/cljs/netrunner/ajax.cljs
+++ src/cljs/netrunner/ajax.cljs
@@ -1,7 +1,8 @@
 (ns netrunner.ajax
   (:require-macros [cljs.core.async.macros :refer [go]])
   (:require [cljs.core.async :refer [chan put!] :as async]
-            [goog.net.XhrIo :as xhr]))
+            [goog.net.XhrIo :as xhr]
+            [goog.json :as json]))

 (defn parse [event]
   (let [xhr (.-target event)
@@ -14,7 +15,14 @@
     (xhr/send url #(put! ch (parse %)))
     ch))

-(defn POST [url params]
-  (let [ch (chan)]
-    (xhr/send url #(put! ch (parse %)) "POST" params)
-    ch))
+(defn POST
+  ([url params]
+     (let [ch (chan)]
+       (xhr/send url #(put! ch (parse %)) "POST" params)
+       ch))
+  ([url params format]
+     (let [ch (chan)
+           headers (when (= format :json) #js {"Content-Type" "application/json"})
+           content (if (= format :json) (json/serialize (clj->js params)) params)]
+       (xhr/send url #(put! ch (parse %)) "POST" content headers)
+       ch)))


extract the construction of the board

extract the construction of the board

--- src/cljs/tictactoe/core.cljs
+++ src/cljs/tictactoe/core.cljs
@@ -70,26 +70,29 @@
 ;; Rendering

 (defn render-board-cell
-  [app-state x y]
-  (let [cell-state (get (:board app-state) [x y])]
+  [board x y]
+  (let [cell-state (get board [x y])]
     (cell/render-cell cell-state x y
       (if (= :cell/empty cell-state)
         {:on-click #(on-move-event x y)} {}))
     ))

+(defn render-board
+  [board]
+  (into
+    [:svg.board
+     {:view-box (str "0 0 " board-size " " board-size)
+      :style {:max-height "500px"}}]
+    (for [x (range board-size)
+          y (range board-size)]
+      [render-board-cell board x y]
+      )))
+
 (defn tictactoe
   []
   [:div
-   (panel/render-top-panel
-     {:on-restart on-restart-event :on-undo on-undo-event})
-   (into
-     [:svg.board
-      {:view-box (str "0 0 " board-size " " board-size)
-       :style {:max-height "500px"}}]
-     (for [x (range board-size)
-           y (range board-size)]
-       [render-board-cell @current-state x y]
-       ))
+   (panel/render-top-panel {:on-restart on-restart-event :on-undo on-undo-event})
+   (render-board (:board @current-state))
    ])


queue: bikeshedding.

queue: bikeshedding.

--- src/io/cyanite/engine/queue.clj
+++ src/io/cyanite/engine/queue.clj
@@ -31,7 +31,7 @@

 (defprotocol WrapperEvent
   (get-data [_])
-  (set-data [this v]))
+  (set-data! [this v]))

 ;; For sakes of prototyping, we are using the mutable
 ;; wrapper. This is not very idiomatic to ring buffer,
@@ -41,7 +41,7 @@
 (deftype Event [^{:volatile-mutable true} x]
   WrapperEvent
   (get-data [_] x)
-  (set-data [this v] (set! x v)))
+  (set-data! [this v] (set! x v)))

 (defn wrapper-event-factory
   []
@@ -83,7 +83,7 @@
   (let [capacity (or (:queue-capacity defaults) default-capacity)
         pool     (threadpool (or (:pool-size defaults) default-poolsize))]
     (DisruptorQueue. (disruptor (wrapper-event-factory) capacity pool)
-                     (make-translator (fn [e v] (set-data e v))))))
+                     (make-translator (fn [e v] (set-data! e v))))))

 (defrecord BlockingMemoryQueue [ingestq writeq defaults]
   component/Lifecycle


Organize anon sync handlers a little bit

--- src/braid/core/server/sync_handler.clj
+++ src/braid/core/server/sync_handler.clj
@@ -41,12 +41,15 @@
       (if-let [dynamic-msg-handler (get @message-handlers id)]
         (run-cofx! ev-msg (dynamic-msg-handler (assoc ev-msg :user-id user-id)))
         (event-msg-handler (assoc ev-msg :user-id user-id)))
-      ;; XXX: hook in anon here
       (anon-msg-handler ev-msg))))

+;; anonymous event handlers
+
 (defmethod anon-msg-handler :default
-  [ev-msg]
-  #_(debugf "anon msg %s" (:id ev-msg)))
+  [{:as ev-msg :keys [?reply-fn event]}]
+  (debugf "Unhandled anon event %s" (:id ev-msg))
+  (when ?reply-fn
+    (?reply-fn {:umatched-event-as-echoed-from-from-server event})))

 (defmethod anon-msg-handler :braid.server.anon/load-group
   [{:as ev-msg :keys [event id ?data ring-req ?reply-fn send-fn]}]
@@ -61,6 +64,13 @@
   [ev-msg]
   (debugf "Closing connection for anonymous client %s" (:client-id ev-msg))
   (helpers/remove-anonymous-reader (get-in ev-msg [:ring-req :session :fake-id])))
+
+(defmethod anon-msg-handler :braid.client/ping
+  [{:as ev-msg :keys [?reply-fn]}]
+  (when-let [reply ?reply-fn]
+    (reply [:braid.server/pong])))
+
+;; logged in event handlers

 (defmethod event-msg-handler :default
   [{:as ev-msg :keys [event id ?data ring-req ?reply-fn send-fn user-id]}]


Переработка web запроса по выборке документов на POST json

--- src/ixinfestor/core_handler.clj
+++ src/ixinfestor/core_handler.clj
@@ -252,16 +252,17 @@

   (context context-path []

-           (GET "/bytag/:id/:page/:page-size" [id page page-size]
-                (-> webdoc-select* ;;; SRC
-                    (ix/webdoc-pred-search-for-the-child-tree-tags*
-                     {:id (if (= id "root") nil (Long/parseLong id))})
-                    (ix/com-pred-page* (dec (Long/parseLong page)) (Long/parseLong page-size))
-                    (korma.core/order :id :desc)
-                    ix/com-exec
-                    korma.db/transaction
-                    ring.util.response/response
-                    cw/error-response-json))
+           (POST "/bytag" {{:keys [tag-id page page-size]} :params}
+                 (do
+                   (-> webdoc-select* ;;; SRC
+                       (ix/webdoc-pred-search-for-the-child-tree-tags*
+                        {:id (if (= tag-id "root") nil tag-id)})
+                       (ix/com-pred-page* (dec page) page-size)
+                       (korma.core/order :id :desc)
+                       ix/com-exec
+                       korma.db/transaction
+                       ring.util.response/response
+                       cw/error-response-json)))

            (GET "/edit/new" [] (ring.util.response/response {}))
            (GET "/edit/:id" [id]


scheduler: Don't preempt for jobs that have running/unknown tasks.

--- scheduler/src/cook/mesos/rebalancer.clj
+++ scheduler/src/cook/mesos/rebalancer.clj
@@ -298,15 +298,23 @@
     [(next-state state pending-job preemption-decision) preemption-decision]
     [state nil]))

+(defn taskless?
+  "Returns true iff the job has no instances with status running or unknown."
+  [job]
+  (not-any? #(contains? #{:instance.status/running :instance.status/unknown}
+                        (:instance/status %))
+            (:job/instance job)))
+
 (defn rebalance
   "Takes a db, a list of pending job entities, a map of spare resources and params.
    Returns a list of pending job entities to run and a list of task entities to preempt"
   [db pending-job-ents host->spare-resources {:keys [max-preemption] :as params}]
   (let [timer (timers/start rebalance-duration)
-        init-state (init-state db (util/get-running-task-ents db) pending-job-ents host->spare-resources)]
+        jobs-to-make-room-for (filter taskless? pending-job-ents)
+        init-state (init-state db  (util/get-running-task-ents db) jobs-to-make-room-for host->spare-resources)]
     (loop [state init-state
            remaining-preemption max-preemption
-           [pending-job-ent & pending-job-ents] pending-job-ents
+           [pending-job-ent & jobs-to-make-room-for] jobs-to-make-room-for
            pending-job-ents-to-run []
            task-ents-to-preempt []]
       (if (and pending-job-ent (pos? remaining-preemption))
@@ -314,12 +322,12 @@
           (if preemption-decision
             (recur state'
                    (dec remaining-preemption)
-                   pending-job-ents
+                   jobs-to-make-room-for
                    (conj pending-job-ents-to-run pending-job-ent)
                    (into task-ents-to-preempt (:task preemption-decision)))
             (recur state'
                    remaining-preemption
-                   pending-job-ents
+                   jobs-to-make-room-for
                    pending-job-ents-to-run
                    task-ents-to-preempt)))


Version 0.6.6-SNAPSHOT

Version 0.6.6-SNAPSHOT

--- metlog-vault/project.clj
+++ metlog-vault/project.clj
@@ -1,4 +1,4 @@
-(defproject metlog-vault "0.6.5"
+(defproject metlog-vault "0.6.6-SNAPSHOT"
   :description "Repository for storing and displaying time series data reported by metlog-agent.."

   :license {:name "Eclipse Public License"


indentation fix

indentation fix

--- test/cats/core_spec.cljc
+++ test/cats/core_spec.cljc
@@ -116,15 +116,15 @@
       (t/is (= (maybe/just 6)
                ((curry-monad+ (maybe/just 1)) (maybe/just 5))))))

-    (t/testing "It can lift a function to a Monad Transformer"
-      (let [maybe-sequence-monad (maybe/maybe-transformer b/sequence-monad)
-            monad+ (m/lift-m 2 add2)]
-        (t/is (= [(maybe/just 1) (maybe/just 2)
-                  (maybe/just 3) (maybe/just 4)
-                  (maybe/just 5) (maybe/just 6)]
-                 (m/with-monad maybe-sequence-monad
-                   (monad+ [(maybe/just 0) (maybe/just 2) (maybe/just 4)]
-                           [(maybe/just 1) (maybe/just 2)])))))))
+  (t/testing "It can lift a function to a Monad Transformer"
+    (let [maybe-sequence-monad (maybe/maybe-transformer b/sequence-monad)
+          monad+ (m/lift-m 2 add2)]
+      (t/is (= [(maybe/just 1) (maybe/just 2)
+                (maybe/just 3) (maybe/just 4)
+                (maybe/just 5) (maybe/just 6)]
+               (m/with-monad maybe-sequence-monad
+                 (monad+ [(maybe/just 0) (maybe/just 2) (maybe/just 4)]
+                         [(maybe/just 1) (maybe/just 2)])))))))

 (t/deftest filter-tests
   (t/testing "It can filter Maybe monadic values"


Enable handling of non-default tagged literals

- Fixes https://github.com/LightTable/Clojure/issues/64 and https://github.com/LightTable/LightTable/issues/244

--- lein-light-nrepl/src/lighttable/nrepl/eval.clj
+++ lein-light-nrepl/src/lighttable/nrepl/eval.clj
@@ -18,7 +18,8 @@
 (defn- try-read [rdr feature]
   {:pre [(#{:clj :cljs} feature)]}
   (when rdr
-    (reader/read {:read-cond :allow :features #{feature} :eof ::EOF} rdr)))
+    (binding [reader/*data-readers* *data-readers*]
+      (reader/read {:read-cond :allow :features #{feature} :eof ::EOF} rdr))))

 (defn lined-read
   ([string] (lined-read string :clj))


CEO-366 Add Google Analytics.

CEO-366 Add Google Analytics.

--- src/clj/collect_earth_online/views.clj
+++ src/clj/collect_earth_online/views.clj
@@ -20,6 +20,8 @@
    [:meta {:name "keywords"    :content "collect earth online image analysis crowdsourcing platform openforis SIG spatial informatics group"}]
    [:meta {:name "viewport"    :content "width=device-width, user-scalable=no"}] ; prevent touch zoom on mobile
    [:link {:rel "shortcut icon" :href "favicon.ico"}]
+   [:script {:async true :src "https://www.googletagmanager.com/gtag/js?id=G-NT7YQRX0H8"}]
+   [:script "window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-NT7YQRX0H8');"]
    (include-css "/css/bootstrap.min.css")
    (apply include-js
           "/js/jquery-3.5.1.slim.min.js"


move atoms to namespace level

move atoms to namespace level

--- src/cljs/clj_money/views/accounts.cljs
+++ src/cljs/clj_money/views/accounts.cljs
@@ -31,6 +31,8 @@
 (def ^:private *accounts* (r/atom []))
 (def ^:private *commodities* (r/atom []))
 (def ^:private working-transaction (r/atom nil))
+(def ^:private account (r/atom nil))
+(def ^:private transaction-items (r/atom nil))

 (defn- delete
   [account]
@@ -244,8 +246,7 @@
                        :title "Click here to return to the list of accounts."
                        :icon :ban-circle})]])))

-(defn- account-header
-  [account]
+(defn- account-header []
   [:section
    [:div.pull-right
     (util/button "New"
@@ -275,8 +276,7 @@
    [:td.text-right (currency-format (:polarized-value item))]
    [:td.text-right (currency-format (:balance item))]])

-(defn- items-table
-  [items]
+(defn- items-table []
   [:table.table.table-striped.table-hover
    [:thead
     [:tr
@@ -285,8 +285,8 @@
      [:th.col-sm-2.text-right "Amount"]
      [:th.col-sm-2.text-right "Balance"]]]
    [:tbody
-    (if @items
-      (map item-row @items)
+    (if-let [items @transaction-items]
+      (map item-row items)
       [:tr [:td {:colSpan 4} [:span.inline-status "Loading..."]]])]])

 (defn- query-again?
@@ -295,27 +295,27 @@
        (not= 0 (-> items last :index))))

 (defn- next-query-range
-  [[prev-start] {:keys [latest-transaction-date]}]
-  (let [start (if prev-start
+  [[prev-start]]
+  (let [latest (:latest-transaction-date account)
+        start (if prev-start
                 (t/minus prev-start (t/months 3))
-                (t/first-day-of-the-month (or latest-transaction-date
+                (t/first-day-of-the-month (or latest
                                               (t/today))))]
     [start (-> start (t/plus (t/months 2)) t/last-day-of-the-month)]))

 (defn- get-items
-  ([account items]
-   (get-items account items nil))
-  ([account items prev-date-range]
-   (let [[start end :as date-range] (next-query-range prev-date-range account)]
+  ([] (get-items nil))
+  ([prev-date-range]
+   (let [[start end :as date-range] (next-query-range prev-date-range)]
      (transaction-items/search
-       {:account-id (:id account)
+       {:account-id (:id @account)
         :transaction-date [:between start end]}
        (fn [result]
-         (swap! items
+         (swap! transaction-items
                 (fnil concat [])
-                (map #(polarize-item % account) result))
-         (when (query-again? @items)
-           (get-items account items date-range)))
+                (map #(polarize-item % @account) result))
+         (when (query-again? @transaction-items)
+           (get-items date-range)))
        notify/danger))))

 (def ^:private trx-form
@@ -349,10 +349,7 @@
            account-id
            other-account-id]
     :as quick-entry-trx}]
-  (let [account (->> @*accounts*
-                     (filter #(= (:id %) account-id))
-                     first)
-        rename-map (if (or (and (> quantity 0M)
+  (let [rename-map (if (or (and (> quantity 0M)
                                 (left-side? account))
                            (and (< quantity 0M)
                                 (not (left-side? account))))
@@ -368,7 +365,9 @@

 (defn- handle-saved-transaction
   [transaction]
-  (.log js/console "created transaction " (prn-str transaction)))
+  (reset! working-transaction nil)
+  (reset! transaction-items nil)
+  (get-items))

 (defn- save-transaction []
   (-> @working-transaction
@@ -396,28 +395,25 @@
   (accounts/get-all (:id @state/current-entity)
                     #(reset! *accounts* (-> % nest unnest))
                     notify/danger)
-  (let [account (r/atom {})
-        transaction-items (r/atom nil)]
-    (accounts/get-one id
-                      (fn [a]
-                        (reset! account a)
-                        (get-items a transaction-items))
-                      notify/danger)
-
-    (with-layout
-      [:section
-       [:div.row
-        [:div.col-md-12
-         [account-header account]]]
-       [:div.row
-        [:div.col-md-6
-         [transaction-form]]
-        [:div.col-md-6
-         [:div.panel.panel-default
-          [:div.panel-heading
-           [:h2.panel-title "Transaction Items"]]
-          [:div.panel-body {:style {:height "40em" :overflow "auto"}}
-           [items-table transaction-items]]]]]])))
+  (accounts/get-one id
+                    (fn [a]
+                      (reset! account a)
+                      (get-items))
+                    notify/danger)
+  (with-layout
+    [:section
+     [:div.row
+      [:div.col-md-12
+       [account-header]]]
+     [:div.row
+      [:div.col-md-6
+       [transaction-form]]
+      [:div.col-md-6
+       [:div.panel.panel-default
+        [:div.panel-heading
+         [:h2.panel-title "Transaction Items"]]
+        [:div.panel-body {:style {:height "40em" :overflow "auto"}}
+         [items-table transaction-items]]]]]]))

 (secretary/defroute new-account-path "/accounts/new" []
   (r/render [new-account] (app-element)))


features for my game

features for my game

--- example/src/clj_discord_example/core.clj
+++ example/src/clj_discord_example/core.clj
@@ -43,7 +43,9 @@
                        " "
                        (rand-nth ["short-hair" "long-hair"])
                        " "
-                        (rand-nth ["not-talkative" "of-average-talkativeness" "long-winded"])
+                       (rand-nth ["not-talkative" "of-average-talkativeness" "long-winded"])
+"\n"
+"STR:" (r3d6) " DEX:" (r3d6) " CON:" (r3d6) " INT:" (r3d6) " WIS:" (r3d6) " CHA:" (r3d6) " hot:" (r3d6) " cul:" (r3d6) " grb:" (r3d6) " rch:" (r3d6)
 )))

 (defn log-event [type data]


Fixed issue #33 by changing call to repl/repl* to repl/repl instead.

--- src/leiningen/new/mies/repl.clj
+++ src/leiningen/new/mies/repl.clj
@@ -2,4 +2,4 @@
   '[cljs.repl :as repl]
   '[cljs.repl.node :as node])

-(repl/repl* (node/repl-env))
+(repl/repl (node/repl-env))


update example

update example

--- examples/pedestal/src/example/server.clj
+++ examples/pedestal/src/example/server.clj
@@ -6,43 +6,42 @@
             [reitit.ring :as ring]))

 (defn interceptor [x]
-  {:enter (fn [ctx] (println ">>" x) ctx)
-   :leave (fn [ctx] (println "<<" x) ctx)})
+  {:enter (fn [ctx] (update-in ctx [:request :via] (fnil conj []) {:enter x}))
+   :leave (fn [ctx] (update-in ctx [:response :body] conj {:leave x}))})

-(defn handler [_]
-  (println "handler")
+(defn handler [{:keys [via]}]
   {:status 200,
-   :body "pong"})
+   :body (conj via :handler)})

 (def async-handler
   {:enter (fn [{:keys [request] :as ctx}]
-            (a/go
-              (assoc ctx :response (handler request))))})
+            (a/go (assoc ctx :response (handler request))))})

 (def routing-interceptor
   (pedestal/routing-interceptor
     (http/router
       ["/api"
-       {:interceptors [[interceptor :api]
-                       [interceptor :ipa]]}
+       {:interceptors [(interceptor :api)
+                       (interceptor :ipa)]}

        ["/sync"
-        {:interceptors [[interceptor :sync]]
-         :get {:interceptors [[interceptor :get]]
+        {:interceptors [(interceptor :sync)]
+         :get {:interceptors [(interceptor :get)]
                :handler handler}}]

        ["/async"
-        {:interceptors [[interceptor :async]]
-         :get {:interceptors [[interceptor :get] async-handler]}}]]
+        {:interceptors [(interceptor :async)]
+         :get {:interceptors [(interceptor :get) async-handler]}}]]

       ;; optional interceptors for all matched routes
-      {:data {:interceptors [[interceptor :router]]}})
+      {:data {:interceptors [(interceptor :router)]}})

     ;; optional default ring handler (if no routes have matched)
     (ring/create-default-handler)

     ;; optional top-level routes for both routes & default route
-    {:interceptors [[interceptor :top]]}))
+    {:interceptors [(muuntaja.interceptor/format-interceptor)
+                    (interceptor :top)]}))

 (defonce server (atom nil))


Operator extractor

Operator extractor

--- src/atom_finder/util/classifier_util.clj
+++ src/atom_finder/util/classifier_util.clj
@@ -226,74 +226,86 @@

 (defn in-function? [node] (ancestral-instance? IASTFunctionDefinition node))

-(defmulti precedence-level "returns the precedence level of the node" class)
-(defmethod precedence-level :default [node]
-  (let [precedence-list
-        {CPPASTQualifiedName 1
-         IASTArraySubscriptExpression 2
-         IASTFieldReference 2
-         IASTCastExpression 2
-         IASTFunctionCallExpression 2
-         CPPASTNewExpression 3
-         CPPASTDeleteExpression 3
-         CPPASTConditionalExpression 15
-         CPPASTExpressionList 16}]
-    (precedence-list (type node))))
-(defmethod precedence-level IASTUnaryExpression [node]
-    (let [precedence-list
-        {IASTUnaryExpression/op_postFixDecr 2
-         IASTUnaryExpression/op_postFixIncr 2
-         IASTUnaryExpression/op_minus 3
-         IASTUnaryExpression/op_plus 3
-         IASTUnaryExpression/op_prefixDecr 3
-         IASTUnaryExpression/op_prefixIncr 3
-         IASTUnaryExpression/op_sizeof 3
-         IASTUnaryExpression/op_amper 3
-         IASTUnaryExpression/op_star 3
-         IASTUnaryExpression/op_not 3
-         IASTUnaryExpression/op_tilde 3
-         IASTUnaryExpression/op_throw 15}]
-    (precedence-list (.getOperator node))))
-(defmethod precedence-level IASTBinaryExpression [node]
-    (let [precedence-list
-        {IASTBinaryExpression/op_pmdot 4
-         IASTBinaryExpression/op_pmarrow 4
-         IASTBinaryExpression/op_modulo 5
-         IASTBinaryExpression/op_multiply 5
-         IASTBinaryExpression/op_divide 5
-         IASTBinaryExpression/op_plus 6
-         IASTBinaryExpression/op_minus 6
-         IASTBinaryExpression/op_shiftLeft 7
-         IASTBinaryExpression/op_shiftRight 7
-         IASTBinaryExpression/op_greaterThan 8
-         IASTBinaryExpression/op_greaterEqual 8
-         IASTBinaryExpression/op_lessThan 8
-         IASTBinaryExpression/op_lessEqual 8
-         IASTBinaryExpression/op_equals 9
-         IASTBinaryExpression/op_notequals 9
-         IASTBinaryExpression/op_binaryAnd 10
-         IASTBinaryExpression/op_binaryXor 11
-         IASTBinaryExpression/op_binaryOr 12
-         IASTBinaryExpression/op_logicalAnd 13
-         IASTBinaryExpression/op_logicalOr 14
-         IASTBinaryExpression/op_assign 15
-         IASTBinaryExpression/op_binaryAndAssign 15
-         IASTBinaryExpression/op_binaryOrAssign 15
-         IASTBinaryExpression/op_binaryXorAssign 15
-         IASTBinaryExpression/op_divideAssign 15
-         IASTBinaryExpression/op_minusAssign 15
-         IASTBinaryExpression/op_moduloAssign 15
-         IASTBinaryExpression/op_multiplyAssign 15
-         IASTBinaryExpression/op_plusAssign 15
-         IASTBinaryExpression/op_shiftLeftAssign 15
-         IASTBinaryExpression/op_shiftRightAssign 15}]
-    (precedence-list (.getOperator node))))
-
-(defn operator
-  "If this node is an operator, extract it"
-  [node]
-  (when (any-pred? #(instance? % node) [IASTUnaryExpression IASTBinaryExpression])
-    (.getOperator node)))
+(defmulti expr-operator "If the node is an operator expression, return information about its operator" class)
+
+(def ExprOperator {:precedence s/Int :syntax s/Str})
+
+(s/defmethod expr-operator :default :- ExprOperator [node :- IASTNode]
+  (-> node type
+      {CPPASTQualifiedName            {:enum nil :arity 2   :name :qualified-name  :precedence 1  :syntax "::"       }
+       IASTArraySubscriptExpression   {:enum nil :arity 2   :name :array-subscript :precedence 2  :syntax "[]"       }
+       IASTFieldReference             {:enum nil :arity 2   :name :field-reference :precedence 2  :syntax ". or ->"  }
+       IASTCastExpression             {:enum nil :arity 2   :name :cast            :precedence 2  :syntax "(<TYPE>)" }
+       IASTFunctionCallExpression     {:enum nil :arity 2   :name :function-call   :precedence 2  :syntax "F()"      }
+       CPPASTNewExpression            {:enum nil :arity 1   :name :new             :precedence 3  :syntax "new"      }
+       CPPASTDeleteExpression         {:enum nil :arity 1   :name :delete          :precedence 3  :syntax "delete"   }
+       CPPASTConditionalExpression    {:enum nil :arity 3   :name :conditional     :precedence 15 :syntax "?:"       }
+       CPPASTExpressionList           {:enum nil :arity nil :name :expression-list :precedence 16 :syntax ","        }}))
+
+(s/defmethod expr-operator IASTUnaryExpression :- ExprOperator [node]
+  (-> node .getOperator
+      {
+       IASTUnaryExpression/op_prefixIncr       {:enum 0  :arity 1 :name :prefixIncr   :precedence 3  :syntax "++x"    }
+       IASTUnaryExpression/op_prefixDecr       {:enum 1  :arity 1 :name :prefixDecr   :precedence 3  :syntax "--x"    }
+       IASTUnaryExpression/op_plus             {:enum 2  :arity 1 :name :plus         :precedence 3  :syntax "+x"     }
+       IASTUnaryExpression/op_minus            {:enum 3  :arity 1 :name :minus        :precedence 3  :syntax "-x"     }
+       IASTUnaryExpression/op_star             {:enum 4  :arity 1 :name :star         :precedence 3  :syntax "*x"     }
+       IASTUnaryExpression/op_amper            {:enum 5  :arity 1 :name :amper        :precedence 3  :syntax "&x"     }
+       IASTUnaryExpression/op_tilde            {:enum 6  :arity 1 :name :tilde        :precedence 3  :syntax "~x"     }
+       IASTUnaryExpression/op_not              {:enum 7  :arity 1 :name :not          :precedence 3  :syntax "!x"     }
+       IASTUnaryExpression/op_sizeof           {:enum 8  :arity 1 :name :sizeof       :precedence 3  :syntax "sizeof" }
+       IASTUnaryExpression/op_postFixIncr      {:enum 9  :arity 1 :name :postFixIncr  :precedence 2  :syntax "x++"    }
+       IASTUnaryExpression/op_postFixDecr      {:enum 10 :arity 1 :name :postFixDecr  :precedence 2  :syntax "x--"    }
+       IASTUnaryExpression/op_throw            {:enum 12 :arity 1 :name :throw        :precedence 15 :syntax "throw"  }}))
+       ;IASTUnaryExpression/op_bracketedPrimary 11
+       ;IASTUnaryExpression/op_typeid ; 13
+       ;IASTUnaryExpression/op_typeof ; 14 - deprecated
+       ;IASTUnaryExpression/op_sizeofParameterPack ; 16
+       ;IASTUnaryExpression/op_noexcept ; 17
+       ;IASTUnaryExpression/op_labelReference ; 18
+
+(s/defmethod expr-operator IASTBinaryExpression :- ExprOperator [node]
+  (-> node .getOperator
+      {
+       IASTBinaryExpression/op_multiply          {:enum 1  :arity 2 :name :multiply         :precedence 5  :syntax "*"    }
+       IASTBinaryExpression/op_divide            {:enum 2  :arity 2 :name :divide           :precedence 5  :syntax "/"    }
+       IASTBinaryExpression/op_modulo            {:enum 3  :arity 2 :name :modulo           :precedence 5  :syntax "%"    }
+       IASTBinaryExpression/op_plus              {:enum 4  :arity 2 :name :plus             :precedence 6  :syntax "+"    }
+       IASTBinaryExpression/op_minus             {:enum 5  :arity 2 :name :minus            :precedence 6  :syntax "-"    }
+       IASTBinaryExpression/op_shiftLeft         {:enum 6  :arity 2 :name :shiftLeft        :precedence 7  :syntax "<<"   }
+       IASTBinaryExpression/op_shiftRight        {:enum 7  :arity 2 :name :shiftRight       :precedence 7  :syntax ">>"   }
+       IASTBinaryExpression/op_lessThan          {:enum 8  :arity 2 :name :lessThan         :precedence 8  :syntax "<"    }
+       IASTBinaryExpression/op_greaterThan       {:enum 9  :arity 2 :name :greaterThan      :precedence 8  :syntax ">"    }
+       IASTBinaryExpression/op_lessEqual         {:enum 10 :arity 2 :name :lessEqual        :precedence 8  :syntax "<="   }
+       IASTBinaryExpression/op_greaterEqual      {:enum 11 :arity 2 :name :greaterEqual     :precedence 8  :syntax ">="   }
+       IASTBinaryExpression/op_binaryAnd         {:enum 12 :arity 2 :name :binaryAnd        :precedence 10 :syntax "&="   }
+       IASTBinaryExpression/op_binaryXor         {:enum 13 :arity 2 :name :binaryXor        :precedence 11 :syntax "^="   }
+       IASTBinaryExpression/op_binaryOr          {:enum 14 :arity 2 :name :binaryOr         :precedence 12 :syntax "|="   }
+       IASTBinaryExpression/op_logicalAnd        {:enum 15 :arity 2 :name :logicalAnd       :precedence 13 :syntax "&&"   }
+       IASTBinaryExpression/op_logicalOr         {:enum 16 :arity 2 :name :logicalOr        :precedence 14 :syntax "||"   }
+       IASTBinaryExpression/op_assign            {:enum 17 :arity 2 :name :assign           :precedence 15 :syntax "="    }
+       IASTBinaryExpression/op_multiplyAssign    {:enum 18 :arity 2 :name :multiplyAssign   :precedence 15 :syntax "*="   }
+       IASTBinaryExpression/op_divideAssign      {:enum 19 :arity 2 :name :divideAssign     :precedence 15 :syntax "/="   }
+       IASTBinaryExpression/op_moduloAssign      {:enum 20 :arity 2 :name :moduloAssign     :precedence 15 :syntax "%="   }
+       IASTBinaryExpression/op_plusAssign        {:enum 21 :arity 2 :name :plusAssign       :precedence 15 :syntax "+="   }
+       IASTBinaryExpression/op_minusAssign       {:enum 22 :arity 2 :name :minusAssign      :precedence 15 :syntax "-="   }
+       IASTBinaryExpression/op_shiftLeftAssign   {:enum 23 :arity 2 :name :shiftLeftAssign  :precedence 15 :syntax "<<="  }
+       IASTBinaryExpression/op_shiftRightAssign  {:enum 24 :arity 2 :name :shiftRightAssign :precedence 15 :syntax ">>="  }
+       IASTBinaryExpression/op_binaryAndAssign   {:enum 25 :arity 2 :name :binaryAndAssign  :precedence 15 :syntax "&="   }
+       IASTBinaryExpression/op_binaryXorAssign   {:enum 26 :arity 2 :name :binaryXorAssign  :precedence 15 :syntax "^="   }
+       IASTBinaryExpression/op_binaryOrAssign    {:enum 27 :arity 2 :name :binaryOrAssign   :precedence 15 :syntax "|="   }
+       IASTBinaryExpression/op_equals            {:enum 28 :arity 2 :name :equals           :precedence 9  :syntax "=="   }
+       IASTBinaryExpression/op_notequals         {:enum 29 :arity 2 :name :notequals        :precedence 9  :syntax "!="   }
+       IASTBinaryExpression/op_pmdot             {:enum 30 :arity 2 :name :pmdot            :precedence 4  :syntax "."    }
+       IASTBinaryExpression/op_pmarrow           {:enum 31 :arity 2 :name :pmarrow          :precedence 4  :syntax "->"   }
+       ; IASTBinaryExpression/op_max ; 32
+       ; IASTBinaryExpression/op_min ; 33
+       ; IASTBinaryExpression/op_ellipses ; 34
+       }))
+
+(s/defn precedence-level
+  [node :- IASTNode]
+  (some->> node expr-operator :precedence))

 (defn assignment?
   "Returns true if the operator is an assignment operator"


add gerund analysis : doesn't work yet

add gerund analysis : doesn't work yet

--- src/babel/italiano/morphology/verbs.cljc
+++ src/babel/italiano/morphology/verbs.cljc
@@ -3,6 +3,14 @@
    [dag_unify.core :refer [unify]]
    [babel.morphology :refer [expand-replace-patterns group-by-two]]))

+
+(def replace-patterns-gerund
+  (expand-replace-patterns
+   {:synsem {:infl :participle}}
+   [{:agr :top
+     :p ["#(.*)ando$" "$1are"
+         "#(.*)ando$" "$1arsi"]}]))
+
 (def replace-patterns-imperfect-past-tense
   (expand-replace-patterns
    {:synsem {:infl :imperfect}}
@@ -562,9 +570,13 @@
           :u (unify (:u each)
                     {:synsem {:cat :verb}})
           :g (:g each)})
+
        (concat
+        ;; if more are added in the future, please
+        ;; preserve alphabetical ordering.
         replace-patterns-conditional-tense
         replace-patterns-future-tense
+        replace-patterns-gerund
         replace-patterns-imperfect-past-tense
         replace-patterns-past-tense
         replace-patterns-present-tense)))


fix typo

fix typo

--- src/babel/italiano/morphology/verbs.cljc
+++ src/babel/italiano/morphology/verbs.cljc
@@ -3,14 +3,13 @@
    [dag_unify.core :refer [unify]]
    [babel.morphology :refer [expand-replace-patterns group-by-two]]))

-
 (def replace-patterns-gerund
   (expand-replace-patterns
    {:synsem {:infl :participle}}
    [{:agr :top
-     :p ["#(.*)ando$" "$1are"
-         "#(.*)ando$" "$1arsi"]}]))
-
+     :p [#"(.*)ando$" "$1are"
+         #"(.*)ando$" "$1arsi"]}]))
+
 (def replace-patterns-imperfect-past-tense
   (expand-replace-patterns
    {:synsem {:infl :imperfect}}


fix refactor goof that made human orthologue in search results not dereference correctly

--- src/cljs/gointermod/search/handlers.cljs
+++ src/cljs/gointermod/search/handlers.cljs
@@ -46,7 +46,6 @@
 (defn aggregate-by-orthologue [search-results]
   "helper to get the counts of aggregate go terms per organism / go term / ontology branch "
   (reduce (fn [new-map result]
-          ;  (.log js/console "%cresult" "color:hotpink;font-weight:bold;" (clj->js result))
      (->
          (update-in new-map [(:display-ortholog-id result) (:ontology-branch result)] conj (:go-term result))
          (assoc-in [(:display-ortholog-id result) :is-selected?] true)
@@ -63,8 +62,6 @@
 (defn lookup-original-input-identifier [identifier result]
   (let [id-map (re-frame/subscribe [:mapped-resolved-ids])
   input-identifier (utils/get-id (get @id-map identifier)) ]
-;  input-identifier nil ]
-  ;  (.log js/console "%cid-map" "color:hotpink;font-weight:bold;" (clj->js @id-map))
   (if input-identifier
     input-identifier
     (utils/get-id result :original)
@@ -90,7 +87,7 @@
           ortho-primary-id (get result 3)
           human-ortholog (re-frame/subscribe [:input-gene-friendly-id (lookup-original-input-identifier original-primary-id result)])]

-    { :human-ortholog human-ortholog
+    { :human-ortholog @human-ortholog
       :original-input-gene (nonhuman-ortholog-to-input-gene original-primary-id)
       :ortho-db-id (get result 0)
       :ortho-symbol (get result 1)


Added information about the BA problem and some more functionality for training and test sets.

--- src/clojush/examples/bioavailability.clj
+++ src/clojush/examples/bioavailability.clj
@@ -1,5 +1,20 @@
 ;; bioavailability.clj
 ;;
+;; This problem is a symbolic regression problem with 359 test cases
+;; over 241 variables. Each test case is a candidate drug compound,
+;; with each variable being a bi-dimensional molecule descriptor of
+;; that compound. The data file data/bioavailability.txt
+;; contains the data, with the last column being the target variable,
+;; in this case human oral bioavailability (%F), a float in the
+;; range [0.0, 100.0].
+;;
+;; The experimental procedure is copied from the paper below. This
+;; procedure uses 70% of the test cases as a training set, and the
+;; remaining 30% as a test set. Each time this file is run, it will
+;; select random training (251 test cases) and test (108 test cases)
+;; sets from the test cases to use throughout the entire run.
+;;
+;; See this paper for more information about this problem:
 ;; Sara Silva and Leonardo Vanneschi. 2009. Operator equalisation,
 ;; bloat and overfitting: a study on human oral bioavailability
 ;; prediction. In Proceedings of the 11th Annual conference on
@@ -27,6 +42,27 @@
                %)
          lines)))

-(count (read-data))
+;(count (read-data))

-(map last (read-data))
+;(count (first (read-data)))
+
+;(map last (read-data))
+
+;(def test-cases-shuffled
+;  (shuffle (read-data)))
+
+
+(defn define-test-cases
+  []
+  (let [test-cases-shuffled (shuffle (read-data))
+        train-num 251]
+    {:train (subvec test-cases-shuffled 0 train-num)
+     :test (subvec test-cases-shuffled train-num)}))
+
+
+(count (:test (define-test-cases)))
+
+
+
+
+


Fix major bugs in different-errors-diversifying? and new handling of diversification tests

--- src/clojush/pushgp/genetic_operators.clj
+++ src/clojush/pushgp/genetic_operators.clj
@@ -1046,16 +1046,17 @@
   [ind argmap]
   (if (and (:parent1-errors argmap)
            (:parent2-errors argmap))
-    (let [errs (do
-                 (swap! evaluations-count inc)
-                 (:errors ((:error-function argmap)
-                           {:genome (:genome ind)
-                            :program (translate-plush-genome-to-push-program
-                                       {:genome (:genome ind)}
-                                       argmap)})))]
+    (let [errs (or (:errors ind)
+                   (do
+                     (swap! evaluations-count inc)
+                     (:errors ((:error-function argmap)
+                               {:genome (:genome ind)
+                                :program (translate-plush-genome-to-push-program
+                                           {:genome (:genome ind)}
+                                           argmap)}))))]
       (assoc ind :diversifying
-        (and (not= (:errors ind) (take (count errs) (:parent1-errors argmap)))
-             (not= (:errors ind) (take (count errs) (:parent2-errors argmap))))))
+        (and (not= errs (take (count errs) (:parent1-errors argmap)))
+             (not= errs (take (count errs) (:parent2-errors argmap))))))
     (assoc ind :diversifying true)))

 (defn diversifying?
@@ -1110,14 +1111,12 @@
                        (vec (filter identity
                                     (map #(if (< (lrand) autoconstructive-entropy) nil %)
                                          pre-entropy-child-genome))))
-        check-diversification #(diversifying?
-                                 %
-                                 (-> argmap
+        checked (diversifying? {:genome child-genome}
+                               (-> argmap
                                      (assoc :parent1-genome parent1-genome)
                                      (assoc :parent2-genome parent2-genome)
                                      (assoc :parent1-errors (:errors parent1))
-                                     (assoc :parent2-errors (:errors parent2))))
-        checked (check-diversification {:genome child-genome})]
+                                     (assoc :parent2-errors (:errors parent2))))]
     (if (:diversifying checked)
       (make-individual :genome child-genome
                        :errors (:errors checked)
@@ -1130,7 +1129,7 @@
                        :is-random-replacement false)
       (let [new-genome (random-plush-genome
                          max-genome-size-in-initial-program atom-generators argmap)
-            new-checked (check-diversification {:genome new-genome})]
+            new-checked (diversifying? {:genome new-genome} argmap)]
         (if (:diversifying new-checked)
           (make-individual :genome new-genome
                            :errors (:errors new-checked)


Change listening host to localhost instead of 0.0.0.0

No reason to listen for connections from the outside.

--- src/leiningen/new/reagent/env/dev/clj/reagent/dev.clj
+++ src/leiningen/new/reagent/env/dev/clj/reagent/dev.clj
@@ -4,7 +4,7 @@
             [leiningen.core.main :as lein]))

 (defn browser-repl []
-  (piggieback/cljs-repl :repl-env (weasel/repl-env :ip "0.0.0.0" :port 9001)))
+  (piggieback/cljs-repl :repl-env (weasel/repl-env :ip "127.0.0.1" :port 9001)))

 (defn start-figwheel []
   (future


Conditionally rebind *err* to *out* only for Clojure.

ClojureScript has no *err*.

--- src/main/clojure/clojure/test/check/clojure_test.cljc
+++ src/main/clojure/clojure/test/check/clojure_test.cljc
@@ -168,7 +168,7 @@
   ;; to be a regular function instead of a multimethod, and may do
   ;; so before this code is loaded (see TCHECK-125)
   (if-not (instance? #?(:clj clojure.lang.MultiFn :cljs MultiFn) ct/report)
-    (binding [*out* *err*]
+    (binding [*out* #?(:clj *err* :cljs *out*)]
       (println "clojure.test/report is not a multimethod, some reporting functions have been disabled."))
     (let [begin-test-var-method (get-method ct/report #?(:clj  :begin-test-var
                                                          :cljs [::ct/default :begin-test-var]))]


Simplify report-first-fail

Simplify report-first-fail

Only print docs for actual failure, not containing suites

--- src/main/clojure/com/stuartsierra/lazytest/report.clj
+++ src/main/clojure/com/stuartsierra/lazytest/report.clj
@@ -86,34 +86,10 @@
   "Lazy test result reporter.  Takes a TestResult and prints the
   details of only the first failed test.  If all tests pass, prints
   nothing."
-  ([r] (report-first-fail r nil))
-  ([r stack]
-     (cond (= :com.stuartsierra.lazytest/TestResult (type r))
-           (when-not (success? r)
-             (report-first-fail (first (drop-while success? (:children r)))
-                                (cons r stack)))
+  [r]
+  (if (assertion-result? r)
+    (when-not (success? r)
+      (println "FAILURE")
+      (print-result r))
+    (report-first-fail (first (drop-while success? (:children r))))))

-           (= :com.stuartsierra.lazytest/TestThrown (type r))
-           (do (print "ERROR AT ")
-               (print-result r)
-               (doseq [s stack]
-                 (print "IN ")
-                 (print-result s)))
-
-           (= :com.stuartsierra.lazytest/AssertionPassed (type r))
-           nil
-
-           (= :com.stuartsierra.lazytest/AssertionFailed (type r))
-           (do (print "FAIL AT ")
-               (print-result r)
-               (doseq [s stack]
-                 (print "IN ")
-                 (print-result s)))
-
-           (= :com.stuartsierra.lazytest/AssertionThrown (type r))
-           (do (print "ERROR AT ")
-               (print-result r)
-               (doseq [s stack]
-                 (print "IN ")
-                 (print-result s))))))
-


DimDraw-GUI: Now the drawing is no longer computed before the button is pressed.

--- src/main/clojure/conexp/gui/draw/control/dim_draw.clj
+++ src/main/clojure/conexp/gui/draw/control/dim_draw.clj
@@ -13,11 +13,10 @@
 (defn dimdraw
   "Installs DimDraw Layout control."
   [frame scn buttons]
-  (let [^JButton btn    (make-button buttons "DimDraw"),
-        layout          (dim-draw-layout (lattice (get-layout-from-scene scn)))]
+  (let [^JButton btn    (make-button buttons "DimDraw")]
     (listen btn :action
             (fn [_]
-              (update-layout-of-scene scn layout)
+              (update-layout-of-scene scn (dim-draw-layout (lattice (get-layout-from-scene scn))))
               (fit-scene-to-layout scn)))))

 ;;;


Removed UDP component.

Removed UDP component.

We'll eventually be using the HTTP server to support the CLI.

--- src/hxgm30/language/components/udp.clj
+++ src/hxgm30/language/components/udp.clj
@@ -1,64 +0,0 @@
-(ns hxgm30.language.components.udp
-  (:require
-    [billo.udp.server.core :as server]
-    [clojusc.twig :as logger]
-    [com.stuartsierra.component :as component]
-    [hxgm30.dice.cli.util :as util]
-    [hxgm30.dice.roller :as roller]
-    [hxgm30.language.components.config :as config]
-    [taoensso.timbre :as log]))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;   UdpServer Component API   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(defn cli-parser
-  [args options]
-  (let [data (util/args->data args)]
-    (log/debug "Parsed args from UDP client: " (vec data))
-    ;(format "%s" (roller/roll (:system options) data))
-    ))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;   Component Lifecycle Implementation   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(defrecord CLIServer [])
-
-(defn start
-  [this]
-  (let [port (config/lang-udp-server-port this)]
-    (log/infof "Starting language UDP CLI server component on port %s..." port)
-    (let [options {:port port
-                   :parser-fn cli-parser
-                   :parser-opts {:system this}}
-          server (server/run options)]
-    (log/trace "Using server options:" options)
-    (log/debug "Started language UDP CLI server component.")
-    (assoc this :cli server))))
-
-(defn stop
-  [this]
-  (log/info "Stopping language UDP CLI server component ...")
-  (when-let [server (:cli this)]
-    (log/debug "Using server object:" server)
-    (server))
-  (log/debug "Stopped language UDP CLI server component.")
-  (assoc this :cli nil))
-
-(def lifecycle-behaviour
-  {:start start
-   :stop stop})
-
-(extend CLIServer
-  component/Lifecycle
-  lifecycle-behaviour)
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;   Component Constructor   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(defn create-component
-  ""
-  []
-  (map->CLIServer {}))


Update builtins.clj

Update builtins.clj

--- src/iyye/subcon/knowledge/builtins.clj
+++ src/iyye/subcon/knowledge/builtins.clj
@@ -36,8 +36,8 @@

 (defn iyye_is_type_predicate_function [params]
     (let [[p1-type p2-type] params
-          p2-name (:Name (:name (first p2-type)))
-          rels1 (:Relations (first p1-type))
+          p2-name (:Name (:name  p2-type))
+          rels1 (:Relations p1-type)
           rels2 (for [rel rels1]
                   [rel (and p2-name (= (:super (:Data rel)) p2-name))])
           rels3 (filter #(second %) rels2)]
@@ -46,59 +46,53 @@
         (words/->Iyye_ModalPredicate :IYE :AXIOM (persistence/local-time-to-string) :NEVER)))); FIXME Yumzia modal logic, FIXME 0 recursive

 (defn iyye_is_predicate_function [params]
-    (let [[relations & rest] params
-          rel (first (filter #(= "relation" (:Type (:name %))) relations))]
+    (let [[rel & rest] params
+          ;rel (first (filter #(= "relation" (:Type (:name %))) relations))
+          ]
       (if (= 2 (count rest))
         (if (and (not (:UNKNOWN (first (first rest)))) (not (:UNKNOWN (first (second rest)))))
           (if rel
             ((:PredicateFunction rel) rest)
-            (words/->Iyye_Error (pr-str "No relation: " relations) pr-str))
+            (words/->Iyye_Error (pr-str "No relation: " rel) pr-str))
           (words/->Iyye_Error (pr-str "No relation, unknown: " rest) pr-str))
         (words/->Iyye_Error (pr-str "No relation, unrelated, should be 2: " rest) pr-str))))

-(defn iyye_add_relation [p1-type p2-type relation]
-  (let [is_type relation]
-    (let [p1-supertype (assoc is_type :Data {:super (:Name (:name p2-type))})
-          p2-subtype (assoc is_type :Data {:sub (:Name (:name p1-type))})
-          new-p1-type (assoc p1-type :Relations
+(defn iyye_add_relation [p1-type p2-type relation pred]
+  (let [is_type (assoc relation :Predicate pred)
+        p1-supertype (assoc is_type :Data {:super (:Name (:name p2-type))})
+        p2-subtype (assoc is_type :Data {:sub (:Name (:name p1-type))})
+        new-p1-type (assoc p1-type :Relations
                                      (conj (:Relations p1-type) p1-supertype))
-          new-p2-type (assoc p2-type :Relations
+        new-p2-type (assoc p2-type :Relations
                                      (conj (:Relations p2-type) p2-subtype))]
-      (do
-        (words/set-iyye-type! new-p1-type)
-        (words/set-iyye-type! new-p2-type)
-        new-p2-type))))
+    (do
+      (words/set-iyye-type! new-p1-type)
+      (words/set-iyye-type! new-p2-type)
+      new-p2-type)))

 (defn iyye_is_type_function [params]
-  (let [[relations & remaining] params
-        rel (first (filter #(= "relation" (:Type (:name %))) relations))]
-    ; (case (count relation)
-    ;  0 (words/->Iyye_Error (pr-str "No relation: " params) pr-str)
-      (if (and (:Predicate rel) (words/check-params rel remaining)) ; is Relation
-        ((:Function rel) remaining)
-        (words/->Iyye_Error (pr-str "Not a relation: " rel) pr-str)))
-    ; (let [rels (filter #(and (not (nil? %)) (words/check-params % remaining)) relation)]
-    ; (if (> (count rels) 1)
-    ;  (words/->Iyye_Error (pr-str "Too many relations: " rels) pr-str)
-    ; (if (= (count rels) 1)
-    ;  ((:PredicateFunction (first rels)) remaining)
-    ;  (words/->Iyye_Error (pr-str "No relation in: " relation) pr-str)
-    )
+  (let [[rel & remaining] params
+        pars (words/check-select-params rel remaining)
+        ;rel (first (filter #(= "relation" (:Type (:name %))) relations))
+        ]
+      (if (and (:Predicate rel) pars) ; is Relation
+        ((:Function rel) pars)
+        (words/->Iyye_Error (pr-str "Not a relation: " rel) pr-str))))

 (defn iyye_is_type_function_relation [params]
-  (let [[type1 type2 & rest] params]
+  (let [[type1 type2 pred & rest] params]
   (if rest
     (words/->Iyye_Error (pr-str "Too many types to relation: " params) pr-str)
     (if type2
       (if (:UNKNOWN (first type2))
-        (iyye_add_relation (first type1)  (words/create-iyye-type (:UNKNOWN (first type2))) (words/builtin-words @iyye_is_type_rel))
-        (iyye_add_relation (first type1) (first type2) (words/builtin-words @iyye_is_type_rel)))
+        (iyye_add_relation type1 (words/create-iyye-type (:UNKNOWN type2)) (words/builtin-words @iyye_is_type_rel) pred)
+        (iyye_add_relation type1 type2 (words/builtin-words @iyye_is_type_rel) pred))
       (words/->Iyye_Error (pr-str "No type in : " params) pr-str)))))

 (defn iyye_consists_function [params]
   (let [[p1-type p2-type] params]
     (when (and p1-type p2-type)
-      (iyye_add_relation p1-type p2-type @iyye_consists_type)))) ; FIXME Yumzya
+      (iyye_add_relation p1-type p2-type @iyye_consists_type 0)))) ; FIXME Yumzya

 (defn iyye_instance_function [p1 name]
   (let [])
@@ -150,7 +144,7 @@
                    (create-entry yumzya)))))

 (defn- init-builtin-relations []
-  (let [t_is (create-iyye-builtin-relation "type" ["type" "*"] iyye_is_type_function_relation iyye_is_type_predicate_function)
+  (let [t_is (create-iyye-builtin-relation "type" ["type" "?" "predicate"] iyye_is_type_function_relation iyye_is_type_predicate_function)
         ;t_is2 (create-iyye-builtin-relation "is" [:UNKNOWN "type"] iyye_is_type_create_function iyye_is_type_predicate_function)
         ;  consistsof (create-iyye-builtin-relation "has" [] iyye_consists_function iyye_is_type_predicate_function)
         ;instof (create-iyye-builtin-relation "instance" ["type"] iyye_instance_function iyye_is_type_predicate_function)
@@ -162,8 +156,8 @@
     (dosync (alter words/builtin-words conj (create-entry t_is)))))

 (defn- init-builtin-verbs []
-  (let [t_is (create-iyye-builtin-verb "is" ["relation" "type" "*"] "relation" iyye_is_type_function)
-        t_is? (create-iyye-builtin-query "is?" ["relation" "type" "*"] iyye_is_predicate_function)
+  (let [t_is (create-iyye-builtin-verb "is" ["relation" "*"] "relation" iyye_is_type_function)
+        t_is? (create-iyye-builtin-query "is?" ["relation" "type" "?"] iyye_is_predicate_function)
         ;t_is2 (create-iyye-builtin-relation "is" [:UNKNOWN "type"] iyye_is_type_create_function iyye_is_type_predicate_function)
         consistsof (create-iyye-builtin-verb "has" ["type" "*"] "relation" iyye_consists_function)
         ;instof (create-iyye-builtin-relation "instance" ["type"] iyye_instance_function iyye_is_type_predicate_function)
@@ -181,10 +175,14 @@
         f (get-function @iyye_is_type)]
         (when f
           (do
-            (f [(get-type @iyye_is_type_rel) (get-type @iyye_ai) (get-type @iyye_actor)])
-            (f [(get-type @iyye_is_type_rel) (get-type @iyye_human) (get-type @iyye_actor)])
-            (f [(get-type @iyye_is_type_rel) (get-type @iyye_iyye) (get-type @iyye_ai)])
-            (f [(get-type @iyye_is_type_rel) (get-type @iyye_yumzya) (get-type @iyye_human)])))))
+            (f [(get-type @iyye_is_type_rel) [(get-type @iyye_ai)] [(get-type @iyye_actor)]
+                [(words/->Iyye_ModalPredicate :IYE :AXIOM (persistence/local-time-to-string) :ALWAYS)]])
+            (f [(get-type @iyye_is_type_rel) [(get-type @iyye_human)] [(get-type @iyye_actor)]
+                [(words/->Iyye_ModalPredicate :IYE :AXIOM (persistence/local-time-to-string) :ALWAYS)]])
+            (f [(get-type @iyye_is_type_rel) [(get-type @iyye_iyye)] [(get-type @iyye_ai)]
+                [(words/->Iyye_ModalPredicate :IYE :AXIOM (persistence/local-time-to-string) :ALWAYS)]])
+            (f [(get-type @iyye_is_type_rel) [(get-type @iyye_yumzya)] [(get-type @iyye_human)]
+                [(words/->Iyye_ModalPredicate :IYE :AXIOM (persistence/local-time-to-string) :ALWAYS)]])))))

 (defn- init-builtins-kb []
   (init-builtin-words)


pretty up the data declaration

pretty up the data declaration

--- test/tst/tupelo/xxx.cljc
+++ test/tst/tupelo/xxx.cljc
@@ -22,20 +22,18 @@
 (def data {
   :tag :root
   :content [
-    { :tag :a :content [
-      {:tag :a1 :content [] }
-    ] }
-    { :tag :b :content [
-      {:tag :b1 :content [] }
-      {:tag :b2 :content [] }
-    ] }
-  {:tag :c :content [
-      {:tag :c1 :content [] }
-      {:tag :c2 :content [] }
-      {:tag :c3 :content [] }
-    ] }
-  ]
-}
+    { :tag :a
+      :content [
+        {:tag :a1 :content [] } ] }
+    { :tag :b
+      :content [
+        {:tag :b1 :content [] }
+        {:tag :b2 :content [] } ] }
+    { :tag :c
+      :content [
+        {:tag :c1 :content [] }
+        {:tag :c2 :content [] }
+        {:tag :c3 :content [] } ] } ] }
 )

 (defn walk-1* [result path-in node]


removed unnecessary repl tests

removed unnecessary repl tests

--- src/latte_compiler/static_analysis.clj
+++ src/latte_compiler/static_analysis.clj
@@ -117,20 +117,6 @@
                res (reduce m-conj (m-result coll) (map util/succ nfuns))]
               res)))

-;(funsred (vec [
-;               [:fndef [:void] [:ident "main"] [:args] [:block [:sexp [:expr [:eapp [:ident "printInt"] [:expr [:elitint 1]]]]] [:sexp [:expr [:evar [:ident "return"]]]]]]
-;               [:fndef [:int] [:ident "g"] [:args [:arg [:tident [:ident "string"]] [:ident "a"]]] [:block [:ret [:expr [:eadd [:elitint 4] [:plus] [:elitint 2]]]]]]
-;               [:fndef [:int] [:ident "f"] [:args [:arg [:int] [:ident "a"]] [:arg [:int] [:ident "b"]]] [:block [:ret [:expr [:eapp [:ident "g"] [:expr [:estring "132"]]]]]]]
-;               ])
-;         (hash-map
-;           "printInt" (->FunDef "printInt" :void [:int])
-;           "printString" (->FunDef "printString" :void [:string])
-;           "error" (->FunDef "error" :void [])
-;           "readInt" (->FunDef "readInt" :int [])
-;           "readString" (->FunDef "readString" :string [])
-;           ))
-
-
 (defn bucketize
   [buffer expr]
   (if (= :clssdef (first expr))
@@ -148,18 +134,6 @@
     (util/err "no correct main function found")
     )
   )
-
-(= (->FunDef "main" :int []) (->FunDef "main" :void []))
-;(main-check
-;  (hash-map
-;    "main" (->FunDef "main" :void [])
-;    "printInt" (->FunDef "printInt" :void [:int])
-;    "printString" (->FunDef "printString" :void [:string])
-;    "error" (->FunDef "error" :void [])
-;    "readInt" (->FunDef "readInt" :int [])
-;    "readString" (->FunDef "readString" :string [])
-;    )
-;  )

 (defn analyze-class
   [glob-state clssexpr]


comment updates to tile-spec-index

comment updates to tile-spec-index

--- src/lcmap/aardvark/tile_spec_index.clj
+++ src/lcmap/aardvark/tile_spec_index.clj
@@ -1,5 +1,5 @@
 (ns lcmap.aardvark.tile-spec-index
-  "Search index for tile-spec ubids (universal band ids)."
+  "Search index for tile-specs"
   (:require [lcmap.aardvark.config :refer [config]]
             [lcmap.aardvark.es :as es]
             [lcmap.aardvark.tile-spec :as tile-spec]
@@ -26,7 +26,7 @@
   (str (server-url) "/" (index-name)))

 (defn bulk-api-url
-  "Returns the url to bulk api"
+  "Returns the url to the bulk api"
   []
   (str (url) "/"
        (strip "/" (get-in config [:search :ubid-index-type])) "/_bulk"))
@@ -37,7 +37,7 @@
   (str (url) "/_search"))

 (defn +tags
-  "Creates additional tags from a ubid"
+  "Appends additional tags to a tile-spec"
   [tile-spec]
   (let [ubid-tags (str/split (:ubid tile-spec) #"/|_")]
     (if (> (count ubid-tags) 1)
@@ -45,19 +45,19 @@
       tile-spec)))

 (defn index-entry
-   "Creates an index entry."
+   "Converts a tile-spec to an index entry."
   [tile-spec]
   (str (json/write-str {"index" {"_retry_on_conflict" 3}}) "\n"
        (json/write-str tile-spec) "\n"))

 (defn clear
-  "Clears the tile-spec-index"
+  "Clears the tile-spec index"
   []
   (es/clear! (url)))

 (defn search
-  "Submits a supplied query to the ubid index, which should conform to the
-   elasticsearch query syntax. Returns a clojure dictionary of the raw results"
+  "Submits a query to the index.  Query should conform to elasticsearch
+   querystring query syntax. Returns map of raw results"
   ([query]
    (search (search-api-url) query))

@@ -65,13 +65,13 @@
    (es/search api-url query (get-in config [:search :max-result-size]))))

 (defn result
-  "Returns sequence of tile-specs from search results"
+  "Extracts tile-specs from search results"
   [search-results]
   (map #(get % "_source")
        (get-in search-results ["hits" "hits"])))

 (defn save
-  "Create index entry(s) in ES"
+  "Saves tile-specs to the ElasticSearch index."
   [tile-specs]
   (log/debugf "creating index entry(s) for %s" tile-specs)
   (es/load! (bulk-api-url)


Bump to current stable releases.

Bump to current stable releases.

--- src/leiningen/new/re_frame/project.clj
+++ src/leiningen/new/re_frame/project.clj
@@ -1,9 +1,9 @@
 (defproject {{ns-name}} "0.1.0-SNAPSHOT"
-  :dependencies [[org.clojure/clojure "1.6.0"]
-                 [org.clojure/clojurescript "0.0-3211"]
-                 [reagent "0.5.0"]
+  :dependencies [[org.clojure/clojure "1.7.0"]
+                 [org.clojure/clojurescript "1.7.145"]
+                 [reagent "0.5.1"]
                  [re-frame "0.4.1"]{{#re-com?}}
-                 [re-com "0.6.1"]{{/re-com?}}{{#routes?}}
+                 [re-com "0.6.2"]{{/re-com?}}{{#routes?}}
                  [secretary "1.2.3"]{{/routes?}}{{#garden?}}
                  [garden "1.2.5"]{{/garden?}}]

@@ -16,7 +16,7 @@
   :clean-targets ^{:protect false} ["resources/public/js/compiled" "target" {{#test?}}
                                     "test/js"{{/test?}} {{#garden?}}
                                     "resources/public/css/compiled"{{/garden?}}]
-
+
   {{#garden?}}
   :garden {:builds [{:id "screen"
                      :source-paths ["src/clj"]


Tundra: update tests

Tundra: update tests

--- test/taoensso/carmine/tests/tundra.clj
+++ test/taoensso/carmine/tests/tundra.clj
@@ -9,9 +9,10 @@
 (comment (test/run-tests '[taoensso.carmine.tests.tundra]))

 (defmacro wcar* [& body] `(car/wcar {:pool {} :spec {}} ~@body))
-(def tkey (partial car/key :carmine :temp :test))
+(def tkey (partial car/key :carmine :tundra :test))
+(def qname "carmine-tundra-tests")
 (defn clean-up! []
-  (mq/clear-queues {} "carmine.tundra")
+  (mq/clear-queues {} qname)
   (when-let [ks (seq (wcar* (car/keys (tkey :*))))]
     (wcar* (apply car/del ks))))

@@ -44,17 +45,19 @@
 (let [tstore (tundra/tundra-store dstore)]
   (expect (and (:access-key creds) (:secret-key creds)))
   (expect Exception (wcar {} (tundra/dirty     tstore (tkey "invalid"))))
-  (expect Exception (wcar {} (tundra/ensure-ks tstore (tkey "invalid")))))
+  (expect nil       (wcar {} (tundra/ensure-ks tstore (tkey "invalid"))))
+  (expect Exception (wcar {} (car/sadd @#'tundra/k-evictable (tkey "invalid-evictable"))
+                             (tundra/ensure-ks tstore (tkey "invalid-evictable")))))

 (expect [[:clj-val] [:clj-val] [:clj-val-new]]
-  (let [tstore  (tundra/tundra-store dstore)
+  (let [tstore  (tundra/tundra-store dstore {:qname qname})
         tworker (tundra/worker tstore {} {:eoq-backoff-ms 100 :throttle-ms 100})]
     (wcar {} (car/mset (tkey 0) [:clj-val]
                        (tkey 1) [:clj-val]
                        (tkey 2) [:clj-val])) ; Reset vals

-    ;; Invalid keys throw w/o preventing valid keys from being processed
-    (wcar {} (try (tundra/dirty tstore (tkey "invalid")
+    ;; Invalid keys don't prevent valid keys from being processed
+    (wcar {} (try (tundra/dirty tstore (tkey "invalid") (tkey "invalid-evictable")
                                        (tkey 0) (tkey 1) (tkey 2))
                   (catch Exception _ nil)))

@@ -65,13 +68,13 @@
              (car/with-replies)) ; Make some local modifications

     ;; Invalid keys throw w/o preventing valid keys from being processed
-    (wcar {} (try (tundra/ensure-ks tstore (tkey "invalid")
+    (wcar {} (try (tundra/ensure-ks tstore (tkey "invalid") (tkey "invalid-evictable")
                                            (tkey 0) (tkey 1) (tkey 2))
                   (catch Exception _ nil)))
     (wcar {} (car/mget (tkey 0) (tkey 1) (tkey 2)))))

 (expect [-1 -1 -1] ; nil eviction timeout (default) is respected!
-  (let [tstore  (tundra/tundra-store dstore)
+  (let [tstore  (tundra/tundra-store dstore {:qname qname})
         tworker (tundra/worker tstore {} {:eoq-backoff-ms 100 :throttle-ms 100})]
     (wcar {} (car/mset (tkey 0) "0" (tkey 1) "1" (tkey 2) "1") ; Clears timeouts
              (tundra/dirty tstore (tkey 0) (tkey 1) (tkey 2))
@@ -86,7 +89,8 @@
         (> t1  0)
         (> t2  t1)))

- (let [tstore  (tundra/tundra-store dstore {:redis-ttl-ms (* 1000 60 60 24)})
+ (let [tstore  (tundra/tundra-store dstore {:redis-ttl-ms (* 1000 60 60 24)
+                                            :qname qname})
        tworker (tundra/worker tstore {} {:eoq-backoff-ms 100 :throttle-ms 100
                                          :auto-start? false})]
    (wcar {} (car/set (tkey 0) "0") ; Clears timeout
@@ -102,4 +106,4 @@
             (car/ttl (tkey 0)))))

 (comment (clean-up!)
-         (mq/queue-status {} "carmine.tundra"))
+         (mq/queue-status {} qname))


Remove vile useful.core ns

Remove vile useful.core ns

--- src/flatland/useful/core.clj
+++ src/flatland/useful/core.clj
@@ -1,5 +0,0 @@
-(ns flatland.useful.core
-  (:use [flatland.useful.ns :only [alias-ns]]))
-
-(doseq [module '(bean cli compress datatypes debug dispatch experimental experimental.unicode fn io java macro map parallel seq state string test utils)]
-  (alias-ns (symbol (str "useful." module))))


update copyright year

update copyright year

--- src/foosball/views/about.clj
+++ src/foosball/views/about.clj
@@ -42,7 +42,7 @@
    [:div.col-lg-8.jumbotron
     [:h1 "Foosball"]
     [:p.lead (str "Version " (:version project)) ]
-    [:p.lead "Copyright © 2013 " [:a {:href "http://about.me/thomaschrstnsn"} "Thomas Christensen"]]
+    [:p.lead "Copyright © 2014 " [:a {:href "http://about.me/thomaschrstnsn"} "Thomas Christensen"]]
     [:h2 "Built using"]
     [:div.col-lg-12
      [:table.table.table-hover


Problems tweaked

Problems tweaked

--- src/foreclojure/data_set.clj
+++ src/foreclojure/data_set.clj
@@ -662,7 +662,7 @@

       (insert! :problems
            {:_id 64
-            :title "Intro to reduce"
+            :title "Intro to Reduce"
             :times-solved 0
             :description "Reduce takes a 2 argument function and an optional starting value. It then applies the function to the first 2 items in the sequence (or the starting value and the first element of the sequence). In the next iteration the function will be called on the previous return value and the next item from the sequence, thus reducing the entire collection to one value. Don't worry, it's not as complicated as it sounds."
             :tags ["elementary" "seqs"]
@@ -672,9 +672,9 @@

       (insert! :problems
            {:_id 65
-            :title "Black box testing"
-            :times-solved 0
-            :description "Clojure has many sequence types, which act in subtly different ways. The core functions typically convert them into a uniform \"sequence\" type and work with them that way, but it can be important to understand the behavioral and performance differences so that you know which kind is appropriate for your application.
Write a function which takes a collection and returns one of :map, :set, :list, or :vector - describing the type of collection it was given.
You won't be allowed to inspect their class or use the built-in predicates like list? - the point is to poke at them and understand their behavior."
+            :title "Black Box Testing"
+            :times-solved 0
+            :description "Clojure has many collection types, which act in subtly different ways. The core functions typically convert them into a uniform \"sequence\" type and work with them that way, but it can be important to understand the behavioral and performance differences so that you know which kind is appropriate for your application.

Write a function which takes a collection and returns one of :map, :set, :list, or :vector - describing the type of collection it was given.
You won't be allowed to inspect their class or use the built-in predicates like list? - the point is to poke at them and understand their behavior."
             :tags ["medium" "seqs" "testing"]
             :tests ["(= :map (__ {:a 1, :b 2}))"
                     "(= :list (__ (range (rand-int 20))))"


Keep user's code on successful problem solution too

--- src/foreclojure/problems.clj
+++ src/foreclojure/problems.clj
@@ -82,12 +82,11 @@
 (defn run-code [id raw-code]
   (let [code (.trim raw-code)
         {:keys [tests restricted]} (get-problem id)
-        sb-tester (get-tester restricted)]
+        sb-tester (get-tester restricted)
+        this-url (str "/problem/" id)]
+    (session/flash-put! :code code)
     (if (empty? code)
-      (do
-        (session/flash-put! :code code)
-        (flash-msg "Empty input is not allowed"
-                   (str "/problem/" id)))
+      (flash-msg "Empty input is not allowed" this-url)
       (try
         (loop [[test & more] tests
                i 0]
@@ -97,14 +96,9 @@
             (let [testcase (s/replace test "__" (str code))]
               (if (sb sb-tester (safe-read testcase))
                 (recur more (inc i))
-                (do
-                  (session/flash-put! :code code)
-                  (flash-msg "You failed the unit tests."
-                             (str "/problem/" id)))))))
+                (flash-msg "You failed the unit tests." this-url)))))
         (catch Exception e
-          (do
-            (session/flash-put! :code code)
-            (flash-msg (.getMessage e) (str "/problem/" id))))))))
+          (flash-msg (.getMessage e) this-url))))))

 (def-page code-box [id]


fix result field name to be string instead of symbol

--- src/graphql_clj/executor.clj
+++ src/graphql_clj/executor.clj
@@ -33,7 +33,7 @@

 (defn- get-field-entry [{:keys [name field-name] :as field-entry} state parent-type-name parent-result]
   (printf "get-field-entry: field-entry: %s, parent-result: %s%n" field-entry parent-result)
-  [(or name field-name) (->> (resolve-field-on-object field-entry state parent-type-name parent-result)
+  [(str (or name field-name)) (->> (resolve-field-on-object field-entry state parent-type-name parent-result)
                              (complete-value field-entry state))])

 (defn- get-field-type


Adapt history to pointer based cont references in unrolled list

--- src-cljs/cljs_workspace/om_history.cljs
+++ src-cljs/cljs_workspace/om_history.cljs
@@ -22,8 +22,7 @@

 (defn init-history [init-state]
   (reset! app-state init-state)
-  (reset! app-history [init-state])
-  (reset! (@current-branch :data) @app-history)
+  (reset! (@current-branch :data) @(@app-history :data))
   (add-morph history-view (@current-branch :id) history-indicator))

 (def branch-count (atom 1))
@@ -35,10 +34,14 @@
 (def current-branch (atom {:id (generate-uuid) :data (atom [])}))

 ;; global atom referencing the total history graph
-(def app-history (@current-branch :data))
+(def app-history (atom {:root @current-branch :data (@current-branch :data)}))

 ;; ffd
 (def history-view)
+
+(defn most-recent-state []
+  (let [l (len @(@current-branch :data))]
+        (when (> l 0) (nth-history (- l 2)))))

 (defn switch-to-branch [branch]
   (prn "old branch id: " (@current-branch :id))
@@ -47,7 +50,10 @@
   (set-fill history-view (@current-branch :id) "lightgrey")
   (set-fill history-view (branch :id) "green")
   (add-morph history-view (branch :id) history-indicator)
-  (reset! current-branch branch))
+  (reset! current-branch branch)
+  (when-let [s (most-recent-state)]
+    (reset! app-state s))
+  (render-tree @app-history @current-branch (fn [branch] (switch-to-branch branch))))

 (defn nth-history
   ([i]
@@ -57,16 +63,16 @@
     (if (< i (dec (count data)))
       (let [e (nth data i)]
         (if (e :cont)
-          (first @(e :cont))
+          (first @(get-in e [:cont :data]))
           e))
-      (if-let [cont ((last data) :cont)]
+      (if-let [cont (get-in (last data) [:cont :data])]
         (nth-history (- i (dec (count data))) @cont)
         nil))))

 (defn len [unrolled-list]
   (+ -1 (count unrolled-list)
     (when-let [end (last unrolled-list)]
-      (when-let [n (end :cont)] (len @n)))))
+      (when-let [n (get-in end [:cont :data])] (len @n)))))

 (def history-indicator
   {:id "indexMorph"
@@ -128,7 +134,7 @@
 ;
 ; -----\----
 ;       \------
-; {:id ... :data [ . . . .  {:cont ---------------------> [ . . . . . ]
+; {:id ... :data [ . . . .  {:cont ---------------------> {:root . :data [ . . . . . ] }
 ;                            :fork | }]}
 ;                                  \
 ;                                   V
@@ -138,9 +144,9 @@
   (if (< i (dec (count @branch)))
       (let [e (nth @branch i)]
         (if (e :cont)
-          [0 (e :cont)]
+          [0 (get-in e [:cont :data])]
           [i branch]))
-      (if-let [cont ((last @branch) :cont)]
+      (if-let [cont (get-in (last @branch) [:cont :data])]
         (get-branch-part (- i (dec (count @branch))) cont)
         (prn "Out of Range!"))))

@@ -156,7 +162,7 @@
           pre-branch (vec (take rel-index @branch-part))
           post-branch (vec (drop rel-index @branch-part))
           ; insert the branching point into the old branch
-          branched-branch (conj pre-branch {:cont (atom post-branch) :fork new-branch})]
+          branched-branch (conj pre-branch {:cont {:root @branch :data (atom post-branch)} :fork new-branch})]
         ; update the old branch with the inserted version
         (reset! branch-part branched-branch)
         ; let current branch pointer point to new branch
@@ -166,7 +172,7 @@
 (defn append-to-branch [branch s]
   ; in case the branch got forked we have to jump these interruptions
   (if-let [end (last @branch)]
-    (if-let [cont (end :cont)]
+    (if-let [cont (get-in end [:cont :data])]
       (append-to-branch cont s)
       (swap! branch conj s))
     (swap! branch conj s)))
@@ -181,14 +187,13 @@
         (when-not (= (last b) n)
           (append-to-branch (@current-branch :data) n))
         (let [c (len @(@current-branch :data))]
-            (render-tree @app-history)
+            (render-tree @app-history @current-branch (fn [branch] (switch-to-branch branch)))
             (prn (str c " Saved " (pluralize c "State")))))))

 (om/root
   (fn [app owner]
     (om/component
       (dom/div {}
-        (om/build morphic/morph app)
         history-slider)))
   history-view
   {:target (. js/document (getElementById "inspector"))})


Fix typo

Fix typo

--- src-cljs/frontend/components/admin.cljs
+++ src-cljs/frontend/components/admin.cljs
@@ -220,7 +220,7 @@
                                            (not= (:login current-user) (:login user)))
               scope (-> user :admin_scopes relevant-scope)
               dropdown-options (cond->> (keys scope-labels)
-                                        (not= "read-settings" relevant-scope) (remove #{"read-settings"}))]
+                                        (not= "read-settings" scope) (remove #{"read-settings"}))]
           (html
             [:tr
              [:td (:login user)]


Adds error handling.

Adds error handling.

--- src/onyx/peer/task_pipeline.clj
+++ src/onyx/peer/task_pipeline.clj
@@ -1,6 +1,7 @@
 (ns onyx.peer.task-pipeline
   (:require [clojure.core.async :refer [alts!! <!! >!! chan close!]]
             [com.stuartsierra.component :as component]
+            [dire.core :as dire]
             [onyx.queue.hornetq :refer [hornetq]]
             [onyx.extensions :as extensions]))

@@ -8,8 +9,8 @@
   (extensions/create-tx-session queue))

 (defn read-batch [queue consumers batch-size timeout]
-  (let [consumer-chs (map (fn [_] (chan 1)) (count consumers))]
-    (doseq [[consumer ch] (map vector (consumers consumer-chs))]
+  (let [consumer-chs (map (fn [_] (chan 1)) (range (count consumers)))]
+    (doseq [[consumer ch] (map vector consumers consumer-chs)]
       (>!! ch (extensions/consume-message queue consumer timeout)))
     (let [rets (->> (range batch-size)
                     (map (fn [_] (first (apply alts!! consumer-chs))))
@@ -172,6 +173,50 @@
                          :sync sync
                          :batch-size 1000
                          :timeout 50}]
+
+      (dire/with-handler! #'open-session-loop
+        java.lang.Exception
+        (fn [e & _] (.printStackTrace e)))
+
+      (dire/with-handler! #'read-batch-loop
+        java.lang.Exception
+        (fn [e & _] (.printStackTrace e)))
+
+      (dire/with-handler! #'decompress-tx-loop
+        java.lang.Exception
+        (fn [e & _] (.printStackTrace e)))
+
+      (dire/with-handler! #'apply-fn-loop
+        java.lang.Exception
+        (fn [e & _] (.printStackTrace e)))
+
+      (dire/with-handler! #'compress-tx-loop
+        java.lang.Exception
+        (fn [e & _] (.printStackTrace e)))
+
+      (dire/with-handler! #'write-batch-loop
+        java.lang.Exception
+        (fn [e & _] (.printStackTrace e)))
+
+      (dire/with-handler! #'status-check-loop
+        java.lang.Exception
+        (fn [e & _] (.printStackTrace e)))
+
+      (dire/with-handler! #'commit-tx-loop
+        java.lang.Exception
+        (fn [e & _] (.printStackTrace e)))
+
+      (dire/with-handler! #'close-resources-loop
+        java.lang.Exception
+        (fn [e & _] (.printStackTrace e)))
+
+      (dire/with-handler! #'complete-task-loop
+        java.lang.Exception
+        (fn [e & _] (.printStackTrace e)))
+
+      (dire/with-handler! #'reset-payload-node-loop
+        java.lang.Exception
+        (fn [e & _] (.printStackTrace e)))

       (assoc component
         :read-batch-ch read-batch-ch


Use functions to access argv

Use functions to access argv

--- src/reagent/impl/component.cljs
+++ src/reagent/impl/component.cljs
@@ -10,6 +10,8 @@
 (declare ^:dynamic *non-reactive*)

+;;; Argv access
+
 (defn extract-props [v]
   (let [p (nth v 1 nil)]
     (if (map? p) p)))
@@ -20,17 +22,20 @@
     (if (> (count v) first-child)
       (subvec v first-child))))

+(defn props-argv [p]
+  (.' p :argv))
+
 (defn get-argv [c]
   (.' c :props.argv))

 (defn get-props [c]
-  (-> (.' c :props.argv) extract-props))
+  (-> (get-argv c) extract-props))

 (defn get-children [c]
-  (-> (.' c :props.argv) extract-children))
+  (-> (get-argv c) extract-children))

 (defn reagent-component? [c]
-  (-> (.' c :props.argv) nil? not))
+  (-> (get-argv c) nil? not))

 ;;; State
@@ -45,6 +50,7 @@
 (defn as-element [x]
   (js/reagent.impl.template.as-element x))

+
 ;;; Rendering

 (defn reagent-class? [c]
@@ -54,10 +60,9 @@
 (defn do-render-sub [c]
   (let [f (.' c :reagentRender)
         _ (assert (ifn? f))
-        p (.' c :props)
         res (if (true? (.' c :cljsLegacyRender))
               (f c)
-              (let [argv (.' p :argv)
+              (let [argv (get-argv c)
                     n (count argv)]
                 (case n
                   1 (f)
@@ -123,7 +128,7 @@
     :componentWillReceiveProps
     (fn [props]
       (this-as c
-               (f c (.' props :argv))))
+               (f c (get-argv c))))

     :shouldComponentUpdate
     (fn [nextprops nextstate]
@@ -142,12 +147,12 @@
     :componentWillUpdate
     (fn [nextprops]
       (this-as c
-               (f c (.' nextprops :argv))))
+               (f c (props-argv nextprops))))

     :componentDidUpdate
     (fn [oldprops]
       (this-as c
-               (f c (.' oldprops :argv))))
+               (f c (props-argv oldprops))))

     :componentWillMount
     (fn []


can just hit enter in text-field to search

--- src/semtag_web/client/main.cljs
+++ src/semtag_web/client/main.cljs
@@ -17,6 +17,18 @@
 ;;************************************************

 (def $button ($ :#url_search_button))
+(def $text-field ($ :#url_search_text))
+
+(def enter-key 13)
+
+(defn- key-pressed
+  "If keypressed = keycode then call func"
+  [key-code func event]
+    (when  (=  (.-keyCode event) key-code)
+      (func)))
+
+(defn return-key-pressed [f]
+  (partial key-pressed enter-key f))

 (defn- shorten-to [s max-length]
   (let [s-length (count s)]
@@ -35,8 +47,8 @@
            [:td (:tags %)]])
       data) ])

-(defn button-handler []
-  (let [query (jayq.core/val ($ :#url_search_text))
+(defn mls-search []
+  (let [query (jayq.core/val $text-field)
         parent (jayq.core/parent $button)]
     (-> (jayq.core/find parent :h2)
       (jayq.core/inner (str "Search results for '" query "'")))
@@ -49,4 +61,5 @@
                      (generate-rows data)))
        })))

-(bind $button "click" button-handler)
+(bind $button "click" mls-search)
+(bind $text-field :keypress (return-key-pressed mls-search))


Une première solution à l'exercice "Anagram" de Exercism dans la track Clojure

--- exercism/clojure/anagram/src/anagram.clj
+++ exercism/clojure/anagram/src/anagram.clj
@@ -1,5 +1,18 @@
-(ns anagram)
+(ns anagram
+  (:require [clojure.string :as str]))

-(defn anagrams-for [word prospect-list] ;; <- arglist goes here
-  ;; your code goes here
-)
+(defn is-anagram
+  "Test if the given argument 'candidate-anagram' is an anagram of the given argument 'word'. The function is case-insensitive.
+   Furthermore a word is not considered as its own anagram : if the 2 parameters are the same word (potentially with different case), the function returns false"
+  [word candidate-anagram]
+  (let [to-lower-case (str/lower-case word)
+        as-sorted-char-seq (sort to-lower-case)
+        prospect-to-lower-case (str/lower-case candidate-anagram)]
+    (and (not= to-lower-case prospect-to-lower-case) ;; A word is not its own anagrame
+         (= as-sorted-char-seq (sort prospect-to-lower-case))))) ;; if the 2 words are anagrams, they have the same sorted sequence of characters
+
+(defn anagrams-for
+  "Returns the sequence of anagrams of the given argument 'word' that are in the 'prospect_list' argument. The function is case-insensitive.
+   Furthermore a word is not considered as its own anagram."
+  [word prospect-list]
+  (filter #(is-anagram word %1) prospect-list))


Update sample file

Update sample file

--- sample/project.clj
+++ sample/project.clj
@@ -3,7 +3,6 @@
   :url "http://example.com/FIXME"
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
-  :min-lein-version "2.0.0"

   :global-vars {*warn-on-reflection* true}

@@ -11,16 +10,11 @@
   :java-source-paths ["src/java" "gen"]
   :javac-options ["-target" "1.6" "-source" "1.6" "-Xlint:-options"]

-  ;; The following two definitions are optional. The default
-  ;; target-path is "target", but you can change it to whatever you like.
-  ;; :target-path "bin"
-  ;; :compile-path "bin/classes"
-
   ;; Uncomment this line if your project doesn't use Clojure. Also
   ;; don't forget to remove respective dependencies.
   ;; :java-only true

-  :dependencies [[org.clojure-android/clojure "1.5.1-jb" :use-resources true]
+  :dependencies [[org.clojure-android/clojure "1.6.0-RC1" :use-resources true]
                  [neko/neko "3.0.0"]]
   :profiles {:dev {:dependencies [[org.clojure/tools.nrepl "0.2.3"]
                                   [compliment "0.0.3"]]
@@ -45,14 +39,17 @@
             ;; here or in your ~/.lein/profiles.clj file.
             ;; :sdk-path "/home/user/path/to/android-sdk/"

+            ;; Use this if you don't want to use the latest version of
+            ;; Android Build Tools.
+            ;; :build-tools-version "19.0.3"
+
             ;; Specify this if your project is a library.
-            ;; :library false
+            ;; :library true

             ;; Uncomment this if dexer fails with OutOfMemoryException.
             ;; :force-dex-optimize true

-            ;; Options to pass to dx executable, former is for general
-            ;; java-related options and later is for 'dex task'-specific options.
+            ;; Options to pass to dx executable.
             ;; :dex-opts ["-JXmx4096M"]

             ;; Proguard config for "droid create-obfuscated-dex" task.


All basicfunctions are macros now

All basicfunctions are macros now

--- src/logic/basicfunctions.clj
+++ src/logic/basicfunctions.clj
@@ -2,78 +2,28 @@

 ; other logical functions (nand, impl, etc.)

-;;;;; NAND ;;;;;;
-;;; function ;;;
-#_(defn nand
-  "Logical negated and (!(phi & psi))"
-  ([] false)
-  ([x] (not x))
-  ([x & next]
-   (if x (apply nand next) true)))
-
-;;; macro ;;;
 (defmacro nand
-  "Logical negated and (!(phi & psi))"
-  ([] false)
-  ([x] (not x))
-  ([x & next]
-    `(let [nand# ~x]
-       (if nand# (nand ~@next) true))))
-
-;;;;; NOR ;;;;;
-;;; functon ;;;
-#_(defn nor
-  "Logical negated or (!(phi | psi))"
-   ([] true)
-   ([x] (not x))
-   ([x & next]
-     (if x false (apply nor next))))
-
-; ??
-(defmacro nand1
+  "Logical negated and"
      [& more]
      `(not (and ~@more)))

-;;; macro ;;;
 (defmacro nor
-  "Logical negated or (!(phi | psi))"
-  ([] true)
-  ([x] (not x))
-  ([x & next]
-    `(let [nor# ~x]
-       (if nor# false (nor ~@next)))))
-
-(defmacro nor1
+  "Logical negated ore"
      [& more]
      `(not (or ~@more)))

-(defn impl
+(defmacro impl
   "Logical implication (phi -> psi)"
   [phi psi]
-  (or (not phi) psi))
+  `(if (not ~phi)
+     true
+     ~psi))

-; besser als Makro, q wird nicht ausgewertet, wenn p false ist
-(defmacro impl1
-  [p q]
-  `(if (not ~p)
-     true
-     ~q))
-
-(defn nimpl
+(defmacro nimpl
   "Logical negated implication (!(phi -> psi))"
   [phi psi]
-  (not (impl phi psi)))
+  `(not (impl ~phi ~psi)))

-;;;;; EQUIV ;;;;;
-;;; function ;;;
-#_(defn equiv
-  "Logical equivalence (phi <-> psi)"
-   ([] true)
-   ([x] true)
-   ([x & more]
-     (if (= x (first more)) (apply equiv more) false)))
-
-;;; macro ;;;
 (defmacro equiv
    "Logical equivalence (phi <-> psi)"
    ([] true)
@@ -84,17 +34,18 @@
      `(let [y# ~y]
         (if (= ~x  y#) (equiv y# ~@more) false))))

-(defn rimpl
+(defmacro rimpl
   "Converse logical implication (phi <- psi)"
   [phi psi]
-  (impl psi phi))
+  `(impl ~psi ~phi))

-(defn nrimpl
+(defmacro nrimpl
   "Negated converse logical implication (!(phi <- psi))"
   [phi psi]
-  (nimpl psi phi))
+  `(nimpl ~psi ~phi))

-(defn xor
+(defmacro xor
   "Logical exclusive or"
   [phi psi]
-  (and (or phi psi) (not (and phi psi))))
+  `(let [phi# ~phi, psi# ~psi]
+     (and (or phi# psi#) (not (and phi# psi#)))))


optimize munge and demunge

optimize munge and demunge

--- src/main/cljs/cljs/core.cljs
+++ src/main/cljs/cljs/core.cljs
@@ -9843,12 +9843,14 @@
     (.toString sb)))

 (defn munge [name]
-  ((if (symbol? name) symbol str)
-    (let [name' (munge-str (str name))]
-      (cond
-        (= name' "..") "_DOT__DOT_"
-        (js-reserved? name') (str name' "$")
-        :else name'))))
+  (let [name' (munge-str (str name))
+        name' (cond
+                (identical? name' "..") "_DOT__DOT_"
+                (js-reserved? name') (str name' "$")
+                :else name')]
+    (if (symbol? name)
+      (symbol name')
+      (str name'))))

 (defn- demunge-str [munged-name]
   (let [r (js/RegExp. (demunge-pattern) "g")
@@ -9861,7 +9863,7 @@
             (str ret
               (.substring munged-name last-match-end
                 (- (. r -lastIndex) (. x -length)))
-              (if (= x "$") "/" (gobject/get DEMUNGE_MAP x)))
+              (if (identical? x "$") "/" (gobject/get DEMUNGE_MAP x)))
             (. r -lastIndex)))
         (str ret
           (.substring munged-name last-match-end (.-length munged-name)))))))
@@ -9869,7 +9871,7 @@
 (defn demunge [name]
   ((if (symbol? name) symbol str)
     (let [name' (str name)]
-      (if (= name' "_DOT__DOT_")
+      (if (identical? name' "_DOT__DOT_")
         ".."
         (demunge-str (str name))))))


android device back button goes back in webview #1204

--- src/status_im/android/core.cljs
+++ src/status_im/android/core.cljs
@@ -55,10 +55,15 @@
                        ;; todo: it might be better always return false from
                        ;; this listener and handle application's closing
                        ;; in handlers
-                       (let [stack (subscribe [:get :navigation-stack])
-                             creating? (subscribe [:get :creating-account?])]
+                       (let [stack      (subscribe [:get :navigation-stack])
+                             creating?  (subscribe [:get :creating-account?])
+                             result-box (subscribe [:chat-ui-props :result-box])
+                             webview    (subscribe [:get :webview-bridge])]
                          (cond
                            @creating? true
+
+                           (and @webview (:can-go-back? @result-box))
+                           (do (.goBack @webview) true)

                            (< 1 (count @stack))
                            (do (dispatch [:navigate-back]) true)