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.


On Sun, Oct 13, 2019 at 9:20 PM 'Jim Russell' via Programming <
[email protected]> 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 <[email protected]>
> 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 6:36 PM 'Jim Russell' via Programming <
> >> [email protected]> wrote:
> >>
> >> And only you, Roger, well deserve the right to answer "Because I said
> so!"
> >> I was only considering the case of u=#, and remembering that #/. was
> >> described as in the i. family, and seeing that...
> >>
> >> Well never mind. Sorry.
> >>
> >>
> >>> On Oct 13, 2019, at 7:50 PM, Roger Hui <[email protected]>
> >> wrote:
> >>>
> >>> 
> >>>>
> >>>> why do the sizes of the x and y argument to Key need to match?
> >>>
> >>> Because the x u/. y key adverb is _defined_ so that
> >>>
> >>>  - items of x specify keys for _corresponding_ items of y and
> >>>  - u is applied to each collection of y having identical keys.
> >>>
> >>> You can argue that the definition should be something else, but it is
> not
> >>> debatable that if you are going to use u/. then items of x must have
> >>> corresponding items in y, that is, x and y must have the same number of
> >>> items, that is, {.$x must be the same as {.$y .  x and y need not have
> >> the
> >>> same shape, but the leading element of their shapes must be the same.
> >>>
> >>>
> >>>
> >>>> On Sun, Oct 13, 2019 at 3:58 PM 'Jim Russell' via Programming <
> >>>> [email protected]> 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 <[email protected]>
> 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

Reply via email to