This talk was presented on Aug 3rd 2023 during the Scala in the City event a ITV in London https://www.meetup.com/scala-in-the-city/events/292844968/ Visit the following for a description, slideshow, all slides with transcript, pdf, github repo, and eventually a video recording: http://fpilluminated.com/assets/n-queens-combinatorial-puzzle-meets-cats.html At the centre of this talk is the N-Queens combinatorial puzzle. The reason why this puzzle features in the Scala book and functional programming course by Martin Odersky (the languageβs creator), is that such puzzles are a particularly suitable application area of 'for comprehensions'. Weβll start by (re)acquainting ourselves with the puzzle, and seeing the role played in it by permutations. Next, weβll see how, when wanting to visualise candidate puzzle solutions, Catsβ monoidal functions fold and foldMap are a great fit for combining images. While we are all very familiar with the triad providing the bread, butter and jam of functional programming, i.e. map, filter and fold, not everyone knows about the corresponding functions in Catsβ monadic variant of the triad, i.e. mapM, filterM and foldM, which we are going to learn about next. As is often the case in functional programming, the traverse function makes an appearance, and we shall grab the opportunity to point out the symmetry that exists in the interrelation of flatMap / foldMap / traverse and flatten / fold / sequence. Armed with an understanding of foldM, we then look at how such a function can be used to implement an iterative algorithm for the N-Queens puzzle. The talk ends by pointing out that the iterative algorithm is smarter than the recursive one, because it βremembersβ where it has already placed previous queens.