Respect ^:skip-wiki

Respect ^:skip-wiki

Fixes #4

--- src/grimoire/doc.clj
+++ src/grimoire/doc.clj
@@ -197,23 +197,26 @@
         fns     (filter #(and (fn? @%1)
                               (not (macro? %1)))
                         ns-vars)
-        vars    (filter #(not (fn? @%1)) ns-vars)]
-
-    (let [meta  (-> ns the-ns meta (or {}))
-          thing (ns->thing config ns)]
-      (api/write-meta (:datastore config) thing meta))
-
-    ;; write per symbol docs
-    (doseq [var ns-vars]
-      (write-docs-for-var config var))
-
-    ;; FIXME: this shouldn't be needed
-    (when (= ns 'clojure.core)
-      (write-docs-for-specials config)))
-
-  ;; FIXME: should be a real logging thing
-  (println "Finished" ns)
-  nil)
+        vars    (filter #(not (fn? @%1)) ns-vars)
+        ns-meta (-> ns the-ns meta (or {}))]
+
+    (when-not (:skip-wiki ns-meta)
+      ;; Respect ^:skip-wiki from clojure-grimoire/lein-grim#4
+
+      (let [thing (ns->thing config ns)]
+        (api/write-meta (:datastore config) thing ns-meta))
+
+      ;; write per symbol docs
+      (doseq [var ns-vars]
+        (write-docs-for-var config var))
+
+      ;; FIXME: this shouldn't be needed
+      (when (= ns 'clojure.core)
+        (write-docs-for-specials config)))
+
+    ;; FIXME: should be a real logging thing
+    (println "Finished" ns)
+    nil))

 (defn maybe-take-pair [leader args]
   (if (= (first args) leader)
@@ -353,7 +356,7 @@
                    #(t/->Version % version)
                    #(t/->Platform % platform)
                    identity])
-
+
           (doseq [ns (->> p-source-paths
                           (map io/file)
                           (tns.f/find-namespaces))]


use anon-queues, set in the reply_to property of the message from the client, rather than explicitly maintaining a a response exchange

--- src/herring/core.clj
+++ src/herring/core.clj
@@ -12,7 +12,6 @@

 (def herring-exchange "herring")
-(def response-exchange "herring_response")

 ;; Create User
@@ -42,23 +41,23 @@
 ;; Handlers
 (defn auth-handler
   "Handle requests for authentication"
-  [ch {:keys [content-type delivery-tag type] :as meta} ^bytes payload]
+  [ch {:keys [content-type delivery-tag type reply-to] :as meta} ^bytes payload]
   (println "<< in auth-handler >>") ;; debug
+  (println "<< meta : " meta)
   (if (= content-type "application/json")
     (do
       (let [data (json/read-str (String. payload "UTF-8"))
             username (get data "username")
             password (get data "password")
-            response-key (get data "responseKey")
             response-payload (json/write-str
                                (authenticate-user username password))]
         (println "RECEIVED:"
                  (clojure.string/join ", " [username
-                                            response-key
+                                            reply-to
                                             response-payload]))
         (lb/publish ch
-                    response-exchange
-                    response-key
+                    ""
+                    reply-to
                     response-payload
                     :content-type "application/json")
         (lb/ack ch delivery-tag)))
@@ -97,6 +96,4 @@
     (println "Starting herring...")
     (le/declare ch herring-exchange
                 "direct" :durable false :auto-delete true)
-    (le/declare ch response-exchange
-                "direct" :durable false :auto-delete true)
     (start-consumers ch herring-exchange)))


schema before migrations again

schema before migrations again

--- src/pc/init.clj
+++ src/pc/init.clj
@@ -30,8 +30,8 @@
    #'pc.nrepl/init
    #'pc.statsd/init
    #'pc.datomic/init
+   #'pc.datomic.schema/init
    #'pc.datomic.migrations/init
-   #'pc.datomic.schema/init
    #'pc.models.chat-bot/init
    #'pc.models.plan/init
    #'pc.nts/init


Add getter lens.

Add getter lens.

--- src/lentes/core.cljc
+++ src/lentes/core.cljc
@@ -135,6 +135,12 @@
                 f
                 (clojure.core/select-keys ks))))))

