Welcome! Please see the About page for a little more info on how this works.

0 votes
in Printing by
edited by


I find when cell-content widths vary a lot (e.g. in some col, some long strings and some short) that the current right-aligned output is hard to read.

can print-table have opt to left-align output?

Also, I often want to copy output from print-table into a spreadsheet. left-aligning would help (trimming not a one-click thing in spreadsheets afaik), but what might actually help even more is to have e.g. a csv output (so no whitespace padding happens) at all. I can reach for csv lib ofc, but the use case of 'get some clojure data into spreadsheet' is something I might want anywhere anytime, so in the same way that vi editor comes as standard with many linux distros mostly, this would be handy to have.

2 Answers

0 votes

At the moment the only args to print-table are the data to print. The cells are built internally to be right justified by building up a format string for the max width. The format string is then sent to the format function as the first arg to each cell print. If you really needed to change that behavior then you'd have to override the behavior of the format function to modify the format string to force left-justification.

Thanks. I was suggesting the existing function might be changed to e.g.  accept some opts
0 votes

This might not help you but I discovered if you take the output of print-table and paste it into an org-mode buffer in emacs, the table formatter in emacs will left-align everything.

ago by
Thanks. I have found the 'doric' library does what I need. At least until print-table can be improved