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

- doesn't stop at 0 per specification
No edit summary
(- doesn't stop at 0 per specification)
Line 39:
 
let modify f (l, x::r) = l, f x :: r
 
let dec x =
if x = 0 then 0
else x - 1
 
let rec exec p d =
Line 54 ⟶ 50:
exec (move_right p) (modify succ d)
| (_, '-'::_), _ ->
exec (move_right p) (modify dec pred d)
| (_, ','::_), _ ->
let c = read_int () in
Anonymous user