N-queens problem: Difference between revisions

m
→‎{{header|Tailspin}}: use new array content matchers
m (→‎{{header|Tailspin}}: syntax update)
m (→‎{{header|Tailspin}}: use new array content matchers)
Line 10,886:
def minor: $ - $prev::length - 1;
def major: $ + $prev::length + 1;
// If any element of prev matches row, array is non-emptynot andan noarray resultthat proceedscontains pastrow, thesend firstit lineon...
$prev -> (<~[ <$prev...,row>]> $row] !)
// Similar for the major and minor diagonals
-> (<?($prev -> [i](<$row> 0- $i !) -> (<~[<$minor>](0>)> $prev !)
-> [i](<?($ -> [i]($i <+ $minor>)> 0i !) -> (<~[<$major>](0>)> $prev !)
-> [i](<?($ + $i..., <$major>)> 0 !) -> (<[row](0)> $prev !)
-> [ $prev..., $row] !
end addIfPossible
1..$n -> addIfPossible !
Anonymous user