4 ms·
Some languages do force you to check any time you access an element. If the rest of the language is in line with this, then it's actually amazing. Option/Maybe
by the_gipsy 7y ago
Some languages do force you to check any time you access an element. If the rest of the language is in line with this, then it's actually amazing. Option/Maybe types help here, pattern matching lists also let's you make sure you handle all cases.
In some instances it makes sense to use a special NonEmptyList type that guarantees there is always at least one element, so you don't need to check.