roc-lang / examples

All kinds of Roc examples
https://www.roc-lang.org/examples
Creative Commons Zero v1.0 Universal
30 stars 17 forks source link

example suggestion: Avoiding splitting a Str into characters #141

Open Anton-4 opened 10 months ago

Anton-4 commented 10 months ago

From the Roc Str reference:

If it seems like a good idea to split a string into "characters" (graphemes), you should definitely stop and reconsider whether this is really the best design. Almost always, doing this is some combination of more error-prone or slower (usually both) than doing something else that does not require taking graphemes into consideration.

It would be good to have several snippets that demonstrate this.