IT SLICES! IT DICES!
It causes a 100,000 light year-diameter quantum explosion!
Based on one innocuous remark[1] and a Sunday evening package
popularity poll results[2], I finally decided to put together various
bits and pieces of code that have been scattered across my
private projects for a few years now and I assembled them into a
package anyone can use.
Rendering tables is fun - especially if you want each and every cell
to behave like an ECMA-48 terminal with proper support for (most of)
Set Graphics Rendition control codes. Colors, italics, underlines - if
you can name it, it is there. See ECMA-48 Fifth Edition - June
1991[3], section 8.3.117 for reference - or the ECMA SGR module of
this package. Combining solid, dashed, thick and thin borders in all
combinations makes the tabular data even more pleasing to the eye.
The public API is fairly straightforward and contains just two
procedures - one for printing the result to (current-output-port) and
one for obtaining the result as a string value. An example showing the
most important features is right on the front page of package's
documentation[4]. The package also comes with an extensive
documentation of its internals - all private modules are completely
scribbled using scribble/srcdoc.
In addition to the documentation, the whole package internals are also
heavily contracted using both inter-module and intra-module
contracts. I hope that others will have a look at the code[5] and it
will fuel the ongoing discussion about contract usage in various
scenarios. My two cents would be that it was extremely useful to have
the intra-module contracts in place during development - especially in
connection with the extensive tests. This combination allowed me to
quickly test some of the various approaches available and decide
on-the-fly what works the best (at least for me).
Although the internal package version is 0.5.1 - meaning it is far
from complete - there are no plans to change the public API and/or its
behavior. That is the reason why I am releasing it right now. The
internals may (and probably will), however, change a lot in the
future. There are still some features missing which I need to
implement before it can fully replace all my other code so expect more
to come in the future.
In the meantime, I'd love to hear any feedback, suggestions or any
comments that anyone may have regarding both the functionality and the
code itself. At the upcoming Racket meetup next Saturday I plan to
show some of the features live in REPL and I will be available for
answering questions there.
Special thanks go out to:
- Jay McCarthy - for reminding me that I am not the only old-timer
spending most of his time in the text-only terminal (and for
organizing RacketCon), - Stephen De Gabrielle - for that Sunday evening package popularity
poll (and his relentless popularization of Racket itself), and - Laurent Orseau - for the text-table package, of course.
Cheers!
Dominik
[1] RacketCon 2021 - Day 1 - Session 3 - Bogdan Popa & Ryan Culpepper - YouTube
[2] What are the most used packages? - #6 by spdegabrielle
[3] https://www.ecma-international.org/wp-content/uploads/ECMA-48_5th_edition_june_1991.pdf
[4] Unicode Tables
[5] Dominik Joe Pantůček / uni-table · GitLab