add 'mapi' equivalent for label and constructor maps

This commit is contained in:
Lesenechal Remi 2020-02-21 17:05:52 +01:00 committed by Pierre-Emmanuel Wulfman
parent a734995bdc
commit bc7a4daa64
2 changed files with 11 additions and 0 deletions

View File

@ -28,6 +28,8 @@ let bind_fold_lmap f init (lmap:_ LMap.t) =
let bind_map_lmap f map = bind_lmap (LMap.map f map) let bind_map_lmap f map = bind_lmap (LMap.map f map)
let bind_map_cmap f map = bind_cmap (CMap.map f map) let bind_map_cmap f map = bind_cmap (CMap.map f map)
let bind_map_lmapi f map = bind_lmap (LMap.mapi f map)
let bind_map_cmapi f map = bind_cmap (CMap.mapi f map)
let range i j = let range i j =
let rec aux i j acc = if i >= j then acc else aux i (j-1) (j-1 :: acc) in let rec aux i j acc = if i >= j then acc else aux i (j-1) (j-1 :: acc) in

View File

@ -19,3 +19,12 @@ val is_tuple_lmap : 'a Types.label_map -> bool
val get_pair : val get_pair :
'a Types.label_map -> 'a Types.label_map ->
(('a * 'a) * 'b list, unit -> Trace.error) result (('a * 'a) * 'b list, unit -> Trace.error) result
val bind_map_lmapi :
(Types.label -> 'a -> ('b * 'c list, 'd) result) ->
'a Types.label_map -> ('b Types.label_map * 'c list, 'd) result
val bind_map_cmapi :
(Types.constructor' -> 'a -> ('b * 'c list, 'd) result) ->
'a Types.constructor_map -> ('b Types.constructor_map * 'c list, 'd) result