Hacker News new | ask | show | jobs
by gus_massa 3772 days ago
The lists are made of cons, but you can make arbitrary trees with cons.

After looking carefully, the kpos is the result of the function find. In this case it's a cons with the row and the column of the king. So the code that runs is more like

  (define kpos (cons 1 2))
  (- (cdr kpos) 1)
In this case, for clarity I prefer to use a struct instead of a cons to save the position

  (struct cell (row col))
  (define kpos (cell 1 2))
  (- (cell-col kpos) 1)