On Sun, 11 Feb 2007, John Cowan wrote:

> OT: I've noticed a tendency in Scheme libraries to eschew global value
> definitions for functions that return a constant value.  Has anyone
> else noticed this (I can't point to evidence offhand), and does anyone
> know why?

It makes the call site use a function call instead of a variable reference.
That means that when you're making changes later, you can change the *way*
something is defined (using a function) instead of just the definition
(using a value).  For example, you may initially implement a program that
updates the display every 0.2 seconds, and then later decide that you want
to update the display less often (or not at all) when being run as a shell
script and more often when being run at a user interaction window.

If you defined the update-frequency as a variable, then you can change its
value across the program by changing a constant in the source.  But if you
defined it as a function, then you can change the *WAY* it's computed (ie,
check to see if the program is running in batch mode) by changing a function
in the source.
                                Bear

_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to