From: PAUL KIEFER
Subject: reversing lists within lists
Date: 
Message-ID: <487lhg$s6k@falcon.ccs.uwo.ca>
	I want to reverse a list which has numerous depths of lists 
within it... how would I do this.

	Any response is greatly appreciated.

Paul.
-- 
****************************************************************************
/  									   \
/   Porthos:  ······@gaul.csd.uwo.ca	         			   \
/									   \
From: Michael Tselman
Subject: Re: reversing lists within lists
Date: 
Message-ID: <487rui$2ei@camelot.ccs.neu.edu>
PAUL KIEFER (······@gaul.csd.uwo.ca) wrote:
: 	I want to reverse a list which has numerous depths of lists 
: within it... how would I do this.

: 	Any response is greatly appreciated.

: Paul.
: -- 
: ****************************************************************************
: /  									   \
: /   Porthos:  ······@gaul.csd.uwo.ca	         			   \
: /									   \

--

The first thing that comes to mind:


>(defun rev (list)
   (if (consp list)
        (reverse (mapcar #'rev list))
        list))
REV

>(rev '(1 2 3 4))
(4 3 2 1)

>(rev '(1 (2 3) 4))
(4 (3 2) 1)

>(rev '(((1 2 3) 4 5) ((6)) 7))
(7 ((6)) (5 4 (3 2 1)))

----------------

Enjoy,


Misha



-----------------------------------------------------------------------------+
Michael Tselman (Misha)   Internet: ·····@ccs.neu.edu   | Imagination is     |
College of Computer Science, Northeastern University    |   more important   |
23 Cullinane Hall, 360 Huntington Ave., Boston, MA 02115|     than knowledge!|
Phone: (617)-373-3822,      Fax:  (617)-373-5121        |                    |
WWW: http://www.ccs.neu.edu/home/misha                  | (A. Einstein)      |
-----------------------------------------------------------------------------+