Re: tasters wanted

Liste des GroupesRevenir à cl lisp 
Sujet : Re: tasters wanted
De : jbb (at) *nospam* notatt.com (Jeff Barnett)
Groupes : comp.lang.lisp
Date : 18. Aug 2024, 07:19:28
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v9s092$2996i$1@dont-email.me>
References : 1 2 3 4 5
User-Agent : Mozilla Thunderbird
On 8/17/2024 12:24 PM, B. Pym wrote:
B. Pym wrote:
          <SNIP SNIP>
>
(define (collect-repeats sorted)
   (let (accum '()  tmp '()  a)
     (until (empty? sorted)
       (setq a (sorted 0))
       (setq tmp
         (collect
           (and (true? sorted) (= a (sorted 0)) (pop sorted))))
       (when (> (length tmp) 1) (push tmp accum)))
     (reverse accum)))
 Shorter:
  (define (collect-repeats sorted)
   (local (accum tmp a)
     (while sorted
       (setq a (sorted 0))
       (setq tmp
         (collect (and (true? sorted) (= a (sorted 0)) (pop sorted))))
       (and (1 tmp) (push tmp accum)))
     (reverse accum)))
Shorter!!!!!!! Shorter because you moved the and clause embedded in the collect clause into the same line as the collect operator. Good work.
I take from your recent barrage of similarly helpful postings that you are once again between employers. It's probably good to keep in shape doing all these coding exercises.
--
Jeff Barnett

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