how to write in a block(?) a very long "block", of statements



Sometimes I wonder if ev should not be simply recursive (even in the 
read-eval-print loop).
I.e. keep on evaluating until no further evaluation is possible. If I 
remember correctly Maple does it that way.
If I am not mistaken Maple detects situations like x:x+1 when x is 
unbound and gives an error.
In maxima you get
ev(x)
x+2
ev(ev(x))
x+3

which I keep finding rather strange (I know why it works that way).

Michel



>Dear Viktor,
>
>Your example is rather complicated, but if I'm not mistaken, it comes down
>to the following:
>
>         expr: alpha$
>         s() := expr$
>         ev( s(), alpha=3 );
>
>You are expecting the last line to evaluate to 3, but it evalutes to alpha.
>This is a misunderstanding of the operation of ev.  ev(EX,alpha=3) does not
>substitute 3 for alpha in the result of evaluating EX; it merely creates an
>environment in which alpha=3 and evaluates EX in that environment.  It does
>not *reevaluate* existing expressions.
>
>Perhaps this confusion comes from the rather complicated semantics of ev,
>since after all ev(expr, alpha=3) evaluates to 3, and you might reasonably
>expect that wrapping expr in a function wouldn't change anything.  But it
>does.  This is one of the many reasons I do not recommend using ev in
>programming.  (In fact, I have documented my many reasons to avoid ev in
>general in previous emails.)
>
>However, you can have ev do what (I think) you expect by adding "infeval" to
>all your ev's.
>      ev(s(), alpha=3, infeval) => 3
>
>That said, I would strongly recommend a solution using "subst" instead of
>ev.  Ev is really not designed for programming, but for interactive use.
>
>              -s
>  
>