[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] html-stream: idiom for large iterations?
From: |
Graham Fawcett |
Subject: |
[Chicken-users] html-stream: idiom for large iterations? |
Date: |
Tue, 5 Apr 2005 11:25:03 -0400 |
I'm fairly new to Scheme and streams, and am trying to grok how to use
the html-stream extension to generate an HTML document with a large
repeating section. I wrote the following (to compare its performance
to similar functions I implemented other languages):
(require-extension html-stream)
(stream->string
(html-stream
(html (head (title "Hello, world!"))
(body (ul
(apply stream-append
(map (lambda (x) (html-stream
(li "This is item " x)))
(iota 1000))))))))
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?
Thanks,
-- Graham
- [Chicken-users] html-stream: idiom for large iterations?,
Graham Fawcett <=