First, make your life easier by making a function
(define (name x)
(cond ((pair? x) 'pair)
((symbol? x) 'symbol)
(else (error "i don't know how to handle this case"))))
Once you have this, make a recursive function that takes three arguments: a symbol (whose value is 'pair or 'symbol), an integer saying how many times that kind of thing occurred before the start of the current list, and a list of stuff.
Rashakil Fol
Super Senior Demiposter
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177