-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
newStates is an auxiliary function for listStates. Its type may be generalizable to:
(Automata a) => a -> State -> [State]But to generalize its type, we would need to create a function whose particular cases for [] and Maybe were catMaybes and concat, as we can see here (from ToGraph.hs):
listStates :: DFA -> [State]
listStates dfa = stabilize (nub . concat . (map (newStates dfa))) [fromJust (initialDFA dfa)]
newStates :: DFA -> State -> [State]
newStates dfa s = s : catMaybes [(deltaDFA dfa) s a | a <- (alphaDFA dfa)]
listStatesNfa :: NFA -> [State]
listStatesNfa nfa = stabilize (nub . concat . (map (newStatesNfa nfa))) (initialNFA nfa)
newStatesNfa :: NFA -> State -> [State]
newStatesNfa nfa s = s : concat [(deltaNFA nfa) s a | a <- (alphaNFA nfa)]Metadata
Metadata
Assignees
Labels
No labels