Skip to content
Snippets Groups Projects
env.ml 583 B
Newer Older
erwan's avatar
erwan committed

(* module Dico = Map.Make(struct type t = string * string let compare = compare end) *)

module Dico = Map.Make(String)

open Algo
(*
module Dico = Map.Make(String)
type t = value Dico.t Dico.t 
*)
type t = local_env Dico.t 

let (get: t -> string -> string -> value) =
  fun e pid v ->
    try ((Dico.find pid e) v)
    with _ -> failwith (Printf.sprintf "Unknown value: %s.%s" pid v)
      
let (set: t -> string -> string -> value -> t) =
  fun e pid v value ->
    Dico.add pid (fun x -> if x=v then value else Dico.find pid e x) e

let (init:unit -> t) = fun () -> Dico.empty