Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

BOFH excuse #190: Proprietary Information.


comp / comp.lang.lisp / Re: continuing next iteration

SubjectAuthor
o Re: continuing next iterationB. Pym

1
Subject: Re: continuing next iteration
From: B. Pym
Newsgroups: comp.lang.lisp
Organization: A noiseless patient Spider
Date: Mon, 26 Aug 2024 03:37 UTC
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Nobody447095@here-nor-there.org (B. Pym)
Newsgroups: comp.lang.lisp
Subject: Re: continuing next iteration
Date: Mon, 26 Aug 2024 03:37:42 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <vagta5$2afk3$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Date: Mon, 26 Aug 2024 05:37:43 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="ddb29dda6a5be89b0e6e9e24964aa013";
logging-data="2440835"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18X/Zoc1fEvMTFrcXlM6+RH"
User-Agent: XanaNews/1.18.1.6
Cancel-Lock: sha1:fHzN9UH15BHNJ9FkG/8NYfq9akQ=
View all headers

> > (loop for i below 6
> finally (return (reverse (pairlis list list2)))
> do (format t "~d" i)
> collect i into list
> do (format t "^2 = ~2d~%" (* i i))
> collect (* i i) into list2)
> 0^2 = 0
> 1^2 = 1
> 2^2 = 4
> 3^2 = 9
> 4^2 = 16
> 5^2 = 25
> ((0 . 0) (1 . 1) (2 . 4) (3 . 9) (4 . 16) (5 . 25))

Gauche Scheme

(use srfi-42) ;; list-ec

(list-ec (:range i 6)
(begin
(display i)
(format #t "^2 = ~2d\n" (* i i))
(cons i (* i i))))

0^2 = 0
1^2 = 1
2^2 = 4
3^2 = 9
4^2 = 16
5^2 = 25
((0 . 0) (1 . 1) (2 . 4) (3 . 9) (4 . 16) (5 . 25))

1

rocksolid light 0.9.8
clearnet tor