Deutsch   English   Français   Italiano  
<v7c38d$2jti1$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: "B. Pym" <Nobody447095@here-nor-there.org>
Newsgroups: comp.lang.lisp
Subject: Re: tasters wanted
Date: Thu, 18 Jul 2024 21:59:42 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <v7c38d$2jti1$1@dont-email.me>
References: <v7bkuk$2hcim$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Date: Thu, 18 Jul 2024 23:59:42 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="e3005d10dbae2efb5a40377df304e982";
	logging-data="2750017"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX183Smuxv43YFjaPqLxa9wBN"
User-Agent: XanaNews/1.18.1.6
Cancel-Lock: sha1:tFiGALpkxMuuxPcQDiOaif92x6s=
Bytes: 1608

B. Pym wrote:

> Ken Tilton wrote:
> 
> > Ooh! Ooh! Lemme try again!
> > 
> > (defun collect-repeats-simple (sorted-list &key (test 'eql))
> >    (loop with acc and tail
> >        for a in sorted-list
> >        for b in (cdr sorted-list)
> > 
> >        if (funcall test a b)
> >        if acc do (setf tail (rplacd tail (list b)))
> >        else do (setf acc (list* a (setf tail (list b))))
> >        else when acc collect acc into result
> >        and do (setf acc nil)
> > 
> >        finally (return (nconc result
> >                          (when acc (list acc))))))
> > 
> > God I love rplaca/d!


His definition is buggy.

(collect-repeats-simple '(4 5 5 5 5 5 5 5 8 8))
  ===>
((5 5 5) (8 8))