Make hy-repr use double spaces for dictionaries

This commit is contained in:
Kodi Arfer 2017-10-31 11:58:25 -07:00
parent 199bb70150
commit 90a09b5b44
2 changed files with 14 additions and 6 deletions

View File

@ -44,9 +44,17 @@
(hy-repr-register tuple (fn [x]
(+ "(," (if x " " "") (-cat x) ")")))
(hy-repr-register dict :placeholder "{...}" (fn [x]
(+ "{" (-cat (reduce + (.items x))) "}")))
(setv text (.join " " (genexpr
(+ (hy-repr k) " " (hy-repr v))
[[k v] (.items x)])))
(+ "{" text "}")))
(hy-repr-register HyDict :placeholder "{...}" (fn [x]
(+ "{" (-cat x) "}")))
(setv text (.join " " (genexpr
(+ (hy-repr k) " " (hy-repr v))
[[k v] (partition x)])))
(if (% (len x) 2)
(+= text (+ " " (hy-repr (get x -1)))))
(+ "{" text "}")))
(hy-repr-register [set HySet] (fn [x]
(+ "#{" (-cat x) "}")))
(hy-repr-register frozenset (fn [x]