Thanks very much. Useful in learning S: There is a big savings in the full round trip in j764 but no difference in j632
, each / 2 test /\ |: <"0 S:1[ 1 2 3 4 ; 5 6 7 8 ; <'a';'b';'c';'d' ┌─────┬──────┬───────┐ │1 2 3│6 8 10│┌─┬─┬─┐│ │ │ ││a│b│c││ │ │ │└─┴─┴─┘│ └─────┴──────┴───────┘ 10 ts ', each / 2 test /\ |: <"0 S:0 (i.1e4);(i.1e4);(i.1e4)' 12.3561/sec 10.194MB 10 ts ',~ each each/ 2 test each/\ <"1 &.|: > <"0 each (i.1e4);(i.1e4);(i.1e4)' 3.50359/sec 12.8865MB but overall, its good advice that any data that will be used in a calculation should be coded as a number, and if you want to scan through a table, keep that (calc dependent) section of it unboxed. ----- Original Message ----- From: R.E. Boss <[email protected]> To: [email protected] Cc: Sent: Friday, October 11, 2013 11:46:43 AM Subject: Re: [Jprogramming] Scanning (/ or looping) records of an inverted table Your solution could be shortened a bit to <"1|:<"0 S:1[ 1 2 3 4 ; 5 6 7 8 ; <'a';'b';'c';'d' +---------+---------+---------+---------+ |+-+-+---+|+-+-+---+|+-+-+---+|+-+-+---+| ||1|5|+-+|||2|6|+-+|||3|7|+-+|||4|8|+-+|| || | ||a|||| | ||b|||| | ||c|||| | ||d||| || | |+-+||| | |+-+||| | |+-+||| | |+-+|| |+-+-+---+|+-+-+---+|+-+-+---+|+-+-+---+| +---------+---------+---------+---------+ 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 Pascal Jasmin > Sent: vrijdag 11 oktober 2013 15:48 > To: [email protected] > Subject: [Jprogramming] Scanning (/ or looping) records of an inverted table > > with 4 row 3 column inverted table > > 1 2 3 4 ; 5 6 7 8 ; <'a';'b';'c';'d' > ┌───────┬───────┬─────────┐ > │1 2 3 4│5 6 7 8│┌─┬─┬─┬─┐│ > │ │ ││a│b│c│d││ > │ │ │└─┴─┴─┴─┘│ > └───────┴───────┴─────────┘ > > is there a way to scan through each record without doing this: > > <"1 &.|: > <"0 each 1 2 3 4 ; 5 6 7 8 ; <'a';'b';'c';'d' > ┌─────────┬─────────┬─────────┬─────────┐ > │┌─┬─┬───┐│┌─┬─┬───┐│┌─┬─┬───┐│┌─┬─┬───┐│ > ││1│5│┌─┐│││2│6│┌─┐│││3│7│┌─┐│││4│8│┌─┐││ > ││ │ ││a││││ │ ││b││││ │ ││c││││ │ ││d│││ > ││ │ │└─┘│││ │ │└─┘│││ │ │└─┘│││ │ │└─┘││ > │└─┴─┴───┘│└─┴─┴───┘│└─┴─┴───┘│└─┴─┴───┘│ > └─────────┴─────────┴─────────┴─────────┘ > > I was hoping for some version/combination of L: S: but I can't say I > understand S: > > test =. 4 : 'a;b;<c [b=. b+ a [''a b c'' =. x' > 2 test each/\ <"1 &.|: > <"0 each 1 2 3 4 ; 5 6 7 8 ; <'a';'b';'c';'d' > ┌─────────┬─────────┬──────────┐ > │┌─┬─┬───┐│┌─┬─┬───┐│┌─┬──┬───┐│ > ││1│6│┌─┐│││2│8│┌─┐│││3│10│┌─┐││ > ││ │ ││a││││ │ ││b││││ │ ││c│││ > ││ │ │└─┘│││ │ │└─┘│││ │ │└─┘││ > │└─┴─┴───┘│└─┴─┴───┘│└─┴──┴───┘│ > └─────────┴─────────┴──────────┘ > > > > Maybe <"1 &.|: > <"0 each is actually really good? > ---------------------------------------------------------------------- > 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
