You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add safe versions of collection functions tryTake and trySkip. [6098424]
Submitted by Huw Simpson on 6/25/2014 12:00:00 AM 0 votes on UserVoice prior to migration
The take and skip functions on the Seq module raise an error when bounds are exceeded. I suggest the following safe alternatives:
// Safely skip n elements of a sequence, and return the rest.
trySkip : count:int -> source:Seq<'T> -> Seq<'T>
// Safely take n elements from the beginning of a sequence, skip the rest.
tryTake : count:int -> source:Seq<'T> -> Seq<'T>
The suggested functions operate in a similar manner to their link equivalents which don't raise errors when bounds are exceeded.
If this suggestion is accepted it would make sense to implement these functions for List and Array also.
Add safe versions of collection functions tryTake and trySkip. [6098424]
Submitted by Huw Simpson on 6/25/2014 12:00:00 AM
0 votes on UserVoice prior to migration
The take and skip functions on the Seq module raise an error when bounds are exceeded. I suggest the following safe alternatives:
// Safely skip n elements of a sequence, and return the rest.
trySkip : count:int -> source:Seq<'T> -> Seq<'T>
// Safely take n elements from the beginning of a sequence, skip the rest.
tryTake : count:int -> source:Seq<'T> -> Seq<'T>
The suggested functions operate in a similar manner to their link equivalents which don't raise errors when bounds are exceeded.
If this suggestion is accepted it would make sense to implement these functions for List and Array also.
Response
** by fslang-admin on 7/18/2015 12:00:00 AM **
Closing issue with no votes.
Original UserVoice Submission
Archived Uservoice Comments
The text was updated successfully, but these errors were encountered: