For a nonnegative order, first enumerate every possible row and then every possible ordered selection of rows:Every one of the positions chooses one of symbols independently. Consequently the enumeration contains candidate squares for , each exactly once. The conventional order-zero extension produces one empty square. This is generation only; repeated symbols have not yet been rejected.
squares :: Int -> [[[Int]]]
squares n
| n < 0 = error "negative order"
| otherwise = cp (replicate n (cp (replicate n [1..n]))) Articles by others on the same topic
There are currently no matching articles.