Skip to content

Commit

Permalink
Refactor index search function
Browse files Browse the repository at this point in the history
Update `get_index` to use `List.find_index`, simplifying the implementation while maintaining functionality.
  • Loading branch information
Linda-Njau committed Nov 21, 2024
1 parent 35af3fd commit b95e0f2
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/sail_json_backend/json.ml
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,7 @@ let map_arg_to_mnemonic arg id =
)
(Hashtbl.find_all mappings (String.lowercase_ascii (id ^ "_mnemonic")))

let get_index elem lst =
List.find_map (fun (i, x) -> if x = elem then Some i else None) (List.mapi (fun i x -> (i, x)) lst)
let get_index elem lst = List.find_index (fun x -> x = elem) lst

let map_param_to_arg id param args_list =
match Hashtbl.find_opt inputs id with
Expand Down

0 comments on commit b95e0f2

Please sign in to comment.