<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<!-- %% -->
<!-- %A  coll.msk                    GAP documentation            Alexander Hulpke -->
<!-- %% -->
<!-- %A  @(#)<M>Id: coll.msk,v 1.24 2006/08/29 13:38:17 gap Exp </M> -->
<!-- %% -->
<!-- %Y  (C) 1998 School Math and Comp. Sci., University of St Andrews, Scotland -->
<!-- %Y  Copyright (C) 2002 The GAP Group -->
<!-- %% -->
<Chapter Label="Collections">
<Heading>Collections</Heading>

<#Include Label="[1]{coll}">


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="sect:IsCollection">
<Heading>IsCollection (Filter)</Heading>

<#Include Label="IsCollection">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Collection Families">
<Heading>Collection Families</Heading>

<#Include Label="CollectionsFamily">
<#Include Label="IsCollectionFamily">
<#Include Label="ElementsFamily">
<#Include Label="CategoryCollections">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Lists and Collections">
<Heading>Lists and Collections</Heading>

<Index>Sorted Lists as Collections</Index>
The following functions take a <E>list or collection</E> as argument,
and return a corresponding <E>list</E>.
They differ in whether or not the result is
mutable or immutable (see&nbsp;<Ref Sect="Mutability and Copyability"/>),
guaranteed to be sorted,
or guaranteed to admit list access in constant time
(see&nbsp;<Ref Func="IsConstantTimeAccessList"/>).

<#Include Label="IsListOrCollection">
<#Include Label="Enumerator">
<#Include Label="EnumeratorSorted">
<#Include Label="EnumeratorByFunctions">
<#Include Label="List:coll">
<#Include Label="SortedList">
<#Include Label="SSortedList">
<#Include Label="AsList">
<#Include Label="AsSortedList">
<#Include Label="AsSSortedList">
<#Include Label="Elements">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Attributes and Properties for Collections">
<Heading>Attributes and Properties for Collections</Heading>

<#Include Label="IsEmpty">
<#Include Label="IsFinite">
<#Include Label="IsTrivial">
<#Include Label="IsNonTrivial">
<#Include Label="IsWholeFamily">
<#Include Label="Size">
<#Include Label="Representative">
<#Include Label="RepresentativeSmallest">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Operations for Collections">
<Heading>Operations for Collections</Heading>

<#Include Label="IsSubset">
<#Include Label="Intersection">
<#Include Label="Union">
<#Include Label="Difference">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Membership Test for Collections">
<Heading>Membership Test for Collections</Heading>

<Index Key="in" Subkey="operation for testing membership">
<C>\in</C></Index>
<Index Key="in" Subkey="operation for"><K>in</K></Index>

<ManSection>
<Oper Name="\in" Arg='obj, C' Label="for a collection"/>

<Description>
returns <K>true</K> if the object <A>obj</A> lies in the collection <A>C</A>,
and <K>false</K> otherwise.
<P/>
The infix version of the command
<P/>
<A>obj</A> <K>in</K> <A>C</A>
<P/>
calls the operation <Ref Oper="\in" Label="for a collection"/>,
for which methods can be installed.
<P/>
<Example><![CDATA[
gap> 13 in Integers;  [ 1, 2 ] in Integers;
true
false
gap> g:= Group( (1,2) );;  (1,2) in g;  (1,2,3) in g;
true
false
]]></Example>
</Description>
</ManSection>

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Random Elements">
<Heading>Random Elements</Heading>

<#Include Label="[2]{coll}">
<#Include Label="Random:coll">
<#Include Label="PseudoRandom">
<#Include Label="RandomList">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Iterators">
<Heading>Iterators</Heading>

<#Include Label="Iterator">
<#Include Label="IteratorSorted">
<#Include Label="IsIterator">
<#Include Label="IsDoneIterator">
<#Include Label="NextIterator">
<#Include Label="IteratorList">
<#Include Label="TrivialIterator">
<#Include Label="IteratorByFunctions">

</Section>
</Chapter>

<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<!-- %% -->
<!-- %E -->

