Skip to content

Instantly share code, notes, and snippets.

@gsg
Created October 30, 2016 10:35
let rec filter_map f = function
| [] -> []
| x::xs ->
match f x with
| Some y -> y::filter_map f xs
| None -> filter_map f xs
let list =
filter_map (function `G a -> Some (`G a) | _ -> None)
[`G 0; `F "wat"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment