We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Finally managed to do it by simply using data Bf = Cmd (BfState -> BfState) | Cmds (Seq Bf), and folding the function list over a state tuple, instead of mapping with side-effects.
Wasn't as hard as a thought it'd be, except for getting it to time out at the right moment. Because of the different execution method, I'm not even sure if it's possible to update my counter in a way that conforms to the problem statement.
BrainF__k interpreter
You are viewing a single comment's thread. Return to all comments →
Finally managed to do it by simply using
data Bf = Cmd (BfState -> BfState) | Cmds (Seq Bf)
, and folding the function list over a state tuple, instead of mapping with side-effects.Wasn't as hard as a thought it'd be, except for getting it to time out at the right moment. Because of the different execution method, I'm not even sure if it's possible to update my counter in a way that conforms to the problem statement.
Edit: fixed some bugs and managed to pass all test cases except for the ROT13 one, which somehow runs for 5000 iterations too many.