Execute Brain****/Haskell: Difference between revisions
Content deleted Content added
m RCBF (Haskell) moved to RCBF/Haskell: MW has page hierarchy support. |
i don't think minus stops at 0 |
||
Line 27:
modify f (l,x:r) = (l,(f x):r)
exec :: (String, String) -> ([Integer], [Integer]) -> [Integer] -> [Integer]
Line 36 ⟶ 32:
exec p@(_,'>':_) d cs = exec (moveRight p) (pad $ moveRight $ d) cs
exec p@(_,'<':_) d cs = exec (moveRight p) (pad $ moveLeft $ d) cs
exec p@(_,'+':_) d cs = exec (moveRight p) (modify (+ 1) d) cs
exec p@(_,'-':_) d cs = exec (moveRight p) (modify (
exec p@(_,',':_) d (c:cs) = exec (moveRight p) (modify (const c) d) cs
exec p@(_,'.':_) d@(_,x:_) cs = x : exec (moveRight p) d cs
|