Created
September 26, 2023 13:25
-
-
Save isaacabraham/10e58d1292c91acd3f571e23b64aba6c to your computer and use it in GitHub Desktop.
partitionMap.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module List = | |
let partitionMap partitioner = | |
let rec loop (acc1, acc2) = function | |
| [] -> List.rev acc1, List.rev acc2 | |
| x::xs -> | |
match partitioner x with | |
| Choice1Of2 y -> loop (y::acc1, acc2) xs | |
| Choice2Of2 y -> loop (acc1, y::acc2) xs | |
loop ([], []) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment