gleam-lang / language-tour

👩🏽‍💻 Learn Gleam in your browser
https://tour.gleam.run/
82 stars 62 forks source link

Add [head, ..tail] Pattern to List Patterns page #128

Open carloosaf opened 1 month ago

carloosaf commented 1 month ago

The List Patterns section does not include any example of a patterns that destructures the tail of the list into a variable like [head, ..tail]. This kind of pattern is then shown in the List Recursion section but in my opinion it should also be included in the patterns page for clarity. I was looking for this kind of pattern while working on a little project and I assumed that this kind of destructuring wasn't possible because it wasn't mentioned. Including it earlier would help avoid confusion for users exploring list pattern matching.

lpil commented 2 weeks ago

How would you teach that?

carloosaf commented 4 days ago

Sorry for the delayed response. I've created a PR with the proposed changes.

P.S.: This is my first time contributing to an open-source project with both an Issue and a PR, so please let me know if I've missed anything or made any mistakes.