Even if you mistyped the command you do not have to type it all again as GAP permits a lot of command line editing. Maybe you mistyped or forgot the last closing parenthesis. Then your command is syntactically incorrect and GAP will notice it, incapable of computing the desired result.
gap> (9 - 7) * (5 + 6; Syntax error: ) expected (9 - 7) * (5 + 6; ^
Instead of the result an error message occurs indicating the place where
an unexpected symbol occurred with an arrow sign
^ under it. As a
computer program cannot know what your intentions really were, this is
only a hint. But in this case GAP is right by claiming that there
should be a closing parenthesis before the semicolon. Now you can type
P to recover the last line of input. It will be written after
the prompt with the cursor in the first position. Type ctl-
E to take
the cursor to the end of the line, then ctl-
B to move the cursor one
character back. The cursor is now on the position of the semicolon.
Enter the missing parenthesis by simply typing
). Now the line is
correct and may be passed to GAP by hitting the newline key. Note
that for this action it is not necessary to move the cursor past the last
character of the input line.
Each line of commands you type is sent to GAP for evaluation by pressing newline regardless of the position of the cursor in that line. We will no longer mention the newline key from now on.
Sometimes a syntax error will cause GAP to enter a break loop. This
is indicated by the special prompt
brk. You can leave the break loop
by either typing
return; or by hitting ctl-
D. Then GAP will
return to its normal state and show its normal prompt again.
In this section you learned that mistyped input will not lead to big confusion. If GAP detects a syntax error it will print an error message and return to its normal state. The command line editing allows you in a comfortable way to manipulate earlier input lines.
The Programming Language. A complete list of command line editing facilities is found in Line Editing. The break loop is described in Break Loops.
Previous Up Top Next