diff options
author | tomsmeding <tom.smeding@gmail.com> | 2017-07-14 22:59:19 +0200 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2017-07-14 22:59:19 +0200 |
commit | 06533ad580c1afee4ee9b71fa956d2b8586c118a (patch) | |
tree | 96b8de3b8d8046fb7015045ae895a001ea410307 /interpreter.hs | |
parent | e65072b6efe6692c90919410c54cf2d14d20f3d5 (diff) |
Fixes and improvements
Diffstat (limited to 'interpreter.hs')
-rw-r--r-- | interpreter.hs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/interpreter.hs b/interpreter.hs index 59b9402..4f3f3aa 100644 --- a/interpreter.hs +++ b/interpreter.hs @@ -23,10 +23,9 @@ interInss !count !tape !memp allinss@(ins:rest) inp = case ins of (ISet value offset) -> do MV.write tape (memp + offset) value interInss (count + 1) tape memp rest inp - (IMove from tos) -> do + (ICopy from to mult) -> do value <- MV.read tape (memp + from) - MV.write tape (memp + from) 0 - mapM_ (\(offset, multiplier) -> MV.modify tape ((+) (multiplier * value)) (memp + offset)) tos + MV.modify tape ((+) (mult * value)) (memp + to) interInss (count + 1) tape memp rest inp (ISlide offset) -> do interInss (count + 1) tape (memp + offset) rest inp |