/*
* Determine if two lists are equal. Lists are equal if they have
* the same arity and all of the elements are equal.
*
* @param o the list to compare to.
*
* @return true if the lists have the same arity and all the
* elements are equal.
**/
public override bool Equals(System.Object o)
{
if (!(o is List))
{
return(false);
}
List l = (List)o;
int a = this.arity();
if (a != l.arity())
{
return(false);
}
for (int i = 0; i < a; i++)
{
if (!this.elems[i].Equals(l.elems[i]))
{
return(false);
}
// early exit
}
return(true);
}