public class Metro { 4 => int beatsPerMeasure; 140 => int beatsPerMinute; 1 => int beat; 1 => int measure; 1 => int totalBeats; (1.0 / (beatsPerMinute * beatsPerMeasure / 4.0))::minute => dur beatLength; beatsPerMeasure::beatLength => dur measureLength; false => int running; Event pulse; fun void run() { while(running) { beatLength => now; 1 +=> beat; 1 +=> totalBeats; if(beat > beatsPerMeasure) { 1 => beat; 1 +=> measure; } pulse.broadcast(); } } fun void start() { true => running; spork ~ run(); } fun void stop() { false => running; } }