Skip to content

Instantly share code, notes, and snippets.

View xekoukou's full-sized avatar

Apostolis Xekoukoulotakis xekoukou

View GitHub Profile
-- `accepts`, in defunctionalized style:
accepts :: State -> String -> Bool
accepts S0 ('a':xs) = accepts S1 xs
accepts S0 ('b':xs) = accepts S2 xs
accepts S1 ('a':xs) = accepts S2 xs
accepts S1 ('b':xs) = accepts S0 xs
accepts S2 ('a':xs) = accepts S0 xs
accepts S2 ('b':xs) = accepts S2 xs
accepts S2 _ = True
accepts _ _ = False