On Fri, Jul 18, 2014 at 09:42:34AM -0400, Tim Kohl wrote:
> One thing to note about using Print for diagnostics is that sometimes
> the output may be buffered so that you don't always see the loop index
> as the loop is proceeding. In that instance the Display() command is
> a better option since it's not buffered and so you'll get 'real time'
> information.
> 
>       -Tim

Dear Tim, dear Forum,

By default GAP does some buffering (and line breaking magic) of the current 
output line. It may be useful to know that there is the "flush character"
'\c' which flushes the output. Also, an explicit line break '\n' flushes the
output. Compare the following loops:

for i in [1..10] do Print(i, " "); Sleep(1); od;

for i in [1..10] do Print(i, "\n"); Sleep(1); od;

for i in [1..10] do Print(i, " \c"); Sleep(1); od;

And finally a fancy variant:

for i in [1..10] do 
  Print(TextAttr.home,TextAttr.delline," i =",String(i,4)," \c"); 
  Sleep(1); 
od; Print("\n");

Best regards,
   Frank
-- 
///  Dr. Frank Lübeck, Lehrstuhl D für Mathematik, Pontdriesch 14/16,
\\\                    52062 Aachen, Germany
///  E-mail: frank.lueb...@math.rwth-aachen.de
\\\  WWW:    http://www.math.rwth-aachen.de/~Frank.Luebeck/

_______________________________________________
Forum mailing list
Forum@mail.gap-system.org
http://mail.gap-system.org/mailman/listinfo/forum

Reply via email to