How do you apply a List filter before a List map in OCaml? I'm trying the pipe operator but with no success:
let r infile =
match List.tl (In_channel.read_lines infile ) with
| None -> []
| Some body ->
List.filter body ~f:(fun line -> true)
|> List.map body ~f:(fun line ->
match split_on_comma line with
| _ :: _ :: num :: street :: unit :: city :: _ :: region :: _ ->
String.strip (num ^ " " ^ addr_case street ^ ", " ^ addr_case city ^ " " ^ region)
| _ -> assert false)
utop is giving me:
"This expression has type string list but an expression was expected of type string list -> 'a"
I'm aware the List.filter does nothing at present. I'm simply trying to use it before the List.map