union : ('a list -> 'a list -> 'a list)

SYNOPSIS
Computes the union of two `sets'.

DESCRIBE
If l1 and l2 are both sets (a list with no repeated members), union l1 l2 returns the set union of l1 and l2. In the case that l1 or l2 is not a set, all the user can depend on is that union l1 l2 returns a list l3 such that every unique element of l1 and l2 is in l3 and each element of l3 is found in either l1 or l2.

FAILURE
Never fails.

EXAMPLE
- union [1,2,3] [1,5,4,3];
val it = [2,1,5,4,3] : int list

- union [1,1,1] [1,2,3,2];
val it = [1,2,3,2] : int list

- union [1,2,3,2] [1,1,1] ;
val it = [3,2,1,1,1] : int list

COMMENTS
Do not make the assumption that the order of items in the list is fixed. Later implementations may use different algorithms, and return a different concrete result while still meeting the specification.

High performance set operations may be found in the SML/NJ library.

SEEALSO  setify,   set_equal,   intersect,   subtract

HOL  Kananaskis 0