From murdoch at stats.uwo.ca  Sat May 23 01:32:49 2009
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Fri, 22 May 2009 19:32:49 -0400
Subject: [Rd] Scope problem?
In-Reply-To: <d8ad40b50905221202n42292738q73cdec9e9db65c5e@mail.gmail.com>
References: <d8ad40b50905220928p5235b38fi69361e4c7f7cd91d@mail.gmail.com>	<4A16DB38.5010803@stats.uwo.ca>
	<d8ad40b50905221202n42292738q73cdec9e9db65c5e@mail.gmail.com>
Message-ID: <4A173621.7050707@stats.uwo.ca>

On 22/05/2009 3:02 PM, Barry Rowlingson wrote:
> On Fri, May 22, 2009 at 6:04 PM, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
> 
>> Putting force(xl); force(yl) into your interpOne definition (so they get
>> executed when interpOne is called, not just when the returned function is
>> called) should work.
> 
>  *sigh* yes, that looks like it. The help for "force" gives a more
> concise example. What I'd posted was actually a cut-down version of my
> original problem!
> 
>  I've not tested it yet, but other things I'd tried had removed the
> bug without me understanding why - such as reassinging the args to
> interpOne inside the function.
> 
>  Do any other languages work like this?


According to Wikipedia (http://en.wikipedia.org/wiki/Lazy_evaluation), 
functional languages tend to do this; examples they give are Haskell, 
Miranda, and it's optional in Scheme and Ocaml.

Duncan Murdoch



[Rd] Scope problem?
Duncan Murdoch