From Newsgroup: comp.lang.lisp
Lieven Marchand wrote:
if we have this list:
(a <sold> b c d <sold> e f g <sold>)
that shows that article a, d and g are sold and the rest are not how
can we put all the sold articles in one list:
(a d g)
More homework?
(loop for (first next) on '(a <sold> b c d <sold> e f g <sold>)
when (eql next '<sold>)
collect first)
Scheme:
(define items '(a <sold> b c d <sold> e f g <sold> h i <sold>))
(filter-map
(lambda(x y) (and (eq? '<sold> y) x))
items
(cdr items))
(a d g i)
--- Synchronet 3.21d-Linux NewsLink 1.2