//Only four movement commands are understood: north (1), south (2), west (3), and east (4). type Position = {X:int;Y:int} let back = function | 1L -> 2L | 2L -> 1L | 3L -> 4L | 4L -> 3L | _ -> failwith "wrong direction" let moveTo = function | 1L -> fun position -> {position with Y = position.Y + 1} | 2L -> fun position -> {position with Y = position.Y - 1} | 3L -> fun position -> {position with X = position.X - 1} | 4L -> fun position -> {position with X = position.X + 1} | _ -> failwith "wrong direction"