Re: tasters wanted

Liste des GroupesRevenir à cl lisp 
Sujet : Re: tasters wanted
De : Nobody447095 (at) *nospam* here-nor-there.org (B. Pym)
Groupes : comp.lang.lisp
Date : 18. Jul 2024, 23:59:42
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v7c38d$2jti1$1@dont-email.me>
References : 1
User-Agent : XanaNews/1.18.1.6
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))

Date Sujet#  Auteur
18 Jul 24 * Re: tasters wanted9B. Pym
18 Jul 24 +* Re: tasters wanted7B. Pym
15 Aug 24 i`* Re: tasters wanted6B. Pym
15 Aug 24 i `* Re: tasters wanted5B. Pym
15 Aug 24 i  +* Re: tasters wanted2B. Pym
15 Aug 24 i  i`- Re: tasters wanted1Kaz Kylheku
17 Aug 24 i  `* Re: tasters wanted2B. Pym
18 Aug 24 i   `- Re: tasters wanted1Jeff Barnett
19 Jul 24 `- Re: tasters wanted1Kaz Kylheku

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal