On Sunday 11 January 2009 00:15:19 Stefano Ferri wrote:
> works fine. I don't understand your lisp implementation because I
> dont't know lisp, do you want to add the new freeof_var to Maxima
> core in further versions?
I can add it to nrat4.lisp and Expressions.texi if other developers
approve it.
> Can I ask you a last thing? Just for curiosity :-) The code above
> works fine but I wish to understand why with the previous code:
>
> (%i1) freeof_var (ee, [x]) := block ([v : listofvars(ee)],
> not apply("or", map (lambda([xx], member(xx,v)), x)))$
>
> (%i2) map (lambda([e], if freeof(A,e) or freeof(I,e) then e else
> limit(e, A, inf)), u);
>
> where u is a vector, only the first condition in the if statement
> is evaluated, because ee is set only once, only to A and never to
> I. I'm far from being a Maxima geek :-(
As I noted before, (%i1) is just a short definition, it is not
consistent with freeof because it changes the order of arguments.
freeof_var(A,e) returns true for all cases just because it looks for e
in A (not vice versa). Thus the other condition is never evaluated.
Also, apply("or", map (...)) may be not efficient since it performs
full mapping (apply&map does not involve lazy evaluation).
--
Sweetmorn, Chaos 11 YOLD 3175
Alexey Beshenov http://beshenov.ru/