summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--mew.scm8
-rw-r--r--mew.svnwiki2
-rw-r--r--tests/test.mew6
3 files changed, 13 insertions, 3 deletions
diff --git a/mew.scm b/mew.scm
index 5828f36..17c23d2 100644
--- a/mew.scm
+++ b/mew.scm
@@ -1,6 +1,6 @@
 (module mew
   (export
-     act accumulate andloc at
+     act accumulate andloc app at
      boolean
      comp cross-product
      dec def del-at div
@@ -97,7 +97,6 @@
                assoc
                member)
       (lambda fun)
-      (apply app)
       (ceiling ceil)
       (truncate trunc)
       ))
@@ -179,6 +178,11 @@
             (display " "))
           (loop (cdr args) (car args))))))
 
+  (define (app f . args)
+    (if (null? args)
+      (f)
+      (apply apply f args)))
+
   (define-syntax seq
     (syntax-rules ()
       ((_)
diff --git a/mew.svnwiki b/mew.svnwiki
index c204dbb..5b0d4b0 100644
--- a/mew.svnwiki
+++ b/mew.svnwiki
@@ -157,7 +157,7 @@ Alias for {{floor-remainder}}.
 
 <procedure>(app <proc> . <args>)</procedure>
 
-Alias for {{apply}}.
+Like {{apply}}, but supports empty {{<args>}}.
 
 <syntax>(op <form>)</syntax>
 
diff --git a/tests/test.mew b/tests/test.mew
index 5587d90..32d9df1 100644
--- a/tests/test.mew
+++ b/tests/test.mew
@@ -141,6 +141,12 @@
   (test "\n" (with-output-to-string (fun () (prn))))
   (test 3 (esc ret (with-output-to-string (fun () (ret (prn 1 2 3)))))))
 
+(test-group "app"
+  (test 15 (app + '(4 5 6)))
+  (test 15 (app + 4 5 '(6)))
+  (test 15 (app + 4 5 6 '()))
+  (test 0 (app +)))
+
 (test-group "seq"
   (test #t (void? (seq)))
   (test 1 (seq 1))