+(defn getter
+  "A simple readonly lense that runs arbitrary
+  code on focus."
+  [f]
+  (lens f #(throw (ex-info "Read only lens." {}))))
+
 (defn in
   "Given a path and optionally a default value, return a lens that
   focuses the given path in an associative data structure."


fix whitespace

fix whitespace

--- src/seajure.clj
+++ src/seajure.clj
@@ -1,5 +1,6 @@
 (ns seajure
-  (:use [net.cgrand.enlive-html :only [deftemplate content set-attr do-> clone-for]]
+  (:use [net.cgrand.enlive-html :only [deftemplate content set-attr do->
+                                       clone-for]]
         [clj.io :only [spit copy file]]))

 (def assets ["style.css" "logo.png"])


store/restore db

store/restore db

--- src/showkr.cljs
+++ src/showkr.cljs
@@ -28,10 +28,9 @@
     (add-watch data/opts ::render render)
     (add-watch data/db ::render render)

-    #_(add-watch data/world ::store
+    (add-watch data/db ::store
       (fn []
-        (binding [*print-meta* true]
-          (.setItem js/window.localStorage "data" (pr-str (:data @data/world))))))
+        (.setItem js/window.localStorage "db" (pr-str @data/db))))

     ;; listen for path changes
     (.addEventListener js/window "hashchange"
@@ -40,7 +39,9 @@
          (swap! data/opts assoc :path path)))

     ;; kick off rendering
-    (let [stored (.getItem js/window.localStorage "data")]
-      (swap! data/opts merge
-        {:target id :path (get-route)}
-        (or opts {})))))
+    (when-let [stored (.getItem js/window.localStorage "db")]
+      (binding [cljs.reader/*tag-table* (atom {"datascript/DB" db/db-from-reader})]
+        (reset! data/db (cljs.reader/read-string stored))))
+    (swap! data/opts merge
+      {:target id :path (get-route)}
+      (or opts {}))))


Revert "Perf: split some computation out of loop. Perform"

This reverts commit e1b6f0f9037eb9020a4d94fbd493b81442730156.

--- src/onyx/peer/function.clj
+++ src/onyx/peer/function.clj
@@ -76,14 +76,13 @@
       (let [replica @(:onyx.core/replica event)
             peer-state (:peer-state replica)
             segments (build-segments-to-send leaves)
-            groups (group-by :route segments)
+            groups (group-by (juxt :route :hash-group) segments)
             allocations (get (:allocations replica) job-id)]
-        (doseq [[route segs] groups]
+        (doseq [[[route hash-group] segs] groups]
           (let [peers (get allocations (get egress-tasks route))
                 active-peers (filter #(= (get peer-state %) :active) peers)
-                groups-hash (group-by :hash-group segs)]
-            (doseq [[hash-group segs*] groups-hash]
-              (when-let [target (pick-peer id active-peers hash-group max-downstream-links)]
-                (let [link (operation/peer-link event target)]
-                  (onyx.extensions/send-messages messenger event link segs*))))))
+                target (pick-peer id active-peers hash-group max-downstream-links)]
+            (when target
+              (let [link (operation/peer-link event target)]
+                (onyx.extensions/send-messages messenger event link segs)))))
         {}))))


testing

testing

--- src/otp_api_proxy/util.clj
+++ src/otp_api_proxy/util.clj
@@ -269,20 +269,19 @@
   ridership does not operate on an exact schedule."
   [plan]
   ;; see java.util.Comparator docs
-  (let [itins (or (:itineraries (:itineraries plan)) ; see comment below.
-                  (:itineraries plan))
+  (let [itins (:itineraries plan)
         itins-merged (summarize-collection (collect-by-route-sequence itins))
         itins-sorted (sort
                        (fn [a b]
                          (- (:walkDistance a) (:walkDistance b)))
                        itins-merged)]
-    ;; Format changed in 0.18 so that two itineraries tags are nested:
-    ;; <itineraries><itineraries> ... </itineraries></itineraries>
+    ;; Format changed in 0.18 so that the itinerary tag nested beneath
+    ;; itineraries is also called itineraries.
+    ;; <itineraries><itineraries> ... </itineraries>
+    ;;              <itineraries> ... </itineraries>
+    ;; </itineraries>
     ;;
     ;; This is likely a bug, but we can work around it.
-    ;;
-    ;; Hence we look for itineraries lists in both locations, however we
-    ;; insert our results into <itineraries> only.
     ;;
     ;; Ed 2015-10-17
     (assoc  plan  :itineraries itins-sorted)))


Fix StackOverflowError in overtone.sc.buffer/buffer

--- src/overtone/sc/buffer.clj
+++ src/overtone/sc/buffer.clj
@@ -97,9 +97,10 @@
   data with the specified size and num-channels. Size will be
   automatically floored and converted to a Long - i.e. 2.7 -> 2"
   ([size] (buffer size 1 ""))
-  ([size num-channels-or-name] (if (string? num-channels-or-name)
-                                 (buffer 1 num-channels-or-name)
-                                 (buffer num-channels-or-name "")))
+  ([size num-channels-or-name]
+     (if (string? num-channels-or-name)
+       (buffer size 1 num-channels-or-name)
+       (buffer size num-channels-or-name "")))
   ([size num-channels name]
      (let [size (long size)
            id   (next-id :audio-buffer)


Show all valid/invalid moves

Show all valid/invalid moves

--- src/singularity/style.cljs
+++ src/singularity/style.cljs
@@ -23,13 +23,13 @@
                    :font                "14px Calibri,Arial,sans-serif"}]
            [(keyword "g:nth-child(2n) path") {:fill sq-black}
             [:&.sel {:fill sq-sel}]
-            [:&.valid:hover {:fill sq-valid}]
-            [:&.invalid:hover {:fill sq-invalid}]]
+            [:&.valid {:fill sq-valid}]
+            [:&.invalid {:fill sq-invalid}]]
            [:path {:fill   sq-white
                    :stroke sq-text}
             [:&.sel {:fill sq-sel}]
-            [:&.valid:hover {:fill sq-valid}]
-            [:&.invalid:hover {:fill sq-invalid}]]
+            [:&.valid {:fill sq-valid}]
+            [:&.invalid {:fill sq-invalid}]]
            [:text {:font-size "20px"
                    :cursor    "default"
                    :fill      sq-text}]


refactored core.clj

refactored core.clj

--- src/maqueta/core.clj
+++ src/maqueta/core.clj
@@ -17,8 +17,7 @@
            (simpleInitApp []
              (let [teapot (load-model "Models/Teapot/Teapot.obj")
                    mat-default (load-material "Common/MatDefs/Misc/ShowNormals.j3md")
-                   box (Box. Vector3f/ZERO 2.5 2.5 1.0)
-                   wall (Geometry. "Box" box)
+                   wall (Geometry. "Box" (Box. Vector3f/ZERO 2.5 2.5 1.0))
                    mat-brick (load-material "Common/MatDefs/Misc/Unshaded.j3md")
                    gui-font (load-font "Interface/Fonts/Default.fnt")
                    hello-text (BitmapText. gui-font false)
@@ -26,27 +25,35 @@
                    sun (DirectionalLight.)]

                (.setMaterial teapot mat-default)
-               (.attachChild (.getRootNode this) teapot)

                (.setTexture mat-brick "ColorMap"
                             (load-texture "Textures/Terrain/BrickWall/BrickWall.jpg"))
-               (.setMaterial wall mat-brick)
-               (.setLocalTranslation wall 2.0 -2.5 0.0)
-               (.attachChild (.getRootNode this) wall)

-               (.detachAllChildren (.getGuiNode this))
-               (.setSize hello-text (.getRenderedSize (.getCharSet gui-font)))
-               (.setText hello-text "Hello World")
-               (.setLocalTranslation hello-text 300 (.getLineHeight hello-text) 0)
-               (.attachChild (.getGuiNode this) hello-text)
+               (doto wall
+                 (.setMaterial mat-brick)
+                 (.setLocalTranslation 2.0 -2.5 0.0))

-               (.scale ninja 0.05 0.05 0.05)
-               (.rotate ninja 0.0 -3.0 0.0)
-               (.setLocalTranslation ninja 0.0 -5.0 -2.0)
-               (.attachChild (.getRootNode this) ninja)
+               (doto hello-text
+                 (.setSize (.getRenderedSize (.getCharSet gui-font)))
+                 (.setText "Hello World")
+                 (.setLocalTranslation 300 (.getLineHeight hello-text) 0))
+
+               (doto (.getGuiNode this)
+                 .detachAllChildren
+                 (.attachChild hello-text))
+
+               (doto ninja
+                 (.scale 0.05 0.05 0.05)
+                 (.rotate 0.0 -3.0 0.0)
+                 (.setLocalTranslation 0.0 -5.0 -2.0))

                (.setDirection sun (Vector3f. -0.1 -0.7 -1.0))
-               (.addLight (.getRootNode this) sun)))))
+
+               (doto (.getRootNode this)
+                 (.attachChild teapot)
+                 (.attachChild wall)
+                 (.attachChild ninja)
+                 (.addLight sun))))))

 (defn -main [& args]
   (doto app


destroy-immediate player when going back to selection scene

--- Assets/game/board.clj
+++ Assets/game/board.clj
@@ -153,7 +153,9 @@
          #(v3+ % (delta-euler (state o :rotation) rotation)))

    (set-state! o :rotation (.eulerAngles (.transform o)))
-   (if (key-down? "escape") (@game.data/selection-fn))
+   (when (key-down? "escape")
+    (destroy-immediate @game.data/player)
+    (@game.data/selection-fn))
    (when @STANDING
    (cond
      (and (key? "w") (wheel-contact? o))


Handle IE sse resume param

Handle IE sse resume param

--- src/gin/games.clj
+++ src/gin/games.clj
@@ -287,8 +287,10 @@
                            "Cache-Control" "no-cache"
                            "Connection" "keep-alive"}
                  :body (let [c (chan)
-                             start-from (try (inc (Long/parseLong (get-in ctx [:request :headers "last-event-id"])))
-                                             (catch Exception e nil))
+                             start-from (or (try (inc (Long/parseLong (get-in ctx [:request :headers "last-event-id"])))
+                                                 (catch Exception e nil))
+                                            (try (inc (Long/parseLong (get-in ctx [:request :query-params "evs_last_event_id"])))
+                                             (catch Exception e nil)))
                              conn (get-in ctx [:request :conn])
                              listen (get-in ctx [:request :listen])
                              player (get-in ctx [:player])


scope is now in studio ns

scope is now in studio ns

--- src/overtone/api.clj
+++ src/overtone/api.clj
@@ -12,10 +12,9 @@
             [overtone.sc.cgens oscillators demand mix io buf-io env tap
              line freq beq-suite berlach bhob info]
             [overtone.music rhythm pitch tuning time]
-            [overtone.studio mixer inst util fx wavetable midi midi-player core]
+            [overtone.studio mixer inst util fx wavetable midi midi-player core scope]
             [overtone.repl ugens examples shell inst debug graphviz]
             [overtone.libs asset event]
-            [overtone.gui scope mixer control]
             [overtone.samples freesound]
             [overtone.helpers.doc :refer [fs]]))


make sure that the intro doc shows up in team docs

--- src/pc/http/team.clj
+++ src/pc/http/team.clj
@@ -34,7 +34,8 @@
                                        :frontend/id (UUID. (:db/id doc) (inc i))))
                               (read-doc "team-intro"))
                              {:db/id (d/tempid :db.part/tx)
-                              :transaction/document (:db/id doc)}
+                              :transaction/document (:db/id doc)
+                              :transaction/broadcast true}
                              {:db/id (:db/id doc)
                               :document/team (:db/id team)}))))


Enable console print in run (seems to make sure it's always called)

--- src/app/app.cljs
+++ src/app/app.cljs
@@ -9,8 +9,6 @@
             [app.components.snippet-list :refer [snippet-list]]
             [app.components.refs-menu :refer [RefMenuItem refs-menu]]
             [app.queries :refer [txbind]]))
-
-(enable-console-print!)

 (defui App
   static om/IQueryParams
@@ -94,4 +92,5 @@

 (defn run []
+  (enable-console-print!)
   (om/add-root! reconciler App (gdom/getElement "app")))


Move constant values to vars

Move constant values to vars

--- src/physim/core.cljs
+++ src/physim/core.cljs
@@ -1,8 +1,10 @@
 (ns physim.core
   (:require [THREE :as THREE]))

+(def particle-radius 20)
+(def particle-diameter (* 2 particle-radius))
 (def particle-count 10)
-(def gravity-multiplier 100)
+(def gravity-multiplier 200)
 (def speed-limit 5)
 (def initial-speed 0)

@@ -45,7 +47,8 @@

 (defn mesh-from-particle
   [p]
-  (let [geometry (THREE.SphereGeometry. 20 20 20)
+  (let [geometry (THREE.SphereGeometry.
+                  particle-radius particle-radius particle-radius)
         material (THREE.MeshNormalMaterial.)
         mesh (THREE.Mesh. geometry material)]
     (set-position! mesh (:pos p))
@@ -84,7 +87,8 @@
                   dir (map #(/ % mag) dir)]
               (map + a
                    (if (> mag 0)
-                     (map #(* % (/ gravity-multiplier (* mag mag))) dir)
+                     (map #(* % (/ gravity-multiplier
+                                   (* mag mag))) dir)
                      [0 0 0]))))
           [0 0 0]
           all))
@@ -102,7 +106,7 @@

 (defn collided?
   [a b]
-  (< (magnitude (map - a b)) 20))
+  (< (magnitude (map - a b)) particle-diameter))

 (defn handle-collisions!
   []
@@ -114,7 +118,7 @@
             abdir (map - (:pos pa) (:pos pb))
             dist (magnitude abdir)
             abdir (map #(/ % dist) abdir)
-            bounce (map #(* % (- 20 dist)) abdir)]
+            bounce (map #(* % (- particle-diameter dist)) abdir)]
         (when (and (not= a b) (collided? (:pos pa) (:pos pb)))
           (do
             (reset! particles (assoc @particles a (assoc pa :pos (map + (:pos pa) bounce) :vel (map + (:vel pa) (map #(* % (magnitude (:vel pa))) abdir)))))


Range callback not working. Going to change model from vector to pair of models.

--- src/re_com/time.cljs
+++ src/re_com/time.cljs
@@ -226,7 +226,7 @@
     (if-not (valid-time-integer? deref-model (deref-or-value min) (deref-or-value max))
       (throw (js/Error. (str "model " deref-model " is not a valid time integer."))))
      (fn [& {:keys [on-change disabled hide-border show-time-icon style]}]
-       [private-time-input tmp-model deref-model min max
+       [private-time-input tmp-model (deref-or-value model) min max
          :on-change on-change
          :disabled disabled
          :hide-border hide-border
@@ -265,7 +265,7 @@
         :children [(when from-label [:label from-label])
                    [private-time-input
                      from-model
-                     (first deref-model)
+                     (first (deref-or-value model))
                      min
                      from-max-model
                      :on-change #(updated-range-time from-model to-min-model on-change)
@@ -276,7 +276,7 @@
                    (when to-label [:label to-label])
                    [private-time-input
                      to-model
-                     (last deref-model)
+                     (last (deref-or-value model))
                      to-min-model
                      max
                      :on-change #(updated-range-time to-model from-max-model on-change)


cleanup layout of demo #2 in gap

cleanup layout of demo #2 in gap

--- src/re_demo/gap.cljs
+++ src/re_demo/gap.cljs
@@ -57,12 +57,13 @@
                                       [p " "]
                                       [:pre
                                        {:style {:width "40em"}}
-                                       "[h-box               ; <-- no :gap, so children seperated by 0px
- :children [[grey-box]
-            [gap :size \"10px\"]  ; <-- absolute gap
-            [grey-box]        ; <-- pushed as far left as possible
-            [gap :size \"1\"]   ; <-- grows as much as possible
-            [grey-box]]]      ; <-- pushed as far right as possible"]
+                                       "[h-box                 ; <-- no :gap, children seperated by 0px
+ :children [
+    [grey-box]
+    [gap :size \"10px\"] ; <-- absolute gap
+    [grey-box]         ; <-- pushed as far left as possible
+    [gap :size \"1\"]    ; <-- grows as much as possible
+    [grey-box]]]       ; <-- pushed as far right as possible"]

                                       [p "Result:"]
                                       [h-box
@@ -84,7 +85,7 @@
                                       [gap :size "10px"]
                                       [p "Notes:"
                                        [:ul
-                                        [:li "This example has a gap with a " [:span.bold "proportional size"] " of \"1\", not an absolute size. "]
+                                        [:li "This example has a gap with a " [:span.bold "proportional size"] " of \"1\", not an absolute size. Synonymous to 100%."]
                                         [:li "Because it \"grows\" to fill all available space, it \"pushes\" box2 and box3 as far apart as possible."]
                                         [:li "Imagine the boxes as buttons, to see how this might be useful."]]]
                                       ]]]]


renaming and word fiddling

renaming and word fiddling

--- src/re_frame/db.cljs
+++ src/re_frame/db.cljs
@@ -1,9 +1,12 @@
 (ns re-frame.db
-  (:require [reagent.core :as r]))
-
-;; The application state
-;; Should never be accessed directly by application code
-;; Access is mediated via handlers and subscriptions
-(def  app-db (r/atom {}))
+  (:require [reagent.core :as reagent]))

+;; -- Application State  --------------------------------------------------------------------------
+;;
+;; Should not be accessed directly by application code
+;; Access is mediated via handlers and subscriptions
+(def  app-db (reagent/atom {}))
+
+
+


Fix rill..

Fix rill..

--- src/rill/handler.clj
+++ src/rill/handler.clj
@@ -66,9 +66,8 @@
       (let [[status events :as response] (apply aggregate/handle-command primary-aggregate command rest-aggregates)]
         (case status
           :ok (if (commit-events event-store id version events)
-                ;; TODO: Ensure observers see primary aggregate as it was before/after triggering event
                 (let [new-primary (update-aggregate primary-aggregate (filter #(= (message/primary-aggregate-id %) id) events))
-                      triggered (mapcat (partial notify-observers event-store new-primary) events)]
+                      triggered (mapcat #(notify-observers event-store % new-primary) events)]
                   [:ok events (+ version (count events)) triggered])
                 [:conflict])
           :rejected response)))))


Update docs

Update docs

--- src/aurora/btree.cljs
+++ src/aurora/btree.cljs
@@ -388,10 +388,8 @@
     tree))

 ;; ITERATORS
-;; .key / .val return key and val currently pointed at. key may be aliased
-;; On creation/reset, points to first key
-;; On next, either point to next key or set .-end? true.
-;; On seek, point to first key greater than or equal to seek-key, or otherwise the last key
+;; on seek-gt, return first key greater than seek-key, or nil if there is no such key
+;; on seek-gte, return first key greater than or equal to seek-key, or nil if there is no such key
 ;; NOTE iterators are not write-safe unless reset after writing

 (deftype Iterator [tree ^:mutable node ^:mutable ix]
@@ -520,6 +518,8 @@
     (Contains. iterator (make-array key-len) (greatest-key key-len))))

 ;; SOLVER
+
+;; los and his are inclusive

 ;; TODO replace last-changed with dirty tracking
 (deftype Solver [constraints constraint->ixes constraint->los constraint->his ^:mutable los ^:mutable his ^:mutable depth pushed-los pushed-his pushed-splitters ^:mutable failed?]


Adds support/requirement for usersCount field in phrases collection.

--- src/cadence/model.clj
+++ src/cadence/model.clj
@@ -21,6 +21,7 @@
                                :user_id 1
                                :random_point "2d"})
   (mc/ensure-index "phrases" {:random_point "2d", :users 1})
+  (mc/ensure-index "phrases" {:usersCount 1})
   (mc/ensure-index "phrases" {:phrase-id 1})
   (mc/ensure-index "phrases" {:phrase 1} {:unique 1 :dropDups 1})
   (mc/ensure-index "classifiers" {:user_id 1
@@ -75,7 +76,9 @@
 (defn add-trained-user-to-phrase
   "Adds the given user-id to the array of users for the given phrase."
   [user-id phrase-id]
-  (mc/update-by-id "phrases" phrase-id {$addToSet {:users user-id}}))
+  (mc/update-by-id "phrases" phrase-id {$addToSet {:users user-id}
+                                        ;; Increment count by 1 too.
+                                        $inc {:usersCount 1}}))

 (defn add-phrases
   "Batch inserts phrases to be used for training and auth."
@@ -87,6 +90,7 @@
                            ; This will be used to store the id's of users who
                            ; have completed training with this phrase.
                            :users []
+                           :usersCount 0
                            :random_point [(rand) 0]}) phrases)))

 (defn identity
@@ -113,6 +117,7 @@
   (let [result (mc/find-one-as-map "phrases"
                                    (if for-auth?
                                      {:users user-id
+                                      :usersCount {$gt 5}
                                       :random_point {"$near" [(rand) 0]}}
                                      {:users {$ne user-id}
                                       :random_point {"$near" [(rand) 0]}})


Simplify state/merge. Fix state/get..

Simplify state/merge. Fix state/get..

--- src/cadence/state.clj
+++ src/cadence/state.clj
@@ -5,16 +5,17 @@

 (def state
   "A map describing the state of the application."
-  (atom {:mode :dev :port 80}))
+  (atom {:mode :development
+         :port 80}))

-(def get
+(defn get [& args]
   "Get a value for the given key from the current state."
-  (partial clojure.core/get @state))
+  (apply clojure.core/get @state args))

 (defn merge
   "Get a value for the given key from the current state."
   [new-state]
-  (swap! state (fn [old-state] (clojure.core/merge old-state new-state))))
+  (swap! state clojure.core/merge new-state))

 (defn compute
   "Compute the state from the given environment."


personel-name and personel-relator-term are handled separately

--- src/catalog/vubis.clj
+++ src/catalog/vubis.clj
@@ -26,8 +26,6 @@
    :language [:datafield (attr= :tag "041") :subfield (attr= :code "a")] ; Sprache
    :general-note [:datafield (attr= :tag "500") :subfield (attr= :code "a")] ; Land, Erscheinungsjahr (des Originalfilms)
    :accompanying-material [:datafield (attr= :tag "300") :subfield (attr= :code "e")] ; Begleitmaterial oder Spiel-Materialdetails
-   :personel-name [:datafield (attr= :tag "700") :subfield (attr= :code "a")] ; Regie oder Darsteller
-   :personel-relator-term [:datafield (attr= :tag "700") :subfield (attr= :code "e")]
    :narrators [:datafield (attr= :tag "709") :subfield (attr= :code "a")] ; Sprecher
    :duration [:datafield (attr= :tag "391") :subfield (attr= :code "a")] ; Spieldauer
    :braille-grade [:datafield (attr= :tag "392") :subfield (attr= :code "a")] ; Schriftart Braille


Don't re-use connection managers for now.

--- src/clj_http/core.clj
+++ src/clj_http/core.clj
@@ -11,7 +11,7 @@
                                            HttpEntityEnclosingRequestBase)
            (org.apache.http.client.params CookiePolicy ClientPNames)
            (org.apache.http.conn.scheme SchemeRegistry Scheme)
-           (org.apache.http.impl.conn.tsccm ThreadSafeClientConnManager)
+           (org.apache.http.impl.conn SingleClientConnManager)
            (org.apache.http.conn.ssl SSLSocketFactory TrustStrategy)
            (org.apache.http.impl.client DefaultHttpClient)
            (org.apache.http.conn.params ConnRoutePNames)))
@@ -32,18 +32,20 @@
     (.setURI res (URI. url))
     res))

-(def insecure-socket-factory
+(def ^{:private true} insecure-socket-factory
   (doto (SSLSocketFactory. (reify TrustStrategy
                              (isTrusted [_ _ _] true)))
-    ;; TODO: should this be controlled by a separate flag?
     (.setHostnameVerifier SSLSocketFactory/ALLOW_ALL_HOSTNAME_VERIFIER)))

-(def insecure-connection-manager
-  (ThreadSafeClientConnManager.
-   (doto (SchemeRegistry.)
-     (.register (Scheme. "https" insecure-socket-factory 443)))))
+(def ^{:private true} insecure-scheme-registry
+  (doto (SchemeRegistry.)
+    (.register (Scheme. "https" insecure-socket-factory 443))))

-(def connection-manager (ThreadSafeClientConnManager.))
+;; TODO: allow re-use of ThreadSafeClientConnManager
+(defn- connection-manager [& [insecure?]]
+  (if insecure?
+    (SingleClientConnManager. insecure-scheme-registry)
+    (SingleClientConnManager.)))

 (defn request
   "Executes the HTTP request corresponding to the given Ring request map and
@@ -54,9 +56,7 @@
   [{:keys [request-method scheme server-name server-port uri query-string
            headers content-type character-encoding body socket-timeout
            conn-timeout debug insecure?] :as req}]
-  (let [http-client (if insecure?
-                      (DefaultHttpClient. insecure-connection-manager)
-                      (DefaultHttpClient.))]
+  (let [http-client (DefaultHttpClient. (connection-manager insecure?))]
     (try
       (doto http-client
         (set-client-param ClientPNames/COOKIE_POLICY


hide password on blur

hide password on blur

--- src/cljs/pw/core.cljs
+++ src/cljs/pw/core.cljs
@@ -39,6 +39,8 @@
     (go (let [fetched (<! rc)]
           (om/transact! state (fn [s] (assoc s :fetched fetched)))))))

+(defn blank-out [fetched] (om/transact! fetched (constantly nil)))
+
 (defn output [fetched owner]
   (reify
     om/IRender
@@ -48,7 +50,9 @@
         (:error fetched) [:input#result.error
                           {:value (:error fetched) :ref "result"}]
         (:pass fetched) [:input#ugh.result
-                         {:value (:pass fetched) :ref "result"}]
+                         {:value (:pass fetched)
+                          :ref "result"
+                          :onBlur (partial blank-out fetched)}]
         :else nil)))
     om/IDidUpdate
     (did-update [_ _ _]
@@ -57,7 +61,7 @@
           (.focus (om/get-node owner "result"))
           (.select (om/get-node owner "result"))
           (go (let [_ (<! timeout-chan)]
-                (om/transact! fetched (constantly nil)))))))))
+                (blank-out fetched))))))))

 (defn fetch-password-if-enter [state evt]
   (when (= (.-keyCode evt) 13)


exclude-clojure -> exclude (+ syms)

exclude-clojure -> exclude (+ syms)

--- src/tailrecursion/boot.clj
+++ src/tailrecursion/boot.clj
@@ -14,11 +14,11 @@
 (defn find-idx [v val]
   (ffirst (filter (comp #{val} second) (map vector (range) v))))

-(defn exclude-clojure [coordinate]
+(defn exclude [syms coordinate]
   (if-let [idx (find-idx coordinate :exclusions)]
     (let [exclusions (core/get coordinate (inc idx))]
-      (assoc coordinate (inc idx) (conj exclusions 'org.clojure/clojure)))
-    (into coordinate [:exclusions ['org.clojure/clojure]])))
+      (assoc coordinate (inc idx) (into exclusions syms)))
+    (into coordinate [:exclusions syms])))

 (def env
   (atom {:dependencies {} :directories #{}, :boot-version nil}))
@@ -29,7 +29,7 @@

 (defn install [{:keys [coordinates repositories]}]
   (let [deps (pom/add-dependencies
-              :coordinates (mapv exclude-clojure coordinates)
+              :coordinates (mapv (partial exclude ['org.clojure/clojure]) coordinates)
               :repositories (merge *default-repositories* repositories))]
     (swap! env update-in [:dependencies] merge deps)))

@@ -37,7 +37,7 @@
   (let [meth (doto (.getDeclaredMethod URLClassLoader "addURL" (into-array Class [URL]))
                (.setAccessible true))]
     (.invoke meth (ClassLoader/getSystemClassLoader)
-             (into-array Object (map #(.. (io/file %) toURI toURL) dirs)))
+             (object-array (map #(.. (io/file %) toURI toURL) dirs)))
     (swap! env update-in [:directories] into dirs)))

 (defn version [string]


#28 comment

#28 comment

--- src/tamaki_core/server.clj
+++ src/tamaki_core/server.clj
@@ -1,32 +1,35 @@
 (ns kalar-core.server
-  (:require [kalar-core.config :refer [read-config]]
+  (:require [tamaki-core.config :refer [read-config]]
             [kalar-core.file.tracker :as tracker]
              [compojure.core :refer [GET defroutes]]
              [compojure.route :as route]
              [ring.util.response :refer [redirect]]
              ))

-(defn load-plugins []
-  (doseq [plugin (-> (read-config) :plugins)]
-    (require plugin)
-    ((-> (symbol (str plugin "/" 'load-plugin)) resolve var-get))))
+(comment
+  (defn load-plugins []
+    (doseq [plugin (-> (read-config) :plugins)]
+      (require plugin)
+      ((-> (symbol (str plugin "/" 'load-plugin)) resolve var-get)))))

-(defn init []
-  (load-plugins))
+(comment
+  (defn init []
+    (load-plugins)))

 (defroutes handler
   (GET ":prefix{.*}/" [prefix] (redirect (str prefix "/index.html")))
   (route/resources "/" {:root (:dest (read-config))})
   (route/not-found "Page not found"))

-(def ^{:private true} track (tracker/track "resources"))
+(comment (def ^{:private true} track (tracker/track "resources")))

-(defn- wrap-tracker [handler]
-  (fn [request]
-    (let [diff (track)]
-      (if (not (and (empty? (:removed diff)) (empty? (:created diff))))
-        (load-plugins))
-      (handler request))))
+(comment
+  (defn- wrap-tracker [handler]
+    (fn [request]
+      (let [diff (track)]
+        (if (not (and (empty? (:removed diff)) (empty? (:created diff))))
+          (load-plugins))
+        (handler request)))))

-(def app (wrap-tracker handler))
+(comment (def app (wrap-tracker handler)))


elliot/search.clj: removed erronous fn

elliot/search.clj: removed erronous fn

--- src/elliot/search.clj
+++ src/elliot/search.clj
@@ -6,10 +6,6 @@

 (def connection (:solr-connection config/all))
 (def block-connection (:solr-block-connection config/all))
-
-(defn process-highlights [response]
-  (println (response :highlights))
-  response)

 (defn query-solr-for-blocks [query-struct doc]
   (common/mapply


slamming no longer needed at queue fns

slamming no longer needed at queue fns

--- src/navigator.clj
+++ src/navigator.clj
@@ -69,32 +69,23 @@

 ;; queue functions

-(defn task-in [db-conn message]
-  (let [task (merge {:task/id-sk (str (get-in message [:header :entity-id :task-id]))}
-                    (hatch/slam-all (get-in message [:payload :entity]) :task))]
-    (tx-entity! db-conn :task task)))
+(defn task-in [db-conn task]
+  (tx-entity! db-conn :task task))

-(defn comp-in [db-conn message]
-  (let [comp (merge {:comp/id-sk (str (get-in message [:header :entity-id :comp-id]))}
-                    (hatch/slam-all (get-in message [:payload :entity]) :comp))]
-    (tx-entity! db-conn :comp comp)))
+(defn comp-in [db-conn comp]
+  (tx-entity! db-conn :comp comp))

-(defn comp-tag-in [db-conn message]
-  (let [comp-tag (hatch/slam-all (get-in message [:payload :entity]) :comp-tag)]
-    (tx-entity! db-conn :comp-tag comp-tag)))
+(defn comp-tag-in [db-conn comp-tag]
+  (tx-entity! db-conn :comp-tag comp-tag))

-(defn perf-asmt-in [db-conn message]
-  (let [perf-asmt (merge {:perf-asmt/id-sk (str (get-in message [:header :entity-id :perf-asmt-id]))}
-                         (hatch/slam-all (get-in message [:payload :entity]) :perf-asmt))]
-    (tx-entity! db-conn :perf-asmt perf-asmt)))
+(defn perf-asmt-in [db-conn perf-asmt]
+  (tx-entity! db-conn :perf-asmt perf-asmt))

-(defn user2comp-in [db-conn message]
-  (let [user2comp (hatch/slam-all (get-in message [:payload :entity]) :user2comp)]
-    (tx-entity! db-conn :user2comp user2comp)))
+(defn user2comp-in [db-conn user2comp]
+  (tx-entity! db-conn :user2comp user2comp))

-(defn user2perf-asmt-in [db-conn message]
-  (let [user2perf-asmt (hatch/slam-all (get-in message [:payload :entity]) :user2perf-asmt)]
-    (tx-entity! db-conn :user2perf-asmt user2perf-asmt)))
+(defn user2perf-asmt-in [db-conn user2perf-asmt]
+  (tx-entity! db-conn :user2perf-asmt user2perf-asmt))

 (comment


Indent for ago-restore.

Indent for ago-restore.

--- src/ago/core.cljs
+++ src/ago/core.cljs
@@ -425,28 +425,28 @@
         (assoc :smas-new (copy-sma-map (:smas-new ago-world-now))))))

 (defn ago-restore [ago-world snapshot]
-    (let [ss (ago-snapshot (atom snapshot)) ; Re-snapshot so snapshot stays immutable.
-          [recycled-smas reborn-smas] (ago-judge-state-machines (:bufs ss)
-                                                                (:smas ss)
-                                                                (:smas @ago-world))
-          [recycled-smasN reborn-smasN] (ago-judge-state-machines (:bufs ss)
-                                                                  (:smas-new ss)
-                                                                  (:smas-new @ago-world))
-          branch-id (- ((:gen-id @ago-world)))] ; Negative in case snapshot re-restored.
-      (swap! ago-world #(-> %
-                            (assoc :seqv (conj (:seqv ss) branch-id 0))
-                            (assoc :bufs (:bufs ss))
-                            (assoc :smas recycled-smas)
-                            (assoc :smas-new recycled-smasN)
-                            (assoc :closed (:closed ss))
-                            (assoc :logical-ms (:logical-ms ss))
-                            (assoc :physical-ms (now))
-                            (assoc :timeouts (:timeouts ss))
-                            (assoc :latches (:latches ss))))
-      (doseq [[sma-old ss-buf-id] reborn-smas]
-        (ago-revive-state-machine ago-world sma-old ss-buf-id))
-      (doseq [[sma-old ss-buf-id] reborn-smasN]
-        (ago-revive-state-machine ago-world sma-old ss-buf-id))
-      (when (seq (:timeouts @ago-world))
-        (timeout-handler ago-world))
-      ago-world))
+  (let [ss (ago-snapshot (atom snapshot)) ; Re-snapshot so snapshot stays immutable.
+        [recycled-smas reborn-smas] (ago-judge-state-machines (:bufs ss)
+                                                              (:smas ss)
+                                                              (:smas @ago-world))
+        [recycled-smasN reborn-smasN] (ago-judge-state-machines (:bufs ss)
+                                                                (:smas-new ss)
+                                                                (:smas-new @ago-world))
+        branch-id (- ((:gen-id @ago-world)))] ; Negative in case snapshot re-restored.
+    (swap! ago-world #(-> %
+                          (assoc :seqv (conj (:seqv ss) branch-id 0))
+                          (assoc :bufs (:bufs ss))
+                          (assoc :smas recycled-smas)
+                          (assoc :smas-new recycled-smasN)
+                          (assoc :closed (:closed ss))
+                          (assoc :logical-ms (:logical-ms ss))
+                          (assoc :physical-ms (now))
+                          (assoc :timeouts (:timeouts ss))
+                          (assoc :latches (:latches ss))))
+    (doseq [[sma-old ss-buf-id] reborn-smas]
+      (ago-revive-state-machine ago-world sma-old ss-buf-id))
+    (doseq [[sma-old ss-buf-id] reborn-smasN]
+      (ago-revive-state-machine ago-world sma-old ss-buf-id))
+    (when (seq (:timeouts @ago-world))
+      (timeout-handler ago-world))
+    ago-world))


quoting grep line

quoting grep line

--- src/hooks/dnsmasq.clj
+++ src/hooks/dnsmasq.clj
@@ -47,7 +47,7 @@
     (let [remote {:host dnsmasq :user user} line (hostline domain (:machine (s/get-system system-id)))
         hosts-file' (str hosts-file) ]
     (execute
-       (bash- (chain-or ("grep" "-q" ~line ~hosts-file')
+       (bash- (chain-or ("grep" "-q" (quoted ~line) ~hosts-file')
            (pipe ("echo" ~line) (~sudo "tee" "-a" ~hosts-file' ">> /dev/null")))) remote)
     (restart remote) hosts-file)
     (catch Throwable t (error t) hosts-file)))


transducers

transducers

--- transducers.clj
+++ transducers.clj
@@ -1,4 +1,4 @@
-(ns transducers
+(ns  transducers
   (:use [clojure.core.async :only [<! go timeout chan >! put! <!!]]))


got rid of dev comments

got rid of dev comments

--- sidecar/src/figwheel_sidecar/repl_api.clj
+++ sidecar/src/figwheel_sidecar/repl_api.clj
@@ -8,12 +8,6 @@
 ;; giving this var a uniq name anticipating this library to be
 ;; included with clojure :use, and system could easily clash
 (defonce ^:dynamic *repl-api-system* nil)
-
-#_(def temp-config
-  {:figwheel-options {:css-dirs ["resources/public/css"]
-                      :nrepl-port 7888}
-   :build-ids  ["example"]
-   :all-builds (fs/get-project-builds)})

 (defn start-figwheel!
   "If you aren't connected to an env where fighweel is running already,
@@ -27,8 +21,6 @@
      (alter-var-root #'*repl-api-system* component/start)
      ;; if no system exists try to read in a configuration
      (start-figwheel! (config/fetch-config)))))
-
-#_ (start-figwheel! temp-config)

 (defn stop-figwheel!
   "If a figwheel process is running, this will stop all the Figwheel autobuilders and stop the figwheel Websocket/HTTP server."


Remove unused :require in ansi.clj

Remove unused :require in ansi.clj

--- src/zprint/ansi.cljc
+++ src/zprint/ansi.cljc
@@ -1,5 +1,4 @@
-(ns ^:no-doc zprint.ansi
-  (:require clojure.string))
+(ns ^:no-doc zprint.ansi)

 ;;
 ;; # Do ANSI Escape code processing


Modify `content-pre-wrap` to allow multiple content passes on the same file

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -3,7 +3,9 @@
   (:require [boot.core :as boot :refer [deftask]]
             [boot.pod :as pod]
             [boot.util :as u]
+            [clojure.data :as data]
             [clojure.java.io :as io]
+            [clojure.set :as set]
             [clojure.string :as string]
             [clojure.edn :as edn]
             [io.perun.core :as perun]
@@ -140,42 +142,80 @@
       (pm/set-meta fileset updated-metas)
       (commit fileset tmp))))

+;; These are modified diff functions from boot. They can be removed if/when
+;; this PR is merged: https://github.com/boot-clj/boot/pull/566
+(defn- diff-tree
+  [tree props]
+  (let [->map #(select-keys % props)]
+    (reduce-kv #(assoc %1 %2 (->map %3)) {} tree)))
+
+(defn- diff*
+  [{t1 :tree :as before} {t2 :tree :as after} props]
+  (if-not before
+    {:added   after
+     :removed (assoc after :tree {})
+     :changed (assoc after :tree {})}
+    (let [props        (or (seq props) [:id])
+          d1           (diff-tree t1 props)
+          d2           (diff-tree t2 props)
+          [x y z]      (map (comp set keys) (data/diff d1 d2))
+          changed-keys (set/union (set/intersection x y)
+                                  (set/intersection (set/union x y) z))]
+      {:added   (->> (set/difference y x changed-keys) (select-keys t2) (assoc after :tree))
+       :removed (->> (set/difference x y changed-keys) (select-keys t1) (assoc after :tree))
+       :changed (->> changed-keys                      (select-keys t2) (assoc after :tree))})))
+
+(defn- diff
+  [before after & props]
+  (let [{:keys [added changed]}
+        (diff* before after props)]
+    (update-in added [:tree] merge (:tree changed))))
+
 (defn content-pre-wrap
   "Wrapper for input parsing tasks. Calls `parse-form` on new or changed
   files with extensions in `extensions`, adds `tracer` to `:io.perun/trace`
-  and writes files for subsequent tasks to process, if desired. Pass
+  and writes files for subsequent tasks to process, if desired.
+  `output-extension` can be used to indicate the type of file the task produces,
+  or pass `nil` to overwrite with a file of the same name and extension. Pass
   `pod` if one is needed for parsing"
-  [parse-form extensions output-extension tracer options & [pod]]
-  (let [tmp     (boot/tmp-dir!)
-        prev-fs (atom nil)]
+  [parse-form-fn extensions output-extension tracer options & [pod]]
+  (let [tmp  (boot/tmp-dir!)
+        prev (atom {})]
     (boot/with-pre-wrap fileset
       (let [global-meta (pm/get-global-meta fileset)
-            changed-meta* (meta-by-ext (boot/fileset-diff @prev-fs fileset :hash) extensions)
+            prev-fs (:fs @prev)
+            parse-form (parse-form-fn (meta-by-ext (boot/fileset-diff prev-fs fileset :hash) extensions))
             changed-meta (trace tracer
-                                (if pod
-                                  (pod/with-call-in @pod ~(parse-form changed-meta*))
-                                  (eval (parse-form changed-meta*))))
-            input-fs (-> (if @prev-fs
-                           (pm/set-meta fileset (meta-by-ext @prev-fs extensions))
-                           fileset)
+                                ;; Change `diff` to boot/fileset-diff when
+                                ;; https://github.com/boot-clj/boot/pull/566 is merged
+                                (into (meta-by-ext (diff prev-fs fileset pm/+meta-key+) extensions)
+                                      (if pod
+                                        (pod/with-call-in @pod ~parse-form)
+                                        (eval parse-form))))
+            input-fs (-> fileset
+                         (pm/set-meta (:meta @prev))
                          (pm/set-meta changed-meta))
             input-meta (meta-by-ext input-fs extensions)
             output-meta (doall
                          (for [{:keys [path parsed filename] :as entry*} input-meta]
-                           (let [new-path (->> output-extension
-                                               (string/replace path #"(?i).[a-z]+$")
-                                               (perun/create-filepath (:out-dir options)))
+                           (let [out-dir (:out-dir options)
+                                 new-path (if output-extension
+                                            (->> output-extension
+                                                 (string/replace path #"(?i).[a-z]+$")
+                                                 (perun/create-filepath out-dir))
+                                            (perun/create-filepath out-dir path))
                                  entry (-> entry*
                                            (dissoc :parsed :original)
-                                           (merge {:original-path path
-                                                   :out-dir (:out-dir options)}
+                                           (merge {:original-path path}
+                                                  (when out-dir
+                                                    {:out-dir out-dir})
                                                   (pm/path-meta new-path global-meta)))]
                              (perun/create-file tmp new-path parsed)
                              entry)))
             new-fs (-> input-fs
                        (commit tmp)
                        (pm/set-meta output-meta))]
-        (reset! prev-fs new-fs)
+        (reset! prev {:fs fileset :meta input-meta})
         new-fs))))

 (def ^:private markdown-deps


minor fix from log in to login

minor fix from log in to login

--- src-cljs/frontend/components/errors.cljs
+++ src-cljs/frontend/components/errors.cljs
@@ -22,7 +22,7 @@
            [:div.container
             [:h1 status]
             [:h3 (str (condp = status
-                        401 "Log in required"
+                        401 "Login required"
                         404 "Page not found"
                         500 "Internal server error"
                         "Something unexpected happened"))]]]


Fetch data when page is loaded from a link.

--- src-cljs/kixi/hecuba/tabs/hierarchy.cljs
+++ src-cljs/kixi/hecuba/tabs/hierarchy.cljs
@@ -179,15 +179,19 @@
         (log "Setting selected sensors to: " sensors)
         (let [sensors-hashmap (into #{} (str/split sensors #";"))]
           (om/update! data [:properties :chart :sensors] sensors-hashmap)
-          (om/update! data [:properties :sensors :selected] sensors-hashmap)
-          ;; If sensors are selected, load sensors tab as default.
-          (when (-> @data :properties :chart :sensors seq)
-            (om/update! data [:properties :active-tab] :sensors))))
+          (om/update! data [:properties :sensors :selected] sensors-hashmap)))

       (when (or (not= start-date old-start-date)
                 (not= end-date old-end-date))
         (log "Setting date range to: " start-date end-date)
-        (om/update! data [:properties :chart :range] {:start-date start-date :end-date end-date}))
+        (om/update! data [:properties :chart :range] {:start-date start-date :end-date end-date})
+        ;; If sensors are selected and there's nothing in old history, load sensors tab as default
+        ;; and fetch measurements.
+        (when (and (-> @data :properties :chart :sensors seq)
+                   (empty? old-nav)
+                   start-date end-date properties)
+          (om/update! data [:properties :active-tab] :sensors)
+          (data/fetch-measurements (:properties data) properties (into #{} (str/split sensors #";")) start-date end-date)))

       (when (and programmes (seq (-> @data :programmes :data)))
         (let [selected-programme (first (filter #(= (:programme_id %) programmes) (-> @data :programmes :data)))]


simplify functions

simplify functions

--- src/yorck_ratings/core.clj
+++ src/yorck_ratings/core.clj
@@ -40,28 +40,26 @@
   (let [pattern (Pattern/compile "^([\\w\\s]+), (\\w{3})", Pattern/UNICODE_CHARACTER_CLASS)]
     (str/replace-first title pattern "$2 $1")))

-(def yorck-titles
-  (fn [yorck-page]
-    (->> yorck-page
-         (h/select (h/descendant
-                     (h/class :movie-details)
-                     (h/tag :h2)))
-         (mapcat :content)
-         (map rotate-article)
-         (map #(RatedMovie. nil nil nil %))
-         vec)))
+(defn yorck-titles [yorck-page]
+  (->> yorck-page
+       (h/select (h/descendant
+                   (h/class :movie-details)
+                   (h/tag :h2)))
+       (mapcat :content)
+       (map rotate-article)
+       (map #(RatedMovie. nil nil nil %))
+       vec))

-(def imdb-title
-  (fn [sp]
-    (->> sp
-         (h/select (h/descendant
-                     (h/class :posters)
-                     (h/class :poster)
-                     (h/class :title)
-                     (h/tag :a)))
-         first
-         :content
-         first)))
+(defn imdb-title [sp]
+  (->> sp
+       (h/select (h/descendant
+                   (h/class :posters)
+                   (h/class :poster)
+                   (h/class :title)
+                   (h/tag :a)))
+       first
+       :content
+       first))

 (defn imdb-titles [yorck-infos fetch-f]
   (let [chs (repeatedly (partial a/chan 1))]