Add List.chooseV, Seq.tryPickV, etc. for ValueOption
I propose we add ValueOption equivalents of the following functions:
List.choose / Seq.choose / Array.choose / Event.choose / Observable.choose
List.pick / Seq.pick / Array.pick / Map.pick
List.tryPick / Seq.tryPick / Array.tryPick / Map.tryPick
List.unfold / Seq.unfold / Array.unfold
(For the sake of completeness: Additional functions in these modules that could be implemented too are all the tryX functions that only return an option, but in this suggestion, I choose to concentrate only on the above since they allocate N objects instead of 1).
The existing way of approaching this problem in F# is... none, really, apart from writing low-level implementations similar to what would go into FSharp.Core.
Pros and Cons
The advantages of making this adjustment to F# are:
- Increased performance, since we can use
choose and pick semantics without N allocations
- Allows later replacing F# internal
Option-based usages (of choose etc.) with ValueOption-based (chooseV etc.) for likely increased performance
- Better feature parity with
option
The disadvantages of making this adjustment to F# are:
- Added function bloat (I'd say that for these N-allocating functions it's worth it)
Extra information
Estimated cost (XS, S, M, L, XL, XXL): S
Related:
Affidavit (please submit!)
Please tick this by placing a cross in the box:
Please tick all that apply:
Add List.chooseV, Seq.tryPickV, etc. for ValueOption
I propose we add
ValueOptionequivalents of the following functions:List.choose/Seq.choose/Array.choose/Event.choose/Observable.chooseList.pick/Seq.pick/Array.pick/Map.pickList.tryPick/Seq.tryPick/Array.tryPick/Map.tryPickList.unfold/Seq.unfold/Array.unfold(For the sake of completeness: Additional functions in these modules that could be implemented too are all the
tryXfunctions that only return an option, but in this suggestion, I choose to concentrate only on the above since they allocate N objects instead of 1).The existing way of approaching this problem in F# is... none, really, apart from writing low-level implementations similar to what would go into FSharp.Core.
Pros and Cons
The advantages of making this adjustment to F# are:
chooseandpicksemantics without N allocationsOption-based usages (ofchooseetc.) withValueOption-based (chooseVetc.) for likely increased performanceoptionThe disadvantages of making this adjustment to F# are:
Extra information
Estimated cost (XS, S, M, L, XL, XXL): S
Related:
Affidavit (please submit!)
Please tick this by placing a cross in the box:
Please tick all that apply: