Sure you would need to do go one level deeper if the top level is different, but you can still use pointer equality at the lower levels
immutableEq(a1, a2) {
return (a1 === a2) || all(mapPair(a1, a2, immutableEq))
}
Now if you update the value of a single element in the array a2, you would not have to check all the elements in depth (only their references): a1 = Immutable.List(el1, el2, el3, el4, el5)
a2 = a1.set(2, Immutable.Map({hello: "world"}));
immutableEq(a1, a2) // all but el3 compared by reference equality