29.2 ListBlist

ListBlist( list, blist )

ListBlist 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 ] 

BlistList (see BlistList) is the inverse function to ListBlist.

Previous Up Top Next
Index

GAP 3.4.4
April 1997