[r6rs-discuss] A suggestion about LETREC

From: Abdulaziz Ghuloum <aghuloum>
Date: Wed Mar 28 17:39:45 2007

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

> On 3/28/07, Abdulaziz Ghuloum <aghuloum_at_cs.indiana.edu> 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.

     http://www.cs.indiana.edu/~dyb/pubs/fixing-letrec.pdf

_at_article{1103776,
  author = {Oscar Waddell and Dipanwita Sarkar and R. Kent Dybvig},
  title = {Fixing Letrec: A Faithful Yet Efficient Implementation of
                          Scheme's Recursive Binding Construct},
  journal = {Higher Order Symbol. Comput.},
  volume = {18},
  number = {3-4},
  year = {2005},
  issn = {1388-3690},
  pages = {299--326},
  doi = {http://dx.doi.org/10.1007/s10990-005-4878-3},
  publisher = {Kluwer Academic Publishers},
  address = {Hingham, MA, USA},
  }



>> > 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.

Aziz,,,
Received on Wed Mar 28 2007 - 17:38:57 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC