diff --git a/src/ludus/process.clj b/src/ludus/process.clj index 991fc94..02ba03f 100644 --- a/src/ludus/process.clj +++ b/src/ludus/process.clj @@ -66,12 +66,20 @@ :list {::data/type ::data/clj :name "list" - :body (fn [] (keys @processes))} + :body (fn [] (into [] (keys @processes)))} :info {::data/type ::data/clj :name "info" :body (fn [pid] (let [process @(get @processes pid) queue (into [] (:queue process))] - (assoc process :queue queue)))} + (assoc process :queue queue ::data/dict true)))} + + :flush {::data/type ::data/clj + :name "flush" + :body (fn [pid] + (let [process (get @processes pid) + queue (into [] (:queue @process))] + (swap! process #(assoc % :queue clojure.lang.PersistentQueue/EMPTY)) + queue))} }}) \ No newline at end of file diff --git a/src/ludus/show.clj b/src/ludus/show.clj index b39ccdf..beac45a 100644 --- a/src/ludus/show.clj +++ b/src/ludus/show.clj @@ -31,7 +31,7 @@ (str "#{" (apply str (into [] show-keyed (dissoc v ::data/dict))) "}") :else - (pr-str v))) + (with-out-str (pp/pprint v)))) (defn- show-set [v] (str "${" (apply str (into [] show-linear v)) "}")) @@ -47,7 +47,9 @@ (vector? v) (show-vector v) (set? v) (show-set v) (map? v) (show-map v) - :else (with-out-str (pp/pprint v)))) + :else + (with-out-str (pp/pprint v)) + )) ([v & vs] (apply str (into [] (comp (map show) (interpose " ")) (concat [v] vs)))) )