Programming with GAP: First session with GAP

Key Points

First session with GAP
  • Remember that GAP is case-sensitive!

  • Do not panic if you see Error, Variable: 'FuncName' must have a value.

  • Care about names of variables and functions.

  • Use command line editing.

  • Use autocompletion instead of typing names of functions and variables in full.

  • Use ? and ?? to view help pages.

  • Set the default help format to HTML using SetHelpViewer.

  • Use the LogTo function to save all GAP input and output into a text file.

  • If calculation takes too long, press -C to interrupt it.

  • Read ‘A First Session with GAP’ from the GAP Tutorial.

Some more GAP objects
  • GAP has a plethora of various immediate, positional and component objects.

  • List arithmetic is very flexible and powerful.

  • Objects like lists and records are good to keep structured and related data.

Functions in GAP
  • Command line is good for prototyping; functions are good for repeated calculations.

  • Informative function names and comments will make code more readable to your future self and to others.

  • Beware of undeclared local variables!

Using regression tests
  • It is easy to create a test file by copying and pasting a GAP session.

  • Writing a good and comprehensive test suite requires some effort.

  • Make it right, then make it fast!

Small groups search
  • Organise the code into functions.

  • Create small groups one by one instead of producing a huge list of them.

  • Using SmallGroupsInformation may help to reduce the search space.

  • GAP is not a magic tool: theoretical knowledge may help much more than the brute-force approach.

Attributes and Methods
  • Positional objects may accumulate information about themselves during their lifetime.

  • This means that next time the stored information may be retrieved at zero cost.

  • Methods are bunches of functions; GAP’s method selection will choose the most efficient method based on the type of all arguments.

  • ‘No-method-found’ is a special kind of error with useful debugging tools helping to understand it.

First session with GAP

Some more GAP objects

Functions in GAP

Using regression tests

Attributes and Methods

Glossary

Attribute
Operation (normally, one-argument), the result of which is stored in its argument and cannot be changed any more.
List
Data structure whose elements are indexed by their position in the list.
Method
Function that will be called for an operation for arguments of the specified type.
Operation
GAP function for which several methods may be available (the particular method that will be used depends on the type of the arguments).
Property
Boolean-valued attribute
Record
Data structure which is a collection of components, each having a unique name, which is an identifier that distinguishes this component, and a value, which is an object of arbitrary type.
Regression testing
Testing based on rerunning previously completed tests to check that new changes do not impact their correctness or worsen their performance.