As in
   1 2 3 4 (~.@:,) 3 4 5 6 NB. union u
1 2 3 4 5 6
... or
   1 2 3 4 ([,e.#]) 3 4 5 6
1 2 3 4 5 6

   1 2 3 4 ([-.-.) 3 4 5 6 NB. intersection n
3 4
... or
   1 2 3 4 (e.#[) 3 4 5 6
3 4

?

APL has primitives for these of course!

Mike 

Kip Murray wrote:
> 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
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com 
> Version: 8.5.375 / Virus Database: 270.13.16/2240 - Release Date: 07/15/09 
> 17:58:00
>
>   

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to