improve listar

master
CrossNox 3 years ago
parent 824182d12c
commit 91c5d80df3
  1. 12
      src/rustint/core.clj

@ -2124,16 +2124,20 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn flistar [ilevel t nxt] (defn flistar [ilevel t nxt]
(let [
preceding_space (clojure.string/join (repeat (* ilevel 2) " ")),
bracket_prec_space (clojure.string/join (repeat (* (- ilevel 1) 2) " "))
]
(cond (cond
(string? t) (format "\"%s\" " t) (string? t) (format "\"%s\" " t)
(= t (symbol "{")) (clojure.string/join (= t (symbol "{")) (format "\n%s{\n%s" bracket_prec_space preceding_space)
(cons "\n{\n" (repeat (* ilevel 2) " ")) (= t (symbol "}")) (format "\n%s}" bracket_prec_space)
) (= t (symbol ";")) (format ";\n%s" preceding_space)
(= t (symbol "}")) "\n}"
(and (not= nxt (symbol "{")) (not= nxt (symbol "}"))) (format "%s " t) (and (not= nxt (symbol "{")) (not= nxt (symbol "}"))) (format "%s " t)
:else (format "%s" t) :else (format "%s" t)
) )
) )
)
(defn listar [l] (defn listar [l]
(let [contadores (hash-map (symbol "{") 1, (symbol "}") -1), (let [contadores (hash-map (symbol "{") 1, (symbol "}") -1),

Loading…
Cancel
Save