pen-lang/pen

Generalized list pattern match

raviqqe opened this issue · 1 comments

Discussed in #1408

Originally posted by raviqqe September 3, 2022

Problem

  • Taking initial or last elements is common operations on lists.

Examples

Solution

  • Generalize if-list expressions.
if [x, y, z, ...xs, v, w] = xs {
  ...
} else {
  ...
}

References

Duplication of #1618.