|
From: Kostas O. <k.o...@at...> - 2014-11-13 23:22:12
|
Thanks Raf and Eberhard, I think that will take care of my immediate
problem. But the solution is certainly non-trivial!
maxima has this command:
------------------------------------------------------------------------
_Function:_ *read*/(expr_1, …, expr_n)/
Prints expr_1, …, expr_n, then reads one expression from the console
and returns the evaluated expression. The expression is terminated
with a semicolon |;| or dollar sign |$|.
See also |readonly <cid:par...@at...>|
Example:
(%i1) foo: 42$
(%i2) foo: read ("foo is", foo, " -- enter new value.")$
foo is 42 -- enter new value.
(a+b)^3;
(%i3) foo;
3
(%o3) (b + a)
Categories: Console interaction <cid:par...@at...>
------------------------------------------------------------------------
I think a similar command would be generally useful in Reduce.
Kostas
On 11/13/2014 15:14, Eberhard Schruefer wrote:
> One possibility would be
>
> symbolic procedure ask_value u;
> begin scalar p,r;
> p := setpchar "? ";
> prin2 u;
> r := xread nil;
> return r
> end;
>
> Then
>
> ask_value 'x;
>
> would yield
>
> x? 199;
>
> 199
>
> Eberhard
>
> On 13/11/14 04:08, Kostas Oikonomou wrote:
>> Does Reduce have a "read" command that can get input from the user?
>> E.g. so you can say something like
>> read("x? ", x), which will prompt for a value for x by printing "x? " on
>> the terminal.
>>
>> Kostas
>>
>> ------------------------------------------------------------------------------
>> Comprehensive Server Monitoring with Site24x7.
>> Monitor 10 servers for $9/Month.
>> Get alerted through email, SMS, voice calls or mobile push notifications.
>> Take corrective actions from your mobile device.
>> http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Reduce-algebra-developers mailing list
>> Red...@li...
>> https://lists.sourceforge.net/lists/listinfo/reduce-algebra-developers
>
> ------------------------------------------------------------------------------
> Comprehensive Server Monitoring with Site24x7.
> Monitor 10 servers for $9/Month.
> Get alerted through email, SMS, voice calls or mobile push notifications.
> Take corrective actions from your mobile device.
> http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
> _______________________________________________
> Reduce-algebra-developers mailing list
> Red...@li...
> https://lists.sourceforge.net/lists/listinfo/reduce-algebra-developers
|