* delay and force
@ 2021-06-10 5:08 Tim Meehan
2021-06-10 5:30 ` Linus Björnstam
0 siblings, 1 reply; 2+ messages in thread
From: Tim Meehan @ 2021-06-10 5:08 UTC (permalink / raw)
To: guile-user
Are there any good examples of "medium-sized" programs that use delay and
force? I have seen the documentation examples, but I am curious about how
it is used by other people in larger projects.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: delay and force
2021-06-10 5:08 delay and force Tim Meehan
@ 2021-06-10 5:30 ` Linus Björnstam
0 siblings, 0 replies; 2+ messages in thread
From: Linus Björnstam @ 2021-06-10 5:30 UTC (permalink / raw)
To: Tim Meehan, guile-user
You can see a version of them used in srfi-41. I do believe I use them in my old implementation of rackets for loops for guile. For/foldr I used them as a way to ensure that the next iteration was evaluated only once (despite being possible to call it several times) to avoid quadratic behaviour.
I don't really think they are used that often, since when you need laziness you would probably reach for srfi-41 (which is horribly slow) or generators (srfi-158).
I see them as a primitive mostly for macro writers, to be honest. It is useful if you want to handle a computation back to the user but want to make sure it is run at most one time. That is mostly how I have seen them used (and used them myself), at least.
--
Linus Björnstam
On Thu, 10 Jun 2021, at 07:08, Tim Meehan wrote:
> Are there any good examples of "medium-sized" programs that use delay and
> force? I have seen the documentation examples, but I am curious about how
> it is used by other people in larger projects.
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-10 5:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-10 5:08 delay and force Tim Meehan
2021-06-10 5:30 ` Linus Björnstam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).