Re: Collecting like-labelled sublists of a list
- From: "John Thingstad" <jpthing@xxxxxxxxx>
- Date: Thu, 31 Jul 2008 01:21:11 +0200
På Wed, 30 Jul 2008 04:11:00 +0200, skrev Thomas A. Russ <tar@xxxxxxxxxxxxx>:
To see the effect, try the following:
(defvar *input* (copy-tree '((0 a b)
(1 c d)
(2 e f)
(3 g h)
(1 i j)
(2 k l)
(4 m n)
(2 o p)
(4 q r)
(5 s t))))
;; I use copy-tree to avoid problems with destructively modifying
;; constant list structure.
(test *input*)
=> ((A B) (C D I J) (E F K L O P) (G H) (M N Q R) (S T))
*input*
=> ((0 A B) (1 C D I J) (2 E F K L O P) (3 G H) (1 I J)
(2 K L O P) (4 M N Q R) (2 O P) (4 Q R) (5 S T))
Note in particular the changes to the first occurences of the lists
headed by 1, 2 and 4.
If your files are as big as you mentioned 25 Mb or more a buffered approach sounds better unless you have a pressing need to keep it all in memory.
--------------
John Thingstad
.
- References:
- Collecting like-labelled sublists of a list
- From: Cortez
- Re: Collecting like-labelled sublists of a list
- From: Thomas A. Russ
- Collecting like-labelled sublists of a list
- Prev by Date: Re: Collecting like-labelled sublists of a list
- Next by Date: Re: Collecting like-labelled sublists of a list
- Previous by thread: Re: Collecting like-labelled sublists of a list
- Next by thread: Re: Collecting like-labelled sublists of a list
- Index(es):