// ------------------------------------------------------------------ // deserialization thereof public static IPersistentMap DeserializeKeyVarMap(string[] ks, string[] vs) { ITransientMap m = (ITransientMap)PersistentHashMap.EMPTY.asTransient(); for (int i = 0; i < ks.Length; i++) { m.assoc(Keyword.intern(ks[i]), DeserializeVar(vs[i])); } return(m.persistent()); }
public static IPersistentMap create(IDictionary other) { ITransientMap ret = (ITransientMap)EMPTY.asTransient(); foreach (DictionaryEntry de in other) { ret = ret.assoc(de.Key, de.Value); } return(ret.persistent()); }
public static IPersistentMap DictionaryToMap <T1, T2> (Dictionary <T1, T2> dict) { ITransientMap bldg = (ITransientMap)PersistentHashMap.EMPTY.asTransient(); foreach (var kv in dict) { bldg = bldg.assoc(kv.Key, kv.Value); } return(bldg.persistent()); }
private object ReadMap(TextReader source) { ConsumeChar(source); ReadWhiteSpace(source); ITransientMap transientMap = (ITransientMap)PersistentHashMap.EMPTY.asTransient(); while (PeekChar(source) != '}') { var key = Read(source); ReadWhiteSpace(source); var val = Read(source); ReadWhiteSpace(source); transientMap = transientMap.assoc(key, val); } ConsumeChar(source); return(transientMap.persistent()); }