diff options
author | Son Ho | 2021-11-26 19:28:15 +0100 |
---|---|---|
committer | Son Ho | 2021-11-26 19:28:15 +0100 |
commit | 2a3505c3a67df15d776775122e8a9de4f6e2ce5a (patch) | |
tree | 50462fc93393798c92b3e899e2020b3d73942c98 /src/Identifiers.ml | |
parent | 4681c55f73d0c0bae172bfeb536c8c6413b5c24c (diff) |
Make progress on evaluate_non_local_function_call
Diffstat (limited to 'src/Identifiers.ml')
-rw-r--r-- | src/Identifiers.ml | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Identifiers.ml b/src/Identifiers.ml index 23c887c4..824fd8ad 100644 --- a/src/Identifiers.ml +++ b/src/Identifiers.ml @@ -48,6 +48,9 @@ module type Id = sig val mapi : (id -> 'a -> 'b) -> 'a vector -> 'b vector + val mapi_from1 : (id -> 'a -> 'b) -> 'a vector -> 'b vector + (** Same as [mapi], but where the indices start with 1 *) + val for_all : ('a -> bool) -> 'a vector -> bool val exists : ('a -> bool) -> 'a vector -> bool @@ -120,6 +123,12 @@ module IdGen () : Id = struct let mapi = List.mapi + let mapi_from1 f ls = + let rec aux i ls = + match ls with [] -> [] | x :: ls' -> f i x :: aux (i + 1) ls' + in + aux 1 ls + let for_all = List.for_all let exists = List.exists |