From: Deepak Surti on
On Dec 9, 2:44 am, Alberto Riva <a...(a)nospam.ufl.edu> wrote:
> Ron Garret wrote:
> >>>>>> On Dec 8, 1:48 pm, Deepak Surti <dmsu...(a)gmail.com> wrote:
> >>>>>>> Hi,
> >>>>>>> I attempted to solve Sudoku. I have posted my solution
> >>>>>>> here:http://deepaksurti.com/lisp/sudoku/mysoln.html
> >>>>>>> Kindly let me know your comments.
> > SInce no one else is saying it: I think you did a great job on this
> > project.  Thanks for sharing it.
>
> I haven't looked carefully at your code yet, but this caught my eye:
>
> (defun solved? (board)
>    "A board is solved if it has no contradictions.!"
>    (multiple-value-bind (found count)
>        (contradictions? board)
>      (if (and (= count 81) (not found))
>        t
>        nil)))
>
> The IF is unnecessary, you could simply return:
>
>    (and (= count 81) (not found))
>
> And in UPDATE-BOARD you have:
>
> (if (contradictions? board)
>      nil
>    (if (equal-boards board newboard)
>          board
>      (update-board newboard)))
>
> Which can be written as:
>
> (unless (contradictions? board)
>     (if (equal-boards board newboard)
>          board
>       (update-board newboard)))
>
> Alberto

Hi Alberto,

Thanks for your observations. I will incorporate
these in my code.

Thanks,
Deepak Surti