Update domain name to kpe.io
[pipes.git] / src.lisp
index b4edcdc105b865c6ec82ec4640ca5bf3a73398f6..c1d058be485838e40adeb0e11c08878205a34118 100644 (file)
--- a/src.lisp
+++ b/src.lisp
@@ -7,10 +7,8 @@
 ;;;; Programmers:   Kevin M. Rosenberg and Peter Norvig
 ;;;; Date Started:  Apr 2000
 ;;;;
-;;;; $Id: src.lisp,v 1.2 2003/05/06 16:15:51 kevin Exp $
+;;;; $Id$
 ;;;;
-;;;; This file is Copyright (c) 2000-2002 by Kevin M. Rosenberg and
-;;;; Copyright (c) 1998-2002 by Peter Norvig. 
 ;;;; *************************************************************************
 
 (in-package #:pipes)
@@ -22,7 +20,7 @@
   `(cons ,head #'(lambda () ,tail)))
 
 (defun pipe-tail (pipe)
-  "Return tail of pipe or list, and destructively update 
+  "Return tail of pipe or list, and destructively update
    the tail if it is a function."
   (if (functionp (rest pipe))
     (setf (rest pipe) (funcall (rest pipe)))
@@ -40,7 +38,7 @@
 (defun pipe-enumerate (pipe &key count key (result pipe))
   "Go through all (or count) elements of pipe,
    possibly applying the KEY function. (Try PRINT.)"
-  ;; Returns RESULT, which defaults to the pipe itself. 
+  ;; Returns RESULT, which defaults to the pipe itself.
   (if (or (eq pipe +empty-pipe+) (eql count 0))
     result
     (progn
@@ -63,11 +61,11 @@ if the pipe is infinite in length."
   (if (eq pipe +empty-pipe+)
       +empty-pipe+
     (let ((head (pipe-head pipe))
-         (tail (pipe-tail pipe)))
+          (tail (pipe-tail pipe)))
       (if (funcall predicate head)
-         (make-pipe head (pipe-filter predicate tail))
+          (make-pipe head (pipe-filter predicate tail))
         (pipe-filter predicate tail)))))
-               
+
 
 (defun pipe-map (fn pipe)
   "Map fn over pipe, delaying all but the first fn call."
@@ -87,10 +85,10 @@ if the pipe is infinite in length."
            (result (funcall fn head)))
       (if (or (and filter-pred (funcall filter-pred result))
               result)
-         (make-pipe result (pipe-map-filtering fn tail filter-pred))
+          (make-pipe result (pipe-map-filtering fn tail filter-pred))
         (pipe-map-filtering fn tail filter-pred)))))
 
-      
+
 (defun pipe-append (x y)
   "Return a pipe that appends the elements of x and y."
   (if (eq x +empty-pipe+)
@@ -106,7 +104,7 @@ if the pipe is infinite in length."
     (let ((x (funcall fn (pipe-head pipe))))
       (make-pipe (pipe-head x)
                  (pipe-append (pipe-tail x)
-                             (pipe-mappend fn (pipe-tail pipe)))))))
+                              (pipe-mappend fn (pipe-tail pipe)))))))
 
 (defun pipe-mappend-filtering (fn pipe &optional filter-pred)
   "Map fn over pipe, delaying all but the first fn call,
@@ -118,7 +116,7 @@ if the pipe is infinite in length."
            (result (funcall fn head)))
       (if (or (and filter-pred (funcall filter-pred result))
               result)
-         (make-pipe (pipe-head result)
-                    (pipe-append (pipe-tail result)
-                                 (pipe-mappend-filtering fn tail filter-pred)))
+          (make-pipe (pipe-head result)
+                     (pipe-append (pipe-tail result)
+                                  (pipe-mappend-filtering fn tail filter-pred)))
         (pipe-mappend-filtering fn tail filter-pred)))))