Re: Scheme help...

Subject: Re: Scheme help...
From: Earl Hood <ehood@xxxxxxxxxxxxxxxxx>
Date: Tue, 24 Feb 1998 13:02:24 -0800
> Anyhow, the question is about the difference between this:
> 
> (define foo (bar))
> and
> (define (foo) (bar))
> 
> I don't have my Perl book with me, but they are roughly analogous to:
> 
> foo = bar()

$foo = bar();

> foo =  function (){ # no args
>     return bar();
> }

sub foo { bar(); }

Of course, it is not exact with Scheme due the inherent difference
in the languages.  But I believe closely parallels Paul's description
about (define ...).  In the Perl statements, "foo" is a different
in each statement.  The first, it is a scalar variable, and the second, it
is a routine.

In the first, bar is invoked and the return value is assigned to $foo.
I.e. Using $foo will not call bar again.  In the second, every call to
foo will call bar.  Hence the return value of foo may not always be the
same depending on the behavior of bar.

	--ewh


 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread
  • Re: Scheme help..., (continued)
    • Chris Maden - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id NAA11905Tue, 24 Feb 1998 13:25:56 -0500 (EST)
      • Harald Hanche-Olsen - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id NAA12831Tue, 24 Feb 1998 13:55:43 -0500 (EST)
    • Daniel Speck - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id NAA12415Tue, 24 Feb 1998 13:40:36 -0500 (EST)
    • Paul Prescod - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id PAA14183Tue, 24 Feb 1998 15:30:40 -0500 (EST)
      • Earl Hood - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id QAA14800Tue, 24 Feb 1998 16:06:14 -0500 (EST) <=
        • Kendall G. Clark - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id RAA15832Tue, 24 Feb 1998 17:23:58 -0500 (EST)
        • Norman Walsh - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id RAA16128Tue, 24 Feb 1998 17:39:30 -0500 (EST)
        • Kendall G. Clark - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id SAA16701Tue, 24 Feb 1998 18:15:51 -0500 (EST)
        • Sebastian Rahtz - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id FAA28235Wed, 25 Feb 1998 05:35:22 -0500 (EST)