Doubt receive 3 numbers and say if the first is equal to the sum of the other two in LISP [closed]

1

I'm doing a function in Lisp that gets 3 numbers and says if the first is equal to the sum of the other two, the code I got was this:

(defun maior(n1 n2 n3)
  (if (=(+ n2 n3)n1)
  (format t "~D é maior que ~D e ~D!" n1 n2 n3)
)

But it's not running I think the problem is syntax, I want to show that the sum of n2 and n3 is equal to n1 .

    
asked by anonymous 06.09.2015 / 20:17

1 answer

2

Close parenthesis of if was missing:

(defun maior(n1 n2 n3)
  (if (=(+ n2 n3)n1)
      (format t "~D é maior que ~D e ~D!" n1 n2 n3)
  )
)

Example in ideone .

    
06.09.2015 / 21:29