replaces remove_from by take which does not raise any exceptions
This commit is contained in:
parent
8ce4772ae4
commit
a0a8f114c0
@ -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 ->
|
||||
|
6
vendors/ligo-utils/simple-utils/x_list.ml
vendored
6
vendors/ligo-utils/simple-utils/x_list.ml
vendored
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user