Complicated objects in Maxima



Richard Fateman <fateman at eecs.berkeley.edu> writes:
> On 5/17/2012 7:21 AM, Robert Dodier wrote:
>> Rupert,
>>
>> Your general approach makes sense to me. A few comments.
>>
>> About CLOS objects, I don't see any problem with letting them float
>> around in Maxima. Makes sense to me to patch DISPLA to print them.
>> May as well use native Lisp objects whenever they're useful.
> I think there is a potential problem, since CLOS objects will look
> like atoms.
> Every place that in the system in which there is an implicit assumption that
> every expression E is either a lisp list with an operator found by
> (caar E), or
> an atom which is a number or a symbol, may need to be checked for
> an atom which is a number or a symbol or a CLOS object.
>
>   I think it would be safer to introduce extra stuff via
>
> ((group_stuff simp) <clos-object>)
>
> in which case the simplifier for group_stuff will know about the object,
> and the display properties can use the regular dispatch mechanism.

Yep, I'm convinced. I suspect that one almost never wants to do
defmethod-like dispatching on the expression anyway, so there doesn't
seem to be any downside there.

>
> Nuking defstruct seems like a bad idea: the substructures in defstruct
> are maxima expressions, not CLOS objects.  Unless everything in
> Maxima is framed in terms of CLOS, (probably too much work !)
> I think there is a problem.

Ok, I'm not convinced that it's worth the effort to port the working
defstruct code to modern (as in 1990's) Common Lisp. But I don't know
what you mean by a problem? I think that Robert's suggesting moving to
Lisp's defstruct, in which case the results still look like conses.

>> There is an existing structure scheme in Maxima which is essentially a
>> reimplementation of similar stuff in Lisp. See defstruct, @, new.
>> However that doesn't have any method stuff so it sounds like what you're
>> doing is beyond its capabilities.
> Probably some variant of methods could be introduced to defstruct with
> a page or so of code;
> Maybe using tellsimp, it would be only a few lines.

Why on Earth would you do that? Proving Greenspun's 10th rule right in a
system hosted in Lisp would be downright depressing...

Rupert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: not available
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20120517/3be043f4/attachment-0001.pgp>;