Thanks Chris. Nice to know about that one.

I prefer Roger's 1-line "label1". But if there are appropriate
standard utilities shipped with J602 then I guess the reader should be
told about them. I'll mention "border" in a footnote.

Ian


On Wed, Nov 18, 2009 at 8:07 AM, chris burke <cbu...@jsoftware.com> wrote:
> Perhaps system/packages/misc/border.ijs does what you want.
>
> On Tue, Nov 17, 2009 at 2:23 PM, Ian Clark <earthspo...@googlemail.com>wrote:
>
>> >And label1 grabs a left argument for Format from... somewhere :-)
>>
>> ...I was wrong. Format is used monadically throughout. label1 simply
>> combines the column labels with table (y) into a single unboxed table,
>> formats it (which gets the column spacings right for the labels) then
>> splits it off again with the verb ({. ; }.).
>>
>> Then it avoids my reshape (2 2$...) by leveraging the property of stitch
>> (,.)
>>
>> Neat, Roger. Thanks for that potted masterclass.
>>
>> Ian
>>
>>
>> On Tue, Nov 17, 2009 at 3:53 AM, Ian Clark <earthspo...@googlemail.com>
>> wrote:
>> > Our postings crossed, Roger. You're reading my thoughts.
>> >
>> > Yes, label is exactly how I was thinking. And label1 grabs a left
>> > argument for Format from... somewhere :-)
>> >
>> > Thanks. One of those will do fine.
>> >
>> > Ian
>> >
>> >
>> > On Tue, Nov 17, 2009 at 3:45 AM, Roger Hui <rhui...@shaw.ca> wrote:
>> >>   label1=: 4 : '(x;":,.i.#y) ,. ({.;}.)":(i.{:$y),y'
>> >>
>> >>
>> >>
>> >> ----- Original Message -----
>> >> From: Roger Hui <rhui...@shaw.ca>
>> >> Date: Monday, November 16, 2009 19:42
>> >> Subject: Re: [Jprogramming] labelling a table
>> >> To: Programming forum <programming@jsoftware.com>
>> >>
>> >>>    label=: 4 : '(x;{.t),:(":,.i.#y);}.t=. ":(i.{:$y),y'
>> >>>
>> >>>    ] zz=: 4 5 ?...@$ 20
>> >>>   6 15 19 12 14
>> >>> 19  0 17  0 14
>> >>>  6 18 13 18 11
>> >>> 12 18  0 10  2
>> >>>
>> >>>    'Foo' label zz
>> >>> +---+--------------+
>> >>> |Foo| 0  1  2  3  4|
>> >>> +---+--------------+
>> >>> |0  | 6 15 19 12 14|
>> >>> |1  |19  0 17  0 14|
>> >>> |2  | 6 18 13 18 11|
>> >>> |3  |12 18  0 10  2|
>> >>> +---+--------------+
>> >>>
>> >>>
>> >>>
>> >>> ----- Original Message -----
>> >>> From: Ian Clark <earthspo...@googlemail.com>
>> >>> Date: Monday, November 16, 2009 16:16
>> >>> Subject: [Jprogramming] labelling a table
>> >>> To: Programming forum <programming@jsoftware.com>
>> >>>
>> >>> > Suppose I have an arbitrary table, eg
>> >>> >
>> >>> >    zz
>> >>> > 1  2  3  4  5
>> >>> > 2  3  1  8 10
>> >>> > 3  1  2 12 15
>> >>> > 4  8 12  6  2
>> >>> > 5 10 15  2  7
>> >>> >
>> >>> > what's a slick way of displaying it boxed and labelled, like
>> >>> > this? ...
>> >>> >
>> >>> > +-+-------------+
>> >>> > |s|0  1  2  3  4|
>> >>> > +-+-------------+
>> >>> > |0|1  2  3  4  5|
>> >>> > |1|2  3  1  8 10|
>> >>> > |2|3  1  2 12 15|
>> >>> > |3|4  8 12  6  2|
>> >>> > |4|5 10 15  2  7|
>> >>> > +-+-------------+
>> >>> >
>> >>> > Sorry to be lazy. It would do me good to work it out for
>> >>> myself, but
>> >>> > I'm pressed for time. Needed for APWJ. The best I can come up
>> >>> > with so
>> >>> > far is this:
>> >>> >
>> >>> > s=: 4 : '(<x;<y) { zz'
>> >>> > s table i.5
>> >>> > ...
>> >>> >
>> >>> > Ian
>> >> ----------------------------------------------------------------------
>> >> For information about J forums see http://www.jsoftware.com/forums.htm
>> >>
>> >
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
> ----------------------------------------------------------------------
> 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