Skip to content

Instantly share code, notes, and snippets.

@whamtet
Created April 22, 2022 01:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whamtet/114980b6c625205458d0e8d02b917bb0 to your computer and use it in GitHub Desktop.
Save whamtet/114980b6c625205458d0e8d02b917bb0 to your computer and use it in GitHub Desktop.
#!/usr/local/bin/planck
(require '[planck.core :refer [*in* slurp]])
(require '[clojure.string :as string])
(defn replaces [s]
(reduce
(fn [s [k v]]
(string/replace s k v))
s
{"Object {" "{"
"Array [" "["}))
(defn map-lines [f s]
(->> (.split s "\n")
(map f)
(string/join "\n")))
(defn remove+- [s]
(let [s (.trim s)]
(if (or (.startsWith s "+") (.startsWith s "-"))
(.substring s 1)
s)))
(->> *in*
slurp
replaces
(map-lines remove+-)
println)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment