That's pretty clever. I like using

   (#~2|i.@#) ": (;:'a b c d'),]&.>p:p:p:i.4 4
│a   │b   │c   │d   │
│13  │19  │43  │71  │
│163 │193 │293 │359 │
│463 │619 │743 │971 │
│1091│1181│1423│1601│

although now that it's come up, I realize (_2{:\}: ": ...) is a little
shorter. Either way, it lets you dodge the problem with non-unique rows
but at the cost of quite a few characters. Thanks for this version
though--I am sure I will end up using it!

Marshall

On Wed, Jul 15, 2015 at 03:33:18PM -0400, Raul Miller wrote:
> I've been using ~.": a lot lately, when working with csv data (with a
> header row).
> 
> Here's what that looks like:
> 
>    ~.": (;:'a b c d'),]&.>p:p:p:i.4 4
> ┌────┬────┬────┬────┐
> │a   │b   │c   │d   │
> ├────┼────┼────┼────┤
> │13  │19  │43  │71  │
> │163 │193 │293 │359 │
> │463 │619 │743 │971 │
> │1091│1181│1423│1601│
> └────┴────┴────┴────┘
> 
> of course, that will be mangled if you're using a proportionally
> spaced font or have other font issues. But in a good fixed width font,
> you get a more compact display than boxed.
> 
> This wouldn't work right if rows of data were duplicated, but that
> would be garbage data in the contexts I've been working with. So for
> me that's a non-issue.
> 
> Anyways, this might work for someone else, also...
> 
> FYI,
> 
> -- 
> Raul
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to