You can write a html formatter for boxed arrays based on
http://www.jsoftware.com/jwiki/Essays/Boxed%20Array%20Display
For arrays with rank greater than 2, you need to align
elements at the same row and column. That is,
in the output x{~<i0;j;k and x{~<i1;j;k are aligned.
----- Original Message -----
From: Raul Miller <[email protected]>
Date: Sunday, March 28, 2010 15:22
Subject: Re: [Jbeta] displaying boxed array in html
To: Beta forum <[email protected]>
> On Sun, Mar 28, 2010 at 9:22 AM, Eric Iverson
> <[email protected]> wrote:
> > In jhs it is easy to use jhtml'...' to put raw html in the
> display log. It
> > would be relatively easy to write a verb that displays J data
> in an html
> > table. This is a good exercise for the community.
>
>
> Here is a rough model:
>
> fmt0=:3 :0 L:0
> if.#$y do.
> ,@(,"1&'<br />')"2^:(_1 + #...@$) ":y
> else.
> ":y
> end.
> )
>
> fmt=:3 :0 L:1 ^:_
> if.L.y do.
> '<table border=1>'&, ,&'</table>'
> ;'<tr>'&,&.> ,&'</tr>'&.> <@;"1
> '<td>'&,&.> ,&'</td>'&.>fmt0 y
> else.
> fmt0 y
> end.
> )
>
> fmt0 is meant to model converting an unboxed array into an html
> fragment. I did not put much effort into it, but you
> probably already
> have something that does what it does.
>
> fmt is meant to model representing a boxed array as a table.
>
> I have not figured out what it should be doing for arrays higher than
> rank 2 arrays. Would putting <br> tags between table
> elements (like
> fmt0 should be doing if i had not left trailing <br> tags in
> place) be
> adequate?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm