"read" question



Hi Barton,

It didn't change things for me.  I also tried various combinations of
load-reset-etc.

What should the usage be?

Here is how I used it.

The new Interactive.mac:

Restart():= block( while (foo # "q") do
            (foo: read("Enter a number to continue, \"q\" to quit. "),
                 print(" you entered ",foo)
             ),
          print(" Bye!")
        )$

(%i1) load("Interactive");
(%o1)                          ./Interactive.mac
(%i2) Restart();
Enter a number to continue, "q" to quit.
34;
    you entered  34
Enter a number to continue, "q" to quit.
25;
    you entered  25
Enter a number to continue, "q" to quit.
"q";
    you entered  q
    Bye!
(%o2)                                 Bye!
(%i3) Restart();
    Bye!
(%o3)                                 Bye!
(%i4) Restart();
    Bye!
(%o4)                                 Bye!

TIA,

-sen


  ---------------------------------------------------------------------------
  | Sheldon E. Newhouse            |    e-mail: sen1 at math.msu.edu           |
  | Mathematics Department         |       				   |
  | Michigan State University      | telephone: 517-355-9684                |
  | E. Lansing, MI 48824-1027 USA  |       FAX: 517-432-1562                |
  ---------------------------------------------------------------------------

On Sat, 27 Jan 2007, Barton Willis wrote:

> -----maxima-bounces at math.utexas.edu wrote: -----
>
>> When I load it into maxima (either command line
>> or xmaxima), it executes as expected.  But, in order to load and
>> execute it again, I have to completely restart maxima.  Is there a
>> simple way to keep the same session going and simply re-run the
>> Interactive.mac file?
>
> Sure, try wrapping the block inside a function; something like
>
>   read_and_print_stuff_until_q() := block( while (foo # "q") do ...)
>
> Barton
>