Live Variables

This commit is contained in:
elvis
2024-12-21 02:16:04 +01:00
parent 1f0d48263a
commit f1b4c3a17d
8 changed files with 209 additions and 60 deletions

View File

@ -101,6 +101,11 @@ let unique_intersection la lb =
aux la lb [] |> unique
let drop_last_element_list =
function
| [] -> []
| l -> l |> List.rev |> List.tl |> List.rev
(* Complicated way to drop the last element and add a new option element to the
beginning *)
let prev l a =
@ -108,7 +113,7 @@ let prev l a =
| [] ->
[a]
| _ ->
a :: (List.map (fun x -> Some x) (l |> List.rev |> List.tl |> List.rev))
a :: (List.map (fun x -> Some x) (drop_last_element_list l))
let pad l a n =
let l = List.map (fun i -> Some i) l in