Summarize output files suitable for plotting

This commit is contained in:
Mark Evenson 2022-09-03 08:28:31 +02:00
parent 73546f9896
commit d9c0eeebc6
2 changed files with 26 additions and 0 deletions

View File

@ -8,5 +8,6 @@
:pathname "./"
:components ((:file "package")
(:file "json-path")
(:file "plot")
(:file "glacier")))))

View File

@ -0,0 +1,25 @@
(in-package :glacier)
(defun summarize (file)
(let* ((s
(alexandria:read-file-into-string file))
(j
(jsown:parse s))
(rounds
(loop :for column :in (get-path j '$.columns)
:collecting (get-path column '$.values))))
(loop :for round :in rounds
:collecting ;; TODO optimize
(list
(length
(remove-if-not #'zerop round))
(length
(remove-if-not
(lambda (x) (= 1 x))
round))
(length
(remove-if-not
(lambda (x) (= 2 x))
round))))))