Execute Brain****/Haskell: Difference between revisions

no edit summary
(This version compiles with GHC and will run if loaded into ghci using :load BF)
No edit summary
Line 33:
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 (\x -> x -subtract 1) d) cs
exec p@(_,',':_) d (c:cs) = exec (moveRight p) (modify (const c) d) cs
exec p@(_,'.':_) d@(_,x:_) cs = x : exec (moveRight p) d cs
Anonymous user