[GAP Forum] Using the GAP language as an ordinary programming language

Petr Savicky savicky at cs.cas.cz
Thu Oct 9 09:29:07 BST 2014


On Wed, Oct 08, 2014 at 04:02:55PM -0700, Douglas Wilson wrote:
> I've been using Python, and therefore have
> access to Sage, which includes an interface
> to GAP.  So I can write a Python program
> that, via Sage, will let me evaluate an
> expression using GAP.
> 
> That seems a very round-about way of
> using GAP, and is limited to single
> expressions.  What I'd really like to do is
> run a GAP language program from the
> command line.

Under Linux, it is possible to use a shell script
to start a gap program and pass some input from
the command line to it. For example, if script.sh
is

  #!/bin/bash
  /somepath/gap << EOF
  parameter := $1;
  Read("program.g");
  EOF

then the shell command

  ./script.sh 123

starts GAP and runs

  parameter := 123;
  Read("program.g");

Best wishes,
Petr Savicky.




More information about the Forum mailing list