std-intersection | ![]() |
STD-INTERSECTION
returns the intersection of the two sets lst1 and lst2, a list of all elements that are in both lists. The returned list keeps the order of the first list, but we cannot consider it stable because of the problem outlined below.
Problem with Duplicates
The actual implementation has a problem with duplicate elements in the first list:
You might expect that (std-intersection '(0 0 0 1) '(0 0 1))
returns (0 0 1)
, but it actually returns (0 0 0 1)
.
(std-intersection '(0 1 2) '(2 3 4)) => (2)
lst1, lst2: proper lists, without defined order.
The intersection set. A list with elements which are contained in both lists, keeping the order of the first list.
None.
(std-require 'STDLIST)
Defined in STDLIST