Progress, sort of - problem localized, if not understood



--- Barton Willis  wrote:
> 
> It seems that Maxima is calling a non-nset union function.
> This seems unrelated to your lasteval function.  Did you do
> 'make clean'?  Did the test suite run OK without your extra
> lasteval code?

Yes, to both.  With the default setup, the only errors I see on a make
check are:

STYLE-WARNING: using deprecated EVAL-WHEN situation names LOAD EVAL
COMPILE
STYLE-WARNING: redefining $F in DEFUN

So those at least are unrelated to this.  The others I don't see (this
is with sbcl 0.8.20 and cvs maxima.  I'm somewhat baffled as to why
this could matter.

> The errors you see in the trigrat and friends (35 rtest15.mac) look
> like the kind errors Maxima reports when the testsuite
> is run more than once (might be related to the bug that kill
> kills too much). Again, this seems unrelated to you lasteval
> function.

Hmm. OK.  I tried again, using your "Maximaized" version, with the
following:

make clean
make check

again using sbcl.  The result was the same - clearly something in
Maxima doesn't like the presence of lasteval, although why it would
manifest itself in this fashion I have no idea.  

Poking around, since $union is on the major offenders list, the only
other instance of $union I see in the lisp source code is in
trdata.lisp.  What effect that could have is not immediately clear. 
The header of the source file is not encouraging:

;;; N.B. This is some data. Boy, does it have subtle effect on the code
;;; produced by TRANSLATE. It should be carefully checked and updated.
;;; Since it is so small, and compiles so quickly it sometimes serves
;;; as a fix (i.e. hack) file. so be careful.

The code containing $union is :

;;; ELL has just shown a bug with FIRST and REST interaction with
;;; DEFMATCH and MATCHDECLARE. The extra simplification needed
;;; it seems. LIST mode must be implemented, untill then the
;;; cost of the extra SIMPLFY call is not much compared with the
;;; consing involved. Above all, we must have correct code !!!

 (mapc #'(lambda (l) (putprop l t 'tr-nosimp))
	'(				;$FIRST $REST $LAST
	  $print
	  $num $denom $lhs $rhs $part
	  $cons $reverse $endcons $append
	  $union $intersection $setdiff $symdiff
	  $mapset $predset |${| $elementof
	  ))

Now, here is the surprising fact - when I commented out the above mapc
statement, ALL TEST SUITE ERRORS VANISHED.  Not just the nset related
ones - the test suite totally passed.  My guess is this mapc statement,
or parts of it, is/are something left over from the old set code?  The
problem is it has lots of critical pieces in it, like $print, $lhs, and
$rhs which don't pertain strictly to sets.  Although the test suite
passed without this mapc being present at all, so it's hard to see how
it could be truly critical.  Any guru know what this is about?

After all that, I ran a quick check of the functioning of lasteval -
more extensive testing will have to wait til this evening:

Maxima 5.9.1.1cvs http://maxima.sourceforge.net
Using Lisp SBCL 0.8.20
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
This is a development version of Maxima. The function bug_report()
provides bug reporting information.
(%i1) finalevallist;
(%o1)                                 []
(%i2) processunits(exp) := (block[letrat:true],letsimp(exp,ruleset1));
(%o2)  processunits(exp) := (block             , letsimp(exp,
ruleset1))
                                  letrat : true
(%i3) let([kg*m/s^2,N],ruleset1);
                                  kg m
(%o3)                             ---- --> N
                                    2
                                   s
(%i4) finalevallist : [processunits];
(%o4)                           [processunits]
(%i5) kg*m/s^2;
(%o5)                                  N



Just fyi, this is the macsys.lisp diff:

 diff maxima/src/macsys.lisp maximabuild/src/macsys.lisp
95a96,106
> (defun lasteval (f x)
> ;; Does a final evaluation using a user supplied list of
> ;; functions, listed in finalevallist  (Barton Willis wrote
> ;; this one to Maximaize a pure lisp one by CY.)
>   (setq f (reverse (margs f)))
>   (dolist (fi f x)
>     (setq x (mfuncall fi x))))
> 
> ;; Initialize finalevallist
> (defmvar $finalevallist `((mlist)))
> 
161c172,173
<       (setq $% (toplevel-macsyma-eval $__))
---
>       (setq $% (toplevel-macsyma-eval $__)) ;; Global definition of
$% - important!!
>       (setq totaleval (lasteval $finalevallist (toplevel-macsyma-eval
$__)))
172c184
<       (set (setq d-tag (makelabel $outchar)) $%)
---
>       (set (setq d-tag (makelabel $outchar)) totaleval)
189c201
<           (displa `((mlable) ,d-tag ,$%)))
---
>           (displa `((mlable) ,d-tag ,totaleval)))


and the trdata.lisp diff:

diff maxima/src/trdata.lisp maximabuild/src/trdata.lisp 
86,93c86,93
<   (mapc #'(lambda (l) (putprop l t 'tr-nosimp))
<       '(                              ;$FIRST $REST $LAST
<         $print
<         $num $denom $lhs $rhs $part
<         $cons $reverse $endcons $append
<         $union $intersection $setdiff $symdiff
<         $mapset $predset |${| $elementof
<         ))
---
> ;;; (mapc #'(lambda (l) (putprop l t 'tr-nosimp))
> ;;;   '(                              ;$FIRST $REST $LAST
> ;;;     $print
> ;;;     $num $denom $lhs $rhs $part
> ;;;     $cons $reverse $endcons $append
> ;;;     $union $intersection $setdiff $symdiff
> ;;;     $mapset $predset |${| $elementof
> ;;;     ))
123c123
<   )
\ No newline at end of file
---
>   )



		
__________________________________ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/