anchor.diff:         ((fun :accessor fun :initform ',function-symbol)
   	(arity :accessor arity :initform ,arity)))))
   
  -(defclass value ($node)
  -  ((value :accessor value)))
  +(defun div (a b)
  +  (cond ((= a 0) a)
  +	((= b 0) most-positive-fixnum)
  +	(t (truncate a b))))
   
   
   (define-instruction plus + 2)
   (define-instruction minus - 2)
  -(define-instruction div / 2)
  +(define-instruction div div 2)
   (define-instruction times * 2)
  +(define-instruction nop identity 0)
  +(define-instruction copy identity 1)
  +
  +(defmethod generate-code ((nop nop) registers)
  +  (declare (ignore registers))
  +  `(progn))
  +
  +
   (define-instruction land logand 2)
   (define-instruction lior logior 2)
   (define-instruction lxor logxor 2)
  
positive.code: (in-package :cost-calc)
  
  (defclass instruction ($node)
    ((fun :accessor fun)
     (arity :accessor arity)
     (args :accessor args)))
  
  (eval-when (:compile-toplevel :load-toplevel :execute)
    (defvar *instructions* nil)
  
negative.code: (defun make-instruction (name)
    (make-instance name))
  
  (defun make-random-instruction ()
    (let ((inst (make-instance (elt *instructions* (random (length *instructions*)))
  			     :to (random *register-count*))))
      (setf (from inst) (loop for i from 0 below (arity inst) collect (random *register-count*)))
      inst))
  
  (defun make-random-instructions (count)
    (loop for i from 0 below count collect
         (make-random-instruction)))
   
  (defun make-random-formula (&rest args)
    (make-instance 'formula
  		 :insts (make-random-instructions (random 10)) 
  		 :args args
  		 :registers (loop for i from (length args) below *register-count* collect (make-random-register i))))
  
  (defun random-lambda (&rest args)
    (generate-formula-code (apply #'make-random-formula args)))
  
  (defun square (a)
    (* a a))
  
  (defun cube (a)
    (* a a a))
  
  (defun stupid (a)
    (/ (+ a a) a))
  
  (defvar *input-set* (loop for i from 1 to 20 collect i))
  
  (defparameter *expectations* (mapcar #'stupid *input-set*))
  
  (defun chi-squared (observations expectations)
    (reduce #'+ (mapcar (lambda (observed expected)
  			(/ (square (- observed expected)) expected))
  		      observations expectations)))
  
  (defun comparator (lambda)
    (chi-squared (mapcar lambda *input-set*) *expectations*))
  
  (defun random-comp ()
    (let ((code (random-lambda 'a)))
      (cons (comparator (eval code)) code)))
  
  ;;(loop for (a . b) =  (random-comp) until (eql a 0) finally (return (values a b)))
  ;;....the stupid way.
  
  (defun crossover (formula1 formula2)
    ((random (length (insts formula1)))
    