22 Boolean Lists

This chapter describes boolean lists. A boolean list is a list that has no holes and contains only the boolean values true and false (see Chapter Booleans). In function names we call boolean lists blist for brevity.

  • IsBlist( obj ) C

    A boolean list (``blist'') is a list that has no holes and contains only true and false. If a list is known to be a boolean list by a test with IsBlist it is stored in a compact form. See More about Boolean Lists.

    gap> IsBlist( [ true, true, false, false ] );
    true
    gap> IsBlist( [] );
    true
    gap> IsBlist( [false,,true] );
    false    # has holes
    gap> IsBlist( [1,1,0,0] );
    false    # contains not only boolean values
    gap> IsBlist( 17 );
    false    # is not even a list 
    

    Boolean lists are lists and all operations for lists are therefore applicable to boolean lists.

    Boolean lists can be used in various ways, but maybe the most important application is their use for the description of subsets of finite sets. Suppose set is a finite set, represented as a list. Then a subset sub of set is represented by a boolean list blist of the same length as set such that blist[i] is true if set[i] is in sub and false otherwise.

    Sections

    1. Boolean Lists Representing Subsets
    2. Set Operations via Boolean Lists
    3. Function that Modify Boolean Lists
    4. More about Boolean Lists

    [Top] [Previous] [Up] [Next] [Index]

    GAP 4 manual
    February 2000