[plt-scheme] Issue in ver-4.0 with mutable pairs

From: Ryan Culpepper (ryanc at ccs.neu.edu)
Date: Sat Jan 24 21:58:50 EST 2009

Vinay Sachdev wrote:
> Hi,
>  I am not able to create table or hash-table in r5rs.
> (define tbl (make-hash-table))
>  Its giving error "unbound identifier in module".
>  In the help also i am unable to find it.
>  Can you please tell me how to do this. Or there is
>  way to access mzscheme library in r5rs.
>  Also how to  access all documentation for r5rs, since
>  i am using this as module lang.

You can access mzscheme and other PLT languages and libraries from r5rs 
modules by using '#%require'. For example,

#lang r5rs
(#%require (only mzscheme
		 make-hash-table hash-table-put! hash-table-get))
(define tbl (make-hash-table))

Search the PLT help for "r5rs" and you should find several relevant 
sections. One of the pages, in the Guide, also has a link to R5RS (the 
report) itself.


> Thanks and Regards
> Vinay sachdev
> On Sat, Jan 17, 2009 at 7:39 AM, Jens Axel Soegaard
> <jensaxel at soegaard.net>wrote:
>> Vinay Sachdev skrev:
>>> Hi,
>>>  I am reading SICP and i am at the start of chap-3.
>>>  I am using PLT-Scheme ver-4.0 .I ran into problem with
>>>  mutable pairs. it was giving error. So instead of using
>>>  set-car! i used set-mcar!, but then even to create list
>>>  i have to create mutable list.
>>>  I have an older version also(ver-3.71). Is it a bad idea to
>>>  install older version or is there any other way out?
>> In the module language, try this:
>> #lang r5rs
>> (let ((p (cons 1 2)))
>>  (set-car! p 4)
>>  (display p))
>> It prints (4 . 2).
>>   My main purpose is to do read SICP and do its exercise.
>>>  One more question, is there any other issues with
>>>  PLT-Scheme in later chapters of SICP?
>> When you come to the picture language, use this
>> PLaneT package:
>> http://planet.plt-scheme.org/package-source/soegaard/sicp.plt/2/1/planet-docs/sicp-manual/index.html
>> /Jens Axel
> ------------------------------------------------------------------------
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.