Thinking Functionally With Haskell

Cover Thinking Functionally With Haskell
Authors:
Genres: Fiction
There’s no maths involved. Yousolve the puzzle with reasoning and logic.Advice on how to play Sudoku, the Independent This chapter is devoted to an extended exercise in the use of lists to solve problems, and in the use of equational reasoning to reason about them and to improve efficiency.
The game of Sudoku is played on a 9 by 9 grid, though other sizes are also possible. Given a matrix, such as that in Figure 5.1, the idea is to fill in the empty cells with the digits 1 to 9 so that each row
..., column and 3×3 box contains the numbers 1 to 9. In general there may be any number of solutions, though in a good Sudoku puzzle there should always be a unique solution. Our aim is to construct a program to solve Sudoku puzzles. Specifically, we will define a function solve for computing a list of all the ways a given grid may be completed. If only one solution is wanted, then we can take the head of the list. Lazy evaluation means that only the first result will then be computed.
Figure 5.1 A Sudoku grid We begin with a specification, then use equational reasoning to calculate a more efficient version.
MoreLess

Read book Thinking Functionally With Haskell for free

You can download books for free in various formats, such as epub, pdf, azw, mobi, txt and others on book networks site. Additionally, the entire text is available for online reading through our e-reader. Our site is not responsible for the performance of third-party products (sites).
Ads Skip 5 sec Skip
+Write review

User Reviews:

Write Review:

Guest

Guest