Take the following code snippet as an example:
f:= FreeGroup("P","Q","R","S");
AssignGeneratorVariables(f);
g:= f/ParseRelators(f, "P^12=Q^4=R^4=S^8=1, Q^2=R^2, S^2 = P^6*Q^2*R,
Q*P=P^7*Q^2*R, Q*P^3=P^3*Q, R*P=P^10*Q*R, R*Q=P^6*Q^3*R, S*P=P^2*R*S,
S*Q=P^3*Q^3*R*S, S*R=R*S" );
I'm not sure if there is a long code line continuation method implemented in GAP language.
Edit: Based on the nice tricks and tips given by Olexandr and Horn, I would like to add some corresponding supplementary information as follows:
"Triple Quoted Strings" is described here.
The handling mechanism of line continuation, i.e., backslash followed by new line, is described here.
In addition, the gap source code also includes the following description:
$ ugrep -i 'line continuation.*backslash'
bin/x86_64-pc-linux-gnu-default64-kv8/src/io.c: // handle line continuation, i.e., backslash followed by new line; and
src/io.c: // handle line continuation, i.e., backslash followed by new line; and
Regards, HZ
The problem here is not with the command occupying several lines, but with the string including a line break, as the error message says:
You have to use backslash
\
to continue the string from a new line. This input works:You can also use spaces as you like to indent and format it, e.g.
or so.