[Jprogramming] Another Problem to Sharpen J Skills
'Mike Day' via Programming
programming at jsoftware.com
Fri Sep 1 08:03:09 UTC 2017
I forgot to point out earlier that
6 12 $ ? 72 $ 10
may be defined more succinctly as
? 6 12 $ 10
FWIW, I had a look at an alternative approach, working on the union of
all rows:
union =: ~.@:, NB. ie nub of the ravel
rix =: (] #~ */@:(e."1)~) union NB. another row intersection verb
It works, but is more verbose, uses more memory and more cp time for
the limited
cases I've explored.
Mike
On 01/09/2017 08:40, 'Mike Day' via Programming wrote:
> The main requirement is to obtain the set-intersection of the rows:
>
> rowintersection =: ([-.-.)&~./
>
> (The &~. isn't essential, but it will save space for large arrays
> with significant repetition.)
>
>
> (Drafting this, I see Raul's beaten me to it, though he didn't
> include the &~. !!!)
>
>
> Also,
>
> colintersection =: rowintersection@:|:
>
>
>
> Cheers,
>
>
> Mike
>
>
>
>
> On 01/09/2017 07:48, Skip Cave wrote:
>> ]a =: 6 12$ ?72$10
>
>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list