> how can I specify a function which generates the output for maxima?
Martin,
Well, first let me revise my code from nset... the correct way is:
(displa-def $set dimension-match "{" "}")
This defines dimension-match as the dimension function for $set. The
dimension function takes a Maxima form and returns a representation of
the two-dimensional layout. In this case, dimension-match handles
matchfix syntax in general (e.g. mlist), with parameters
left-display-symbol "{" and right-display-symbol "}". The value of the
dimension function is fed to the function output (in display.lisp),
which has a comment defining its input format.
I did not use def-operator or $matchfix because they define syntax both
for input and for output, and Barton and I did not want to preempt
braces just for sets.
The grind property is used for linear formatting (display2d:false).
Msize-matchfix is the linear equivalent of dimension-match, and also
uses dissym. But it was an error to use it here, because the linear
form {a,b,c} is not recognized on input. I should have just let it use
the default form, set(...).
I don't know how you want to display graphs, but you can always look at
displa.lisp for various models. There are two basic approaches. One is
to define your own format from scratch (this can be messy). The other,
often more convenient, is to reformat the expression and use standard
formatting methods.
Normally, the NFormat module reformats to the external form -- for both
printing and for Part (as opposed to InPart). But NFormat is not
extensible (though that would be easy to change). So you have to do
this in the dim- function itself. For a model, take a look at
dim-mncexpt.
Using this approach, you could easily have an output form like, for
example:
Graph( a -> (b, c) ; b -> (a) ; c -> (c) )
by transforming your internal form to
(($graph simp)
((semilist simp)
((marrow simp) $a ((mprogn) $b $c))
... ))
with the definition
(display-def semilist dimension-nary "; " 0 0)
The other operators (marrow, mprogn) are already defined.
Let me know if you need more information.
-s