Created
February 24, 2011 07:13
-
-
Save mbrezu/841878 to your computer and use it in GitHub Desktop.
tefun.lisp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defpsmacro tefun (name args &body body) | |
(let ((traced-name (gensym (symbol-name name)))) | |
`(progn | |
(defun ,traced-name ,args | |
,@body) | |
(defun ,name ,args | |
(trace (+ "entering " | |
,(encode-js-identifier (symbol-name name)) | |
"(" | |
,@(mapcar #'(lambda (name val) | |
`(+ ,(symbol-name name) | |
" = " | |
,val)) | |
args | |
args) | |
")")) | |
(let ((result (,traced-name ,@args))) | |
(trace (+ "exiting " | |
,(encode-js-identifier (symbol-name name)) | |
" returning " | |
result)) | |
(return result)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment