[racket] Some questions regarding exercises in PLAI

From: Eric Tanter (etanter at dcc.uchile.cl)
Date: Mon Aug 30 09:40:02 EDT 2010

Hi Ionut, Jay,

I don't understand the question this way -- rather, how to maintain laziness without introducing an extra variant of CFAE-Value, ie. reusing the Closure variant to implement expression closures.

Maybe Shriram can confirm which interpretation is correct ;)

-- Éric

On Aug 30, 2010, at 9:21 AM, Jay McCarthy wrote:

> Hi Ionut,
> In this section PLAI is asking you to write more of a meta-interpreter
> where you use the thunks of the language you are writing the
> interpreter in.
> Jay
> On Mon, Aug 30, 2010 at 2:23 AM, Ionut G. Stan <ionut.g.stan at gmail.com> wrote:
>> Hi,
>> I'm pretty sure this is not the best mailing list to ask about PLAI, but as
>> I've found no other I decided to try here (I've found about PLAI on the
>> original DrScheme mailing list, and racket-lang.org seems to mention PLAI in
>> the "Learning" section). I won't mind if I don't get an answer to my
>> question though. Maybe there's a dedicated mailing list?
>> So, here's my problem, just in case :)
>> I'm stuck understanding what a certain exercise is asking me. I'm talking
>> about exercise 8.2.1 from chapter 8, Implementing Laziness.
>> The exercise asks to implement laziness without using expression closures,
>> but using thunks instead. Thunks being just like closure, except they don't
>> have arguments bound to them. What I don't understand is the fact that this
>> is the way I've implemented expression closures. They're just like closures,
>> except for the argument part. So, from my point of view, is just a matter of
>> renaming my algebraic data types.
>> I'm using Haskell to implement all the languages discussed in the book, and
>> my ADT for CFAE/L-Value looks like this:
>> data CFAELValue
>>    = NumberValue Int
>>    | Closure String CFAEL Environment
>>    | Expression CFAEL Environment
>>    deriving (Eq, Show)
>> So, Expression is the constructor for expression closures, and the only
>> difference when compared to Closure is the String argument.
>> Is anyone willing to shed some light on what the exercise does actually
>> require me to do?
>> Just for completeness, I've put the Haskell sources for all the languages up
>> to chapter 8 on Github: http://github.com/igstan/plai-haskell. CFAE-L.hs is
>> the one used for chapter 8.
>> Thanks.
>> --
>> Ionuț G. Stan  |  http://igstan.ro
>> _________________________________________________
>>  For list-related administrative tasks:
>>  http://lists.racket-lang.org/listinfo/users
> -- 
> Jay McCarthy <jay at cs.byu.edu>
> Assistant Professor / Brigham Young University
> http://teammccarthy.org/jay
> "The glory of God is Intelligence" - D&C 93
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

Posted on the users mailing list.