unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* 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

unofficial mirror of guile-user@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guile-user/0 guile-user/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guile-user guile-user/ https://yhetil.org/guile-user \
		guile-user@gnu.org
	public-inbox-index guile-user

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.lisp.guile.user
	nntp://news.gmane.io/gmane.lisp.guile.user


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git