Exemplo n.º 1
0
 public static void FromMap(Dafny.Map <K, V> m, out MutableMap <K, V> new_m)
 {
     new_m = new MutableMap <K, V>();
     foreach (var key in m.Domain)
     {
         new_m.mapImpl.Add(key, m.Select(key));
     }
 }
Exemplo n.º 2
0
        // TODO: This is pretty inefficient.  Should change Dafny's interface to allow us to
        // pass in an enumerable or an ImmutableDictionary
        public static Dafny.Map <K, V> MapOf(MutableMap <K, V> s)
        {
            List <Dafny.Pair <K, V> > pairs = new List <Dafny.Pair <K, V> >();

            foreach (var pair in s.mapImpl)
            {
                pairs.Add(new Dafny.Pair <K, V>(pair.Key, pair.Value));
            }
            return(Dafny.Map <K, V> .FromCollection(pairs));
        }
Exemplo n.º 3
0
 public static void EmptyMap(out MutableMap <K, V> m)
 {
     m = new MutableMap <K, V>();
 }