[plt-scheme] htdp and modules

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Fri Nov 23 11:21:13 EST 2007

On Nov 23, 2007, at 5:08 AM, Jan Christiansen wrote:

> Hi,
>
> Am 22.11.2007 um 18:21 schrieb Matthias Felleisen:
>
>>> We really would like to use HtDP (and we at least use it for the  
>>> first quarter of the course) but we would also like to use the  
>>> module system for the next exercises. We want to demonstrate the  
>>> ideas of abstract data types.
>>
>> That's a legitimate concern. I have considered this myself for  
>> HtDP/2e (though I wouldn't call this abstract data type. This term  
>> is too loaded.)
>>
>> Here are two modules that work in the way you want. The first  
>> imports contract.ss, though note the unusual spec (when compared  
>> with the mzscheme language). It also exports a value and a  
>> function via provide/contract. The second one imports these values.
>
> this is great. Thanks a lot. Just one more question. Is there a way  
> to use the standard provide without a contract. I know that I could  
> use an any contract to achieve this but I would like to introduce  
> the module system first and then extend it by contracts.
>
> Regards, Jan


Hmph, it's not in there. Here is a brute-force patch:

In collects/lang/, change htdp-intermediate.ss, htdp-intermediate- 
lambda.ss htdp-advanced.ss as follows:

> 	   (rename beginner-or or)
>            (rename beginner-require require)
> 	   provide
;; ---------^^^^^^^^-------------- add this
>            (rename beginner-dots ..)
>            (rename beginner-dots ...)

[Warning: this works because teaching programs become modules  
somewhere on their way to the REPL.]

I'll add this as a feature request for the next release. -- Matthias




Posted on the users mailing list.