[Maxima] mapatom safe op function

Richard Fateman fateman at cs.berkeley.edu
Mon Dec 15 18:14:41 CST 2008


Barton Willis wrote:
> Does Maxima  have a function that is equivalent to
>
>     safe_op(e) := block([inflag : true], if mapatom(e) then false else 
> op(e));
>
> If not, I think we should --- if not mapatom(e) then op(e) is frequent and 
> tiresome.
>
> Barton
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>   
I think this could be written as

(defun $safe_op(e)(and  (listp e)(listp (car e))(getop(caar e)))

and yes, it would be much simpler than what goes on with ... if not 
mapatom(e) then op(e).....

RJF




More information about the Maxima mailing list