Last active
September 13, 2015 06:32
-
-
Save talesin/0a06d4f97cdc037fd58b to your computer and use it in GitHub Desktop.
F# Async filter
This file contains hidden or 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
| let filterAsync predicate (items:Async<_> list) = async { | |
| let rec loop acc items' = async { | |
| match items' with | |
| | [] -> return acc | |
| | x :: xs -> | |
| let! item = x | |
| return! loop (if predicate item then item :: acc else acc) xs | |
| } | |
| return! loop [] items | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment