Skip to content
Snippets Groups Projects
Commit f138827c authored by David Bühler's avatar David Bühler
Browse files

[Kernel] Persistent array: slightly simplifies [pretty] function.

Uses the same convention as Pretty_utils.
parent ef7261d5
No related branches found
No related tags found
No related merge requests found
...@@ -38,8 +38,7 @@ module Space (Field : Field.S) = struct ...@@ -38,8 +38,7 @@ module Space (Field : Field.S) = struct
module Vector = struct module Vector = struct
let pretty (type n) fmt (M { data ; _ } : n vector) = let pretty (type n) fmt (M { data ; _ } : n vector) =
let pp_sep fmt () = Format.fprintf fmt "@ " in Parray.pretty ~sep:"@ " Field.pretty fmt data
Parray.pretty ~pp_sep Field.pretty fmt data
let init size f = let init size f =
let data = Parray.init (Nat.to_int size) (fun _ -> Field.zero) in let data = Parray.init (Nat.to_int size) (fun _ -> Field.zero) in
......
...@@ -36,10 +36,10 @@ let rec reroot t = ...@@ -36,10 +36,10 @@ let rec reroot t =
t' := Diff (i, v', t) ; t' := Diff (i, v', t) ;
mem mem
let pretty ?(pp_sep = Format.pp_print_space) pp fmt t = let pretty ?(sep = format_of_string " ") pp fmt t =
let mem = reroot t in let mem = reroot t in
for i = 0 to Array.length mem - 1 do for i = 0 to Array.length mem - 1 do
if i > 0 then pp_sep fmt () ; if i > 0 then Format.fprintf fmt sep ;
pp fmt mem.(i) pp fmt mem.(i)
done done
......
...@@ -33,6 +33,6 @@ val fold : (int -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b ...@@ -33,6 +33,6 @@ val fold : (int -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val map : ('a -> 'a) -> 'a t -> 'a t val map : ('a -> 'a) -> 'a t -> 'a t
val pretty : val pretty :
?pp_sep : (Format.formatter -> unit -> unit) -> ?sep : Pretty_utils.sformat ->
(Format.formatter -> 'a -> unit) -> (Format.formatter -> 'a -> unit) ->
Format.formatter -> 'a t -> unit Format.formatter -> 'a t -> unit
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment