1 /****************************************************************************
2 **
3 **  This file is part of GAP, a system for computational discrete algebra.
4 **
5 **  Copyright of GAP belongs to its developers, whose names are too numerous
6 **  to list here. Please refer to the COPYRIGHT file for details.
7 **
8 **  SPDX-License-Identifier: GPL-2.0-or-later
9 **
10 **  This file declaress the functions which mainly deal with proper sets.
11 **
12 **  A *proper set* is a list that has no holes, no duplicates, and is sorted.
13 **  For the full definition  of sets see chapter "Sets" in the {\GAP} Manual.
14 **  Read also section "More about Sets" about the internal flag for sets.
15 */
16 
17 #ifndef GAP_SET_H
18 #define GAP_SET_H
19 
20 #include "system.h"
21 
22 /****************************************************************************
23 **
24 *F  SetList(<list>) . . . . . . . . . . . . . . . . .  make a set from a list
25 **
26 **  'SetList' returns  a new set that contains  the elements of <list>.  Note
27 **  that 'SetList' returns a  new list even if <list>  was already a set.  In
28 **  this case 'SetList' is equal to 'ShallowCopy'.
29 **
30 **  'SetList' makes a copy  of the list  <list>, removes the holes, sorts the
31 **  copy and finally removes duplicates, which must appear next to each other
32 **  now that the copy is sorted.
33 */
34 Obj SetList(Obj list);
35 
36 
37 /****************************************************************************
38 **
39 *F  IsSet(<list>) . . . . . . . . . . . . . . . . . . test if a list is a set
40 **
41 **  'IsSet' returns 1 if the list <list> is a proper set  and 0 otherwise.  A
42 **  proper set is a list that has no holes, no duplicates, and is sorted.  As
43 **  a side effect 'IsSet' may changes the type of proper sets.
44 **
45 **  A typical call in the set functions looks like this:                   \\
46 **  |    if ( ! IsSet(list) )  list = SetList(list); |                     \\
47 **  This tests if 'list' is a proper set.  If it is, then the type is changed
48 **  to reflect this. If it is not then 'SetList' is called to make a copy of
49 **  'list', remove the holes, sort the copy, and remove the duplicates.
50 */
51 Int IsSet(Obj list);
52 
53 
54 /****************************************************************************
55 **
56 *F * * * * * * * * * * * * * initialize module * * * * * * * * * * * * * * *
57 */
58 
59 /****************************************************************************
60 **
61 *F  InitInfoSet() . . . . . . . . . . . . . . . . . . table of init functions
62 */
63 StructInitInfo * InitInfoSet ( void );
64 
65 
66 #endif // GAP_SET_H
67