simp.lisp



Hi,

Firstly I need to apologise to Robert Dodier, whose email I forgot to
reply to: and then it was a couple of days ago.

However, I decided that I really needed to understand
Maxima's simplification routines better, so I've been slowly working my
way down simp.lisp. To ensure I read and understand, I've been writing
documentation strings for the functions as I go, along with reindenting
them for readability.

I'm on plusin at the moment - the going's slow! But it's interesting.
I've got a couple of general questions (actually, now I've written
stuff, it's a question and some remarks):

1) When I finally reach the bottom, would there be interest in
uploading the docced file to cvs? I'm being really careful not to
add/change code, so the only change to the sexps is a string at the
start of each defun. Thus although it would be an enormous patch/change
(think every line of code), there would actually be no change to the
program, just the addition of docs!

2) There are lots of smallish utility functions in simp.lisp, in
particular predicates like mplusp and the like. As a general comment, I
think it might be nice to group up, say, predicates in a file of their
own for reuse - I'm sure we'd find the same code with different names
in different parts of the tree.

3) Some of this code involves lots of copy-paste - in particular the
predicates like ratnump and mplusp, which just check (caar x) - I think
this stuff would be quite amenable to "macroization", which would mean
other tests on the caar could be performed trivially.

4) Goto! Aargh! I never realised _how_ incredibly difficult it is to
understand code with gotos - for example uses them heavily. Although I
understand the code is working currently, I think it's worth going
through this sort of thing and tidying it - after all, if I found a bug
somewhere in the middle of simp.lisp: in plusin, say, I'd just groan
and try to ignore it: the code's just so complicated that it's
incredibly hard to keep in one's head at once (unless this is just me
being rubbish!)

5) (ahah there was another question) Can anyone explain the idiom of
writing a defun containing just a ((lambda (x) ....) nil)) as in
eqtest? Is it just a way of doing let for ancient lisp interpreters
that didn't have it?

That was quite a long post...

Anyway, I'm intending to carry on cranking through simp.lisp because
I?want to understand it, but I was wondering if anyone would be
interested in the results!

Rupert