records



Here's what I just wrote.  get the file
at  http://cs.berkeley.edu/~fateman/temp/msethack.lisp
saveit in, say, c:/temp/rjf.lisp

load it into maxima via
loadfile("c:/temp/rjf.lisp");

establishes  defstruct, new, and @


  Uses @ as new infix operator.


   defstruct(f(x,y,z)); /* declare f to be a record with 3 fields, x,y,z */
   myrecord: new(f);   /* myrecord is an instance of f */
   myrecord@y:45;       /*  change myrecord as seen below. */
   myrecord;  ==>   f(x,45,z)

accessing is done this way...

myrecord@y ==> 45.


  initializers also possible

  defstruct(f(x,y=3.14159, z));
  ff:new(f)  ==>   f(x,3.14159,z)
  ff@y:2.71828 ==>  ff is  f(x,2.71828,z).

would someone care to test this out, and install it?

Perhaps the only part that really needs installation in maxima
is the change to mset, and maybe not even that.

Downside: it  uses up the symbol @.


It would generally be better not to use x,y,z as field names
because assigning values, say x:10 to them will break stuff like ff@x,
which will be ff@10, which is not meaningful.

RJF


RJF 8/14/05