BlistList( list, sub ) F
returns a new boolean list that describes the list sub as a sublist of
the dense list list.
That is BlistList returns a boolean list blist of the same length as
list such that blist[i] is true if list[i] is in
sub and false otherwise.
list need not be a proper set (see Sorted Lists and Sets),
even though in this case BlistList is most efficient.
In particular list may contain duplicates.
sub need not be a proper sublist of list,
i.e., sub may contain elements that are not in list.
Those elements of course have no influence on the result of BlistList.
gap> BlistList( [1..10], [2,3,5,7] ); [ false, true, true, false, true, false, true, false, false, false ] gap> BlistList( [1,2,3,4,5,2,8,6,4,10], [4,8,9,16] ); [ false, false, false, true, false, false, true, false, true, false ]
ListBlist( list, blist ) O
returns the sublist sub of the list list, which must have no holes,
represented by the boolean list blist, which must have the same
length as list. sub contains the element list[i] if
blist[i] is true and does not contain the element
if blist[i] is false. The order of the elements in sub is
the same as the order of the corresponding elements in list.
gap> ListBlist([1..8],[false,true,true,true,true,false,true,true]); [ 2, 3, 4, 5, 7, 8 ] gap> ListBlist( [1,2,3,4,5,2,8,6,4,10], > [false,false,false,true,false,false,true,false,true,false] ); [ 4, 8, 4 ]
SizeBlist( blist ) F
returns the number of entries of the boolean list blist that are
true. This is the size of the subset represented by the boolean
list blist.
gap> SizeBlist( [ false, true, false, true, false ] ); 2
IsSubsetBlist( blist1, blist2 ) F
returns true if the boolean list blist2 is a subset of the boolean
list list1, which must have equal length, and false otherwise.
blist2 is a subset of blist1 if blist1[i] =
blist1[i] or blist2[i] for all i.
gap> blist1 := [ true, true, false, false ];; gap> blist2 := [ true, false, true, false ];; gap> IsSubsetBlist( blist1, blist2 ); false gap> blist2 := [ true, false, false, false ];; gap> IsSubsetBlist( blist1, blist2 ); true
GAP 4 manual