Testing objects for equivalence

UPDATE!!! I found that my blogpost appers in Maple reporter. You should know, that this blogpost was just a question about how to solve my problem better. Alec Mihailovs gave me and aswer and his solution of testing nested objects is much better. If you still want to use my piece of code, you should remove "set object" form "convertAMVStolist" procedure and replace all occurrences of "hastype" with "type" (as mentioned in comments below).

This piece of code should be able to test two objects (not of every type) for equivalence (like testeq() does). The benefit is, that it should be able to test also nested objects. Is there any other and more simple way how to do that? How to test nested objects in sets?

>

This procedure converts objects such as Array, Matrix, Vector and set into listlist eventually. list. Other objects remains.

> convertAMVStolist:=proc(eq) local a;

> if hastype(eq, 'Matrix') or hastype(eq, 'Array') or hastype(eq, 'Vector') or hastype(eq, 'set') then