

                                                             scan-lists-of-lists
                                                      scan-lists-of-lists-fringe

    FUNCTION
SCAN-LISTS-OF-LISTS LISTS-OF-LISTS &optional LEAF-TEST           [Function]
SCAN-LISTS-OF-LISTS-FRINGE LISTS-OF-LISTS &optional LEAF-TEST    [Function]

    Package
    series

    DESCRIPTION

The argument LISTS-OF-LISTS is viewed as an n-ary tree where each internal
node is a non-empty list and the elements of the list are the children of
the node.  SCAN-LISTS-OF-LISTS and SCAN-LISTS-OF-LISTS-FRINGE each scan
LISTS-OF-LISTS in preorder and return a series of its nodes.
SCAN-LISTS-OF-LISTS returns every node in the tree.
SCAN-LISTS-OF-LISTS-FRINGE returns only the leaf nodes.

The scan proceeds as follows.  The argument LISTS-OF-LISTS can be any Lisp
object.  If LISTS-OF-LISTS is an atom or satisfies the predicate LEAF-TEST
(if present), it is a leaf node.  (The predicate can count on only being
applied to conses.) Otherwise, LISTS-OF-LISTS is a (not necessarily proper)
list.  The first element of LISTS-OF-LISTS is recursively scanned in full,
followed by the second and so on until a non-cons cdr is encountered.
Whether or not this final cdr is NIL, it is ignored.

(SCAN-LISTS-OF-LISTS '((2) (NIL))) => #Z(((2) (NIL)) (2) 2 (NIL) NIL) 
(SCAN-LISTS-OF-LISTS-FRINGE '((2) (NIL))) => #Z(2 NIL) 
(SCAN-LISTS-OF-LISTS-FRINGE '((2) (NIL)) 
                            #'(LAMBDA (E) (NUMBERP (CAR E)))) 
 => #Z((2) NIL)


     SEE ALSO
     about-series
     about-generators

;Copyright 1989 by the Massachusetts Institute of Technology,
;Cambridge, Massachusetts.

;Permission to use, copy, modify, and distribute this software and its
;documentation for any purpose and without fee is hereby granted,
;provided that this copyright and permission notice appear in all
;copies and supporting documentation, and that the name of M.I.T. not
;be used in advertising or publicity pertaining to distribution of the
;software without specific, written prior permission. M.I.T. makes no
;representations about the suitability of this software for any
;purpose.  It is provided "as is" without express or implied warranty.

;    M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
;    ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
;    M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
;    ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
;    WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
;    ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
;    SOFTWARE.



