First, note that the standard actually contains functions that will help with things like this. There's a useful count-if function that can take a predicate and count how many elements in a list satisfy it. For your case, you could do:
CL-USER> (count-if #'(lambda (x)
(> x 5))
(list 1 2 3 4 5 6 6 7))
;=> 3
CL-USER> (defun count-greater-than (numbers threshold)
(count-if (lambda (n) (> n threshold)) numbers))
COUNT-GREATER-THAN
CL-USER> (count-greater-than (list 1 2 3 4 5 6 6 7) 5)
3
CL-USER> (count-greater-than (list 1 2 3 4 5 6 6 7) 6)
1
In your particular case, it looks like you're doing this manually, but you have the parenthesis wrong. It looks like you're trying to create a local helper function called counter. You can either define it outside the function with defun, e.g.:
(defun count-greater-than (numberlist threshold)
(if (null numberlist) 0
(counter (numberlist threshold 0))))
(defun counter (numberlist threshold count)
(cond ((null numberlist) count)
((> (first numberlist) threshold) (counter (rest numberlist) threshold (+ 1 count)))
(t (counter (rest numberlist) threshold count))))
or you could do it with a local definition, using labels:
(defun count-greater-than (numberlist threshold)
(labels ((counter (numberlist threshold count)
(cond ((null numberlist) count)
((> (first numberlist) threshold) (counter (rest numberlist) threshold (+ 1 count)))
(t (counter (rest numberlist) threshold count)))))
(if (null numberlist) 0
(counter numberlist threshold 0))))
Notes
As Xach points out in the comments, you can actually do this even more succinctly using count's :test argument. I don't know whether it captures the notion of "count things with this property" quite as explicitly, but it makes for a very short solution:
CL-USER> (count 5 (list 1 2 3 4 5 6 6 7) :test #'<)
;=> 3
This counts how many times 5 is in the list, but the trick is that rather than checking whether a list element is 5 using eql or =, it uses <. That is, count will end up checking (< 5 1), then (< 5 2), …, up to (< 5 6), (< 5 7). It is specified that the test will be called with the arguments in that order. The glossary entry on satisfy the test says (emphasis added):
- (for a two argument test) to be in a state such that the two-place predicate which is the sequence function's test argument returns true
when given a first argument that is the object being considered, and
when given a second argument that is the result of calling the
sequence function's key argument on an element of the sequence
function's sequence argument which is being tested for equality;