Skip to content

Commit

Permalink
Remove unused List module
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-j-hu committed Jun 25, 2019
1 parent 65b4053 commit dcc6501
Showing 1 changed file with 8 additions and 23 deletions.
31 changes: 8 additions & 23 deletions src/easy_format.ml
Original file line number Diff line number Diff line change
@@ -1,27 +1,12 @@
open Format

(** Shadow map and split with tailrecursive variants. *)
module List = struct
include List

[@@@warning "-32"]

(** Tail recursive of map *)
let map f l = List.rev_map f l |> List.rev

(** Tail recursive version of split *)
let rev_split l =
let rec inner xs ys = function
| (x, y) :: xys ->
inner (x::xs) (y::ys) xys
| [] -> (xs, ys)
in
inner [] [] l

let split l = rev_split (List.rev l)

[@@@warning "+32"]
end
let rev_split l =
let rec inner xs ys = function
| (x, y) :: xys ->
inner (x::xs) (y::ys) xys
| [] -> (xs, ys)
in
inner [] [] l

type wrap = [
| `Wrap_atoms
Expand Down Expand Up @@ -131,7 +116,7 @@ let propagate_from_leaf_to_root
let acc = init_acc x in
map_node x acc
| List (param, children) ->
let new_children, accs = List.rev_split (List.rev_map aux children) in
let new_children, accs = rev_split (List.rev_map aux children) in
let acc = List.fold_left merge_acc (init_acc x) accs in
map_node (List (param, new_children)) acc
| Label ((x1, param), x2) ->
Expand Down

0 comments on commit dcc6501

Please sign in to comment.