1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 14:21:31 +03:00

Do the lookup symmetrically.

This commit is contained in:
Rob Rix 2016-08-12 09:45:42 -04:00
parent 1a342edb37
commit 4100ac4173

View File

@ -45,12 +45,12 @@ rws compare as bs
(previous, unmappedA, unmappedB) <- get
fromMaybe (insertion previous unmappedA unmappedB kv) $ do
foundA@(UnmappedTerm i _ a) <- nearestUnmapped unmappedA kdas kv
let UnmappedTerm j' _ _ = KdTree.nearest kdbs foundA
foundB@(UnmappedTerm j' _ _) <- nearestUnmapped unmappedB kdbs foundA
guard (j == j')
guard (i >= previous)
compared <- compare a b
pure $! do
put (i, List.delete foundA unmappedA, List.delete kv unmappedB)
put (i, List.delete foundA unmappedA, List.delete foundB unmappedB)
pure (i, compared)
nearestUnmapped unmapped tree key = let UnmappedTerm i _ _ = KdTree.nearest tree key in
find ((== i) . termIndex) unmapped