unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: "Linus Björnstam" <linus.internet@fastmail.se>
To: "Tim Meehan" <btmeehan@gmail.com>, guile-user <guile-user@gnu.org>
Subject: Re: delay and force
Date: Thu, 10 Jun 2021 07:30:15 +0200	[thread overview]
Message-ID: <b993a8cb-376b-45ab-99f3-15c8ec29d009@www.fastmail.com> (raw)
In-Reply-To: <CACgrOxLgGCHz3uPd70J=q56YDU0XYroBY9qF4HgCQLkuwMaSTg@mail.gmail.com>

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.
> 



      reply	other threads:[~2021-06-10  5:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10  5:08 delay and force Tim Meehan
2021-06-10  5:30 ` Linus Björnstam [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b993a8cb-376b-45ab-99f3-15c8ec29d009@www.fastmail.com \
    --to=linus.internet@fastmail.se \
    --cc=btmeehan@gmail.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).