You are right about vert_boss being incorrect, but one can use the monad (;) . Adding a (_) will help: vert1 =: [:> ;"_1 &.>/ vert2 =: [:> ;"_1 L:0 _1/
vert1 t +----+-+ |Boss|3| +----+-+ |Adam|1| +----+-+ |John|4| +----+-+ vert2 x NB. x from http://www.jsoftware.com/jwiki/Essays/Inverted%20Table +------+-------+-+--+----+ |Smith |John |0|23|1.25| +------+-------+-+--+----+ |Jones |Dakota |1|29|0.97| +------+-------+-+--+----+ |Chan |Wilson |0|47|2.11| +------+-------+-+--+----+ |Wilson|Diana |1|23|1.25| +------+-------+-+--+----+ |Saxon |Joan |1|31|2.8 | +------+-------+-+--+----+ |Angelo|Roberto|0|19|1.11| +------+-------+-+--+----+ |Smith |John |0|23|1.25| +------+-------+-+--+----+ |Wilson|John |1|23|1.25| +------+-------+-+--+----+ R.E. Boss (Add your info to http://www.jsoftware.com/jwiki/Community/Demographics ) > -----Original Message----- > From: [email protected] [mailto:programming- > [email protected]] On Behalf Of Roger Hui > Sent: zaterdag 5 oktober 2013 23:49 > To: Programming forum > Subject: Re: [Jprogramming] row from boxes > > Try it on the examples in the Wiki essay, or: > > vert_boss =: [:> ;"1 &.>/ > vert =: |:@:(<"_1&>) > > t=: (3 4$'BossAdamJohn');3 1 4 > t > ┌────┬─────┐ > │Boss│3 1 4│ > │Adam│ │ > │John│ │ > └────┴─────┘ > vert_boss t NB. incorrect > ┌────┬─────┐ > │Boss│3 1 4│ > ├────┼─────┤ > │Adam│3 1 4│ > ├────┼─────┤ > │John│3 1 4│ > └────┴─────┘ > vert t > ┌────┬─┐ > │Boss│3│ > ├────┼─┤ > │Adam│1│ > ├────┼─┤ > │John│4│ > └────┴─┘ > > And I do mean the monad ; (raze). > > > > On Sat, Oct 5, 2013 at 2:10 PM, R.E. Boss <[email protected]> wrote: > > > Example(s)? > > > > (I take it you mean monad ,: ) > > > > > > R.E. Boss > > > > (Add your info to > > http://www.jsoftware.com/jwiki/Community/Demographics ) > > > > > > > -----Original Message----- > > > From: [email protected] > [mailto:programming- > > > [email protected]] On Behalf Of Roger Hui > > > Sent: zaterdag 5 oktober 2013 23:05 > > > To: Programming forum > > > Subject: Re: [Jprogramming] row from boxes > > > > > > In general the columns of a table need not be lists, so you can not > > > use > > the > > > monad ; . > > > > > > > > > On Sat, Oct 5, 2013 at 1:43 PM, R.E. Boss <[email protected]> wrote: > > > > > > > vert =: [:> ;"1 &.>/ > > > > invert =: (,~,:)~L:0/ > > > > > > > > > > > > R.E. Boss > > > > > > > > (Add your info to > > > > http://www.jsoftware.com/jwiki/Community/Demographics ) > > > > > > > > > > > > > -----Original Message----- > > > > > From: [email protected] > > > [mailto:programming- > > > > > [email protected]] On Behalf Of Roger Hui > > > > > Sent: zaterdag 5 oktober 2013 21:21 > > > > > To: Programming forum > > > > > Subject: Re: [Jprogramming] row from boxes > > > > > > > > > > The a that you have is known as an inverted > > > > > table<http://www.jsoftware.com/jwiki/Essays/Inverted%20Table>. > > > > > To convert a table into an inverted table, use "invert"; to do > > > > > the > > > > inverse, use > > > > > "vert". > > > > > > > > > > vert =: |:@:(<"_1&>) > > > > > invert=: <@(>"1)@|: > > > > > > > > > > vert a > > > > > ┌─┬─┐ > > > > > │0│a│ > > > > > ├─┼─┤ > > > > > │1│b│ > > > > > ├─┼─┤ > > > > > │2│c│ > > > > > └─┴─┘ > > > > > invert vert a > > > > > ┌─────┬───┐ > > > > > │0 1 2│abc│ > > > > > └─────┴───┘ > > > > > > > > > > If you prefer your version of a table, apply <"1 to the result > > > > > of > > "vert". > > > > > > > > > > > > > > > > > > > > > > > > > On Sat, Oct 5, 2013 at 9:07 AM, Joe Bogner <[email protected]> > > > wrote: > > > > > > > > > > > Given this structure: > > > > > > ]a =. (< _1]\ 0 1 2), (< _1]\ 'a','b','c') > > > > > > > > > > > > +-+-+ > > > > > > > > > > > > |0|a| > > > > > > > > > > > > |1|b| > > > > > > > > > > > > |2|c| > > > > > > > > > > > > +-+-+ > > > > > > > > > > > > > > > > > > How can I transform it into this? > > > > > > > > > > > > > > > > > > (0;'a');(1;'b');<(2;'c') > > > > > > > > > > > > > > > > > > +-----+-----+-----+ > > > > > > > > > > > > |+-+-+|+-+-+|+-+-+| > > > > > > > > > > > > ||0|a|||1|b|||2|c|| > > > > > > > > > > > > |+-+-+|+-+-+|+-+-+| > > > > > > > > > > > > +-----+-----+-----+ > > > > > > > > > > > > > > > > > > I've tried every variant in indexing and selecting to no avail. > > > > > > Thank you > > > > > > > > > > > > > > > > > > > http://www.jsoftware.com/help/jforc/more_verbs_for_boxes.htm > > > > > > > > > > > > http://www.jsoftware.com/docs/help701/learning/06.htm > > > > > > > > > > > > > http://www.jsoftware.com/help/primer/from_boxed_indexes.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 > > > -------------------------------------------------------------------- > > > -- 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
