lux/chaos.rkt

32 lines
735 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
(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)
#:fallbacks
2014-11-21 18:26:01 +00:00
[(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)
(thunk))])
(provide
gen:chaos
(contract-out
[chaos? (-> any/c boolean?)]
[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)]
[chaos-swap! (-> chaos? (-> any) any)]))