Skip to content

Instantly share code, notes, and snippets.

@HerbM
Created November 24, 2016 01:24
Show Gist options
  • Save HerbM/4fd85c9c301adea350334b765edab3a6 to your computer and use it in GitHub Desktop.
Save HerbM/4fd85c9c301adea350334b765edab3a6 to your computer and use it in GitHub Desktop.
// Dr. Syme meets Dr. Seuss :slightly_smiling_face:
// Expert FSharp 4.0 p. 165 read aloud:
module public GlobalClock =
type TickTock = Tick | Tock
let mutable private clock = Tick
let private tick = new Event<TickTock>()
let internal oneTick() =
(clock <- match clock with
Tick -> Tock
| Tock -> Tick)
tick.Trigger (clock)
let tickEvent = tick.Publish
// GlobalClock having type TickTock
// Code is beautiful, funny, and useful
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment