[racket] Some questions regarding exercises in PLAI

From: Ionut G. Stan (ionut.g.stan at gmail.com)
Date: Mon Aug 30 04:23:30 EDT 2010


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.


Ionuț G. Stan  |  http://igstan.ro

Posted on the users mailing list.