1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 04:51:57 +03:00

Take the alternation of the for loops.

This commit is contained in:
Rob Rix 2017-03-09 15:38:13 -05:00
parent c1ababe068
commit d762cb7866

View File

@ -46,16 +46,16 @@ decompose myers = case myers of
SES {} -> return []
MiddleSnake as bs -> fmap (fromMaybe (error "bleah")) $
for [0..maxD] $ \ d -> do
for [negate d, negate d + 2 .. d] (\ k -> do
for [0..maxD] $ \ d ->
(<|>)
<$> for [negate d, negate d + 2 .. d] (\ k -> do
forwardEndpoint <- findDPath Forward (EditDistance d) (Diagonal k)
backwardV <- gets backward
let reverseEndpoint = backwardV `at` (maxD + k)
if odd delta && k `inInterval` (delta - pred d, delta + pred d) && overlaps forwardEndpoint reverseEndpoint
then return (Just (Snake reverseEndpoint forwardEndpoint, EditDistance $ 2 * d - 1))
else continue)
for [negate d, negate d + 2 .. d] (\ k -> do
<*> for [negate d, negate d + 2 .. d] (\ k -> do
reverseEndpoint <- findDPath Reverse (EditDistance d) (Diagonal (k + delta))
forwardV <- gets forward
let forwardEndpoint = forwardV `at` (maxD + k + delta)