Renardo's `var()` creates a time-varying value that switches between states at bar-aligned boundaries
A var (TimeVar) holds a list of values and a list of durations. It evaluates to the current value based on the global clock and cycles through values after each duration expires. var([0, 5, 7], [4, 4, 8]) returns 0 for 4 beats, 5 for the next 4, then 7 for 8, then repeats. Crucially, the switch is bar-aligned and deterministic — not random. TimeVars are transparent to arithmetic: var([0,2]) + 5 produces a new var cycling [5, 7]. They can be used anywhere a number is expected: as degree offsets, dur values, bpm, filter frequencies, etc. The common mistake is expecting a var to interpolate — it steps, not glides (use linvar for interpolation).
Examples
# Transpose melody by a varying amount
p1 >> pluck([0,2,4]) + var([0, 2, 0, 7], [4, 4, 4, 4])
# Changing root every 16 beats
Root.default = var([0, 0, 5, 7], [16, 16, 8, 8])
Assessment
What does var([0, 7], 4) return at beat 3? At beat 5? How is this different from linvar([0, 7], 4)?