your program is infinitely recursing.
first problem) you aren't making any assignments in the mutate function,
CODE
;; your mutate function (more prettily formatted):
(defun mutate (x y)
(if (> x 0)
(/ x y))
(if (> y 0)
(/ y x))
(if (< x 0)
(* x y))
(if (< y 0)
(* y x))
(evolve x y))
;; what I think you might mean:
(defun mutate (x y)
(progn
(if (> x 0)
(setq x (/ x y)))
(if (> y 0)
(setq y (/ y x)))
(if (< x 0)
(setq x (* x y)))
(if (< y 0)
(setq y (* y x))))
(evolve x y)))
use (setq &symbol &value) to make assignments. Alternately, you can use (set '&symbol &value) or (setf &symbol &statement) and others, but setq is flexible and works on most data structures (atoms, lists, arrays, class members, et cetera)
Also, its a good habit to use (progn &statement &statement ...) when you want to run several statements sequentially.
second problem) issues of equivalence
lisp has several equivalence operators, =, eq, eql, and equal (and probably others, but not that I know of)
for arithmetic work, = is one of the less constraining
for example, the following statements all return true ( T ):
CODE
(defparameter x 5)
> (= x 5)
> T
> (eq x 5)
> T
> (eql x 5)
> T
> (equal x 5)
> T
but what if we weren't comparing integers?
CODE
(defparameter x 5.0)
> (= x 5)
> T
> (eq x 5)
> nil
> (eql x 5)
> nil
> (equal x 5)
> nil
only = returns true, the other equivalence operators return false ( nil )!
Which brings me to the third point:
LISP is a dynamically typed language, and the CLISP evaluator contains a rational type (i.e (/ 5 10) evaluates to 1/2 ) as well as floating points. so unlike c, c++, java, c# and other staticly typed languages, int / int does not necessarily translate into an integer. However, you may find the following useful:
CODE
(ceiling &argument) ;; rounds up to the next integer
(floor &argument);; rounds down to the next integer
(round &argument);; conventional rounding
[\code]
As I'm not exactly sure what your program does, I can't really help you beyond this, however, here's what your code might look like with these changes (and pretty formatting)
[code]
; Functions --
(defun evolve (x y)
(if (= x 15) ; if
(format t "x is equal to 15~%"); then
(if (= y 30) ; else & if
(format t "y is equal to 30~%"); then
(mutate x y)))) ; else
(defun mutate (x y)
(progn
(if (> x 0)
(setq x (ceiling (/ x y))))
(if (> y 0)
(setq y (ceiling (/ y x))))
(if (< x 0)
(setq x (ceiling (* x y))))
(if (< y 0)
(setq y (ceiling (* y x))))
(evolve x y)))
; Program --
(format t "jpw1991~%29/3/2008~%"); ~% --> \n
(evolve 5 10)
A final thought, a quick and dirty way of debugging recursive (or mutually recursive) functions is the lisp trace command, (trace '&function_name), which prints to toplevel the arguments and return values of every call to and return from function &function_name.
Hope this helped,
-Jerome