 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;  Discrete charts ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
+
+(defn median-of [n items]
+  (assert (odd? n))
+  (let [ind (quot n 2)]
+    (when (> (count items) ind)    
+      (nth (sort items) ind))))
 
 
 (defn make-dm-charts 



(def alg-forms
     {:sahtn   (fn [m] `(sahtn/sahtn ~'init #{:nav :reach :discretem-tla}))
      :aha*    (fn [m] `(aha/ah-a* ~'init true))
      :dash-a* (fn [m] `(dao/implicit-dash-a*-opt ~'init :gather true :d true :s :eager :dir :right
                                                  :choice-fn rand-nth))})

                               ["time"  "runtime (s)" :secs]]]
       (-> (datasets/ds-summarize
            (datasets/ds-derive #(/ (:ms %) 1000) (filter :ms *dm-results*) :secs)
            [:objects :alg] [[field (fn [& args] (median-of 3 args)) #_util/mean field]])
           (datasets/ds->chart
            [:alg] :objects field
            {:term "solid dashed size 2.0,1.5"
