RosettaCodeData/Task/N-queens-problem/APL/n-queens-problem.apl

12 lines
379 B
APL
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

⍝Solution
accm{,(()=)}
atk{()+¯1 0 1×}
dfs{/( ), }
qfmt{.=}
subs{(),¨()~atk }
queens{qfmt¨(0 0)accm dfs subs }
printqueens{i1{'answer'ii+1}¨queens }
⍝Example
printqueens 6