Generalized list pattern match
raviqqe opened this issue · 1 comments
raviqqe commented
Discussed in #1408
Originally posted by raviqqe September 3, 2022
Problem
- Taking
initial
orlast
elements is common operations on lists.
Examples
pen/examples/life-game/lifeGame.pen
Line 110 in 7853a8b
pen/examples/snake/entity/snake.pen
Line 47 in 7853a8b
Solution
- Generalize if-list expressions.
if [x, y, z, ...xs, v, w] = xs {
...
} else {
...
}