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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Scheme help..., Paul Prescod | Thread | Columns in Norm's DocBook Styleshee, Kendall G. Clark |
Re: Scheme help..., Paul Prescod | Date | Columns in Norm's DocBook Styleshee, Kendall G. Clark |
Month |