write List.flat_map

This commit is contained in:
tali 2024-01-30 18:54:41 -05:00
parent 2ecef57faa
commit eec24d1602
1 changed files with 11 additions and 0 deletions

View File

@ -16,4 +16,15 @@ module Result_syntax = struct
let ( let+ ) r f = Result.map f r let ( let+ ) r f = Result.map f r
end end
module List = struct
include List
let flat_map f xs =
let rec iter acc = function
| [] -> rev acc
| x :: xs -> iter (rev_append (f x) acc) xs
in
iter [] xs
end
include (val Logging.logs "Irc") include (val Logging.logs "Irc")