1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 14:54:16 +03:00

Name the lists consistently.

This commit is contained in:
Rob Rix 2017-10-23 21:16:55 -04:00
parent 4ea2a9dea8
commit 01a1ab3b94

View File

@ -240,14 +240,14 @@ mapContiguous :: (Foldable syntax, Functor syntax, GAlign syntax)
-> RWSEditScript syntax (Record (FeatureVector ': fields1)) (Record (FeatureVector ': fields2)) -> RWSEditScript syntax (Record (FeatureVector ': fields1)) (Record (FeatureVector ': fields2))
-> [MappedDiff syntax (Record (FeatureVector ': fields1)) (Record (FeatureVector ': fields2))] -> [MappedDiff syntax (Record (FeatureVector ': fields1)) (Record (FeatureVector ': fields2))]
mapContiguous canCompare = go 0 0 [] [] mapContiguous canCompare = go 0 0 [] []
where go _ _ ls rs [] = mapChunk ls rs where go _ _ as bs [] = mapChunk as bs
go i j ls rs (first : rest) = case first of go i j as bs (first : rest) = case first of
This a -> go (succ i) j (featurize i a : ls) rs rest This a -> go (succ i) j (featurize i a : as) bs rest
That b -> go i (succ j) ls (featurize j b : rs) rest That b -> go i (succ j) as (featurize j b : bs) rest
These a b -> mapChunk ls rs <> (These (i, a) (j, b) : go (succ i) (succ j) [] [] rest) These a b -> mapChunk as bs <> (These (i, a) (j, b) : go (succ i) (succ j) [] [] rest)
mapChunk ls [] = This . (termIndex &&& term) <$> reverse ls mapChunk as [] = This . (termIndex &&& term) <$> reverse as
mapChunk [] rs = That . (termIndex &&& term) <$> reverse rs mapChunk [] bs = That . (termIndex &&& term) <$> reverse bs
mapChunk ls rs = findNearestNeighbourTo' canCompare (reverse ls) (reverse rs) mapChunk as bs = findNearestNeighbourTo' canCompare (reverse as) (reverse bs)
genFeaturizedTermsAndDiffs :: Functor syntax genFeaturizedTermsAndDiffs :: Functor syntax