> I'd put my vote in for "do it once, do it right."...
> are we going to use CLOS objects and introduce object
> oriented programming to Maxima?
What I have in mind is more modest than restructuring Maxima. It is
just restructuring generalized numbers. Generalized numbers are things
you can do arithmetic on but generally treat as atomic in symbolic
expressions. Arithmetic on them should be efficient in time and space
(though you can't require bounded size: consider bignums and rationals).
Integers, floats, rationals, float complexes, integer complexes
(Gaussian integers), bigfloats and the like are generalized numbers. So
are real and complex intervals (of various flavors), IEEE floats (which
include various kinds of infinity etc.), various other kinds of infinity
and infinitesimal, modular integers, modular reals (clock arithmetic),
fuzzy sets of different kinds, numeric differentials, etc. Maybe also
non-scalars like numeric-entry matrices of various types, etc.
I am intentionally *not* proposing that these all be unified with
symbolic calculation in a grand universal-algebra object-oriented
framework. That is an interesting, but vaster and more difficult,
project.
Different kinds of generalized number have different properties. For
example, trichotomy fails for complexes and intervals, transitivity
fails for modular numbers, various arithmetic identities fail for
infinities and NaNs (inf-inf is not 0, etc.), etc.
I believe it would be fairly straightforward and not too time-consuming
to add at least scalar generalized numbers. I would do this by having a
single CAAR covering all of them, e.g. gennum, with all additional
information in the cdar and the cdr. I could identify all places where
gennum needs to be handled by looking for all places which handle
bigfloats (in fact, the bigfloat caar would be replaced by gennum). The
hard part is generalizing the logic so that gennums where assumptions
fail (x=x, x-x=0, etc.) are handled correctly.
The gennum package would be object-oriented. I don't know if it's best
to implement it in a traditional Lisp way or to use CLOS. If CLOS, I'd
want to keep to a fairly simple subset....
-s