Python 2, 9094 bytes
defg=lambda f(a,bc,p=[])*p:c=id(lambda a),id(b);r=c:c in p;p+=c,;return rp or a>[]<b and all(map(fg((id(a),id(b)),c,*p),a,b))orif a>[]<b else a==b
g(0)
An improvement on isaacg's very clever solution of storing the id pairs of lists being processed and declaring them equal if the same comparison comes up on a lower level.
The recursive step all(map(f...,a,b)) says that a and b are equal if all corresponding pair of elements in them are equal. This works nicely to reject unequal-length because map pads the shortest list with None, unlike zip which truncates. Since none of the actual lists contain None, these padded lists will always be rejected.
Python 2, 90 bytes
def f(a,b,p=[]):c=id(a),id(b);r=c in p;p+=c,;return r or a>[]<b and all(map(f,a,b))or a==b
An improvement on isaacg's very clever solution of storing the id pairs of lists being processed and declaring them equal if the same comparison comes up on a lower level.
The recursive step all(map(f,a,b)) says that a and b are equal if all corresponding pair of elements in them are equal. This works nicely to reject unequal-length because map pads the shortest list with None, unlike zip which truncates. Since none of the actual lists contain None, these padded lists will always be rejected.
Python 2, 94 bytes
g=lambda c,*p:lambda a,b:c in p or all(map(g((id(a),id(b)),c,*p),a,b))if a>[]<b else a==b
g(0)
An improvement on isaacg's very clever solution of storing the id pairs of lists being processed and declaring them equal if the same comparison comes up on a lower level.
The recursive step all(map(...,a,b)) says that a and b are equal if all corresponding pair of elements in them are equal. This works nicely to reject unequal-length because map pads the shortest list with None, unlike zip which truncates. Since none of the actual lists contain None, these padded lists will always be rejected.
Python 2, 90 bytes
def f(a,b,p=[]):c=id(a),id(b);r=c in p;p+=c,;return r or a>[]<b and all(map(f,a,b))or a==b
An improvement on isaacg's very clever solution of storing the id pairs of lists being processed and declaring them equal if the same comparison comes up on a lower level.
The recursive step all(map(f,a,b)) says that a and b are equal if all corresponding pair of elements in them are equal. This works nicely to reject unequal-length because map pads the shortest list with None, unlike zip which truncates. Since none of the actual lists contain None, these padded lists will always be rejected.
Python 2, 90 bytes
def f(a,b,p=[]):c=id(a),id(b);r=c in p;p+=c,;return r or a>[]<b and all(map(f,a,b))or a==b
An improvement on isaacg's very clever solution of storing the id pairs of lists being processed and declaring them equal if the same comparison comes up on a lower level.
Python 2, 90 bytes
def f(a,b,p=[]):c=id(a),id(b);r=c in p;p+=c,;return r or a>[]<b and all(map(f,a,b))or a==b
An improvement on isaacg's very clever solution of storing the id pairs of lists being processed and declaring them equal if the same comparison comes up on a lower level.
The recursive step all(map(f,a,b)) says that a and b are equal if all corresponding pair of elements in them are equal. This works nicely to reject unequal-length because map pads the shortest list with None, unlike zip which truncates. Since none of the actual lists contain None, these padded lists will always be rejected.
Python 2, 9190 bytes
def f(a,b,p=[]):c=id(a),id(b);r=c in p;p+=c,;return r or a>[]<b and all(map(f,a,b))if a>[]<b elseor a==b
An improvement on isaacg's very clever solution of storing the id pairs of lists being processed and declaring them equal if the same comparison comes up on a lower level.
Python 2, 91 bytes
def f(a,b,p=[]):c=id(a),id(b);r=c in p;p+=c,;return r or all(map(f,a,b))if a>[]<b else a==b
An improvement on isaacg's very clever solution of storing the id pairs of lists being processed and declaring them equal if the same comparison comes up on a lower level.
Python 2, 90 bytes
def f(a,b,p=[]):c=id(a),id(b);r=c in p;p+=c,;return r or a>[]<b and all(map(f,a,b))or a==b
An improvement on isaacg's very clever solution of storing the id pairs of lists being processed and declaring them equal if the same comparison comes up on a lower level.