git @ Cat's Eye Technologies Burro / 5be9639
Improve visualization of state. Tests fail though. Chris Pressey 9 months ago
1 changed file(s) with 13 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
216216 > let
217217 > (Tape l' r') = strip t
218218 > 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)
220227
221228 When comparing two tapes for equality, we must disregard any zero cells
222229 farther to the left/right than the outermost non-zero cells. Specifically,
282289 semantics.
283290
284291 > 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) ++ "}"
286297 >
287298 > newstate = State (tape [0]) (tape [0]) True
288299