summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2022-10-31 14:56:16 +0100
committerLeah Neukirchen <leah@vuxu.org>2022-10-31 14:56:16 +0100
commit2eda98b2e16a2a90e6fcf40f6f21be91ebfeea10 (patch)
treef3442385dcac615d9674e6cc89017537c9dea883
parent0bc8ebf07908d8d69508a91d0df15b2541127b20 (diff)
downloadmew-2eda98b2e16a2a90e6fcf40f6f21be91ebfeea10.tar.gz
mew-2eda98b2e16a2a90e6fcf40f6f21be91ebfeea10.tar.xz
mew-2eda98b2e16a2a90e6fcf40f6f21be91ebfeea10.zip
add comp, negate, per
-rw-r--r--mew.scm12
-rw-r--r--mew.svnwiki12
2 files changed, 21 insertions, 3 deletions
diff --git a/mew.scm b/mew.scm
index e167196..616033c 100644
--- a/mew.scm
+++ b/mew.scm
@@ -1,6 +1,7 @@
 (module mew
   (export
      accumulate at
+     comp
      dec def div
      empty? eof esc
      fin final for generic-for-each
@@ -10,9 +11,9 @@
      keys
      len loc
      mod
-     nth
+     negate nth
      one-of op
-     prn puts
+     per prn puts
      rep
      set str slurp
      tally-accumulator tbl time
@@ -27,7 +28,9 @@
 
   (import scheme
           (rename (chicken base)
-             (print puts))
+             (print puts)
+             (complement negate)
+             (compose comp))
           (chicken module)
           (chicken syntax)
           (chicken port)
@@ -539,4 +542,7 @@
          (,(rename 'or) ,@(map (lambda (v)
                                  `(,(rename 'equal?) x ,v))
                                (cdr expr)))))))
+
+  (define (per . args)
+    (apply comp (reverse args)))
 )
diff --git a/mew.svnwiki b/mew.svnwiki
index 00511cd..6ca3fd8 100644
--- a/mew.svnwiki
+++ b/mew.svnwiki
@@ -112,6 +112,18 @@ If {{<form>>} is empty, behaves as {{values}}, i.e. the identity function.
 
 {{(op + 2 _)}} is the function that adds 2 to its argument.
 
+<procedure>(negate <fun>)</procedure>
+
+Alias for {{complement}}.
+
+<procedure>(comp <fun>...)</procedure>
+
+Alias for {{compose}}.
+
+<procedure>(per <fun>...)</procedure>
+
+Reverse function composition.
+
 <procedure>(str . <args>)</procedure>
 
 Returns a new string composed by concatenating the strings given by