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
