length() , patch suggestion



Greetings:

I've mentioned this a couple of times, but now I've made a change
for my own use. As usual, I can make a patch and send it
if anyone is interested in checking it out.

It seems to me that length(), part(), are meant to work together
conceptually (or were at some point in the past).  (I'm not saying it
is a good or bad idea, it just seems to be that way.)

So, if length(expr) is n, then I can operate on,
or access parts 0 through n. But I've seen only one case where
this rule is not followed. (There may be more.)

---------------------------------------------------
(%i1) inflag;
(%o1)                                false
(%i2) length(-1/4);
(%o2)                                  2
(%i3) part(-1/4,2);

part: fell off the end.
  -- an error. To debug this try: debugmode(true);
---------------------------------------------------

The change is to this line in the definition of length()
in comm.lisp

((or $inflag (and (not (member (caar e) '(mtimes mexpt) :test #'eq))
   (not (and (eq 'rat (caar e)) (< (cadr e) 0))))) (length (margs e)))

--John