All pastes #748062 Raw Edit

Stuff

public text v1 · immutable
#748062 ·published 2007-10-24 15:37 UTC
rendered paste body
restrict_idx_1 :: [(Int,Int)] -> Maybe Grid -> Maybe Grid
restrict_idx_1    _  Nothing  = Nothing
restrict_idx_1 idxs grid = foldl f grid idxs
  where
    f (Just g) (x,y)
      --| Maybe.isNothing (Maybe g) = Nothing
      | Set.size s == 1 = Just g
      | Set.size s > 1  = Just $ set g x y $ Set.difference s (paigas idxs g)
      | otherwise       = Nothing
      where
        s = get g x y

paigas idxs grid = foldl f Set.empty idxs
  where
    f s (x,y)
      | Set.size s2 == 1 = Set.union s s2
      | otherwise        = s  -- todo
      where
        s2 = get grid x y