 (def w-slide (* 1000 60 20))
 
 (doseq [p people]
-  (let [segment (assoc p :window-key (.getTime (random-timestamp)))
-        assigned-extents (wids 0 w-range w-slide segment)]
+  (let [w-key :event-time
+        segment (assoc p w-key (.getTime (random-timestamp)))
+        assigned-extents (wids 0 w-range w-slide w-key segment)]
     (doseq [e assigned-extents]
       (swap! state update e conj p))))
 

;; WID requires that a strict lower-bound of the windowing attribute
;; be defined. In our example, this will be 0. We will use a window
;; range of 20, and a slide value of 5. `extents` tells of which values
;; of `:window-key` fall into their respect windows via:
;;
;; (doseq [n (range 20)]
;;  (println n ": " (extents 0 20 5 n)))

;; `wids` is defined in section 3.4 of the paper. This is the variant
;; of the algorithm that also covers the case where range and slide
;; are defined on the same value.
(defn wids-lower [min-windowing-attr w-slide w-key t]
  (dec (long (Math/floor (/ (- (get t w-key)
                               min-windowing-attr) w-slide)))))

(defn wids-upper [min-windowing-attr w-range w-slide w-key t]
  (dec (long (Math/floor (/ (- (+ (get t w-key) w-range)
                               min-windowing-attr) w-slide)))))

(defn wids [min-windowing-attr w-range w-slide w-key t]
  (let [lower (wids-lower min-windowing-attr w-slide w-key t)
        upper (wids-upper min-windowing-attr w-range w-slide w-key t)]
    (range (inc lower) (inc upper))))

;; The follow code runs through 30 segments with
