public bool Subst(ref IErlObject term, ErlVarBind binding) { bool changed = false; var r = m_Items.Select(o => { IErlObject key = null, value = null; if (o.Key.Subst(ref key, binding)) { changed = true; } if (o.Value.Subst(ref value, binding)) { changed = true; } return(new KeyValuePair <IErlObject, IErlObject>( key ?? o.Key, value ?? o.Value )); }).ToList(); if (!changed) { return(false); } term = new ErlMap(r.ToDictionary(kvp => kvp.Key, kvp => kvp.Value)); return(true); }
/// <summary> /// Write an Erlang map to the stream. /// </summary> /// <param name="map"></param> public void WriteMap(ErlMap map) { write(ErlExternalTag.Map); Write4BE(map.Count); foreach (var kvp in map) { Write(kvp.Key); Write(kvp.Value); } }
public ErlMap(ErlMap map) : this(map.m_Items, true) { }
/// <summary> /// Determine if two Erlang lists are equal /// </summary> public bool Equals(ErlMap o) { return(m_Items.SequenceEqual(o.m_Items)); }