From 331b4a0134587d8516d56da9a4a381236bbb67d2 Mon Sep 17 00:00:00 2001 From: gered Date: Tue, 8 Mar 2016 18:21:06 -0500 Subject: [PATCH] add "tools" namespace, for handy development functions/code --- vwowrla.core/repl/tools.clj | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 vwowrla.core/repl/tools.clj diff --git a/vwowrla.core/repl/tools.clj b/vwowrla.core/repl/tools.clj new file mode 100644 index 0000000..6c3c8df --- /dev/null +++ b/vwowrla.core/repl/tools.clj @@ -0,0 +1,25 @@ +(ns tools + (:import + (java.util TimeZone)) + (:require + [clojure.java.io :as io]) + (:use + vwowrla.core.parser)) + +(def opts {:log-owner-char-name "Blasticus" + :year 2016 + :timezone (TimeZone/getDefault) + :windows? false}) + +(defn collect-unique-entity-names + [f options] + (with-open [rdr (io/reader f)] + (->> (line-seq rdr) + (reduce + (fn [entity-names ^String line] + (let [event (parse-line line options)] + (-> entity-names + (conj (:source-name event)) + (conj (:target-name event))))) + #{}) + (remove nil?))))