   [f window xs]
   (pmap f (partition window 1 xs)))
 
+(defn make-monotonic [fn coll]
+  "Note that fn has to be min or max"
+  (loop [acc (first coll) l (seq coll) res []]
+    (if (empty? l)
+        res
+        (recur (fn acc (first l))
+               (rest l)
+               (conj res (fn acc (first l)))))))
+
 ;; WHOOPBANG
 
 ;; The following is a routine, under the header WHOOPBANG,

  (->> (deseasonalize ts)
       (windowed-apply ols-coefficient long-block)
       (windowed-apply average window)
       (reduce min)))



;; WHIZBANG


         (map (partial lengthening-ts start-pd end-pd))
         (apply map long-trend))))


