I need to separate strings containing different numbers of - delimiters. I want the fourth item counting backwards, ignoring any results that have too few pieces
let segments = string.split("2-33-444-5555-66666-7777-8888", on: "-")
let chosen = segments[-4] // <- This syntax is not valid.
According to this guide (https://tour.gleam.run/everything/#basics-lists):
Finding a list's size or retrieving entries somewhere beyond its beginning costs a lot, so people seldom do it. Algorithms which access sequences by index are uncommon in Gleam, and for those cases lists would be an unsuitable structure to choose.
but there's no suggestion for another data structure. How do I retrieve the separated pieces counting backwards?