Commit d674c82a authored by POTTIER Francois's avatar POTTIER Francois

New function [SymbolMap.init].

parent ca968110
Pipeline #96365 passed with stages
in 24 seconds
......@@ -563,6 +563,11 @@ module SymbolMap = struct
symbol :: accu
) m []
let init f xs =
List.fold_left (fun accu x ->
add x (f x) accu
) empty xs
let purelynonterminal m =
fold (fun symbol _ accu ->
accu && Symbol.nonterminal symbol
......@@ -332,8 +332,16 @@ module SymbolMap : sig
include Map.S with type key = Symbol.t
(* [domain m] is the domain of the map [m], that is, the list of keys
for which an entry exists in the map [m]. *)
val domain: 'a t -> key list
(* [init f xs] creates a map whose keys are the elements [x] found in the
list [xs] and the datum associated with [x] is [f x]. *)
val init: (key -> 'a) -> key list -> 'a t
(* This returns [true] if and only if all of the symbols in
the domain of the map at hand are nonterminals. *)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment