projects
/
jscl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2af650b
)
DEFUN macro
author
David Vazquez
<davazp@gmail.com>
Sun, 16 Dec 2012 23:31:11 +0000
(23:31 +0000)
committer
David Vazquez
<davazp@gmail.com>
Sun, 16 Dec 2012 23:31:11 +0000
(23:31 +0000)
lispstrack.lisp
patch
|
blob
|
history
test.lisp
patch
|
blob
|
history
diff --git
a/lispstrack.lisp
b/lispstrack.lisp
index
44be5a6
..
7b5fbf9
100644
(file)
--- a/
lispstrack.lisp
+++ b/
lispstrack.lisp
@@
-301,6
+301,7
@@
((symbolp x)
(lookup-function x fenv))))
((symbolp x)
(lookup-function x fenv))))
+#+common-lisp
(defmacro eval-when-compile (&body body)
`(eval-when (:compile-toplevel :execute)
,@body))
(defmacro eval-when-compile (&body body)
`(eval-when (:compile-toplevel :execute)
,@body))
@@
-350,6
+351,9
@@
(backquote-expand-1 (cadr form))
form))
(backquote-expand-1 (cadr form))
form))
+(defmacro backquote (form)
+ (backquote-expand-1 form))
+
(define-transformation backquote (form)
(backquote-expand-1 form))
(define-transformation backquote (form)
(backquote-expand-1 form))
diff --git
a/test.lisp
b/test.lisp
index
6d386cb
..
3abd8f5
100644
(file)
--- a/
test.lisp
+++ b/
test.lisp
@@
-1,3
+1,20
@@
+;;; 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")
(lambda (x y) x)
(debug "hola")
@@
-26,12
+43,7
@@
;;; Macros
(debug "---MACROS---")
;;; 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)))
(defmacro incf (x)
(list 'setq x (list '+ 1 x)))
@@
-69,15
+81,9
@@
(debug (lambda (x y &rest z) 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 (f 33))
-;; (debug (foo))
-
;; (eval-when-compile
;; (%compile-defmacro 'defun
;; (lambda (name args &rest body)
;; (eval-when-compile
;; (%compile-defmacro 'defun
;; (lambda (name args &rest body)