Fork me on GitHub
#clojurescript
<
2021-11-26
>
grav20:11:41

Howdy! ClojureScript's pprint seems to be appending whitespace to linebreaks.

grav20:11:57

Here's an example:

(with-out-str (pprint ['yay
        {:lirum :larum}
        {:foo {:bum/bar
          [{:ding/baz {:buz 42}}
           {:ding 'dong}]}}]))
This will insert a line break after yay and :larum}, but also a space before the line break, so [yay \n {:lirum :larum} \n ... This behaviour is different than that of Clojure's pprint, and eg generating edn with clojurescript might make a linter angry.

grav21:11:40

I created a test-case that fails for cljs.pprint/pprint, but passes for jvm-clojure's pprint. I wanted to see if I could fix it, by creating a new ns, cljs.pprint2, and pasting in the content of https://github.com/clojure/clojurescript/blob/master/src/main/cljs/cljs/pprint.cljs However, using cljs.pprint2/pprint, the test now passes. The mysterious thing is that cljs.pprint.cljs hasn't changed in two years, according to the repo, and I'm using latest 1.10.891.

Arthur23:11:45

Yes, it is possible to use MUI’s selects in your clojurescript code.

🙌 1