You have several problems with the parentheses (some are missing, some are misplaced, etc.) Use your IDE's tools for catching errors like this. In particular, the parentheses surrounding both lines in the body are wrong, because Racket thinks that you're trying to apply a procedure - this is why you're getting an application: not a procedure
error:
((integer? (car lis)) (car lis))
^ ^
wrong wrong
Besides that, you must use conditionals (if
, cond
, etc.) to distinguish between the different cases. And you're not processing the parts of each expression correctly, figure out how to access a list's first, second and third element.
I suggest you start by getting familiar with the syntax, write shorter, simpler procedures before tackling this exercise. I'll give you some hints to get you started, fill-in the blanks:
(define (myfunct lis)
(cond ((integer? lis)
lis)
((equal? 'plus <first element>)
(+ (myfunct <second element>) (myfunct <third element>)))
(<similarly for the 'minus case>)
If everything is correct, the sample input you provided should work as expected:
(myfunct '(plus 4 5))
=> 9
(myfunct '(plus (minus 5 4) 3))
=> 4