Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add safe versions of collection functions tryTake and trySkip. #280

Open
baronfel opened this issue Oct 14, 2016 · 0 comments
Open

Add safe versions of collection functions tryTake and trySkip. #280

baronfel opened this issue Oct 14, 2016 · 0 comments
Labels

Comments

@baronfel
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant