       (fn [[ev' ev]] (assoc ev' :metric (- (:metric ev') (:metric ev))))
       (map vector (rest l) l)))
     children))
+
+
+(defn |>| [& args] (apply > (map #(Math/abs %) args)))
+(defn |<| [& args] (apply < (map #(Math/abs %) args)))
+
+(defn maxpdiff
+  "计算最大变化率，与 aggregate 搭配使用(MAX Percentage DIFFerence)"
+  [& m]
+  (let [r (last m)]
+    (->> (map #(/ (- r %) r) m)
+         (reduce (fn [v v'] (if (> (Math/abs v') (Math/abs v)) v' v))))))
 
 
 (defn feed-dog

        (smap :metric
          (with {:state :ok}
            (apply sdo children)))))))

  [from to & children]
  (apply smap #(assoc % to (from %)) children))

(defn ->difference
  "接受事件的数组，变换成另外一个事件数组。
   新的事件数组中，每一个事件的 metric 是之前相邻两个事件 metric 的差。
