(setq rcs-machacks- "$Header: machacks.l 1.5 83/07/05 00:04:09 jkf Exp $") ;; (c) copywrite 1982, University of California, Berkeley ;; (c) copywrite 1982, Massachusetts Insititute of Technology ;; This file was originally written at the University of California, ;; Berkeley. Some portions were modified and additions made were made at ;; MIT. ;; machacks - maclisp compatibility package. ;; when this file is fasl'ed into a lisp, it will change the syntax to ;; maclisp's syntax and will define functions know to the standard maclisp. ;; it is also used to bootstrap vaxima compilation. ; ; this file will be fasled whenever the -m switch is set for compilation. ; (declare (macros t)) (def coutput (lambda (msg) (print msg) ; should go to unfasl port (terpr))) ;--- displace ; this is useful after a macro has been expanded and you want to save the ; interpreter the trouble of expanding the macro again. ; [this is really only useful for interpretation] (defun displace (old-form new-form) (cond ((atom old-form) (error '|not able to displace this form| old-form)) ((atom new-form) (rplaca old-form 'progn) (rplacd old-form (list new-form))) (t (rplaca old-form (car new-form)) (rplacd old-form (cdr new-form))))) ;--- fboundp :: check if a symbol has a function binding ; (defmacro fboundp (form &protect (form)) `(and (symbolp ,form) (getd ,form))) (defmacro list* (&rest forms) (cond ((null forms) nil) ((null (cdr forms)) (car forms)) (t (construct-list* forms)))) (eval-when (load compile eval) (defun construct-list* (forms) (setq forms (reverse forms)) (do ((forms (cddr forms) (cdr forms)) (return-form `(cons ,(cadr forms) ,(car forms)) `(cons ,(car forms) ,return-form))) ((null forms) return-form)))) (defmacro ttf (&rest l) `(list* . , l)) ;; lexpr-funcall is a cross between apply and funcall. the last arguments ;; is a list of the rest of the arguments ;; this is now in Franz Opus 38.35 ;; (defmacro lexpr-funcall (func &rest args) ;; `(apply ,func (list* ,@args))) ; contents of the file libmax;macros all of these functions are ; (by default) in maclisp ;; (if x p q1 q2 ...) --> (cond (x p) (t q1 q2 ...)) ;; it is important that (if nil