Re: Ugly Sudoku solver

2009-01-27 Thread Konrad Hinsen
On Jan 27, 2009, at 7:48, Tzach wrote: > I do not understand the benefit of storing the map-board result. > The map-board function it self is using lazy for loop. > Why isn't the laziness transitive automatically? map-board is indeed lazy, but every time you call it it creates a *new* lazy seq

Re: Ugly Sudoku solver

2009-01-26 Thread Tzach
Thanks Konrad I do not understand the benefit of storing the map-board result. The map-board function it self is using lazy for loop. Why isn't the laziness transitive automatically? On Jan 11, 12:05 pm, Konrad Hinsen wrote: > On 11.01.2009, at 08:56,Tzachwrote: > > > Following your good advice,

Re: Ugly Sudoku solver

2009-01-11 Thread Konrad Hinsen
On 11.01.2009, at 08:56, Tzach wrote: > Following your good advice, I also update the next-cell function to > work in a lazy way instead of sorting the values of the entire board. Good idea! > (defn next-cell [board] > "return the next potential cell to set, and the valid alternatives" > (f

Re: Ugly Sudoku solver

2009-01-10 Thread Tzach
Following your good advice, I also update the next-cell function to work in a lazy way instead of sorting the values of the entire board. The full source bellow. Next phase: GUI. ;; sudoku solver by Tach ;; with the help of Konrad (defn print-board [board] "Pretty print the sudoku board" (dos

Re: Ugly Sudoku solver

2009-01-10 Thread Tzach
Thanks Konrad A very elegant solution. 40 years of laziness, and I finally realize what a great feature the lazy evaluation is ;) Tzach On Jan 9, 3:30 pm, Konrad Hinsen wrote: > On Jan 9, 2009, at 13:18, Tzach wrote: > > > > > The main functionsudokuis recursive: > > 1. Getting asudokuboard as

Re: Ugly Sudoku solver

2009-01-09 Thread Konrad Hinsen
On Jan 9, 2009, at 13:18, Tzach wrote: > The main function sudoku is recursive: > 1. Getting a sudoku board as an input > 2. Choosing the next empty (zero) cell to test, loop on all valid > values, and call sudoku with the new board > 3. When a solution (board with no zero values) is found: throw

Ugly Sudoku solver

2009-01-09 Thread Tzach
Hi Clojure fans My first attempt with Clojure is a Sudoku solver, and I'm fighting with what are probably trivial problems (for a non newbie) The main function sudoku is recursive: 1. Getting a sudoku board as an input 2. Choosing the next empty (zero) cell to test, loop on all valid values, and