mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
mllib: Add 'combine3' function.
This commit is contained in:
@@ -199,6 +199,12 @@ let rec mapi i f =
|
||||
r :: mapi (i + 1) f l
|
||||
let mapi f l = mapi 0 f l
|
||||
|
||||
let rec combine3 xs ys zs =
|
||||
match xs, ys, zs with
|
||||
| [], [], [] -> []
|
||||
| x::xs, y::ys, z::zs -> (x, y, z) :: combine3 xs ys zs
|
||||
| _ -> invalid_arg "combine3"
|
||||
|
||||
(* ANSI terminal colours. *)
|
||||
let ansi_green ?(chan = stdout) () =
|
||||
if TTY.isatty_stdout () then output_string chan "\x1b[0;32m"
|
||||
|
||||
@@ -53,6 +53,9 @@ val iteri : (int -> 'a -> 'b) -> 'a list -> unit
|
||||
val mapi : (int -> 'a -> 'b) -> 'a list -> 'b list
|
||||
(** Various higher-order functions. *)
|
||||
|
||||
val combine3 : 'a list -> 'b list -> 'c list -> ('a * 'b * 'c) list
|
||||
(** Like {!List.combine} but for triples. All lists must be the same length. *)
|
||||
|
||||
val make_message_function : quiet:bool -> ('a, unit, string, unit) format4 -> 'a
|
||||
(** Timestamped progress messages. Used for ordinary messages when
|
||||
not [--quiet]. *)
|
||||
|
||||
Reference in New Issue
Block a user