Welcome to the CHICKEN Scheme pasting service

This better shows the error added by anandamide on Fri May 6 06:11:29 2016

  
(let*
    ((board
      '((1 0 0 1 0 0 0)
	(0 1 0 0 0 0 0)
	(0 0 1 0 0 0 0)
	(0 1 1 1 0 0 0)
	(0 0 0 0 0 0 0)
	(0 0 0 0 0 0 0)
	(0 0 0 0 0 0 0)))
     (temp '())
     (size (length (car board)))
     
     (cell-index
      (lambda (i j)
	(list-ref (list-ref board j) i)))
     
     (printboard ;displays the board and calls the calling
      (lambda (cc)
	(display (string-join
		  (map (lambda (line)
			 (string-join
			  `("|",@(map (lambda (cell)
					(cond ((eq? cell 0) "  ")
					      ((eq? cell 1) "# ")
					      (else (error "bad cell data" cell))))
				      line) "|\n")""))
		       board)
		  ""))
	(call/cc cc)))
     
     (alive-neighbors ;calculates the number of neighboring cells that are alive
      (lambda (i j)
	(let* ((coords (filter
		       (lambda (point)
			 (not (or (< (car point) 0)
				  (< (cadr point) 0)
				  (> (cadr point) size)
				  (> (car point) size))))
		       `((,(- i 1) ,(- j 1))
			 (,(- i 1) ,j)
			 (,(- i 1) ,(+ j 1))
			 (,i ,(- j 1))
			 (,i ,(+ j 1))
			 (,(+ i 1) ,(- j 1))
			 (,(+ i 1) ,j)
			 (,(+ i 1) ,(+ j 1)))))
	       (cells (map (lambda (point)
			     (cell-index (car point) (cadr point)))
			   coords)))
	  (apply + cells))))

     (update ;will eventually set! board to updated version
      (lambda (cc)
	(set! temp
	      (let loop-i ((i 0) (b '()))
		(if (< i (- size 1))
		    (loop-i (+ i 1) (cons (let loop-j ((j 0) (l '()))
					    (if (< j (- size 1))
						(loop-j (+ j 1) (cons (alive-neighbors i j) l))
						(reverse l))) b))
		    (reverse b))))
	(printf "~A~N" (car temp))
	(printf "~A~N" (cadr temp))
	(printf "~A~N" (caddr temp))
	(printf "~A~N" (cadddr temp))
	(call/cc cc))))
  (call/cc printboard)
  (call/cc update)
  (printf "cell (3, 0) has ~A alive neighbors~N" (alive-neighbors 3 0)))
	       	

output:

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Name of the CHICKEN extension manager:
Visually impaired? Let me spell it for you (wav file) download WAV