Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let left (Loc(t, p)) =
- match p with
- | Top -> failwith "left at top"
- | Node(l::left, up, right) -> Loc(l, Node(left, up, t::right))
- | Node([], up, right) -> failwith "left of first"
- let right (Loc(t, p)) =
- match p with
- | Top -> failwith "right at top"
- | Node(left, up, r::right) -> Loc(r, Node(t::left, up, right))
- | _ -> failwith "right of last"
- let up (Loc(t, p)) =
- match p with
- | Top -> failwith "up at top"
- | Node (left, up, right) -> Loc(Section((List.rev left) @ (t::right)), up)
- let down (Loc(t, p)) =
- match t with
- | Item(_) -> failwith "down with item"
- | Section(t1::trees) -> Loc(t1, Node([], p, trees))
- | _ -> failwith "down of empty"
Add Comment
Please, Sign In to add comment