Fix `unstable/time' & xrepl use.

This commit is contained in:
Eli Barzilay 2011-08-01 14:54:53 -04:00
parent 68fce6d9db
commit 1caa28df28
2 changed files with 6 additions and 6 deletions

View File

@ -1,11 +1,11 @@
#lang racket/base #lang racket/base
;; An improved `time' variant: better output, and repetitions with averages ;; An improved `time' variant: better output, and repetitions with averages
(provide time) (provide time*)
(require racket/list) (require racket/list)
(define (time* thunk times) (define (time/proc thunk times)
(define throw (define throw
(if (<= times 0) (if (<= times 0)
(error 'time "bad count: ~e" times) (error 'time "bad count: ~e" times)
@ -43,7 +43,7 @@
cpu (- cpu gc) gc real)) cpu (- cpu gc) gc real))
(apply values results)) (apply values results))
(define-syntax time (define-syntax time*
(syntax-rules () (syntax-rules ()
[(_ n expr0 expr ...) (time* (lambda () expr0 expr ...) n)] [(_ n expr0 expr ...) (time/proc (lambda () expr0 expr ...) n)]
[(_ expr0 expr ...) (time* (lambda () expr0 expr ...) 1)])) [(_ expr0 expr ...) (time/proc (lambda () expr0 expr ...) 1)]))

View File

@ -738,7 +738,7 @@
"\n; "))) "\n; ")))
(define time-id (define time-id
(make-lazy-identifier 'time* '(only-in unstable/time [time time*]))) (make-lazy-identifier 'time* 'unstable/time))
(defcommand time "[<count>] <expr> ..." (defcommand time "[<count>] <expr> ..."
"time an expression" "time an expression"
["Times execution of an expression, similar to `time' but prints a" ["Times execution of an expression, similar to `time' but prints a"