Dirk Laurie on Wed, 24 May 2017 17:58:31 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Getting my script to wait


I'm writing a tutorial in GP that has little sections with a pattern
of print text, print a Pari-GP expression, print its evaluation,
print a little more text, wait until the reader is ready, go to the
next section.

I thought "input()" would wait for the user as it does in an interactive
session. But no, if I invoke "gp tutorial.gp", it just continues as if the
user typed an empty line, and the whole tutorial just fast-forwards by.

I can understand why it does that: "tutorial.gp" becomes standard
input, and there is nothing of it left.

I can think of several workarounds, e.g. make a function of the whole
tutorial which is invoked at the prompt, but also wonder whether I am
missing something.