2. Agenda
• Theory
• Finding valid patterns and their states
• Why Haskell?
• If there’s time:
– Animating siteswaps with HOpenGL
– Type level siteswaps
3. Siteswap Notation
• Encodes timing of throws
• Ignores hand positions
• E.g.
– 3-ball cascade ‘3,3,3,3,…’
– 3-ball shower ‘5,1,5,1,…’
– 4-ball fountain ‘4,4,4,4,…’
4. Siteswap Notation
• Hands alternate
– Even numbers indicate throws to the same hand
– Odd numbers indicate throws to the other hand
• Current ball will be thrown again after N-1
beats
• Period = length (* 2)
• Number of props = average value
• 0 is a pause with an empty hand
5. Space Time Diagrams
• Tracks the orbit of each balls between the
hands
• Axes represent
– Time
– Ball position
• Time axis is divided into beats
7. State Diagrams
• Tracks when balls in the air will land
• An × indicates a ball scheduled to land
• A - indicates a free hand
• E.g.
– 3-ball cascade: ×××--
– 3-ball shower: ×-×-× → ××-×- → ×-×-×
– 4-ball fountain: ××××-
8. State Diagrams
• To “throw” a 0, shift the pattern to the left:
– -×××- →0 ×××--
• To throw to height N, shift and insert an × at
the Nth place:
– ×××-- →5 ××--×
• State diagrams and heights form the vertices
and edges of a directed graph.
• Valid siteswaps are cycles in this graph.
10. Translation
Siteswap Space Time State Diagram
Period Length (* 2) Tiling Period Cycle Length (* 2)
# of Props Average # of Orbits # of ×’s
Height Value Horizontal Max node label
Distance length
11. Why Haskell?
• Type safety
• Side effects are isolated
• Succinct
– Pattern matching
– Polymorphism
– Higher order functions
12. Code Break
• Finding Valid Siteswaps
• throw, throwMany, foldM
• graph, generateGraph
• E.g. all patterns decorating a 3-cascade
• E.g. over combinator
13. HOpenGL
• Provides a high-level interface to the OpenGL
bindings.
• Computations take place in IO
• E.g. preservingMatrix :: IO a -> IO a
• Use powerful existing tools, e.g. mapM
15. Type Level Siteswaps
• Idea: Can we use the type system to identify
valid siteswaps?
• E.g. Can we improve on the type of (++) for
concatenating patterns?
• Use singleton types, type classes and fundeps
to encode the state graph in the type system.