[Jprogramming] Another Problem to Sharpen J Skills
Skip Cave
skip at caveconsulting.com
Sat Sep 2 04:00:05 UTC 2017
Mike,
Thanks for reminding me that there's a more concise way to create arrays of
random numbers. I should have realized that.
Skip
Skip Cave
Cave Consulting LLC
On Fri, Sep 1, 2017 at 3:03 AM, '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