> < ^ Date: Thu, 10 Feb 2000 10:09:50 -0600
> ^ From: Nathan Dunfield <nathand@abel.math.harvard.edu >
> ^ Subject: Ignoring errors.

Dear Gap Forum,

Is is possible to call a GAP function and simply ignore any errors it
generates and continue on regardless? Bill Thurston and I are going
through at large collection (10,000) of finitely presented groups and
applying a function to each of them which searches for finite index
subgroups with infinite abelianizations. So the code looks like:

for G in LargeCollectionOfGroups do
SearchForSubgroups(G);
od;

Now SearchForSubgroups sometimes fails because, say, a Todd-Coxeter
coset enumeration uses more than 256,000 cosets, or there's integer
overflow, or whatever. These failures are very rare, and since we
have a number of different variants of SearchForSubgroups, when
SearchForSubgroups fails, we just want to continue testing other
examples, and hope that one of the other methods works better next
time. But if one is running the code overnight, when there's a
failure in SearchForSubgroups early on, you end up sitting in the
break loop until morning.

In a language with exceptions, the code I want would look like:

for G in  LargeCollectionOfGroups do
  try:
     SearchForSubgroups(G); 
  except:         # or, in C++, catch
     DoNothing;
od;

Is this possible?

Thanks,

Nathan Dunfield


> < [top]