diff --git a/mevenson/simulation/glacier.asd b/mevenson/simulation/glacier.asd index d807e33..96f7bff 100644 --- a/mevenson/simulation/glacier.asd +++ b/mevenson/simulation/glacier.asd @@ -8,5 +8,6 @@ :pathname "./" :components ((:file "package") (:file "json-path") + (:file "plot") (:file "glacier"))))) diff --git a/mevenson/simulation/plot.lisp b/mevenson/simulation/plot.lisp new file mode 100644 index 0000000..11d956f --- /dev/null +++ b/mevenson/simulation/plot.lisp @@ -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)))))) + +