summary refs log tree commit diff
path: root/mew.scm
diff options
context:
space:
mode:
Diffstat (limited to 'mew.scm')
-rw-r--r--mew.scm15
1 files changed, 14 insertions, 1 deletions
diff --git a/mew.scm b/mew.scm
index 51c3e47..261c389 100644
--- a/mew.scm
+++ b/mew.scm
@@ -17,7 +17,7 @@
      one-of op op*
      per prn proj puts
      range rep
-     sing? search seq set set-at str slurp
+     scan scan-right sing? search seq set set-at str slurp
      tally-accumulator tbl time
      while
      uniq-accumulator unlist until
@@ -828,6 +828,19 @@
                  (loop (+ i (get t (get haystack (+ i ln) #f) (inc ln)))))
                #f)))))))
 
+  (define (scan kons knil . lists)
+    (reverse (apply fold (lambda (elt acc)
+                           (cons (kons elt (car acc)) acc))
+                    (list knil)
+                    lists)))
+
+  (define (scan-right kons knil . lists)
+    (apply fold-right (lambda (elt acc)
+                        (cons (kons elt (car acc)) acc))
+           (list knil)
+           lists))
+
+
   (let ((old-repl-prompt (repl-prompt)))
     (repl-prompt (lambda ()
                    (let ((old-prompt (old-repl-prompt)))