Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

No more blah, blah, blah! -- Kirk, "Miri", stardate 2713.6


devel / comp.lang.lisp / Lis(t|p) comprehensions

SubjectAuthor
o Lis(t|p) comprehensionsRobert L.

1
Lis(t|p) comprehensions

<su5b9t$kli$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16829&group=comp.lang.lisp#16829

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!aioe.org!Ielm+gIDc34O3DFO922iPA.user.46.165.242.75.POSTED!not-for-mail
From: No_spamming@noWhere_7073.org (Robert L.)
Newsgroups: comp.lang.lisp
Subject: Lis(t|p) comprehensions
Date: Fri, 11 Feb 2022 09:46:39 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <su5b9t$kli$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Info: gioia.aioe.org; logging-data="21170"; posting-host="Ielm+gIDc34O3DFO922iPA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: XanaNews/1.18.1.6
X-Notice: Filtered by postfilter v. 0.9.2
 by: Robert L. - Fri, 11 Feb 2022 09:46 UTC

> I know it is possible, but I'm not sure aboout how to write the following
> with a functional approach:
>
> > (loop for i from 1 to 10 collect (loop for j from 1 to i collect j))
> ((1) (1 2) (1 2 3) (1 2 3 4) (1 2 3 4 5) (1 2 3 4 5 6) (1 2 3 4 5 6 7) (1 2
> 3 4 5 6 7 8) (1 2 3 4 5 6 7 8 9) (1 2 3 4 5 6 7 8 9 10))

Gauche Scheme:

(define (rng low high func)
(if (> low high)
'()
(cons (func low) (rng (+ 1 low) high func))))

(rng 1 10 (cut rng 1 <> values))

===>
((1) (1 2) (1 2 3) (1 2 3 4) (1 2 3 4 5) (1 2 3 4 5 6) (1 2 3 4 5 6 7)
(1 2 3 4 5 6 7 8) (1 2 3 4 5 6 7 8 9) (1 2 3 4 5 6 7 8 9 10))


devel / comp.lang.lisp / Lis(t|p) comprehensions

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor