Reputation: 602
I feel like an idiot asking for help for this, but I have been stuck for hours now, and I haven't been able to find anything on the internet that can help me.
I am trying to write a function in LISP that takes in two parameters and returns the number that is greater. Here's what I have at the moment, but I keep getting errors:
(defun greater (x y)
(if (> x y) x y))
I am calling it like this:
(greater (2 1))
Upvotes: 0
Views: 3353
Reputation: 6797
I'm not a Common Lisp expert, but I guess the way you are calling greater
is wrong. This program works for me:
(defun greater (x y) (if (> x y) x y))
(print (greater 5 12))
Upvotes: 4