chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] html-stream: idiom for large iterations?


From: Thomas Chust
Subject: Re: [Chicken-users] html-stream: idiom for large iterations?
Date: Tue, 05 Apr 2005 18:27:35 +0200
User-agent: nail 11.20 1/13/05

Graham Fawcett <address@hidden> wrote:

> [...]
> However, this fails because the (map) generates a list of 1000
> elements, which exceeds the parameter limit for (apply).
>
> Is there an idiomatic way to rewrite this, and avoid the parameter limit?
> [...]

Hello,

well, using fold instead of apply you can usually avoid the parameter
limit:

(require-extension html-stream)
(stream->string
 (html-stream
  (html (head (title "Hello, world!"))
   (body (ul
          (fold-right stream-append (html-stream)
                      (map (lambda (x) (html-stream
                                        (li "This is item " x)))
                           (iota 1000))))))))

But there may be a better solution depending on the actual data you
have to work on.

Ciao,
Thomas Chust

Attachment: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]