square.scm 475 B

1234567891011121314151617181920212223242526
  1. (define-module (sudoku square))
  2. (use-modules (srfi srfi-1))
  3. (define-public (make-square)
  4. (build-square 0 (iota 9 1)))
  5. (define-public (build-square v candidates)
  6. (list v candidates))
  7. (define-public (get-value square)
  8. (car square))
  9. (define-public (set-value square v)
  10. (build-square
  11. v
  12. (get-candidates square)))
  13. (define-public (get-candidates square)
  14. (cadr square))
  15. (define-public (set-candidates square l)
  16. (build-square
  17. (get-value square)
  18. l))