Code: Select all
...
candidate is: f8
candidate is: f7
candidate is: f6
candidate is: f5
candidate is: f4
candidate is: f3
candidate is: f2
candidate is: f1
candidate is: e8
value expected in function = : square
called from user defined function board:white-piece?
called from user defined function board:k?
called from user defined function board:find-king
Code: Select all
(define (side square)
((board square) 1))
(define (board:board key value)
(if value
(begin
(push key keylist)
(context 'board key value))
(context 'board key)))
(define (white-piece? square)
(= "w" (side square)))
(define (find-king side)
(if (= side "w")
(setq k? white-king?)
(setq k? black-king?))
(catch
(dolist (candidate keylist)
(println "candidate is: " candidate)
(if (k? candidate)
(throw candidate)))))
point we get the above error message. I'm not entirely sure what it
is complaining about; that square has no value or that a function called
square was expecting a value?
Note that if I rewrite white-piece? to look like:
Code: Select all
(define (white-piece? square)
(= "w" ((board square) 1)))
to die somewhere after the call but before the body of the function!
Clues and or clue-sticks would be nice!
--hsm
p.s. I believe my addition to the default function for board solves the 'key' problem...