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

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

Path: ...!3.eu.feeder.erje.net!feeder.erje.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: walk through list and add all n'th item
Date: Fri, 19 Jul 2024 03:17:36 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <v7clse$2qjma$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Date: Fri, 19 Jul 2024 05:17:36 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="364020230052eda8729452d34971b1ed";
	logging-data="2969290"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19Q7H90CpmAPiYpWx4cZvYu"
User-Agent: XanaNews/1.18.1.6
Cancel-Lock: sha1:DcLABNs9PnJenGK1ESH+JWmFq/8=
Bytes: 1424

> Wow: loop macro rulez, somehow..
> just one correction:
> (loop for (a b c d) on (list 1 2 3 4 5 6 7 8) by #'cddddr
>       sum a into a-sum
>       sum b into b-sum
>       sum c into c-sum
>       sum d into d-sum
>       finally (return (list a-sum b-sum c-sum d-sum)))
> Yeah, i might consider this code as beautiful
> olivier

Gauche Scheme

(use gauche.lazy)
(use util.match)

(define data (lrange 1 57))

(match (lslices data 4)
  [((a b c d) ...)
   (map (cut fold + 0 <>)
     (list a b c d))])

(378 392 406 420)