(defmacro o (&rest l) (let ((last (gensym))) `(let (,last) ,@(mapcar #'(lambda(x) `(setf ,last (oprim ,x))) l) (terpri) ,last))) (defmacro oprim (x) `(progn (format t "[~a]=[~a] " (quote ,x) ,x) ,x)) (defmacro watch (code) `(progn (sb-profile:unprofile) (sb-profile:reset) (sb-profile:profile ,@(my-funs)) (eval ,code) (sb-profile:report) (sb-profile:unprofile) t) ) (defun my-funs () (let ((out '())) (do-symbols (s) (if (and (fboundp s) (find-symbol (format nil "~a" s) *package*) (not (member s *lisp-funs*))) (push s out))) out)) (defmacro time-it (n &body body) (let ((n1 (gensym)) (i (gensym)) (t1 (gensym))) `(let ((,n1 ,n) (,t1 (get-internal-run-time))) (dotimes (,i ,n1) ,@body) (float (/ (- (get-internal-run-time) ,t1) (* ,n1 internal-time-units-per-second)))))) (defun test-time-it (&key (repeats 100) (loops 100) (max 10)) (let (out) (dotimes (i loops) (push (random max) out)) (time-it repeats (list2stdev out))))