aboutsummaryrefslogtreecommitdiff
path: root/module/hnh/util/lens.scm
diff options
context:
space:
mode:
Diffstat (limited to 'module/hnh/util/lens.scm')
-rw-r--r--module/hnh/util/lens.scm8
1 files changed, 7 insertions, 1 deletions
diff --git a/module/hnh/util/lens.scm b/module/hnh/util/lens.scm
index 7a8fbd19..26c75be7 100644
--- a/module/hnh/util/lens.scm
+++ b/module/hnh/util/lens.scm
@@ -9,7 +9,9 @@
compose-lenses
lens-compose
- ref car* cdr*))
+ ref car* cdr*
+
+ each))
(define (modify object lens f . args)
@@ -97,3 +99,7 @@
(define car* (make-lens car (lambda (pair value) (cons value (cdr pair)))))
(define cdr* (make-lens cdr (lambda (pair value) (cons (car pair) value))))
+
+(define (each obj lens proc)
+ (modify obj lens
+ (lambda (lst) (map proc lst))))