<commit_before>{-
    8 Queens Problem:
    The solution must look something like: [1, 3, 5, 6, 2, 7, 9] where
    each index is a column (file) & each number is the row (rank)
    on which the queen is placed.
-}

solver :: [[Int]] -> [[Int]]
solver [] = []
solver xs = concat $ map addQueen xs

-- | Place one additional queen on the board, given a list of positions
addQueen :: [Int] -> [[Int]]
addQueen xs = [xs ++ [y] | y <- filter (okToPlace xs) [1..8]]
<commit_msg>Add final solution!<commit_after>{-
    8 Queens Problem:
    The solution must look something like: [1, 3, 5, 6, 2, 7, 9] where
    each index is a column (file) & each number is the row (rank)
    on which the queen is placed.
-}

-- | Initial Queen positions (ranks 1 to 8 in the 'a' file)
initial :: [[Int]]
initial = [[x] | x <- [1..8]]

-- | Get the 8th iteration of the solver, all of which have 8 Queens.
solutions = iterate solver initial !! 7

-- | Take a set of solutions and extend it into a set of solutions with
-- added Queens.
solver :: [[Int]] -> [[Int]]
solver xs = concat $ map addQueen xs

-- | Place one additional queen on the board, given a list of positions
-- Note that this works even when xs is an empty list.
addQueen :: [Int] -> [[Int]]
addQueen xs = [xs ++ [y] | y <- filter (okToPlace xs) [1..8]]

{'fraction_non_alphanumeric': 0.14, 'fraction_numerical': 0.02076923076923077, 'mean_word_length': 3.027863777089783, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1269695', 'n_tokens_mistral': 453, 'n_tokens_neox': 414, 'n_words': 203}