N-queens problem: Difference between revisions

m
(SQL PL)
Line 7,148:
(\x y -> y <> foldr (go x) [] [1 .. nCols])
[]
($ queenPuzzle (pred nRows) nCols)
where
go qs iCol b
Line 7,164:
qs
[0 .. iRow - 1]
 
 
--------------------------- TEST -------------------------
Line 7,170 ⟶ 7,169:
showSolutions :: Int -> Int -> [String]
showSolutions nCols nSize =
mapunlines
. mapfmap (intercalate " ")
( unlines
. transpose
. map (intercalate " ")
. map . transposeboardLines
<$> chunksOf nCols (queenPuzzle nSize nSize)
. map boardLines
)
$ chunksOf nCols (queenPuzzle nSize nSize)
where
go r x
9,655

edits