illegal call for function in lisp: being able to make functions call each other

I have to do a algorithm in order to derivate an expression with Lisp. To do so, my teacher told me do a function for each operator and a more global function in order to handle the operator.

So I got a main function deriv calling different function. Each sub function will recal the main deriv function.

Here's my code, I got an illegal call because the main deriv function is defined later in the code. If i put the deriv function before, i get an error concerning Deriv_addSous (and all other sub func). I9 didn't include the other funct since it's not important for my issue.

How can I handle this error, is there any way for the function to be able to call each other?

Thanks :)))

(defun deriv_addSous(terme var)
    (list (car terme) (deriv (cadr terme ) var)(deriv (caddr terme) var))

(defun deriv(expr var)
    ; utiliser une liste et reutiliser la fonction du TD1 pour traiter chaque élément seul
    (if (atom expr) (deriv_term expr var))
    (cond (((equal (car expr) '+) (deriv_addSous expr var))
            ((equal (car expr) '-)(deriv_addSous expr var))
            ((equal (car expr) '*)(deriv_mult expr var))
            ((equal (car expr) '/)(deriv_div expr var))


  • You have a syntax error in the function DERIV. The syntax for COND is violated. There is an extra level of parentheses around the COND clauses.

    If a function is not known at compile time, that's not an error in Common Lisp. Just a warning.