You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)]
The text was updated successfully, but these errors were encountered:
I think the simplest solution is using toNFA function to convert the automata given as input to an NFA (or the most general type if we have a more general one) and define
newStates
is an auxiliary function forlistStates
. Its type may be generalizable to:But to generalize its type, we would need to create a function whose particular cases for
[]
andMaybe
werecatMaybes
andconcat
, as we can see here (fromToGraph.hs
):The text was updated successfully, but these errors were encountered: