Home Online Manual
Top
Back: combinat_lib
Forward: sublists
FastBack:
FastForward:
Up: combinat_lib
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

D.15.9.1 intersectLists

Procedure from library combinat.lib (see combinat_lib).

Usage:
intersectLists(L,M); L list, M list

Return:
list, containing all elements of L which are elements of M

Theory:
we require the elements of the lists to have a compare operator ==.

Example:
 
LIB "combinat.lib";
intersectLists(list(1,1,2,2,3),list(2,3,3,4));
==> [1]:
==>    2
==> [2]:
==>    3
intersectLists(list(1,1,2,2,3),list(1,1,2,2,3));
==> [1]:
==>    1
==> [2]:
==>    2
==> [3]:
==>    3