Good, and there is at least one other nice way to do it.

Matthew Brand wrote:
>    u =. ~.@,
>    n =. ~.@(e.#[)
>     1 2 3 4 u 3 4 5 6
> 1 2 3 4 5 6
>     1 2 3 4 n 3 4 5 6
> 3 4
> 
> 
> 
> 2009/7/16 Kip Murray <[email protected]>:
>> The following is easy but interesting.
>>
>> A "set" is a numeric vector without repetitions.  Provide definitions for the
>> union u and intersection n of two sets:
>>
>>    1 2 3 4 u 3 4 5 6  NB. elements of one or the other
>> 1 2 3 4 5 6
>>
>>    1 2 3 4 n 3 4 5 6  NB. common elements
>> 3 4
>>
>> ----------------------------------------------------------------------
>> 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