File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -41,9 +41,9 @@ fromEither :: Show a => Either a b -> b
41
41
fromEither (Right x) = x
42
42
fromEither (Left x) = error $ show x
43
43
44
- -- * Non-deterministic automata
45
- runNDA :: Map Int Rule -> Int -> String -> Bool
46
- runNDA rules k = elem " " . go (Single k)
44
+ -- * Non-deterministic finite automata
45
+ runNDFA :: Map Int Rule -> Int -> String -> Bool
46
+ runNDFA rules k = elem " " . go (Single k)
47
47
where
48
48
go _ " " = []
49
49
go (Token c) (c': cs) = [cs | c== c']
@@ -60,8 +60,8 @@ main = do
60
60
let rulesStr = takeWhile (/= " " ) dat
61
61
strings = tail $ dropWhile (/= " " ) dat
62
62
rules = parseMap rulesStr
63
- part1 = map (runNDA rules 0 ) strings
63
+ part1 = map (runNDFA rules 0 ) strings
64
64
rules' = insert 8 r8 $ insert 11 r11 rules
65
- part2 = map (runNDA rules' 0 ) strings
65
+ part2 = map (runNDFA rules' 0 ) strings
66
66
print $ length $ filter id part1
67
67
print $ length $ filter id part2
You can’t perform that action at this time.
0 commit comments