summary refs log tree commit diff
path: root/mew.scm
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2022-11-07 22:35:46 +0100
committerLeah Neukirchen <leah@vuxu.org>2022-11-07 22:35:46 +0100
commit2c8ea7f35fadd2a07e53f40fbf5e873573871e25 (patch)
tree049ea7b29e897a4a946b334673d4e11e26f39613 /mew.scm
parent2caa24615fb6bf3b8339276c6bc8b589a830a785 (diff)
downloadmew-2c8ea7f35fadd2a07e53f40fbf5e873573871e25.tar.gz
mew-2c8ea7f35fadd2a07e53f40fbf5e873573871e25.tar.xz
mew-2c8ea7f35fadd2a07e53f40fbf5e873573871e25.zip
add =>, set=>, and=>
Diffstat (limited to 'mew.scm')
-rw-r--r--mew.scm22
1 files changed, 19 insertions, 3 deletions
diff --git a/mew.scm b/mew.scm
index abd4cb8..a6bef13 100644
--- a/mew.scm
+++ b/mew.scm
@@ -25,6 +25,7 @@
      -> fun-> fun->> set->
      =? <>?
      ~?
+     => and=> set=>
 
      generic-make-accumulator)
 
@@ -718,9 +719,6 @@
                                  `(,(rename 'equal?) x ,v))
                                (cdr expr)))))))
 
-  (define (per . args)
-    (apply comp (reverse args)))
-
   (define inject
     (case-lambda
       ((f) (lambda (o)
@@ -744,9 +742,27 @@
     (lambda args
       (unlist (map (lambda (f) (apply f args)) fs))))
 
+  (define (per . args)
+    (apply comp (reverse args)))
+
   (define (act x . fs)
     ((apply per fs) x))
 
+  (define => act)
+
+  (define-syntax set=>
+    (syntax-rules ()
+      ((_ location . fs)
+       (set location (=> location . fs)))))
+
+  (define (and=> x . fs)
+    (and x
+         (if (null? fs)
+           x
+           (let ((result ((car fs) x)))
+             (and result
+                  (apply and=> result (cdr fs)))))))
+
   (define-syntax proj
     (syntax-rules ()
       ((_ 0) (lambda (a . args) a))