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

Tim Kohl tkohl at math.bu.edu
Thu Oct 9 02:02:54 BST 2014


You can create GAP scripts, the convention being to call such a script 
myprogram.g for example and
be sure to include the command 

quit;

as the last line,
and with this you can do something like

gap < myprogram.g 

which will allow you to see the script run ( and to see if it got stuck at an error ) or if your sure of the correctness just do

gap < myprogram.g > myprogram.out

where the .out file has the output.

    -Tim K.

Sent from my iPhone

> On Oct 8, 2014, at 7:02 PM, Douglas Wilson <douglaspardoewilson at gmail.com> 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.  I can pass a saved workspace
> to GAP on the command line, which will
> be used in the subsequent interactive session,
> but that is not the same thing.
> 
> I realize that the GAP is oriented towards
> interactive sessions in a workspace, but surely
> there are ways around that.  For example,
> Smalltalk used to be the same way, but
> GNU Smalltalk will allow you to specify
> a program from the command line, which
> it will then run and exit.
> 
> One motive for asking this is straightforward.
> For me, hi-tech means making the best use
> of the underlying science.  Modern computer
> hardware uses a lot of technology based on
> physics, and is therefore hi-tech.  Almost
> all modern computer software makes little
> use at all of mathematics, and therefore is
> actually quite lo-tech, however sophisticated
> it may seem to the user.
> 
> The future of software, in my opinion will
> inevitably involve more and more use of
> mathematics.  For that purpose, there should
> be a highly mathematical computer
> programming language.  And behold,
> there is: the GAP language.  Except
> for the ability to create Graphical User
> Interfaces, it is functionally complete
> and can do anything more ordinary
> languages can.  That single deficiency
> could be remedied easily be interfacing
> with a simple windowing system, like Tk,
> as Python does.  I'm not much interested
> in writing GUI programs myself, just
> ones to work from the command line.
> 
> My own work is actually quite mathematical,
> and I would like to be able to do things
> like specifying a group by a presentation,
> identifying it, and working with it in the
> usual way.  But I don't want to do it
> interactively, nor do I want to be loading
> up saved workspaces all the time.  I just
> want to use the GAP language like any
> other one.
> 
> Perhaps this capability already exists.
> If so, I can fine no documentation of it
> in the reference manual.  Perhaps you
> could point me to some.  If it doesn't
> exist yet, could it be provided somehow?
> 
>     dpw
> 
> http://DouglasPardoeWilson.SocialTechnology.ca/
> _______________________________________________
> Forum mailing list
> Forum at mail.gap-system.org
> http://mail.gap-system.org/mailman/listinfo/forum



More information about the Forum mailing list