3 ms·
Sounds a bit silly to write something like that by hand, when you could use BatList.drop_while (from batteries) like so: let line_is_not_header line =
by mercurial 12y ago
Sounds a bit silly to write something like that by hand, when you could use BatList.drop_while (from batteries) like so:
let line_is_not_header line =
String.length line < 4 || String.sub line 0 3 != "+++"
match (BatList.drop_while line_is_not_header lines) with
| header_line :: following_lines ->
header env header_line;
modified env 0 following_lines
| _ -> ()
In practice, I find that it's rarely useful to write recursive functions by hand, unless you're willing to limit yourself to the default stdlib.