(define cas-xtm-to-string
(lambda (e)
(cond ((atom? e) (atom->string e))
((list? e)
(cond ((string=? "*" (atom->string (car e)))
(string-append "("
(string-join
(map (lambda (x) (cas-xtm-to-string x)) (cdr e)) "*") ")"))
((string=? "+" (atom->string (car e)))
(string-append "("
(string-join
(map (lambda (x) (cas-xtm-to-string x)) (cdr e)) "+") ")"))
((string=? "/" (atom->string (car e)))
(string-append "("
(string-join
(map (lambda (x) (cas-xtm-to-string x)) (cdr e)) "/") ")"))
((string=? "-" (atom->string (car e)))
(string-append "("
(string-join
(map (lambda (x) (cas-xtm-to-string x)) (cdr e)) "-") ")"))
((string=? "=" (atom->string (car e)))
(string-join
(map (lambda (x) (cas-xtm-to-string x)) (cdr e)) "="))
((string=? "set!" (atom->string (car e)))
(string-join
(map (lambda (x) (cas-xtm-to-string x)) (cdr e)) ":="))
((string=? "vector" (atom->string (car e)))
(string-append "["
(string-join
(map (lambda (x) (cas-xtm-to-string x)) (cdr e)) ",") "]"))
((string=? "exp" (atom->string (car e)))
(string-append "e^" (cas-xtm-to-string (cadr e))))
((string=? "pow" (atom->string (car e)))
(string-append (cas-xtm-to-string (cadr e)) "^" (cas-xtm-to-string (caddr e))))
(else
(string-append (atom->string (car e))
"("
(string-join
(map (lambda (x) (cas-xtm-to-string x)) (cdr e)) ",")
")"))))
(else e))))