diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-09-05 00:55:35 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-09-05 00:55:35 +0200 |
commit | c64a4bc56f93c08cf55fb907078e588ad737684c (patch) | |
tree | f70767074a4550a2be180dd4659e2dedc922b0b4 /module/hnh/util/lens.scm | |
parent | Move lens test. (diff) | |
download | calp-c64a4bc56f93c08cf55fb907078e588ad737684c.tar.gz calp-c64a4bc56f93c08cf55fb907078e588ad737684c.tar.xz |
Major work on, something.
Diffstat (limited to 'module/hnh/util/lens.scm')
-rw-r--r-- | module/hnh/util/lens.scm | 8 |
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)))) |