[Jprogramming] Another Problem to Sharpen J Skills
Henry Rich
henryhrich at gmail.com
Sat Sep 2 16:49:37 UTC 2017
Better
6 2 ?@:$ 10
which Is backed by special code.
Henry Rich
On Sep 1, 2017 04:03, "'Mike Day' via Programming" <
programming at jsoftware.com> wrote:
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
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list