static bool isList(Object x)
{
Object slow = x, fast = x;
for(;;)
{
if (fast == null) return true;
if (slow == rest(fast) || !(fast is Pair)
|| !(slow is Pair)) return false;
slow = rest(slow);
fast = rest(fast);
if (fast == null) return true;
if (!(fast is Pair)) return false;
fast = rest(fast);
}
}