[plt-scheme] version 4 (4.1.3) newbie question

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Thu Nov 5 07:24:35 EST 2009

2009/11/3 Johannes Brauer <brauer at nordakademie.de>:

There are two different kinds of lists.
The ones made with (good old) mutable cons-cells
the new ones which are immutable.

> #lang scheme
This says that  ' should produce the kind of lists
used in the the "scheme" language. That ' produces
immutable cons cells.

The filter in "scheme" expects immutable cells
so this ought to work fine.

> (require r5rs/init)

But here you import the filter function from the language "r5rs/init".
This filter function expects mutable cons-cells.

> (list? (cons 1 '()))
> (filter (lambda (x) (> x 5)) '(3 5 6 7))

Here filter (the one expecting mutable cons-cells)
 is called with a list consisting of immutable cons-cells
giving an error.

That is, the functions in "scheme" and "r5rs" is difficult to mix.

The easiest way to fix your program is to find out which PLT
library where equivalent of the functions in r5rs/init you need is
defined. For most functions, just search for the function name
in the Help Desk.

-- 
Jens Axel Søgaard


Posted on the users mailing list.