diff --git a/src/main/compile/of_mini_c.ml b/src/main/compile/of_mini_c.ml index fb2945265..be27f0f6b 100644 --- a/src/main/compile/of_mini_c.ml +++ b/src/main/compile/of_mini_c.ml @@ -27,7 +27,7 @@ let aggregate_and_compile = fun program form -> let aggregate_and_compile_contract = fun (program : Types.program) name -> let%bind (exp, idx) = get_entry program name in - let program' = List.remove_from idx program in + let program' = List.take idx program in aggregate_and_compile program' (ContractForm exp) let aggregate_and_compile_expression = fun program exp -> diff --git a/vendors/ligo-utils/simple-utils/x_list.ml b/vendors/ligo-utils/simple-utils/x_list.ml index 8541c4614..4b74c0261 100644 --- a/vendors/ligo-utils/simple-utils/x_list.ml +++ b/vendors/ligo-utils/simple-utils/x_list.ml @@ -5,10 +5,10 @@ let rec remove n = function | _ :: tl when n = 0 -> tl | hd :: tl -> hd :: remove (n - 1) tl -let rec remove_from n = function - | [] -> raise (Failure "List.remove_from") +let rec take n = function + | [] -> [] | _ when n = 0 -> [] - | hd :: tl -> hd :: remove_from (n - 1) tl + | hd :: tl -> hd :: take (n - 1) tl let map ?(acc = []) f lst = let rec aux acc f = function