Closed gusty closed 9 years ago
So, may be can we leave them as they are and add another 2 functions: drop
and truncate
with that (safe) behaviour.
I used the name Limit
instead of Truncate
because Truncate
will conflict with the method of the same name for Numerics.
An exception is thrown when outside the bounds but that's a problem when using
seq
aiming for laziness, it will force you to check first the length of the sequence. That's how they're implemented in F# but I prefer the Linq implementation which works as Haskell's drop and take, in those cases it returns an empty list which logically represents 'no results'.