Here is an example of a function that prints the numbers from
1 to 100. The function prints 20 numbers at a time waiting
for the user to press Cntrl-D after having printed 20 numbers:
Print20AtATime := function( ) local i; for i in [ 1 .. 100 ] do Print( i, "\n" ); if i mod 20 = 0 then Print( "Press Cntrl-D" ); Read( "*stdin*" ); fi; od; end;
The trick is to use the statement Read("*stdin*") in order to
read from standard input. However, I cannot see how one can erase
the "Press Cntrl-D" since GAP produces a newline after it has read
Cntrl-D.
Werner Nickel
Mathematics Research Section
Australian National University