Hi, Tyrone.
Just from looking at what’s here, I think this is what’s going on:
obj-locs is a specially constructed list called an “association list”. It’s usually used like what is often now called a dictionary or map in other programming languages, so you can look up things associated with other things. Each member of obj-locs is probably something like the list (object location), which could have been created with (list object location).
assoc is the function that looks up obj in the obj-locs association list (also called an a-list). Calling assoc gives back the whole :
(assoc obj obj-locs) => (obj location)
What the code cares about is checking the location. The cdr of the result is a list (probably with one element, but it doesn’t matter much here). We actually want that single element, so we take the car to get it. In code,
(car (cdr location))
And cadr is just a shorter way to say this: (cadr location)
I hope this helps. It can take a while to build up the intuition about nested list structures and where things are, and it’s pretty common to end up with a list of one element when want you want is just the element.
Good luck with Lisping!
Win Treese