Skip to content

Instantly share code, notes, and snippets.

@isaacabraham
Created September 26, 2023 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isaacabraham/10e58d1292c91acd3f571e23b64aba6c to your computer and use it in GitHub Desktop.
Save isaacabraham/10e58d1292c91acd3f571e23b64aba6c to your computer and use it in GitHub Desktop.
partitionMap.fs
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