(def valid? (stack) (let i 0 (if (or (pos stack.0 cdr.stack) (some [do (++ i) (is i (abs:- _ stack.0))] cdr.stack)) nil t)))
(def valid? (stack) (let i 0 (if (or (pos stack.0 cdr.stack) (some [is ++.i (abs:- stack.0 _)] cdr.stack)) nil t))) (def queens (stack n) (if (is n 8) (do (prall rev.stack "[ ") (prn " ]")) (for rank 1 8 (push rank stack) (if (valid? stack) (queens stack (+ n 1))) (pop stack)))) (queens '() 0)
-----