Subject: Well behaved post_eval_functions list (finally)
From: C Y
Date: Wed, 20 Apr 2005 19:42:40 -0700 (PDT)
I finally figured out how to make kill behave as expected for
post_eval_functions. (It's not actually infolists, but special case
definitions in kill1 which get the job done - one for the specific
post_eval_functions arguement and an entry in the kill all behavior
section. infolist entries apparently are not reset - this can be
tested with :lisp (add2lnc 'f $rules) or something like that - kill
will not remove the f.) So I think the current behavior, as seen in the
following and implimented with the contents of the diff at the end,
should be a "proper" implimentaion of this feature. (Feel free to
point out things I have missed, but since this fundamentally is still a
pretty simple feature I'm hoping this will handle it. As always,
thanks Barton and Robert for the clever stuff.)
CY
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) post_eval_functions;
(%o1) []
(%i2) post_eval_functions : [f];
(%o2) f([f])
(%i3) f(x) := x^2;
2 2
(%o3) (f(x) := x )
(%i4) a;
2
(%o4) a
(%i5) kill(post_eval_functions);
(%o5) done
(%i6) f(x) := x^2;
2
(%o6) f(x) := x
(%i7) post_eval_functions;
(%o7) []
(%i8) post_eval_functions : [f];
2
(%o8) [f ]
(%i9) a;
2
(%o9) a
(%i10) kill(all);
(%o0) done
(%i1) a;
(%o1) a
(%i2) post_eval_functions;
(%o2) []
(%i3) load("./ft.mac");
(%o3) ./ft.mac
(%i4) kg*m/s^2;
(%o4) N
(%i5) kg*m^2/s^2;
(%o5) J
(%i6) kg*m^3/s^2;
(%o6)/R/ J m
(%i7) kg*1000*g*m^3/s^2;
(%o7)/R/ J kg m
(%i8) setunits([cm, grains, minutes, dyne, torr, electron_volt]);
(%o8) done
(%i9) kg*m/s^2;
(%o9)/R/ 100000 dyn
(%i10) kg*m^2/s^2;
`rat' replaced 6.24150959647704e+18 by 6241509596477042688//1 =
6.24150959647704e+18
(%o10)/R/ 6241509596477042688 eV
(%i11) setunits([m, kg, seconds, N, torr, J]);
(%o11) done
(%i12) kg*m/s^2;
(%o12) N
(%i13) kg*m^2/s^2;
(%o13) J
(%i14) kg*m^3/s^2;
(%o14)/R/ J m
(%i15) kg*1000*g*m^3/s^2;
(%o15)/R/ J kg m
(%i16) kill(all);
(%o0) done
(%i1) kg*m/s^2;
kg m
(%o1) ----
2
s
(%i2) quit();
Diffs:
diff -r ../../../maximacommiting/maxima/src/macsys.lisp ./macsys.lisp
45c45,55
< (defmacro toplevel-macsyma-eval (x) `(meval* ,x))
---
> ;;(defmacro toplevel-macsyma-eval (x) `(meval* ,x))
>
> ;; Define the finaleval list
> (defmvar $post_eval_functions `((mlist)))
>
> (defun toplevel-macsyma-eval (x)
> ;; Functional definition of toplevel-macsyma-eval
> (setq x (meval* x))
> (dolist (fi (margs $post_eval_functions) x)
> (setq x (mfuncall fi x))))
>
diff -r ../../../maximacommiting/maxima/src/mlisp.lisp ./mlisp.lisp
1411c1411,1415
< (merror "`ratfac' and `ratwtlvl' may not both be used at the
same time.")))))
---
> (merror "`ratfac' and `ratwtlvl' may not both be used at the
same time.")))
> ((eq x '$post_eval_functions)
> (if (not (and ($listp y) (every 'symbolp (margs y))))
> (mseterr x y)))
> ))
diff -r ../../../maximacommiting/maxima/src/suprv1.lisp ./suprv1.lisp
531a532
> ((eq x '$post_eval_functions) (setq $post_eval_functions
'((mlist)) ))
532a534
> (setq $post_eval_functions '((mlist)))
__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/