racket / rhombus

Rhombus programming language
Other
332 stars 59 forks source link

allow `...` or `&` for `List` in the middle of other bindings #512

Closed mflatt closed 2 months ago

mflatt commented 3 months ago

Since list items (unlike pair-list items) at the end of a list can be accessed just as efficiently as items at the start, allow a repetition in places other than the end of a List pattern.

fun
| sum_left_to_right([]): 0
| sum_left_to_right([a, ..., b]):
    sum_left_to_right([a, ...]) + b