Ok I need some help with thinking through this conceputally. I need to check if a list and another list is structurally equal.

For example:

(a (bc) de)) is the same as (f (gh) ij)), because they have the same structure.

Now cleary the base case will be if both list are empty they are structurally equal.

The recursive case on the other hand I'm not sure where to start.

Some ideas:

Well we are not going to care if the elements are == to each other because that doesn't matter. We just care in the structure. I do know we will car down the list and recursively call the function with the cdr of the list.

The part that confuses me is how do you determine wheter an atom or sublist has the same structure?

Well, If I got the idea, any two atoms have the same structure. Therefore, the base case of your function should test also if both arguments are atoms and, if the test succeeds, return T.

To see if sublists match each other, you just need to call the function recursively on them. In other words, if the function finds cons cells, the function must be called recursively on their CARs and CDRs.

In other words, if the arguments a and b are both cons cells, the function structurally-equal-p tests if (car a) and (car b) have the same structure using recursion. Then, it tests if (cdr a) and (cdr b) also have the same structure. If that is true, then a and b have the same structure and the function returns T.