How to eval a "quoted" expression?



In practice, I think most users of ev should not be using
ev at all.  Instead all names  should be separated into two
sets:
   the indeterminates,   say x,y,z   which will never
be on the left side of an assignment statement and which
will never be bound to anything.
    and
   the variables and constants, say temp, part_one, r,s,u,v, 34.
These will always have values or be bound.
Instead of using ev, use subst.  thus  subst(3,x,expression)
or subst([x=3],expression)

instead of
x:=3;
ev(expression).


Not everything that can be done by ev can be done in this
way, but substitution semantics tends to be much clearer.

The primary difference between lisp and macsyma is that
in lisp, evaluating
foobar --> foobar unbound. error.
in macsyma,
foobar --> foobar   if no previous value.  That is,
any unbound variable is magically quoted.

The notation ''  is sort of like lisp's #.  but I
would not want to pursue all the details of this
analogy.  I use '' in exactly one case, and that
happens fairly often
e:  big_hairy_computation_with_x_in_it....$

f(x):=''e$



Instead of using ev,  subst

Stavros Macrakis wrote:
> A few more examples which may be useful:
> 
>   v: 'vv1;
>   vv1: 'vvv1;
>   vvv1: 'vvvv1;
> 
>   '( '(v) ) => 'v
>   '( v ) => v
>   '( ''v ) => vv1
>   ''v => vvv1
>   ''(''v) => vvvv1
> 
> My example of ev was flawed because I didn't re-set v.  This is better:
> 
>  v: 'vv1;
>  [v, ev(v), v: 'vv2, v, ev(v)] =>  [vv1, vvv1, vv2, vv2, vvv2]
> 
> _______________________________________________
> Maxima mailing list
> Maxima@www.math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima