Score:2

How to compile a GAP program in Linux/Debian?

es flag

I installed GAP in my Ubuntu 20.04.

I can write programs and compile them using terminal by writing gap then do the things that I found in GAP manual in your website without any difficult.

But, if I closed the terminal I lose everything, so obviously I have to write a program in a text editor first, then save it (this is my first problem do I have to save it as a .g file or .gap file or....?), next is to compile this program using terminal, I remember when I used C program we had to put something like this: gcc program.c -o program .

So my second question (that I am sure you guessed) is how to compile this GAP file if we use GNU compiler? Thanks in advance.

Score:2
eg flag

good question!

In section 2.2 of the GAP tutorial it explains that you should first save your file that contains your code with the extension .g, and then, after starting GAP in a terminal, you can use the Read() function to read your code from the file. This way, any functions or variables that you have in your file are read into GAP, to then be accessed by you later in the session.

For example, if I have some file example.g, and it is saved to my home directory, then I could navigate to my home directory in a terminal, start GAP with the gap command, and then type the following:

gap> Read("example.g");

and my code would be executed. See GAP tutorial for more info about this, in section 2.2. I am not sure if the GNU compiler would work with the GAP programming language. Hopefully this helps!

user.dz avatar
ng flag
@issamelmariami it can be short too as: `gap example1.g example2.g` it will read files after loading shell.
cocomac avatar
cn flag
OP: If an answer helped you, you can [accept it](https://meta.stackexchange.com/a/5235/1081494) by pressing the checkmark icon. But leaving a comment saying "thank you" is generally not ideal on Ask Ubuntu or other SE sites
Score:1
ng flag

Another option using workspaces:

  • gap> SaveWorkspace("savefile"); to save workspace from inside GAP shell into a fil.

  • gap -L savefile to load the save workspace from file.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.