public override bool Equals(Object x)
        {
            if (!(x is SeqValue))
            {
                return(false);
            }
            IteratorValue e1 = GetIterator();
            IteratorValue e2 = (x as SeqValue).GetIterator();
            bool          b1 = e1.MoveNext();
            bool          b2 = e2.MoveNext();

            // While both lists have data.
            while (b1 && b2)
            {
                HeronValue v1 = e1.GetValue();
                HeronValue v2 = e2.GetValue();
                if (!v1.Equals(v2))
                {
                    return(false);
                }
                b1 = e1.MoveNext();
                b2 = e2.MoveNext();
            }

            // If one of b1 or b2 is true, then we didn't get to the end of list
            // so we have different sized lists.
            if (b1 || b2)
            {
                return(false);
            }

            return(true);
        }
 public ListValue(IteratorValue val)
 {
     list = new List <HeronValue>();
     while (val.MoveNext())
     {
         Add(val.GetValue());
     }
     elementType = val.GetElementType();
 }