Slide 24
Slide 24 text
ARRAY PATTERN
• Despite its name, the pattern is not solely for array objects
• Steps to matching:
1.The pattern and the object are compared by Constant === object
2.If it returns true, check if the object has a #deconstruct method that
returns Array
3.If the object has a #deconstruct method, its return value is used to
perform sub-pattern matching
pat: Constant(pat, ..., *var, pat, ...)
| Constant[pat, ..., *var, pat, ...]
| [pat, ..., *var, pat, ...] # Syntactic sugar for BasicObject(...)