On 11/11/07, Barton Willis <willisb at unk.edu> wrote:
> Unless somebody has a better name or implementation, I'll commit
> unwind_protect to /share/contrib.
Well, I'll make the same comment as I did last time ...
I think exposing Lisp UNWIND-PROTECT is useful, but the
way it is written in Lisp, I find it hard to tell what is going on:
the arguments are treated very differently, but I can't see that
from reading an undistinguished list of expressions.
How about this. protected_by has the same functionality
as unwind_protect, with different syntax.
my_sign (e, [f]) := block ([prederror : false, my_context],
(newcontext (my_context),
for fi in f do assume (fi),
sign(e))
protected_by killcontext (my_context));
Implementation:
infix ("protected_by", 5, 25); /* or equivalent declarations in Lisp */
(defmspec $protected_by (form)
(let
((a0 (cadr form))
(a1 (cddr form)))
(unwind-protect
(meval a0)
(mapcar #'meval a1))))
> The name might give users the impression that they need to
> learn CL to work with Maxima. And maybe that's a good thing :)
I dunno. Lisp is fairly strange, few people know it, and there isn't
any necessary connection to mathematics.
Knowing the implementation language sheds light on Maxima,
but Maxima should be comprehensible on its own terms.
All the best,
Robert