Open BertLisser opened 5 years ago
Ex 2 The following is okay
constraints :: Sudoku -> [Constraint] constraints s = sortBy length3rd [(r,c, freeAtPositions s (r,c)) | (r,c) <- openPositions s ]
but why not simplify
-- A slightly modified version of the example prune code. prune :: (Row,Column,Value) -> [Constraint] -> Bool -> [Constraint] prune _ [] isNRC = [] prune (r,c,v) ((x,y,zs):rest) isNRC | r == x = (x,y,zs\\[v]) : prune (r,c,v) rest isNRC | c == y = (x,y,zs\\[v]) : prune (r,c,v) rest isNRC | sameBlock (r,c) (x,y) = (x,y,zs\\[v]) : prune (r,c,v) rest isNRC | isNRC && nrcSameBlock (r,c) (x,y) = (x,y,zs\\[v]) : prune (r,c,v) rest isNRC | otherwise = (x,y,zs) : prune (r,c,v) rest isNRC
? I see you understand this, but you are on the half way.
Ex 2 The following is okay
but why not simplify
? I see you understand this, but you are on the half way.