How about no parentheses. h=: 13 :'|:i.~&> y' h i 0 0 1 0 2 2 0 0 1 4 2 2 2 6 2 2 1 2 2 6 h [: |: i.~&>
Linda -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of bill lam Sent: Thursday, December 17, 2015 11:38 AM To: 'Pascal Jasmin' via Programming Subject: Re: [Jprogramming] nub and key of inverted table Thanks. I can see your expression is |:@:>@(i.~L:0 ]) which gives the same x i. x as suggested by Roger. Чт, 17 дек 2015, jprogramming написал(а): > I have > > > > nubi =. ({~ each"_ 1 ~.@|:@:>@((i."_ _1~) leaf~)) f. > > > > keyi =. (i."_ _1~)@:(|:@:>@((i."_ _1~) leaf~))f. > > > > still gives same unique indexes, just not contiguous. > > (i."_ _1 ])@:(|:@:>@((i."_ _1 ]) leaf ])) i > 0 1 2 0 4 2 6 2 8 6 > > > > ----- Original Message ----- > From: bill lam <[email protected]> > To: jprogramming <[email protected]> > Sent: Thursday, December 17, 2015 10:21 AM > Subject: [Jprogramming] nub and key of inverted table > > I want an effecient method of finding nub and key of a inverted table > (rank-1 box array with equal number of items in each cells). eg. > > ]i=. (,.0 2 1 0 2 1 1 1 2 1);10 2$'aaaabaaaabbabbbababb' > +-+--+ > |0|aa| > |2|aa| > |1|ba| > |0|aa| > |2|ab| > |1|ba| > |1|bb| > |1|ba| > |2|ba| > |1|bb| > +-+--+ > > NB. nub of i > ifa ~. a=. afi i > +-+--+ > |0|aa| > |2|aa| > |1|ba| > |2|ab| > |1|bb| > |2|ba| > +-+--+ > > NB. key of i > a i.~ ~.a > 0 1 2 0 3 2 4 2 5 4 > > NB. definition of afi and ifa > afi > |:@:(<"_1@>) > ifa > <@(>"1)@|: > > Although nub and key can be found using afi/ifa, it involves a lot of > box, I worry the time and space efficency when the table is large. > Can anyone suggest other ways to do it. > > -- > regards, > ==================================================== > GPG key 1024D/4434BAB3 2008-08-24 > gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 gpg --keyserver > subkeys.pgp.net --armor --export 4434BAB3 > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm -- regards, ==================================================== GPG key 1024D/4434BAB3 2008-08-24 gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
