;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This file is part of ICCLE2.
;
; ICCLE2 is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; ICCLE2 is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with ICCLE2. If not, see
(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)) ;;E.g.
;(deftest test-o () ; (let* ((a 1) ; (b 2) ; (c (+ a b))) ; (o a b c))) ; prints [a]=[1] [b]=[2] [c]=[3] ;;
Returns the mean runtime
;of each
(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)))))) ;