lux/chaos.rkt

40 lines
926 B
Racket
Raw Normal View History

2014-11-19 15:55:00 +00:00
#lang racket/base
(require racket/contract/base
racket/generic)
(define-generics chaos
2014-11-26 22:21:55 +00:00
(chaos-start! chaos)
2014-11-19 15:55:00 +00:00
(chaos-yield chaos evt)
2014-11-20 15:53:15 +00:00
(chaos-event chaos)
2014-11-22 18:54:08 +00:00
(chaos-output! chaos output)
2014-11-19 15:55:00 +00:00
(chaos-label! chaos label)
(chaos-swap! chaos thunk)
2014-11-26 22:21:55 +00:00
(chaos-stop! chaos)
2014-11-19 15:55:00 +00:00
#:fallbacks
2014-11-26 22:21:55 +00:00
[(define (chaos-start! c)
(void))
(define (chaos-yield c e)
2014-11-19 15:55:00 +00:00
(sync e))
2014-11-20 15:53:15 +00:00
(define (chaos-event c)
never-evt)
2014-11-22 18:54:08 +00:00
(define (chaos-output! c o)
2014-11-19 15:55:00 +00:00
(void))
(define (chaos-label! c l)
(void))
(define (chaos-swap! chaos thunk)
2014-11-26 22:21:55 +00:00
(thunk))
(define (chaos-stop! c)
(void))])
2014-11-19 15:55:00 +00:00
(provide
gen:chaos
(contract-out
[chaos? (-> any/c boolean?)]
2014-11-26 22:21:55 +00:00
[chaos-start! (-> chaos? any)]
2014-11-19 15:55:00 +00:00
[chaos-yield (-> chaos? evt? any)]
2014-11-20 15:53:15 +00:00
[chaos-event (-> chaos? evt?)]
2014-11-19 22:48:05 +00:00
[chaos-output! (-> chaos? any/c any)]
2014-11-19 15:55:00 +00:00
[chaos-label! (-> chaos? string? any)]
2014-11-26 22:21:55 +00:00
[chaos-swap! (-> chaos? (-> any) any)]
[chaos-stop! (-> chaos? any)]))