anchor.diff:           errors))
   
   (defun backtracking-neuron (neuron input-values error)
  -  (let ((pdaf (pdaf (weighted-sum neuron input-values))))
  -    (map 'vector
  -         (lambda (weight input-value) (+ weight
  -					 (delta-weight pdaf input-value error)))
  -	 neuron
  -	 input-values)))
  -				   
  -(defun compute-error (network-outputs expected-outputs)
  -  (map 'vector
  -       #'-
  -       network-outputs
  -       expected-outputs))
  -
  -(defun delta-weight (pdaf input-value error)
  -  (* -1 *learning-rate* error pdaf input-value))
  +  ;; error multiplied by the partial derivative of the activation function
  +  (* error (pdaf (weighted-sum neuron input-values)))))
     
   (defun pdaf (weighted-sum)
     ;; partial derivative of the activation function
  
positive.code:   ;; Using logistic function
    (/ 1 (+ 1 (exp (* -1 weighted-sum)))))
  
  
  ;;; Backtracking
  (defun backtracking (network input-values errors)
    (backtracking-layer (car network) input-values errors))
  
  (defun backtracking-layer (layer input-values errors)
      (map 'vector
  	 (lambda (neuron error) (backtracking-neuron neuron
  						     input-values
  
negative.code: 
  (defun results-to-labels (results)
    ;; the number with the highest output is considered to be the right answer
    ;; TODO: low priority, probably suboptimal alogrithm but only runned once/test
    (position (reduce #'max results) results))
  
  (defun error-rate (network testing-set)
    (- 100 (* (/ (testing network testing-set) testing-set) 100.0)))
  
  (defun training (network n)
    (let ((inputs nil))
      (dotimes (x n)
        (setq inputs (next-image *images*))
        (setq network (backtracking  network
  				   inputs
  				   (network-output network inputs)
  				   (label-to-results (next-label *labels*))))))
    network)
  
  (defun testing (network n)
    (let ((success 0))
      (dotimes (x n)
        (when (equal (results-to-labels (network-output network (next-image *images*)))
  		   (next-label *labels*))
  	(setq success (+ success 1))))
      success))
  