about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--kaagum/lens.scm5
1 files changed, 5 insertions, 0 deletions
diff --git a/kaagum/lens.scm b/kaagum/lens.scm
index 6739244..bbd11f5 100644
--- a/kaagum/lens.scm
+++ b/kaagum/lens.scm
@@ -24,6 +24,7 @@
   #:export (vector-nth
             in-json
             push
+            add
             prepend-over
             alist-delete-over))
 
@@ -51,6 +52,10 @@ possible to traverse JSON trees."
 on."
   (over lens (cut cons x <>) object))
 
+(define (add lens x object)
+  "Add @var{x} onto the part of @var{object} that @var{lens} focuses on."
+  (over lens (cut + x <>) object))
+
 (define (prepend-over lens lst object)
   "Prepend @var{lst} to the part of @var{object} that @var{lens} focuses
 on."