((symbolp x)
(lookup-function x fenv))))
+#+common-lisp
(defmacro eval-when-compile (&body body)
`(eval-when (:compile-toplevel :execute)
,@body))
(backquote-expand-1 (cadr form))
form))
+(defmacro backquote (form)
+ (backquote-expand-1 form))
+
(define-transformation backquote (form)
(backquote-expand-1 form))
+;;; Library
+
+(eval-when-compile
+ (%compile-defmacro 'defmacro
+ (lambda (name args &rest body)
+ `(eval-when-compile
+ (%compile-defmacro ',name (lambda ,args ,@body))))))
+
+(defmacro defun (name args &rest body)
+ `(progn
+ (eval-when-compile
+ (%compile-defun ',name))
+ (fsetq ,name (lambda ,args ,@body))))
+
+
+;;; Tests
+
(lambda (x y) x)
(debug "hola")
;;; Macros
(debug "---MACROS---")
-(eval-when-compile
- (%compile-defmacro 'defmacro
- (lambda (name args &rest body)
- (list 'eval-when-compile
- (list '%compile-defmacro (list 'quote name)
- (list* 'lambda args body))))))
+
(defmacro incf (x)
(list 'setq x (list '+ 1 x)))
(debug (lambda (x y &rest z) x))
-(progn
- (eval-when-compile
- (%compile-defun 'f))
- (fsetq f (lambda (x) (* x x))))
-
+(defun f (x) (* x x))
(debug (f 33))
-;; (debug (foo))
-
;; (eval-when-compile
;; (%compile-defmacro 'defun
;; (lambda (name args &rest body)