All pastes #2049007 Raw Edit

Stuff

public text v1 · immutable
#2049007 ·published 2011-04-21 14:36 UTC
rendered paste body
(define (place-queen board i j)
  (let
      ; copy the board that is got from function.
      ; I will change it via (vector-set!) and return it
      [(output (vector-copy board))]
    
    (begin
      ; set the queen
      (vector-set! (vector-ref output i) j 'q)
      ; set the positions that it is threatening
      (for-each (lambda (item)
             ; (car item) is column
             ; (cadr item) is row
             (vector-set! (vector-ref output (car item)) (cadr item) #f))
                (get-threatened-positions (vector-length board) i j))
      ; I modified the output. Now return it.
      (printf "Output is ~a\n" output)
      (printf "Board is ~a\n" board))))