Fix `unstable/time' & xrepl use.
This commit is contained in:
parent
68fce6d9db
commit
1caa28df28
|
@ -1,11 +1,11 @@
|
|||
#lang racket/base
|
||||
|
||||
;; An improved `time' variant: better output, and repetitions with averages
|
||||
(provide time)
|
||||
(provide time*)
|
||||
|
||||
(require racket/list)
|
||||
|
||||
(define (time* thunk times)
|
||||
(define (time/proc thunk times)
|
||||
(define throw
|
||||
(if (<= times 0)
|
||||
(error 'time "bad count: ~e" times)
|
||||
|
@ -43,7 +43,7 @@
|
|||
cpu (- cpu gc) gc real))
|
||||
(apply values results))
|
||||
|
||||
(define-syntax time
|
||||
(define-syntax time*
|
||||
(syntax-rules ()
|
||||
[(_ n expr0 expr ...) (time* (lambda () expr0 expr ...) n)]
|
||||
[(_ expr0 expr ...) (time* (lambda () expr0 expr ...) 1)]))
|
||||
[(_ n expr0 expr ...) (time/proc (lambda () expr0 expr ...) n)]
|
||||
[(_ expr0 expr ...) (time/proc (lambda () expr0 expr ...) 1)]))
|
||||
|
|
|
@ -738,7 +738,7 @@
|
|||
"\n; ")))
|
||||
|
||||
(define time-id
|
||||
(make-lazy-identifier 'time* '(only-in unstable/time [time time*])))
|
||||
(make-lazy-identifier 'time* 'unstable/time))
|
||||
(defcommand time "[<count>] <expr> ..."
|
||||
"time an expression"
|
||||
["Times execution of an expression, similar to `time' but prints a"
|
||||
|
|
Loading…
Reference in New Issue
Block a user