declare a set variable

add a person to a set

remove a person from a set

size of a set

union of two sets

intersection of two sets

difference of two sets

set of all parents

set of all children

set of all spouses

set of all siblings

set of all ancestors

set of all descendents

same as descendentset; spelling

remove duplicates from set

sort indiset by name

sort indiset by key values

sort indiset by auxiliary values

generate indiset from GEDCOM name string

generate GEDCOM file from person set

**forindiset**(,*SET*,*INDI_V*,*ANY_V*) {*INT_V*}*commands*loop through all persons in person set

These functions allow you to manipulate person sets. A person set is a potentially large set of persons;
each person may have an arbitrary value associated with him/her. A person set must be declared with
the `indiset` function before it can be used.

`Addtoset` adds a person to a set. The first argument is the set; the second argument is the person; and
the third argument may be any value. The same person may be added to a set more than once, each time
with a different value. `Deletefromset` removes a person from a set. The first argument is the set; the
second argument is the person; if the third parameter is true all of the person's entries are removed
from the set; if false only the first entry is removed. `Lengthset` returns the number of persons in a
person set.

`Union`, `intersect` and `difference` return the set union, set intersection and set difference, respectively,
of two person sets. Each functions takes two person sets as arguments and returns a third person set. The
functions do not affect the values of their two argument sets.

`Parentset`, `childset`, `spouseset` and `siblingset` return the set of all parents, set of all children, set of
all spouses and set of all siblings, respectively, of the set of persons in their argument. In all cases there
is no change to the argument person set.

`Ancestorset` returns the set all ancestors of all persons in the argument set. `Descendentset` returns the
set of all descendents of all persons in the argument set. `Descendantset` is the same as `descendentset`; it allows an alternate spelling.

`Uniqueset` sorts a person set by key value and then removes all entries with duplicate keys; the input
set is modified and returned.

`Namesort`, `keysort` and `valuesort` sort a set of persons by name, by key and by associated value,
respectively.

Each person in a person set has an associated value. When a person is added to a set with `addtoset`, the
value is explicitly assigned. When new sets are created by other functions, a number of rules are used to
associate values with persons as they are added to the new sets. For `parentset`, `childset` and
`spouseset` the values are copied from the first input set person that causes the new person to be added
to the set. For `union`, `intersect` and `difference`, the values are copied from the values in the first input
set, except in the case of `union`, when persons are taken from the second set alone, in which case the
values come from there. For `ancestorset` and `descendantset` the value is set to the number of generations
the new person is away from the *first* person in the input set that the new person is related to. If the
new person is related to more than one person in the input set, the value is set for the nearest
relationship; that is, the value is as low as possible. `Valuesort` sorts a person set by the values of these
auxiliary values.

`Genindiset` generates the set of persons that matche a string whose value is a name in GEDCOM
format. `Genindiset` uses the same algorithm that matches names entered at the browse prompt or by
the user interaction `getindiset` function.

`Gengedcom` generates GEDCOM format output, to the report output file, of all persons in the argument
person set. The output contains a person record for each person in the set, and all the family records that
link at least two of the persons in the set together.

`Forindiset` is an iterator that loops through each person in an indiset. The first parameter is an indiset.
The second parameter is a variable that iterates through each person in the set. The third parameter
iterates through the values associated with the persons. The fourth parameter is an integer variable
that counts the iterations.