haskellでエイトクイーン
でももっと短く書けるに違いない

module Main(main) where
import Control.Monad
import Data.Tuple

main = print $ nQueen $ 8

nQueen n = nQueen_ (n-1) (map return [1..n])
where nQueen_ 0 result = result
nQueen_ c base = do xs <- base
x <- [1..n]
guard (cond x xs)
(nQueen_ (c-1)) $ return $ (x:xs)

cond x xs = let list = zip (iterate (subtract 1) (length (x:xs))) (x:xs)
(p:ps) = tUnion (+) list
(m:ms) = tUnion (-) list in
notElem x xs && notElem p ps && notElem m ms

tUnion f [] = []
tUnion f (x:xs) = (f (fst x) (snd x)):(tUnion f xs)