[plt-scheme] Buggy behaviour of the R6RS enumeration module?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sat Aug 23 08:12:23 EDT 2008

An R6RS pair and a PLT `scheme' pair are not the same datatype. An R6RS
corresponds to a PLT `scheme' mutable pair, a.k.a. "mpair".

 #lang scheme
 (require rnrs/enums-6
          scheme/mpair)

 (define-enumeration foo
    (bar baz)
    foo-set)

 (define l1
    (enum-set->list (foo-set bar)))

 (printf "(list? l1) => ~s~%(pair? l1) => ~s~%l1 => ~s~%~%"
          (mlist? l1)
          (mpair? l1)
          l1)
 ; prints #t, #t, and {bar}


At Sat, 23 Aug 2008 13:48:23 +0200, Thomas Chust wrote:
> Hello,
> 
> if I understand R6RS correctly, the procedure enum-set->list should, 
> just as the name indicates, always return a list when passed an enum set 
> as a parameter.
> 
> But unless the set passed in is empty, the return value from that 
> procedure is something else, as you can see by executing the example 
> code below.
> 
> Is this a bug or am I doing something wrong?
> 
> cu,
> Thomas
> 
> 
> #lang scheme
> (require
>   (lib "rnrs/enums-6.ss"))
> 
> (define-enumeration foo
>    (bar baz)
>    foo-set)
> 
> (define l0
>    (enum-set->list (foo-set)))
> 
> (printf "(list? l0) => ~s~%(pair? l0) => ~s~%l0 => ~s~%~%"
>          (list? l0)
>          (pair? l0)
>          l0)
> 
> (define l1
>    (enum-set->list (foo-set bar)))
> 
> (printf "(list? l1) => ~s~%(pair? l1) => ~s~%l1 => ~s~%~%"
>          (list? l1)
>          (pair? l1)
>          l1)
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme


Posted on the users mailing list.