anchor.diff:  ;; Pranav Ravichandran <me@onloop.net>
   
   (defun get-arity (primitive-alist func)
  +  "When passed an assoc list of function-arity pairs,
  +  return the arity of a specific function."
     (cadr (assoc func primitive-alist)))
   
   (defun pick-random (inlist)
  +  "Pick a random element from a list."
     (nth (random (length inlist)) inlist))
   
   (defun generate-program-tree (primitive-alist action-list conditional-list max-tree-depth)
  +  "Generate a random program from a list of primitives, actions
  +  and conditionals. The maximum depth of the program tree will be max-tree-depth."
     (let* ((toss (fair-coin 50))
            (toss2 (fair-coin 50))
            (pick (if toss
  
positive.code:       m0)))
  
  (defun tournament-selection (fitness-alist program-count)
    (car (get-min-max (loop for r-count upto (- program-count 1) collect
                            (pick-random fitness-alist)) #'> #'cdr)))
  
  (defun fair-coin (chance)
    (let ((toss (random 101)))
      (cond ((< toss chance) t)
            ((> toss chance) nil)
            (t 'edge))))
  
  (defun is-tree (tree)
    (every #'(lambda (el) (typep el 'list)) tree))
  
  (defun pick-random-subtree (tree
                               &optional (replacement nil) (acc '()))
    (let ((branches (cdr tree)))
      (if (is-tree branches)
        (let* ((pick-number (random (length branches)))
  
negative.code:         (evolve primitives actions conditionals args fargs fitness-function fitness-p
                  max-tree-depth member-count repeat-var percentage program-count
                  :generation
                  (append (copy-population population-fitness copy-percentage program-count)
                          (crossover-population population-fitness crossover-percentage program-count))
                  :max-run-count (- max-run-count 1)))
        population-fitness)))
  
  