RosettaCodeData/Task/N-queens-problem/J/n-queens-problem-1.j
2015-11-18 06:14:39 +00:00

4 lines
222 B
Text

perm =: ! A.&i. ] NB. all permutations of integers 0 to y
comb2 =: (, #: I.@,@(</)&i.)~ NB. all size 2 combinations of integers 0 to y
mask =: [ */@:~:&(|@-/) {
queenst=: comb2 (] #"1~ mask)&.|: perm