Skip to content

Conversation

@khalidbelk
Copy link
Contributor

Hey : ) Looking through the list module docs yesterday I noticed that index_fold had a pretty vague example (the {...} placeholder). The function signature is clear, and probably enough for a lot of people, but it kinda lacks information about why, in practice, we would want to use the index parameter.

This adds 2 small examples (with lists of two different data types: strings and integers) that should be intuitive enough to understand the use case of index_fold.

Copy link
Member

@lpil lpil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could be wrong as I'm on my phone, but it looks like that line is quite long. Could you wrap the line longs the way the formatter would please 🙏

@khalidbelk
Copy link
Contributor Author

Yes indeed, done ;)

@khalidbelk khalidbelk requested a review from lpil September 21, 2025 18:45
Copy link
Member

@lpil lpil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely!! Thank you, this is much better with proper examples.

@lpil lpil merged commit f88cffd into gleam-lang:main Sep 22, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants