Creating printf functionality in Clojure and ClojureScript


Hi all. I’m just getting started with Clojure although I have been a long time fan of Lisp and functional programming.

I am trying to get printf functionality that will work in both Clojure and ClojureScript. I understand the underlying implementation of Java vs the Google closure compiler makes it impractical to implement printf or format for ClojureScript. I was wondering what techniques the Clojure/ClojureScript community uses to format printing in both languages.

I appreciate any help or advice.

– Lance.


I just had this issue today, and I ended up using “cl-format” - I had to format a number in a CLJ and CLJS way


Thanks, @l3nz, I will take a look at cl-format today.

Follow up question…I thought I read somewhere on this site that there is a way to mark an accepted solution but I can’t find it in the UI.

How do I mark this solution as accepted?


I don’t know. I also miss a decent tutorial/cheatsheet for cl-format - anybody has pointers to share?


This is what I used