[Jprogramming] What is the best compound for set intersection?

Henry Rich henryhrich at gmail.com
Sun Apr 25 16:55:29 UTC 2021


Yes.  I would be implementing

([ -.!.0 -.)

but I don't want to demand that the user write that.  It's like

(i. <./) y

which is implemented as (i.!.0   <./) y

Henry Rich

On 4/25/2021 12:41 PM, Roger Hui wrote:
> A friendly reminder:  beware of tolerant comparison when dealing with the
> set functions.  In particular, the meme (i.@# = i.~) for computing the
> nubsieve and nub, in the APL folklore for decades, can give bad results for
> floating point arguments with tolerant comparison.
>
> If this idea is new to you, the following may be helpful:
> *- Index-Of on Multiple Floats
> <https://www.dyalog.com/uploads/conference/dyalog17/presentations/D07_IndexOf_on_Multiple_Floats.zip>*,
> Dyalog User Meeting, 2017
> *- Tolerant Unique
> <https://www.dyalog.com/uploads/conference/dyalog17/presentations/D10_Tolerant_Unique.zip>*,
> Dyalog User Meeting, 2017.
>
>
> On Sun, Apr 25, 2021 at 9:06 AM Henry Rich <henryhrich at gmail.com> wrote:
>
>> The i.-family is missing a member, I think. We have (x -. y) to find the
>> items of x not in y, but we don't have a way, supported by fast code, to
>> find the items of x that ARE in y.  I'd like to fill that in.  But what
>> is the best idiom, call it I?  I have two requirements, apart from valid
>> result:
>>
>> * the definition should allow for precomputing the search table via at
>> least one of m&I and I&n
>> * the definition should give reasonable and explainable results when x
>> and y have different rank
>>
>> In addition, it would be nice if
>>
>> * repeated items in one argument, preferably x, are repeated in the
>> result, for symmetry with (x -. y)
>>
>> I have used two idioms for intersection: ([ -. -.) and (e. # [) . (e. #
>> [) is ill-behaved on arguments of different rank.  So I am leaning toward
>>
>> ([ -. -.)
>>
>> for I .  Any other ideas?
>>
>> Henry Rich
>>
>>
>> --
>> This email has been checked for viruses by AVG.
>> https://www.avg.com
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm


-- 
This email has been checked for viruses by AVG.
https://www.avg.com



More information about the Programming mailing list