Write a function (count s x) that searches a data structure composed of pairs
(arbitarily nested) for a symbol x and returns the number of times it occurs.
Assuming you have the correct function written, you should get the following:
(count '((a . b) b c () a . d) a) should return 2.
The Attempt at a Solution
I don't really know much about lisp, we just started talking about it. I do know how to write a very basic counting function, that just counts every element in a list:
(cond ((null l) 0)
((atom l) 1)
(t (+ (count-elements (car l))
(count-elements (cdr l))))))
So, how would I pick out a specific element in my list?