summaryrefslogtreecommitdiff
path: root/lib/zipper.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/zipper.ml')
-rw-r--r--lib/zipper.ml5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/zipper.ml b/lib/zipper.ml
index 30be8eb..9313518 100644
--- a/lib/zipper.ml
+++ b/lib/zipper.ml
@@ -107,6 +107,11 @@ let map_focus f z =
107 | None -> z 107 | None -> z
108 | Some (h, t) -> { z with after = Sequence.shift_right t (f h) } 108 | Some (h, t) -> { z with after = Sequence.shift_right t (f h) }
109 109
110let map_focus_or ~default f z =
111 match Sequence.next z.after with
112 | None -> { z with after = Sequence.singleton default }
113 | Some (h, t) -> { z with after = Sequence.shift_right t (f h) }
114
110let map f z = 115let map f z =
111 { z with before = Sequence.map ~f z.before; after = Sequence.map ~f z.after } 116 { z with before = Sequence.map ~f z.before; after = Sequence.map ~f z.after }
112 117