- Dec 1, 2000
- 2,419
- 0
- 0
(define (respond s1)
(cond
[(not (symbol=? (square-val s1) 'blank)) "Invalid move"]
[else
(begin
(set-square-val! s1 turn))]))
What would be a psuedo-code equivalent that would help me understand what's going on here? (I haven't really done much scheme.)
My take:
function respond(s1)
{
if( ! square-val(s1) == "blank" ) return "Invalid Move"
else
{
set-squal-val!(s1, turn);
}
}
The most confusing expression for me is this: (symbol=? (square-val s1) 'blank))
Can someone parse that out in english for me?
(cond
[(not (symbol=? (square-val s1) 'blank)) "Invalid move"]
[else
(begin
(set-square-val! s1 turn))]))
What would be a psuedo-code equivalent that would help me understand what's going on here? (I haven't really done much scheme.)
My take:
function respond(s1)
{
if( ! square-val(s1) == "blank" ) return "Invalid Move"
else
{
set-squal-val!(s1, turn);
}
}
The most confusing expression for me is this: (symbol=? (square-val s1) 'blank))
Can someone parse that out in english for me?
Last edited by a moderator: