There is a syntax error in your code.
Indent and format your code
First you need to format your code:
(defun freq (A L)
(cond (atom (car L)) ; first clause
(eq A (car (car L ))) ; second clause
(T (+ 1 (freq A (cdr L)))) ; third clause
(T (freq A (cdr L))))) ; fourth clause
A useful COND
:
(cond ((> i 0) :positive)
((< i 0) :negative)
(t :equal))
You have written something like:
(cond (> i 0) :positive
(< i 0) :negative
(t :equal))
Here a Lisp interpreter would complain that >
has no value. It's because it is used as a variable. (> i 0)
is seen as the first clause and the test form is the variable >
. Since >
usually is not a variable, this is an error.
A compiler might even reject the whole form at compile time, since there are clauses which are not lists.
As you can see the parentheses around a clause are missing in your code.
Check the syntax of cond
...
cond {clause}* => result*
A cond
has zero or more clauses.
clause::= (test-form form*)
Each clause is a list (!!) starting with a test-form and followed by zero or more forms.
It makes also no sense to have two clause with T
as the test form. The first one will always be take and the second one will always be ignored.