intersect : 'a list -> 'a list -> 'a list
- SYNOPSIS
-
Computes the intersection of two `sets'.
- DESCRIPTION
-
intersect l1 l2 returns a list consisting of those elements of l1 that
also appear in l2. If both sets are free of repetitions, this can be
considered a set-theoretic intersection operation.
- FAILURE CONDITIONS
-
Never fails.
- COMMENTS
-
Duplicate elements in the first list will still be present in the result.
- EXAMPLE
-
# intersect [1;2;3] [3;5;4;1];;
val it : int list = [1; 3]
# intersect [1;2;4;1] [1;2;3;2];;
val it : int list = [1; 2; 1]
- SEE ALSO
-
setify, set_equal, union, subtract.