3 ms·
Passing both a &[String] and an index into the function is duplicative, because a slice already has an index in it (the start point). It would be cleaner to jus
by eridius 7y ago
Passing both a &[String] and an index into the function is duplicative, because a slice already has an index in it (the start point). It would be cleaner to just use `tokens.split_first()` to yank the first token off the list, which gives you both that first token plus the remainder, then you can pass the remainder into subsequent calls, and return the remainder at the end when you're done. Or, heck, you could even take a `&mut &[String]` instead, allowing you to mutate the slice directly and not have to return anything.
- stopachka 7y agoThis is a great suggestion eridius! I'll update it to use split_first. Note: updated the essay and left a thanks to you :)