difference

difference — constructs a list of the differences between two lists.

Syntax

difference (listA, listB)

		

Arguments

listA

A list.

listB

A list.

Returns

All elements in listA that are not in listB.

Description

Constructs a new list that contains all of the elements in listA not contained in listB as compared by the function eq.

Example

Gamma> a = 1;
1
Gamma> b = 2;
2
Gamma> c = 3;
3
Gamma> d = 4;
4
Gamma> e = 5;
5
Gamma> A = list (a, b, c);
(1 2 3)
Gamma> B = list (b, d, e, c);
(2 4 5 3)
Gamma> difference (A, B);
(1)
Gamma> difference (B, A);
(4 5)
Gamma> 
		

See Also

eq, equal, intersection, union