From b2003de8d40b2242ffe55a1d98de85780d6dc123 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 29 Jun 2016 10:06:35 -0400 Subject: [PATCH] Place the index last. --- src/Data/RandomWalkSimilarity.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Data/RandomWalkSimilarity.hs b/src/Data/RandomWalkSimilarity.hs index b7d4b58d0..958839754 100644 --- a/src/Data/RandomWalkSimilarity.hs +++ b/src/Data/RandomWalkSimilarity.hs @@ -36,11 +36,11 @@ rws compare getLabel as bs mapped <- get let ((k, nearest), j) = KdTree.nearest kdas kv if k `Set.member` mapped - then pure (j, insert v) + then pure (insert v, j) else do put (Set.insert k mapped) - pure $! maybe (j, replace nearest v) ((,) j) (compare nearest v) - deleteRemaining diff mapped = fmap snd diff <> (delete . snd . fst <$> filter (not . (`Set.member` mapped) . fst . fst) fas) + pure $! maybe (replace nearest v, j) (flip (,) j) (compare nearest v) + deleteRemaining diff mapped = fmap fst diff <> (delete . snd . fst <$> filter (not . (`Set.member` mapped) . fst . fst) fas) data Gram label = Gram { stem :: [Maybe label], base :: [Maybe label] } deriving (Eq, Show)