There's something like that buried in my bazaar package, maybe it's
sufficient for your needs:
https://github.com/Metaxal/bazaar/blob/master/text-table.rkt

The main submodule prints the examples.

It provides two ways to output tables. The first one 'table->string' is the
simplest one and the example outputs:

  a │   b │    c │  d │ e │          f │  g │    h
——————————————————————————————————————————————————
123 │ 456 │   77 │ 54 │ 1 │ 5646547987 │ 41 │    1
——————————————————————————————————————————————————
111 │  22 │ 3333 │ 44 │ 5 │          6 │  7 │ 8888

The second one is more tweakable but more complicated and the example
produces:
╔════╦╦════════╦════╗
║i   ║║f1      ║f2  ║
╠════╬╬════════╬════╣
╠════╬╬════════╬════╣
║a   ║║b       ║c   ║
╠════╬╬════════╬════╣
║x   ║║y       ║z   ║
╚════╩╩════════╩════╝

If I had time I would merge the two and make it both simple and tweakable...

On Fri, Sep 22, 2017 at 7:07 AM, 'John Clements' via users-redirect <
[email protected]> wrote:

>
> > On Sep 21, 2017, at 16:10, Jay McCarthy <[email protected]> wrote:
> >
> > `raco pkg show` implements something very close that you could turn
> > into a library
> >
> > https://github.com/racket/racket/blob/master/racket/
> collects/pkg/private/show.rkt#L102
>
> Ah! Nice!
>
> John
>
> >
> > On Thu, Sep 21, 2017 at 5:03 PM, 'John Clements' via users-redirect
> > <[email protected]> wrote:
> >> Before I go re-inventing the wheel, I want to ask you folks: has anyone
> written a library that prints out tabular data in a textual format?
> >>
> >> E.G: given
> >>
> >> ‘((“a” “bcd” “ef”) (“gh” “hhu.thnt” “t”)
> >>
> >> returns
> >>
> >> "
> >> ----------------------
> >> | a  | bcd      | ef |
> >> | gh | hhu.thnt | t  |
> >> ———————————
> >> “
> >>
> >> (sorry about the horrible damage that Apple Mail inflicts upon this
> message.)
> >>
> >> … in the style of postgresql and similar display engines?
> >>
> >> It’s easy to write one of these, but if someone else has done it, it
> will probably have nice bells and whistles that mine won’t.
> >>
> >> John
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups "Racket Users" group.
> >> To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected].
> >> For more options, visit https://groups.google.com/d/optout.
> >
> >
> >
> > --
> > -=[     Jay McCarthy               http://jeapostrophe.github.io    ]=-
> > -=[ Associate Professor        PLT @ CS @ UMass Lowell     ]=-
> > -=[ Moses 1:33: And worlds without number have I created; ]=-
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected].
> > For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to