Re: Add the numbers in a 9x9 multiplication Table

"B. Pym" <[email protected]> Fri, 6 Jun 2025 15:25:51 -0000 (UTC)
Newsgroups rec.puzzles,comp.lang.lisp,comp.lang.python
Organization A noiseless patient Spider
Message-ID <[email protected]>
B. Pym wrote:

> Kaz Kylheku wrote:
> 
> > 1> (sum-each ((i 1..10) (j 1..10)) (* i j))
> > 285
> > 2> (sum-each-prod ((i 1..10) (j 1..10)) (* i j))
> > 2025
> 
> Gauche Scheme
> 
> (use srfi-42)
> 
> (sum-ec (: i 10) (: j 10) (* i j))
>   ===>
> 2025

 
Equivalent but more prolix:

(sum-ec (:range i 0 10) (:range j 0 10) (* i j))