Fork me on GitHub

Clormat 0.0.1 A clean reimplementation of clojure.core/format for Clojure/ClojureScript Repo: This covers some of the basic functionality of the format function, specifically for ClojureScript. It's an initial release, covering positional parameters, along with several of the datatypes and flags. Significantly, it is still missing floating point formats and date/times, but these are in progress. The function aims for clojure.core/format compatibility wherever possible.

🎉 31
🆒 9
clojure-spin 8
👍 5
bmo 3
Cora (she/her)04:09:51

so cool!!

💖 1

It's ridiculously finicky


Like, what should this return?

(format “%,(010d” -101)
I thought maybe ”(000,101)” because it can't be ”(,000,101)” but it turns out that prefixing zeros don't get grouped, even though the NumberFormat classes on both Java and JavaScript DO group prefixing zeros

Cora (she/her)04:09:04

matching behavior like this is so hard. thanks for doing it 💜


Or… how should -1 be represented in hex? It can't be 64 bits wide because integers on JavaScript are only 52 bits wide

Cora (she/her)04:09:09

oh god I didn't even think of that


I did say “ridiculously finicky”

Cora (she/her)04:09:09

an understatement, I'm sure

😆 1
Cora (she/her)04:09:45

if anyone can figure it out, though, it's you

💖 1
💯 1

One thing I haven't put a lot of effort into though is incompatible flag combinations

Cora (she/her)04:09:33

how do you mean?


For instance, ”%-010d” says to print a number at least 10 characters wide, left-justified, with leading zeros to make up the width. But if it's left-justified then there can't be any leading zeros


If there are leading zeros then it will take up the whole width and left/right justification won't matter


You know… that kind of thing 🙃


On the plus side, I know much more about formatting text strings than ever before!

Cora (she/her)04:09:24

this just in: found the text formatting goddess

Cora (she/her)04:09:48

I get paralyzed with those kinds of choices tbh

Cora (she/her)04:09:11

and in the end devs need to be aware of at least some of it

Cora (she/her)04:09:44

write once, run anywhere: a god damn lie from the start

doge 1
Lennart Buit07:09:32

Programming in a nutshell: You are walking down the street only to fall in a little pothole that ends up being 3km deep and require a thorough study of spelunking to get out again.

👆 1
😆 1

> An implementation of the cljs.core/format function for ClojureScript. Also runs (redundantly) in Clojure. Not sure how I should read this. Should it say an implementation of the clojure.core/format function?


Well it's trying to be an implementation of the missing cljs.core/format function


That's awesome. Maybe say that in the README? 😃


Also, is clormat a play with the name of cljs.pprint/cl-format?

Noah Bogart11:09:39

Are you trying to do this without reading the openjdk source?


Yes, I am 🙂


The name was probably informed by the existence of cl-format, but I was just thinking “CLojure fORMAT”

Noah Bogart12:09:22

That’s cool and a much harder task lol. Makes sense for licensing reasons if you want to upstream it; you’re a champ for doing this


finicky looks like fn-hickey (aka function by Rich Hickey)


Yes… very finicky. I’ve been exploring more, and I now have more info to make it better for localization (correcting expanding with zeros, etc)

😍 1

Every allowable zero: 0٠༠০०۰၀๐᱐


Depending on the country and language setting


Is it supposed to format numbers and things according to locale? If so I could have a look at the Swedish.


It’s defined to work against the current default locale, which I have yet to figure out how to set during testing 🙂


There are relatively consistent rules to follow regardless of locale, but not all of it is apparent


Expand with 0s varies according to the number system in use (see the earlier message). Group separators are an issue as well, since they also vary with the numbering system


Somewhat ironically, Arabic does not use the numbers we call “arabic” 🙂

😂 1

For instance, the number 1234 in one form of arabic is: ١٬٢٣٤


The second character is the group separator. European countries are easy enough for me: UK: “1,234”, FR: “1 234", GE: “1.234”

Lennart Buit17:09:53

Although the Dutch uses comma for decimals, and dot for thousands. Exactly opposite of Americans. This has never lead to input confusion for me-as-a-Dutchie


These things are easy, since the digits are all the same


Here are all the possible outcome for (format "%,d" 1234):

"1 234"

😵 1

Extra notes: • clojure.core/format wraps java.lang.String/format which does not accept a locale. This means that it always select the current default, and you cannot control it on this function. • You can control it on the JVM, via: (String/format (Locale/forLanguageTag "sv") "%,d" (object-array [1234])) • You can do the same on JS via: (.format (js/Intl.NumberFormat. "sv" #js{:grouping: true}) 1234) • This is for the trivial case of a pattern of "%,d". More detailed cases cannot be formatted via the locale settings, and require manual intervention. For instance, when using "%,010d" then using locale formatting to ask for 10 digits in the UK will give an output of: "0,000,001,234". However, the format function actually outputs: "000001,234". Note how the localization groups the zeros, but the format does not?


I’m just scratching the surface here


It gets hairier 🙂

Ivar Refsdal07:09:38

clj-paginate 0.2.52 Fast pagination of vectors and maps with Clojure for GraphQL. Easily handles vectors with 10M entries. Repo: This release adds support for :sort-fn and with that custom ordering (ascending/descending) of attributes. It's backwards compatible with the previous release.

🎉 4
clojure-spin 2

[ANN] FlowStorm Clojure[Script] debugger 3.0 is out FlowStorm is a Clojure and ClojureScript debugger with some unique features. Version 3.0 has been redesigned to be much simpler and more extensible. It goes from being a debugger to being a platform for building debuggers + a reference implementation. Most remarkable new features for this version are : • ClojureScript is feature par with Clojure now, so every feature is available to both languages. • Remote debugging can be accomplished by just connecting to a nrepl server (socket repl support on the roadmap) • A programmable API. This means debug your code by writing Clojure code that uses the debugger infrastructure. See ( • Opens the possibility for future integration with IDEs/editors Github repo : User Guide Big thanks to Roam Research ( for sponsoring the project! If you have any questions please show up on #flow-storm in clojurians slack PD : I'm planning to make some videos on how to use FlowStorm to debug different kinds of applications (web apis, re-frame SPAs, etc) I hope you find it useful. Cheers!

amazed 14
🎉 24
🚀 14
clojure-spin 13
gratitude 5
😍 2
👏 2
Lidor Cohen16:09:33

👏 👏 👏 Been waiting for this thank you so much! 🙏


you are welcome! if you have any questions show up in #flow-storm!


for people that tried it for ClojureScript and was annoyed by having to reconnect the debugger by hand when reloading a browser page or restarting the shadow repl just released 3.0.188 which does automatic connection management. It also shows the connection status for the repl and the runtime on the bottom right corner