Created
November 24, 2016 01:24
-
-
Save HerbM/4fd85c9c301adea350334b765edab3a6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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