On Mon, Oct 14, 2019 at 12:51 AM Roger Hui <rogerhui.can...@gmail.com> wrote: > > What you described is a different adverb K2 where > > x u K2 y ←→ ((~.x)i.y) u/. y > > (If x has no duplicates, then it's just (x i.y) u/. y .) Please try it > and tell us whether it does what you want. > > This is an interesting computation where the left argument x does not > specify keys for the right argument (that's what x u/. y does). Instead, > the left argument specify the entire universe of possible values for y > together with a final "none-of-the-above" category. >
The above reminds me of the key thread, [Jprogramming] key http://www.jsoftware.com/pipermail/programming/2013-April/thread.html#32317 and > Yes, very much. I am continually writing > > x (~.@[ ... f/.) y > > And what does it cost? f@]/. would get the current behavior. > > Henry Rich > > On 4/15/2013 8:43 PM, Roger Hui wrote: > > * I have a question concerning your use of *key*. Do you find yourself*> > * wishing that in x f/.y, the f would be invoked with a left argument which*> > * is key value corresponding to the items in the right argument? This does*> > * not mean that the J definition or implementation will be changed, but to*> > * find out that if I have an opportunity to define/implement key in another*> >* context ;-) whether I should consider changing it.* in particular. > On Sun, Oct 13, 2019 at 9:20 PM 'Jim Russell' via Programming < > programm...@jsoftware.com> wrote: > > > Just to explain my confusion, and with apologies for my terminology... > > > > Since iota (and i.) return an "off the scale" index to mean "not found", I > > assumed that a "not found", or "none of the above" category would return a > > count (in the case of #) in the final (1+$nub) item of the result. My > > uneducated guess, looking at the results of u="<" or" ," on the same > > trigrams I was applying to #/. was that instead of the 3's I would have > > expected, it seemed each was being used in an iota search of the left > > argument rows to add to the tally of each unique (first encountered) member > > of the x argument. The result is the length of the nub of the left > > argument, so the rest of the left argument seems, for a u of #, to be > > ignored and not needed, at least if x has duplicate entries. > > And if that is the case, it seemed that a final "none of the above" > > element (indexed by the "not found" result of my probably mythical i. > > search) for each y argument row ought would just fall out. > > > > But I did give absolutely no thought to other verbs as u. (Other than > > wonder which might help be understand the behavior of /. .) > > > > Don't take the time to point out my stupidity--I'm happy to wait until I'm > > smart enough to understand it better. > > > > And thanks for checking in to the discussion, Roger. > > > On Oct 13, 2019, at 10:21 PM, Roger Hui <rogerhui.can...@gmail.com> > > wrote: > > > > > > Oh no, it's not because I said so. As I said, it's because this > > particular > > > definition, the current definition, says so. If you think the definition > > > should be / could be something else, we can discuss it. Truth be told, I > > > don't understand how you can have keys that don't have corresponding > > data, > > > or data that don't have corresponding keys. Sounds like a completely > > > different computation than _key_. > > > > > > _Key_ (the current definition) is cognate with the GROUP-BY statement in > > > SQL, the monadic = function in k, the generalized beta in the Connection > > > Machine. > > > > > > >>> > > >>> > > >>>> On Sun, Oct 13, 2019 at 3:58 PM 'Jim Russell' via Programming < > > >>>> programm...@jsoftware.com> wrote: > > >>>> > > >>>> Rick: My ability to read tacit expressions is so poor that I > > overlooked > > >>>> the fact that the your quoted output did not come directly from the > > Key > > >>>> expression; silly me, I thought there was some form of the > > >>>> modifiers/arguments to Key that yielded the results of two inputs. > > >>>> > > >>>> (In contrast to your skill, it took be about a half a day to come up > > >> with > > >>>> the tacit dyad(?) mmjnn=:(; ,.) to glue together my trigram table and > > >> one > > >>>> result vector.) > > >>>> > > >>>> So I wonder if I dare ask again: > > >>>> why do the sizes of the x and y argument to Key need to > > >>>> match? > > >>>> > > >>>> (Thanks again for all the help!) > > >>>> > > >>>>>> On Oct 12, 2019, at 5:16 AM, Ric Sherlock <tikk...@gmail.com> > > wrote: > > >>>>> > > >>>>>>> Or to summarise by trigram: > > >>>>>>> > > >>>>>>> (~.@; trig);|: <: #/.~&> supertrig > > >>>>>>> > > >>>>>>> +---+---+ > > >>>>>>> > > >>>>>>> |ggt|1 2| > > >>>>>>> > > >>>>>>> |gta|2 0| > > >>>>>>> > > >>>>>>> |taa|1 1| > > >>>>>>> > > >>>>>>> |aaa|2 0| > > >>>> > > >>>> ---------------------------------------------------------------------- > > >>>> 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