1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
;;======================================================================
;; Event Processing and Simulator
;;======================================================================
;; The global event list
(define *event-list* '())
(define *start-time* 0)
(define *end-time* (* 60 60 4)) ;; four hours
(define *now* *start-time*)
(define *done* #f)
;; Each item in the event list is a list of a scheduled time and the thunk
;; (time thunk). Sort the list so that the next event is the earliest.
;;
(define event-sort
(lambda (@a @b)
(< (car @a)(car @b))))
|
>
>
>
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
;;======================================================================
;; Event Processing and Simulator
;;======================================================================
;; The global event list
(define *event-list* '())
(define *start-time* 0)
(define *end-time* (* 60 60 4)) ;; four hours
(define *now* *start-time*)
(define *done* #f)
(define (random-sort l)
(sort l
(lambda (x y)
(equal? 0 (random 2)))))
;; Each item in the event list is a list of a scheduled time and the thunk
;; (time thunk). Sort the list so that the next event is the earliest.
;;
(define event-sort
(lambda (@a @b)
(< (car @a)(car @b))))
|