Ask for the syntax of representing operators in Common-Lisp
Subject: Ask for the syntax of representing operators in Common-Lisp
From: Barton Willis
Date: Wed, 12 Jul 2006 16:21:16 -0500
I'm painting kitchen cabinets today, so I only get to
do mental work in the interstices. I'll consider
committing 'common_lisp' to /share/contrib. My only
reservation is that some users will not understand
its limitations and yell at me. At least
'common_lisp' is easy enough to extend:
(defun $common_lisp (e)
(let (($listconstvars nil))
(print `(lambda ,(sort (mapcar 'stripdollar (margs ($listofvars e)))
'string<) ,(tocl ($ratdisrep e))))
'$done))
(setf (get 'mplus 'cl-function) '+)
(setf (get 'mtimes 'cl-function) '*)
(setf (get 'mexpt 'cl-function) 'expt)
(defun mapatom-to-cl (e)
(cond ((eq e '$%i) (complex 0 1))
(($ratnump e) `(/ ,($num e) ,($denom e)))
((eq e '$%pi) pi)
(($constantp e) ($float e)) ;; converts big floats to doubles
(t (stripdollar e))))
(defun tocl (e)
(if ($mapatom e) (mapatom-to-cl e)
`(,(or (get (mop e) 'cl-function) (stripdollar (mop e))) ,@(mapcar
'tocl (margs e))))))
Barton
-----Daniel Lakeland wrote: -----
>I vote that this function be incorporated into
>the next version of maxima