Deutsch   English   Français   Italiano  
<v9s092$2996i$1@dont-email.me>

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

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Jeff Barnett <jbb@notatt.com>
Newsgroups: comp.lang.lisp
Subject: Re: tasters wanted
Date: Sat, 17 Aug 2024 23:19:28 -0600
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <v9s092$2996i$1@dont-email.me>
References: <v7bkuk$2hcim$1@dont-email.me> <v7c38d$2jti1$1@dont-email.me>
 <v9jovo$q7cm$1@dont-email.me> <v9k670$ru4a$1@dont-email.me>
 <v9qpth$20hhm$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 18 Aug 2024 07:19:30 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="e83f565442c57ba8a0f2e764ec9a33b0";
	logging-data="2401490"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18jcroIEAtuxv9il/XPoGcA9NW/BuwvBXI="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:8wz4UopuSHkptzpx8VWa8V+DY3U=
X-Antivirus-Status: Clean
In-Reply-To: <v9qpth$20hhm$1@dont-email.me>
Content-Language: en-US
X-Antivirus: AVG (VPS 240817-12, 8/17/2024), Outbound message
Bytes: 2243

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