SUM and MAKELIST translation bug fixes



Let me begin by describing the bugs.

1) Translating

harm_foo(l,u):=block(mode_declare([l,u],fixnum),
		sum(1/i,i,l,u));

will give you lisp code which contains a form similar to

(DO
 ((|$i| |0| (F1+ |$i|)) (#:G1300 0 (ADD* #:G1300 (RREMAINDER 1 |$i|))))
 ((< N |$i|) #:G1300))

Note the presence of the #: reader macro.  However, in ANSI CL

  Syntax:  #:<<symbol-name>>

  #: introduces an uninterned symbol whose name is symbol-name.  Every
  time this syntax is encountered, a distinct uninterned symbol is
  created.
  
In particular, the first time the step-form (ADD* #:G1300 (RREMAINDER
1 |$i|)) is evaluated the symbol corresponding to this occurrence of
#:G1300 is unbound.

This can be fixed by replacing some occurrences of GENSYM by TR-GENSYM
in the DEF%TR $SUM and DEF%TR $MAKELIST forms.


2) In a similar vein, N and |0| above had better be replaced by
symbols created by TR-GENSYM to cope with extravagances like
sum(1/?n,?n,l,o).  Note that there's actually a somewhat disobliging
comment in the sources to this effect, although the person who made it
seemingly preferred to do nothing about it.

Anyway, I think it is enough to follow the example of DEF%TR $MAKELIST
in this respect.


3) Now, suppose the bounds (l and u in the example above) are not
declared (or otherwise known to Maxima) to be FIXNUMs, say you want to
translate

harm_bar(l,u):=sum(1/i,i,l,u);

In this case Maxima generates completely different lisp code, viz. a
call to DOSUM.  Now, the current environment has to be accounted for
somehow, and this is handled by FUNGEN&ENV-FOR-MEVALSUMARG, which
however contains an obsolete construction and triggers an error.


Here are the context diffs relative to files in the src directory of
the current cvs tree.

Bugs 1) and 2) are dealt with in

http://members.inode.at/wjenkner/maxima/trans1.lisp.diff
(3kB)

while

http://members.inode.at/wjenkner/maxima/fcall.lisp.diff
(1kB)

should take care of 3).


Wolfgang
-- 
wjenkner@inode.at