Renardo Patterns are cyclic sequences that support arithmetic, slicing, and algorithmic manipulation
The core data structure for Renardo is Pattern (accessed via P[...]). Patterns cycle indefinitely when consumed by a player, so P[0,1,2] applied to a dur produces a repeating 3-element rhythm. Arithmetic operators apply element-wise and return new Patterns: P[0,1,2,3] + 2 yields P[2,3,4,5]. Methods include .repeat(n), .stretch(n) (repeat each element), .reverse(), .shuffle(), .stutter(n) (n copies of each). The | operator concatenates two patterns. PGroup (0,2,4) makes chord — multiple pitches on one beat. Patterns differ from plain Python lists: they cycle, support ops, and carry special player semantics.
Examples
p1 >> pluck(P[0,1,2,3].repeat(2)) # 8-step loop
p1 >> pluck(P[0,1,2,3] + 2) # transpose up 2 scale degrees
p1 >> pluck(P[0,1,2,3].stretch(2)) # each note doubled
p1 >> pluck([(0,2,4), (1,3,5)]) # chords
Assessment
Predict the output of P[0,1,2] * 2 as a note sequence. Then write a pattern that plays the notes [0,2,4] twice in a row, reversed on the second pass.