Skip to content

Commit

Permalink
Add new function MeetBlist (#5778)
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph-Edwards authored Aug 31, 2024
1 parent 6e8713a commit 2b475a8
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 5 deletions.
1 change: 1 addition & 0 deletions doc/ref/blist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ In function names we call boolean lists <E>blists</E> for brevity.
<#Include Label="UniteBlistList">
<#Include Label="IntersectBlist">
<#Include Label="SubtractBlist">
<#Include Label="MeetBlist">
<#Include Label="FlipBlist">
<#Include Label="SetAllBlist">
<#Include Label="ClearAllBlist">
Expand Down
29 changes: 29 additions & 0 deletions lib/list.g
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,35 @@ DeclareSynonym( "IntersectBlist", INTER_BLIST );
##
DeclareSynonym( "SubtractBlist", SUBTR_BLIST );

#############################################################################
##
#F MeetBlist( <blist1>, <blist2> )
##
## <#GAPDoc Label="MeetBlist">
## <ManSection>
## <Func Name="MeetBlist" Arg='blist1, blist2'/>
##
## <Description>
## Returns <K>true</K> if there is a position at which both <A>blist1</A>
## and <A>blist2</A> contain <K>true</K>, and <K>false</K> otherwise.
## It is equivalent to, but faster than
## <C>SizeBlist(IntersectionBlist(blist1, blist2)) &lt;&gt; 0</C>.
## An error is thrown if the lists do not have the same length.
## <Example><![CDATA[
## gap> blist1 := [ true, true, true, true ];;
## gap> blist2 := [ true, false, true, false ];;
## gap> MeetBlist( blist1, blist2 );
## true
## gap> FlipBlist( blist1 );
## gap> MeetBlist( blist1, blist2 );
## false
## ]]></Example>
## </Description>
## </ManSection>
## <#/GAPDoc>
##
DeclareSynonym( "MeetBlist", MEET_BLIST );

#############################################################################
##
#F FlipBlist( <blist> )
Expand Down
10 changes: 5 additions & 5 deletions tst/testinstall/kernel/blister.tst
Original file line number Diff line number Diff line change
Expand Up @@ -304,17 +304,17 @@ gap> x;
[ false, false, true, false ]

# FuncMEET_BLIST
gap> MEET_BLIST(fail, fail);
gap> MeetBlist(fail, fail);
Error, MEET_BLIST: <blist1> must be a boolean list (not the value 'fail')
gap> MEET_BLIST([true,false], fail);
gap> MeetBlist([true,false], fail);
Error, MEET_BLIST: <blist2> must be a boolean list (not the value 'fail')
gap> MEET_BLIST([true,false,true], [true,false]);
gap> MeetBlist([true,false,true], [true,false]);
Error, MEET_BLIST: <blist1> must have the same length as <blist2> (lengths are\
3 and 2)
gap> x:= [false,true,true,false];;
gap> MEET_BLIST(x, [true,true,false,false]);
gap> MeetBlist(x, [true,true,false,false]);
true
gap> MEET_BLIST(x, [true,false,false,false]);
gap> MeetBlist(x, [true,false,false,false]);
false

# FuncFLIP_BLIST
Expand Down

0 comments on commit 2b475a8

Please sign in to comment.