On 3/28/07, Abdulaziz Ghuloum <[EMAIL PROTECTED]> wrote:

On Mar 28, 2007, at 5:25 PM, Joe Marshall wrote:

> On 3/28/07, Abdulaziz Ghuloum <[EMAIL PROTECTED]> wrote:
>>
>> Do you mean that an implementation should be allowed to treat E1
>> as E2
>> or E3 instead of E4?
> [examples deleted]
> Yes.

Implementations are already allowed to perform that optimization.
Read ``Fixing Letrec'' for the details.

Thanks for reminding me of that.  But as I understand the paper,
it treats the SET! version as the canonical semantics and shows
that the fixed-point version can implement it in certain situations.
This is slightly different from what I was suggesting.

>> > One advantage of this is that it would be much easier to create a
>> > purely
>> > functional subset of Scheme.
>>
>> How do you do the following functionally?
>>
>> (letrec ([f (g (lambda () f))])
>>   f)
>
> With a lot of rewriting so that f can take a thunked version of itself
> as an argument.

I didn't say f was a procedure.

Something along these lines ought to work.

(letrec ((f (lambda () (g (lambda () (f))))))
 (f))

--
~jrm

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

Reply via email to