mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
CCFormat: List.iter instead of fold_left for append_l (more efficient)
Co-authored-by: Simon Cruanes <simon.cruanes.2007@m4x.org>
This commit is contained in:
parent
d0b05fdb76
commit
82781aa9c7
1 changed files with 2 additions and 1 deletions
|
|
@ -117,7 +117,8 @@ let append ppa ppb fmt () =
|
||||||
"foo" (to_string_test (append (return "foo") (return "")))
|
"foo" (to_string_test (append (return "foo") (return "")))
|
||||||
*)
|
*)
|
||||||
|
|
||||||
let append_l = List.fold_left append (return "")
|
let append_l ppl fmt () =
|
||||||
|
List.iter (fun pp -> pp fmt ()) ppl
|
||||||
|
|
||||||
(*$= append_l & ~printer:(fun s -> CCFormat.sprintf "%S" s)
|
(*$= append_l & ~printer:(fun s -> CCFormat.sprintf "%S" s)
|
||||||
"" (to_string_test @@ append_l [])
|
"" (to_string_test @@ append_l [])
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue