[GAP Forum] use GAP as programing language!

Erik Postma e.j.postma+gap at gmail.com
Mon Oct 26 14:31:53 GMT 2009


2009/10/26 Robson eduardo Assis <lotomano at gmail.com>:
> Hi! I am a very new GAP user and i wanna use it as the folowing:
> 1) I write source forges using a text editor whithout any prompt of GAP.
> 2) In the prompt of GAP I excecute the content of this file and take the
> results to
> other file.
> 3) I'll create a program in c plus plus to convert this results in LATEX and
> then to PDF.
>
> the my questions are about using text files ".g" and rediretion of output or
> files. The manual don't answered my question!
> Thank for the patience!
> Robson Eduardo

Hi Robson,

A simple way to achieve this is to use the input and output
redirection features of your shell, and GAP's -q option. You don't
write which OS you use, but on any Unix-alike, something like this
should work:

epostma at ubuntu64ma293:~/tmp % cat a.g
f := (1,2,3);
g := f^2;
epostma at ubuntu64ma293:~/tmp % gap -q < a.g > b.out
epostma at ubuntu64ma293:~/tmp % cat b.out
(1,2,3)
(1,3,2)

Hope this helps,
Erik Postma.



More information about the Forum mailing list