categories - Category Theory list
 help / color / mirror / Atom feed
From: John Baez <john.c.baez@gmail.com>
To: categories@mta.ca
Subject: laziness in functional programming
Date: Thu, 19 Mar 2009 07:24:55 -0700	[thread overview]
Message-ID: <E1LkT4z-00023A-EJ@mailserv.mta.ca> (raw)

Bill Lawvere wrote:


I don't know the technical meaning of "lazy"; was it an attempt to avoid the
> processing speed and ram needed to take account of the composition with
> inclusion maps, etcetera?
>

No, "lazy evaluation" is a strategy of putting off computations until their
results are known to be necessary.  The opposite is called "eager
evaluation".  Laziness is often wiser.

For example, a programming statement

x:=y

calls for the value of x to be set equal to y.  A strategy of eager
evaluation will do this right away, while lazy evaluation will put off doing
it until the variable x is used in some other task.  If x is never used,
this saves work.

I think most functional programming languages either delay evaluation in
this way, or give the user the option to do this.

Best,
jb




             reply	other threads:[~2009-03-19 14:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-19 14:24 John Baez [this message]
2009-03-20 12:11 Miles Gould
2009-03-20 18:26 Greg Meredith

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

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

  git send-email \
    --in-reply-to=E1LkT4z-00023A-EJ@mailserv.mta.ca \
    --to=john.c.baez@gmail.com \
    --cc=categories@mta.ca \
    /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 NNTP newsgroup(s).