You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
case x of
[1, 2, 3] -> ...
[2, 2, 4] -> ...
[] -> ...
[_, _] -> ...
_ -> ...
A single level of array patterns has a pretty good cost:benefit ratio right now. I'm noting that I might want nested pattern support in the future. The Implementation of Functional Programming Languages1 Chapter 5 has a good general algorithm for un-nesting pattern matches.
Footnotes
Peyton Jones, S. L. (1987). The implementation of functional programming languages (prentice-hall international series in computer science). Prentice-Hall, Inc..
When I implemented #81 I only implemented a single level of pattern matching:
Supporting nested patterns seems pretty complicated:
A single level of array patterns has a pretty good cost:benefit ratio right now. I'm noting that I might want nested pattern support in the future. The Implementation of Functional Programming Languages1 Chapter 5 has a good general algorithm for un-nesting pattern matches.
Footnotes
Peyton Jones, S. L. (1987). The implementation of functional programming languages (prentice-hall international series in computer science). Prentice-Hall, Inc..
https://www.microsoft.com/en-us/research/uploads/prod/1987/01/slpj-book-1987.pdf ↩
The text was updated successfully, but these errors were encountered: