constant/constantp




On Wed, 22 Jul 2009, Richard Fateman wrote:

< Leo Butler wrote:
< > Is this a bug? That is, is the declaration that x is a constant expected
< > to preclude assigment?
 >   
< I think this is not a bug,  0 is a constant, and 1 is a constant.
< 
 
So the declaration 'constant' is not analogous to C's 'const'? It simply
is expected that one can only assign constants to constants? If so, then 
what about this:

(%i2) define_variable(x,0,constant);
modedeclare: warning: constant is not a built-in type; assuming it is a
Maxima extension type.
(%o2) 0
(%i3) constantp(x);
(%o3) true
(%i4) constantp(y);
(%o4) false
(%i5) x:y;
(%o5) y

Leo

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.