title: sleep function (sleep for x seconds) (Maxima)
body: <p>This function sleeps for x seconds, is there a better sleep function, perhaps in fewer lines or that uses less memory (e.g. no 'expand' line)?</p>
  
  <p>Also, it could be more accurate, although for my needs the accuracy is sufficient.<br>
  EDIT: My main use is for a short delay, to view images in the main window as they are created.</p>
  
  <p>I know that '?\*autoconf\-version\*;' can give the Maxima version number, so maybe there is some undocumented way to sleep for a set period of time.</p>
  
  <pre><code>sleep(x) := for i : 1 do
  (
  if (i = 1) then (t:elapsed_real_time()),
  if (elapsed_real_time() - t &gt;= x) then return(),
  expand ((a + b)^500)
  )$
  </code></pre>
  
  <p>to test the sleep function:</p>
  
  <pre><code>print(0, timedate())$
  sleep(1)$
  print(1, timedate())$
  sleep(2)$
  print(2, timedate())$
  sleep(3)$
  print(3, timedate())$
  sleep(4)$
  print(4, timedate())$
  sleep(5)$
  print(5, timedate())$
  </code></pre>
  
  <p>EDIT 2: some useful code (original problem solved)</p>
  
  <pre><code>:lisp (sleep 1)
  ?sleep(1)$
  ?sleep(1);
  sleep(x) := ?sleep(x);
  </code></pre>
  
  <p>EDIT 3: some useful links</p>
  
  <p>[Lisp and Maxima]<br>
  Maxima 5.39.0 Manual: 37. Program Flow<br>
  <a href="http://maxima.sourceforge.net/docs/manual/maxima_37.html" rel="nofollow noreferrer">http://maxima.sourceforge.net/docs/manual/maxima_37.html</a></p>
  
  <p>[How to suppress the output of lisp function]<br>
  Maxima -- GPL CAS based on DOE-MACSYMA / Mailing Lists<br>
  <a href="https://sourceforge.net/p/maxima/mailman/message/33016361/" rel="nofollow noreferrer">https://sourceforge.net/p/maxima/mailman/message/33016361/</a></p>