lux/chaos.rkt

36 lines
827 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-fps chaos)
(chaos-yield chaos evt)
2014-11-20 15:53:15 +00:00
(chaos-event chaos)
2014-11-19 15:55:00 +00:00
(chaos-output! chaos outputs)
(chaos-label! chaos label)
(chaos-swap! chaos thunk)
#:fallbacks
[(define (chaos-fps c)
60.0)
(define (chaos-yield c e)
(sync e))
2014-11-20 15:53:15 +00:00
(define (chaos-event c)
never-evt)
2014-11-19 15:55:00 +00:00
(define (chaos-output! c os)
(void))
(define (chaos-label! c l)
(void))
(define (chaos-swap! chaos thunk)
(thunk))])
(provide
gen:chaos
(contract-out
[chaos? (-> any/c boolean?)]
[chaos-fps (-> chaos? flonum?)]
[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)]))