Update of /project/cl-utilities/cvsroot/cl-utilities In directory common-lisp.net:/tmp/cvs-serv32649
Modified Files: compose.lisp Log Message: Fixed some problems with the benchmarking code and some comments.
Date: Fri May 13 21:17:39 2005 Author: pscott
Index: cl-utilities/compose.lisp diff -u cl-utilities/compose.lisp:1.2 cl-utilities/compose.lisp:1.3 --- cl-utilities/compose.lisp:1.2 Tue May 10 21:45:34 2005 +++ cl-utilities/compose.lisp Fri May 13 21:17:38 2005 @@ -23,16 +23,16 @@ ,@body)))) ;; Make sure the compiler macro gets run (declare (optimize (speed 3) (safety 0) (space 0) (debug 1))) - (time (repeat (3000000) (funcall (compose #'1+ #'2* '1+) 6))) - (time (repeat (3000000) (funcall (lambda (x) (1+ (2* (1+ x)))) 6))) - (time (repeat (3000000) + (time (repeat (30000000) (funcall (compose #'1+ #'2* #'1+) 6))) + (time (repeat (30000000) (funcall (lambda (x) (1+ (2* (1+ x)))) 6))) + (time (repeat (30000000) (funcall (lambda (x) - (funcall #'1+ (funcall #'2* (funcall '1+ x)))) + (funcall #'1+ (funcall #'2* (funcall #'1+ x)))) 6)))))
;; Converts calls to COMPOSE to lambda forms with everything written ;; out and some things written as direct function calls. -;; Example: (compose '1+ #'2* '1+) => (LAMBDA (X) (1+ (2* (1+ X)))) +;; Example: (compose #'1+ #'2* #'1+) => (LAMBDA (X) (1+ (2* (1+ X)))) (define-compiler-macro compose (&rest functions) (labels ((sharp-quoted-p (x) (and (listp x) @@ -40,7 +40,7 @@ (symbolp (second x))))) `(lambda (x) ,(reduce #'(lambda (fun arg) (if (sharp-quoted-p fun) - (list (second fun) arg) + (list (second fun) arg) (list 'funcall fun arg))) functions :initial-value 'x