Improve visualization of state. Tests fail though.
Chris Pressey
9 months ago
216 | 216 | > let |
217 | 217 | > (Tape l' r') = strip t |
218 | 218 | > in |
219 | > show (reverse l') ++ "<" ++ (show r') | |
219 | > case l' of | |
220 | > [] -> | |
221 | > "..." ++ " [" ++ (show 0) ++ "]" ++ (showList r') ++ " ..." | |
222 | > (curr:l'') -> | |
223 | > "..." ++ showList (reverse l'') ++ " [" ++ (show curr) ++ "]" ++ (showList r') ++ " ..." | |
224 | > where | |
225 | > showList [] = "" | |
226 | > showList (x:xs) = " " ++ (show x) ++ (showList xs) | |
220 | 227 | |
221 | 228 | When comparing two tapes for equality, we must disregard any zero cells |
222 | 229 | farther to the left/right than the outermost non-zero cells. Specifically, |
282 | 289 | semantics. |
283 | 290 | |
284 | 291 | > data State = State Tape Tape Bool |
285 | > deriving (Show, Read, Eq) | |
292 | > deriving (Read, Eq) | |
293 | > | |
294 | > instance Show State where | |
295 | > show (State t s h) = | |
296 | > "State{ tape=(" ++ (show t) ++ "), stack=(" ++ (show s) ++ "), halt=" ++ (show h) ++ "}" | |
286 | 297 | > |
287 | 298 | > newstate = State (tape [0]) (tape [0]) True |
288 | 299 |